Skip to main content

CentOS commands

CentOS commands:

1) To view the list of packages installed

> yum list installed

2) To view the count of packages installed

> yum list installed | wc -l

3) To refresh package database and install updates if any

> yum update -y 

(-y is added so that you need not respond with y or yes when prompted)

4) To check if package is installed

> rpm -qa | grep <package-name>

e.g., rpm -qa | grep docker

5) To install docker

> yum install -y https://download.docker.com/linux/centos/8/x86_64/stable/Packages/containerd.io-1.4.3-3.1.el8.x86_64.rpm

> curl -fsSL https://get.docker.com/ | sh

> rpm -qa | grep docker

docker-ce-20.10.3-3.el8.x86_64
docker-ce-rootless-extras-20.10.3-3.el8.x86_64
docker-ce-cli-20.10.3-3.el8.x86_64

COURTESY: https://vexpose.blog/2020/04/02/installation-of-docker-fails-on-centos-8-with-error-package-containerd-io-1-2-10-3-2-el7-x86-64-is-excluded/

6) To start, stop and view status of docker

> systemctl start docker
> systemctl enable docker
> systemctl status docker

7) To list all containers

> docker container ls

8) To list both running and stopped containers

> docker ps -a

9) To list only stopped containers

> docker ps -a | grep Exit

10) To lists all images

> docker images -a OR docker image ls

11) To remove a container by container-id

> docker rm <first-few-chars-of-container-id>

12) Docker provides a single command that will clean up any resources — images, containers, volumes, and networks — that are dangling (not associated with a container)

> docker system prune

13) To remove a container by image-id

> docker rmi <first-few-chars-of-image-id>

14) To install a container

> docker pull docker/whalesay

15) To run container

e.g., > docker run docker/whalesay cowsay Hi

This will start the container from the image if the image is already present. If the image is not present already, it will download the image and start the container

16) To get ip address

> ifconfig

ens33: ...
inet <YOUR-IP-HERE>  netmask X.X.X.X  broadcast Y.Y.Y.Y

17) Find commands

> find . -type f -name filename

To find files with name filename in the current directory

> find / -type d -name directoryname

To find directories with name directoryname in the entire disk

Comments

Popular posts from this blog

How to install/upgrade/downgrade kubectl in Linux (Ubuntu)?

To install the latest version: curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256" echo "$(<kubectl.sha256) kubectl" | sha256sum --check sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl kubectl version --client kubectl version To install a specific (v1.19.0) version: curl -LO "https://dl.k8s.io/release/v1.19.0/bin/linux/amd64/kubectl" curl -LO "https://dl.k8s.io/v1.19.0/bin/linux/amd64/kubectl.sha256" echo "$(<kubectl.sha256) kubectl" | sha256sum --check sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl kubectl version --client kubectl version This will install kubectl client. Run minikube start to install kubectl server.

High availability (Multi-AZ) for Amazon RDS

There is something called failover technology in Amazon. AWS RDS's Multi-AZ deployment uses this technology. If you enable Multi-AZ for an RDS DB, say MySQL DB, RDS automatically creates a standby replica in a different AZ. If the primary DB instance is in AZ-1A, then RDS creates a standby replica in AZ-1B (for example). Suppose I add a new row to a table in the primary DB, then the same row is added, almost in the same time, in the standby replica. This is called as synchronous replication . Thus, standby replicas are useful during DB instance failure/ AZ disruption . How? Because, there is no need to create a backup later because the backup has already been created. This gives high availability during planned system maintenance. Normal backup  operation - I/O activities are blocked in the primary database  Automated backup operation (standby replica) - I/O activities are not blocked This standby replica is not similar to read replica (which is used for disaster recovery). S...

Application Load Balancer (ALB)

The ALB spans all subnets in a VPC i.e., it is not inside a subnet but VPC. ALB is bound to Target Groups (TGs). TGs are bound to subnets.