Linux Training : Section 7 (Part-3)

Advance Package Management

In this lesson, we will learn about the packages installation using dnf and rpm command. And will perform the activities like- Installation of package, deletion, updation, checking all the details of a package (when it got installed, what are the files associated with the package), source and location information.

In this we will use Korn-Shell package as a example-

  1. check it is available or not-

  2. Let’s install the package using the root login access-

  3. Check package is installed or not-

  4. Now, delete the package

  5. Now, verify the information of a package-

  6. Now, delete a package using rpm command-

  7. List all the configuration files related to this package-

  8. Find out which command belongs to which package-

Rollback Updates and Patches

  • Rollback a package or patch

    • yum install <package_name>

    • yum history

    • yum history undo <task_id_from_history>

    • yum update = Update will preserve them

    • yum upgrade = Upgrade will delete obsolete packages

    • yum history undo <task_id_from_history>

SSH & TELNET

  • Telnet » Un-secured connection between computer

  • SSH » Secured

    ssh process is running, so that we are able to login in the linux machine using putty session. If we stop this, we will not be able to login-

    • systemctl stop sshd

    • systemctl start sshd

Telnet uses port 23, designed specifically for local area networks, whereas SSH runs on port 22 by default.

DNS: Download, Install & Configure

  • DNS stands for Domain Name Systems, which is a system that translates domain names into IP addresses. This allows users to access websites by communicating with origin servers.

  • The Domain Name System (DNS) is the phonebook of the Internet. Humans access information online through domain names, like ww.google.com …etc, Web browsers interact through Internet Protocol (IP) addresses. DNS translates domain names to IP addresses so browsers can load Internet resources.

    What is DNS?

Hostname-

  1. PTR Record » IP to Hostname

  2. A Record » Hostname to IP

  3. CNAME Record » Hostname to Hostname

Files-

  1. /etc/named.cnf

  2. /var/named

Service-

  1. systemctl restart named

Lab-

  1. Use a screenshot for further crash and install a bind package-

  2. Let’s edit the file /etc/named.conf

    • Add the IP address as below-

  • Add few lines at the bottom as below-

    Before-

    After-

  1. Create 2 zone files under /var/named-

  2. Add the below data in forward.lab-

  3. Add the below data in reverse.lab-

  4. Restart the service-

    Again, facing above issue, due to this, not able to proceed further.

    But capturing all the commands over here for further lab.

    systemctl start named

    systemctl enable named

  5. Now, disable the firewall-

    systemctl stop firewalld

    system disable firewalld

  6. Change the ownership

    chgrp named -R /var/named

    chown -v root:named /etc/named.conf

    restorecon -rv /var/named

    restorecon /etc/named.conf

  7. To check for any issues in the configuration file use below cmd-

    named-checkconf /etc/named.conf

    named-checkzone lab.local /var/named/forward.lab

    named-checkzone lab.local /var/named/reverse.lab

  8. Add DNS Server Information to network file

    vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

    DNS=192.168.100.153

  9. Restart Network service

    systemctl restart NetworkManager

  10. Modify /etc/resolv.conf

    # nameserver 192.168.100.153

  11. Test DNS Server

    # dig masterdns.lab.local

    # nslookup masterdns.lab.local

    # nslookup clienta.lab.local

    # nslookup clientb.lab.local

    # nslookup 192.168.1.240

    # nslookup 192.168.1.241

Hostname/IP Lookup

  • Command used for DNS lookup

    • nslookup

      NOTE: the Non-Authoritative answer means that the details are not present in the local repo, if it is present then it will not come.

    • dig

NOTE: nslookup is a old command, whereas dig is the latest one and it also provide a lot of information. Mostly, people are using this only.

Network Time Protocol (NTP)-

An NTP (Network Time Protocol) server is a computer that synchronizes the clocks of devices on a network. It does this by getting time from accurate sources like atomic clocks and GPS.

  • Purpose-

    Time Synchronization

  • File-

    /etc/ntp.conf

  • Service-

    systemctl restart ntpd

  • Command-

    ntpq

  • LAB-

    NOTE: Since, package is not getting installed in CentOS10 using yum install ntp , not able to continue with the lab work.

