Time Synchronization in Linux

Network Time Protocol is used to synchronize our computer's time to another server.

We have to configure the file /etc/ntp.conf for NTP. The port for NTP is 123.

All the time synchronization protocols should be run from the root.

To check if the NTP package is already installed, run the command:

rpm -qa | grep ntp

If not installed, install it with the command:

yum install ntp

To modify the ntp.conf file in the location /etc, run the command:

vi /etc/ntp.conf

To set up the server IP in the ntp.conf file, go to the line which begins with server and add:

server 8.8.8.8

linux-ntp

Save and quit.

:wq!​

To start the ntpd service, run the command:

systemctl start ntpd

To get the status of the ntpd service, run the command:

systemctl status ntpd

To get into an interactive mode along with the server information and time, run the command:

ntpq

To come out of this interactive mode, run the command:

quit

To stop the ntpd service, run the command:

systemctl stop ntpd

Chronyd in Linux

Chronyd is used to synchronize our computer's time to another server. It is the newer version of NTP. The package name for chrony is chronyd.

We have to configure the file /etc/chrony.conf for chronyd. The log file for chronyd resides inside the location /var/log/chrony.

To check if the chrony package is already installed, run the command:

rpm -qa | grep chrony

If not installed, install it with the command:

yum install chrony

To do the configuration for chrony within the /etc/chrony.conf file, run the command:

vi /etc/chrony.conf

To set up the server IP in the chrony.conf file, go to the line which begins with server and add:

server 8.8.8.8

linux-chronyd

Save and quit.

:wq!​

To start the chronyd service, run the command:

systemctl start chronyd

To get the status of the chronyd service, run the command:

systemctl status chronyd

To enable the chronyd service at boot time, run the command:

systemctl  enable chronyd

To get into an interactive mode along with the server information and time with chrony program, run the command:

chronyc

To come out of this interactive mode, run the command:

quit

Sendmail in Linux

Sendmail service is used to send and receive emails. We have to configure the files /etc/sendmail.mc and /etc/sendmail.cf for sending and receiving mails.

To check if the Sendmail package is already installed, run the command:

rpm -qa | grep sendmail

If not installed, install it with the command:

yum install sendmail

We need to install another package of Sendmail. Run the command:

yum install sendmail-cf

To do the configuration for send server within the /etc/sendmail.mc file, run the command:

vi /etc/sendmail.mc

To set up the host and domain name, edit the line which contains SMART_HOST and add the hostname.domain. linux-sendmailhostname

Save and quit.

:wq!​

To start the sendmail service, run the command:

systemctl start sendmail

To get the status of the sendmail service, run the command:

systemctl status sendmail

The status of the sendmail service can also be obtained with the command:

ps -ef | grep sendmail

To send mail, run the command:

mail –s “subject line” [email protected]

Once the command is executed, we have to enter the mail body and at last press CTRL+D.

Web Server in Linux

Httpd

The web server is used to serve web pages. The package or service for the webserver is httpd. We have to configure the files /etc/httpd/conf/httpd.conf and /var/www/html/index.html for httpd. The log file for httpd resides inside the location /var/log/httpd/.

To check if the httpd package is already installed, run the command:

rpm -qa | grep http

If not installed, install it with the command:

yum install httpd

Create an index.html file in the location /var/www/html if not present with the commands:

cd /var/www/html/
vi index.html

To create the page, add the lines in the editor in insert mode:

<!DOCTYPE html>
<html>
<body>
<br>
<h1>Welcome to My First Page</h1>
<br>
<br>
</body>
</html>

Save and quit.

:wq!​

To start the httpd service, run the command:

systemctl start httpd

To get the status of the httpd service, run the command:

systemctl status httpd

To enable the httpd service, run the command:

systemctl enable httpd

To stop the firewalld service to launch the page in the browser, run the command:

systemctl stop firewalld
The above step is optional.

To access the page we created, run the command:

ifconfig

linux-httpd

Note, the IP address: 192.168.1.12 and open it in a browser.
linux-httpdpage

Logger in Linux

Central Logger

The Central Logger service is used to generate and collect logs from other servers. The package or service for the webserver is rsyslog. We have to configure the file /etc/rsyslog.conf for the rsyslog service.

To check if the rsyslog package is already installed, run the command:

rpm -qa | grep rsyslog

If not installed, install it with the command:

yum install rsyslog

To do the configuration for rsyslog within the /etc/rsyslog.conf file, run the command:

vi /etc/rsyslog.conf

To send the system logs to another central logger, edit the line which contains @@remote-host and add the hostname or the IP address of the server where we are sending the logs. linux-rsyslog

Save and quit.

:wq!​

To start the rsyslog service, run the command:

systemctl start rsyslog

To get the status of the rsyslog, run the command:

systemctl status rsyslog

OpenLDAP in Linux

OpenLDAP Installation

OpenLDAP is an open-source implementation of the Lightweight Active Directory Access Protocol. The OpenLDAP service is slapd. We have to configure the files within the directory - /etc/openldap/slapd.d for slapd service.

To start the slapd service, run the command:

systemctl start slapd

To enable slapd, run the command:

systemctl enable slapd

To stop the slapd service, run the command:

systemctl stop slapd

For installation of OpenLDAP follow the steps :

  • Become root with the command:
    su -​

Check if the internet is accessible by the command:

ping www.google.com​

If we are getting a response back from the ping command, it ensures the internet is on.

  • Install OpenLDAP along with all its packages, with the command:
    yum install *openldap*​
  • To check the status of slapd, run the command:
    systemctl status slapd​
About Author :

Myself Debomita Bhattacharjee, an IT employee with 6+ years of experience in Software industry. My area of interest is Automation testing and Front End Development.

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions