MANAGING INSTALLED SERVICES:
• Services are programs (called daemons) that once started run continuously in the
background and are ready for input or monitor changes in your computer and respond to
them. For example the Apache server has a daemon called httpd (the d is for daemon) that
listens on port 80/443 on your computer and when it receives a request for a page it sends the
appropriate data back to the client machine.
• Many services are required to run all the time however many can be safely turned off for
both security reasons as running unnecessary services opens more doors into your
computer, but also for performance reasons. It may not make much difference but your
computer should boot slightly faster with less services it has to start on boot.
• One of the techniques in every Linux administrator's toolbox to improve security of a box is
to turn off unneeded services.
INTRODUCTION TO systemd and systemctl command in RHEL7/8
Systemd is a system and service manager for Linux operating systems. It is designed to be
backwards compatible with SysV init scripts, and provides a number of features such as
parallel startup of system services at boot time, on-demand activation of daemons, support
for system state snapshots, or dependency-based service control logic. In Red Hat Enterprise
Linux 7, systemd replaces Upstart as the default init system.
Service vs systemctl commands:
Service systemctl Description
------------------- ---------------------------- ------------------------
service name start systemctl start name.service Starts a service.
service name stop systemctl stop name.service Stops a service.
service name restart systemctl restart name.service Restarts a service.
service name reload systemctl reload name.service Reloads configuration.
service name status systemctl status name.service Check the status of the service
service --status-all systemctl list-units --type Displays the status of all services.
service --all
systemctl is-active name.service Checks if a service is running.
chkconfig and service commands:
There are 2 commands used to control services:
• service - This controls the starting and stopping of services during a session, these
setting are not saved. If you start Apache this way but it is not set to start on boot using
the above method then it will continue to run but on next boot will not start automatically.
• chkconfig - This controls which services are set to start on boot, by their nature these
setting are saved and are applied at next boot. Changing these settings will not start the
service immediately; it will just flag them to be started from the next boot.
The command use for service availability is
#chkconfig - list -- To check the availability of service
#chkconfig service on --- To make the service available after restart
#chkconfig service off --- To make the service unavailable after restart
LAB WORK:
Check the status of ftp service “vsftpd”
• To check the status of the above service
#service vsftpd status
#systemctl status vsftpd
Start the httpd services
• To start the httpd service
#service httpd start
#systemctl start httpd
Reload the http services, may be required after doing some change in config file.
• To reload the service
#service httpd reload
#systemctl reload httpd
To restart the ftp or any service, required when reload does not work
• To restart the http services
#service httpd restart
#systemctl restart httpd
Check the status of the all service availability.
• To check the status of all service availability
#chkconfig - -list
#systemctl status name
Note:- Where 0 1 2 3 4 5 6 are the run levels in Linux, The output shows that on which run level
the service is available even after reboot.
Check the status of a particular service, say “httpd”
• To check the status of a vsftpd service, the command is
#chkconfig - - list name of the service
#chkconfig - - list httpd
Make the service availability on for httpd
• To make the service availability on for vsftpd service,
#chkconfig httpd on
#chkconfig - - list httpd
Make the service availability off for httpd
• To make the service availability off the command is
#chkconfig httpd off
#chkconfig - - list httpd
Make the service vsftpd availablily on only on runlevel 5
• To make the service availablilty on, on a particular runlevel , the syntax is
#chkconfig - - level 1-6 service on/off
#chkconfig - - level 5 httpd on
service,systemctl and systemd,systemctl explained,systemctl service,systemctl,systemctl in linux,chkconfig command in linux,service in linux,how to create a service in linux,restart service in linux,how to restart services in linux,how to check services running in linux,Managing Installed Services in Linux,chkconfig,service management in linux,Why Systemd is a Good Thing for Linux,Why Systemd is an ESSENTIAL Upgrade for Linux,systemd is Now the Linux Standard (Here's Why),chkconfig Commands Still Don't Work? Here's systemctl