Tag: Linux OS

Linux Runlevels

A runlevel is a categorization number that determines what services are started and
what services are stopped

Runlevel #NameDescription
0HaltAll services are shut down and the server is stopped
1Single User ModeThe root account is automatically logged in to the server and other users cannot log in to the server
2Multiuser ModeUsers can log in to the server through CLI and network service are not started
3Extended Multiuser ModeUsers can log in to the server through CLI and network service are started
4User DefinedUser can cusomize the runlevel
5Graphical ModeUser can log in through CLI and GUI with network services started
6RebootThe server is rebooted

Check the current runlevel use following command-

runlevel

To see the default target

systemctl get-default

To change the default target use following command

systemctl set-default multi-user.target

Commands to understand Linux kernel and hardware

Understand the OS versoin and Linux machine hardware

Use uname command to display information of kernel

uname

For more information of kernel use-

uname -r

5 is Kernel Version

11 is Major Version

0 is Minor Version

1022 is patch release

azure is specific info

To understand CPU of machine use lscpu command

lscpu

In this case Architecture is x86_64 with CPU socket 1 and threads that run in parallel is 4.

To understand physical disk use lsblk command

lsblk

sda shows block devices of type disk

Use lsmem command to get the memory of the Linux machine

lsmem

Use free -m command to get the free memory i.e. total vs used memory

free -m

Append the command with sudo to run the command as super user

Install Docker on LINUX – Ubuntu

OS requirements

To install Docker Engine, you need the 64-bit version of one of these Ubuntu versions:

  • Ubuntu Hirsute 21.04
  • Ubuntu Groovy 20.10
  • Ubuntu Focal 20.04 (LTS)
  • Ubuntu Bionic 18.04 (LTS)

To check the OS version of Linux, use-

cat /etc/*release*

Check if you have already install docker on machine-

docker --version

Uninstall the older version of Docker if you have any, to do so-

sudo apt-get remove docker docker-engine docker.io containerd runc

Install Repository

Before the docker is installed setup the docker repository-

User Application Package Tool (APT) to install supporting packages for Docker. Use following commands-

sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

Add Docker’s official GPG key:

GPG or GNU Privacy Guard is a public key cryptographic implementation and is used for allowing secure transmission of information between source and destination

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Install Docker Engine

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io

This installs the latest version of docker on OS.

Check the latest version of docker

docker --version

Reference documents- https://docs.docker.com/engine/install/ubuntu/