Getting Started With Linux

Lab setup data from the Pluralsight course on:

Getting Started with Linux


Looking for more courses on IT security, cloud admin, and containers? Check out:


Launching a Docker container

docker build -t webserver .
docker images
docker run -d webserver

# Dockerfile contents:
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install -y apache2
ADD index.html /var/www/html/
CMD /usr/sbin/apache2ctl -D FOREGROUND
EXPOSE 80

Controlling system locale

less /usr/share/i18n/locales/en_CA
localectl status
localectl list-locales
localectl set-locale LANG=en_CA.utf8

Controlling the system timezone

timedatectl
timedatectl list-timezones | grep -i america
timedatectl set-timezone Canada/Toronto

Discover and mount a storage volume

df -ht ext4
lsblk | grep sd
sudo mkdir /media/newplace
sudo mount /dev/sdb2 /media/newplace

Working with package managers

[on Ubuntu]
less /etc/apt/sources.list
apt list --all-versions | wc
apt update
apt search business card | less
apt show glabels
apt install glabels
apt-get install glabels [don't run]
[on CentOS]
yum list vino
yum info vino
yum install vino
yum info trousers

Working with LXD containers

sudo apt install lxd
sudo lxd init
sudo lxc launch images:rockylinux/9/amd64 rocky
sudo lxc list
sudo lxc exec rocky /bin/bash

Install and launch Apache

[On Rocky Linux]
yum install httpd 
systemctl start httpd
systemctl enable httpd

Compiling software packages

sudo apt install linux-source linux-headers-`uname -r` build-essential make gcc automake cmake
wget https://nmap.org/dist/nmap-7.93.tgz
tar xzf nmap-7.93.tgz
cd nmap-7.93
./configure
make
sudo make install