We have launched a free Basic Kubernetes Course. Click here to enrol now! Kubernetes is a container orchestration platform used by enterprises worldwide and Kubernetes developers are in high demand!
systemd has replaced the univ SysV (System V) and BSD init systems in majority of the linux distributions. Centos 7 now has systemd and has changed the way services are handled. This is not a comprehensive tutorial but a simple introduction on how services are added, started, enabled, listed and removed using systemctl. Before we start discussing, here are some definitions
- SysVInit – This is the Init system shipped with Unix Sytem V. In other words this is the old system that we all are so familiar with and that is being replaced with system d
- run levels – SysVInit had the concept of run levels. There were 7 runlevels between 0 to 6 depending on the mode of operation. Most users are interested in Mode 2 (Multi User Mode) and 3 (Multi user with Networking).
- Service – SysV had startup scripts in /etc/init.d/. The “service” command was used to run a script in this directory. For example, service mysqld start would call the mysqld script in the /etc/init.d directory.
- chkconfig – This utility is used to add, modify or delete the run level information in the SysVInit system. For example to add a service to startup you would do
chkconfig service_name on –level runlevels
- systemd – This is the new init system that this post is about. It has the concepts of dependent “units”. Each unit wraps up related startup objects. When the system boots, systemd activates the default unit called “default.target”. This generally points to graphical.target or multi-user.target.
- systemctl – This is a tool to control and query systemd. It can manage services.
[table id=1 /]