{"id":6688,"date":"2017-05-08T12:38:08","date_gmt":"2017-05-08T04:38:08","guid":{"rendered":"http:\/\/rmohan.com\/?p=6688"},"modified":"2017-05-08T12:38:08","modified_gmt":"2017-05-08T04:38:08","slug":"centos-rhel-7-how-to-change-runlevels-targets-with-systemd","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6688","title":{"rendered":"CentOS \/ RHEL 7 : How to change runlevels (targets) with systemd"},"content":{"rendered":"<p>Systemd has replaced sysVinit as the default service manager in RHEL 7. Some of the sysVinit commands have been symlinked to their RHEL 7 counterparts, however this will eventually be deprecated in favor of the standard systemd commands in the future.<\/p>\n<p>SysVinit V\/s systemd runlevels<\/p>\n<p>Here is a comparison between SysVinit runlevels V\/s systemd targets.<\/p>\n<p>SYSVINIT RUNLEVEL\tSYSTEMD TARGET\tFUNCTION<br \/>\n0\trunlevel0.target, poweroff.target\tSystem halt\/shutdown<br \/>\n1, s, single\trunlevel1.target, rescue.target\tSingle-user mode<br \/>\n2, 4\trunlevel2.target, runlevel4.target, multi-user.target\tUser-defined\/Site-specific runlevels. By default, identical to 3.<br \/>\n3\trunlevel3.target, multi-user.target\tMulti-user, non-graphical mode, text console only<br \/>\n5\trunlevel5.target, graphical.target\tMulti-user, graphical mode<br \/>\n6\trunlevel6.target, reboot.target\tReboot<br \/>\nemergency\temergency.target\tEmergency mode<br \/>\nChanging runlevels with systemd<\/p>\n<p>The runlevel target can be changed by using the systemctl isolate command :<\/p>\n<p># systemctl isolate multi-user.target<br \/>\nTo view what targets are available you can issue the list-units option with the type target<\/p>\n<p># systemctl list-units &#8211;type=target<br \/>\nRun level 3 is emulated by multi-user.target. This is done by symbolic link and can be used interchangeably<\/p>\n<p># systemctl isolate multi-user.target<br \/>\n# systemctl isolate runlevel3.target<br \/>\n# ls -l \/usr\/lib\/systemd\/system\/runlevel3.target<br \/>\nlrwxrwxrwx 1 root root 17 Oct 18 11:41 \/usr\/lib\/systemd\/system\/runlevel3.target -> multi-user.target<br \/>\nRun level 5 is emulated by graphical.target. This is also done by symbolic link and can be used interchangeably<\/p>\n<p># systemctl isolate graphical.target<br \/>\n# systemctl isolate runlevel5.target<br \/>\n# ls -l \/usr\/lib\/systemd\/system\/runlevel5.target<br \/>\nlrwxrwxrwx 1 root root 16 Oct 18 11:41 \/usr\/lib\/systemd\/system\/runlevel5.target -> graphical.target<br \/>\nChanging the default runlevel<\/p>\n<p>The default runlevel can be changed by using the set-default option.<\/p>\n<p># systemctl set-default multi-user.target<br \/>\nTo get the currently set default, you can use the get-default option.<\/p>\n<p># systemctl get-default<br \/>\nThe default runlevel in systemd can also be set using the below method (not recommended though).<\/p>\n<p># ln -sf \/lib\/systemd\/system\/[desired].target \/etc\/systemd\/system\/default.target<br \/>\nThe default target can also be set in the kernel line during boot by adding the following option :<\/p>\n<p>systemd.unit=multi-user.target<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Systemd has replaced sysVinit as the default service manager in RHEL 7. Some of the sysVinit commands have been symlinked to their RHEL 7 counterparts, however this will eventually be deprecated in favor of the standard systemd commands in the future.<\/p>\n<p>SysVinit V\/s systemd runlevels<\/p>\n<p>Here is a comparison between SysVinit runlevels V\/s systemd targets.<\/p>\n<p> [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6688"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6688"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6688\/revisions"}],"predecessor-version":[{"id":6689,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6688\/revisions\/6689"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}