Remember NTP Port: #123

chronyd (New Version of NTP)-

Chrony is a flexible Network Time Protocol implementation (NTP). It can sync the system clock with NTP servers, reference clocks (such as a GPS receiver), and manual input via wristwatch and keyboard.

  • Purpose-

    Time Synchronization

  • Package Name-

    chronyd

  • Configuration File-

    /etc/chronyd.conf

  • Log File-

    /var/log/chrony

  • Service-

    systemctl start/restart chronyd

  • Command-

    chronyc

  • Lab-

    1. Check for the package-

    2. Now, edit the configuration file-

    3. Check for the service status-

    4. using chronyc command, check for the sources and you will find that 8.8.8.8 i.e., google dns details under this-

NOTE: chronyd and ntpd are the same, and it seems like ntpd is removed from CentOS10, due to this we were not able to do the lab work.

New System Utility Command (timedatectl)

  • The timedatectl command is a new utility for RHEL/CentOS10 based distributions, which comes as a part of the systemd system and service manager.

  • It is a replacement for old traditional date command

  • The timedatectl command shows/change date, time and timezone

  • It synchronize the time with NTP server as well

    • You can ither use chronyd or ntpd and make the ntp setting in timedatectl as yes

    • Or you can use systemd-timesyncd daemon to synchronize time which is a replacement for ntpd and chronyd

NOTE: Redhat/CentOS hoes not provide this daemon in its standard repo. You will have to download it separately.

LAB-

  1. To check time status-

  2. To view all available time zones-

    • timedatectl list-timezones

  3. To set the time zones-

    • timedatectl set-timezone “Asia/Kolkata“
  4. To set date

    • timedatectl set-time YYYY-MM-DD
  5. To set date and time

    • timedatectl set-time ‘YYYY-MM-DD HH:MM:SS’
  6. To start automatic time synchronization with a remote NTP server

    • timedatectl set-ntp true

Mail Servers in Linux

  • A Linux mail server is a software program installed in the Linux Operating System that is primarily configured for mailing purposes such as Sending, receiving, and storing mail. A Linux mail server is essential for managing email communication within an organization.

  • Purpose» Storage, Processing and Delivery of emails

  • Multiple Server, it offers-

    1. POSTFIX » Secure MTA, Simplicity, CentOS10, , Ease of configuration, Excellent performance, Active community support

    2. SENDMAIL » CentOS7, Configurable, Complex

    3. EXIM » Flexible, Configurable

    4. QMAIL » Secure, Reliable

    5. OpenSMTPD » Lightweight, Easy to configure

    6. DOVECOT » IMAP, POP3, Performance, Security

    7. Courier » IMAP, POP3

    8. Zimbra » Collaboration Suite

    9. SpamAssassin

    10. ClamAV

  • Configuration File-

    • /etc/postfix

    • /etc/postfix/main.cf

  • Service-

    systemctl restart postfix

  • Does not ‘d’ (httpd)

  • mail -s option

  • CTRL+D to complete the mail

  • LAB-

    1. Check for package-

    2. Also, install s-nail package because» here, s-nail is the postman, who will deliver the mail and postfix is the post office-

    3. Check for the service-

    4. Send a mail-

Web Server Apache (httpd)

The Apache HTTP Server, or Apache, is a free, open-source web server that delivers content from websites. It's one of the most widely used web servers in the world.

  • Purpose= Serve Webpages

  • Service or package name= httpd

  • Files

    • /etc/httpd/conf/httpd.conf

    • /var/www/html/index.html

  • Service

    • systemctl restart httpd

    • systemctl enable httpd

  • Log File

    • /var/log/httpd
  • LAB-

    1. Check for the package-

    2. Go to path-

    3. Create a index.html file-

    4. add the content in that file-

    5. Now, Stop the firewall-

    6. Now, restart the httpd service-

    7. Now, Check for the IP address in the web browser, note: please use the Linux machine for this-


Thanks for going through this blog, Happy Learning !! 😁

0
Subscribe to my newsletter

Read articles from Aditya Dev Shrivastava directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Aditya Dev Shrivastava
Aditya Dev Shrivastava