DevOps Learning Notes
2 Followers
In this lecture you are learning YUM package manager and SSH application service:
YUM:
YUM is the package manager in RPM based Linux distributions. RPM is the Redhat Package Manager that is used to manage packages in Redhat like Operating Systems.
YUM package manager supports in below Operating Systems –
What is Package?
What is RPM?
What is Repository?
All packages are stored in the publicly accessible web store is called Package Repository. YUM downloads the required packages from the repository. Each Operating System vendor maintains their own repository to supply the packages for download.
Let say Amazon Linux operating system by default configured with Amazon Core and Amazon Extras Repositories to download the packages.
How to install a package: Below command shows how to install openssl packages. If the package already installed and its latest then YUM will skip the installation.
[root@ip-172-31-52-242 ~]# yum install openssl
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Package 1:openssl-1.0.2k-24.amzn2.0.4.x86_64 already installed and latest version
Nothing to do
[root@ip-172-31-52-242 ~]#
How to List a package: Below command to check if the package already installed or not.
[root@ip-172-31-52-242 ~]# yum list openssl
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Installed Packages
openssl.x86_64 1:1.0.2k-24.amzn2.0.4 installed
[root@ip-172-31-52-242 ~]#
How to update a package: Below command to update a package to the latest version. If the package already in latest version then YUM do nothing.
[root@ip-172-31-52-242 ~]# yum update openssl
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 3.7 kB 00:00:00
No packages marked for update
[root@ip-172-31-52-242 ~]#
How to check history: Below command to check the history of packages that are altered. It helps to undo the package actions based on the ID associated in the history.
[root@ip-172-31-52-242 ~]# yum history
ID | Command line | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
4 | install telnet | 2023-02-04 03:52 | Install | 1
3 | install httpd -y | 2023-02-04 03:52 | Install | 2
2 | remove httpd | 2023-02-04 03:52 | Erase | 2
1 | install httpd -y | 2023-02-04 03:51 | Install | 9
history list
[root@ip-172-31-52-242 ~]#
How to uninstall a package: Below command to uninstall a package. Only some portion of the output shown below.
[root@ip-172-31-52-242 ~]# yum remove telnet
Running transaction
Erasing : 1:telnet-0.17-65.amzn2.x86_64 1/1
Verifying : 1:telnet-0.17-65.amzn2.x86_64 1/1
Removed:
telnet.x86_64 1:0.17-65.amzn2
Complete!
[root@ip-172-31-52-242 ~]#
SSH Application:
Openssh is the application software that provide services like Secure Login and Secure File Transfer between client and servers.
Key Notes:
Linux Services:
What is Service?
Examples: httpd, vsftpd, sshd etc...
What is systemctl?
Commands used to control a service:
Syntax:
Examples:
[root@ip-172-31-52-242 ~]# systemctl status sshd
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2023-02-04 03:43:12 UTC; 25min ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 3215 (sshd)
CGroup: /system.slice/sshd.service
└─3215 /usr/sbin/sshd -D
Feb 04 03:43:12 ip-172-31-52-242.ec2.internal systemd[1]: Starting OpenSSH server daemon...
Feb 04 03:43:12 ip-172-31-52-242.ec2.internal sshd[3215]: Server listening on 0.0.0.0 port 22.
Feb 04 03:43:12 ip-172-31-52-242.ec2.internal sshd[3215]: Server listening on :: port 22.
Feb 04 03:43:12 ip-172-31-52-242.ec2.internal systemd[1]: Started OpenSSH server daemon.
Feb 04 03:47:08 ip-172-31-52-242.ec2.internal sshd[3279]: Address 49.205.32.209 maps to bro...!
Feb 04 03:47:09 ip-172-31-52-242.ec2.internal sshd[3279]: Accepted publickey for ec2-user f...Y
Hint: Some lines were ellipsized, use -l to show in full.
[root@ip-172-31-52-242 ~]# systemctl stop sshd
[root@ip-172-31-52-242 ~]# systemctl restart sshd
[root@ip-172-31-52-242 ~]# systemctl reload sshd
[root@ip-172-31-52-242 ~]#