{"id":6665,"date":"2016-06-11T20:04:20","date_gmt":"2016-06-11T12:04:20","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=6665"},"modified":"2023-04-28T09:47:07","modified_gmt":"2023-04-28T09:47:07","slug":"change-default-runlevel-centos-7-rhel-7","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/change-default-runlevel-centos-7-rhel-7\/","title":{"rendered":"How to Change default runlevel in CentOS 7 \/ RHEL 7"},"content":{"rendered":"<p><img decoding=\"async\" class=\"alignnone wp-image-6672 size-full lazyload\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/06\/changa-default-run-level.jpg\" alt=\"Change default runlevel\" width=\"1280\" height=\"720\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/06\/changa-default-run-level.jpg 1280w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/06\/changa-default-run-level-300x169.jpg 300w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/06\/changa-default-run-level-768x432.jpg 768w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/06\/changa-default-run-level-1024x576.jpg 1024w\" data-sizes=\"(max-width: 1280px) 100vw, 1280px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1280px; --smush-placeholder-aspect-ratio: 1280\/720;\" \/>In CentOS 7 and RHEL 7, the systemd process replaces the init process for starting services at boot time and also for changing the runlevels. It uses \u201ctargets\u201d instead of run-levels and relies on systemctl command to change runlevel or to change the target.<\/p>\n<p>The systemd provides much more control than the init process does while still supporting existing init scripts.<\/p>\n<p>Take note that in RHEL 7 and CentOS 7, any edits of \/etc\/inittab file will not take effect.<\/p>\n<p>The following articles describe how to change default runlevel in CentOS 7 \/ RHEL 7.<\/p>\n<p>1. How to determine the state that the system currently configured to boot to :<\/p>\n<pre># systemctl get-default\n<\/pre>\n<p>Example 1 :<br \/>\nIf the system running on Non-GUI Mode, &#8220;systemctl get-default&#8221; command will return &#8220;multi-user.target&#8221; :<\/p>\n<p>Method 1 :<\/p>\n<pre>[root@centos72 ~]# systemctl get-default\nmulti-user.target\n<\/pre>\n<p>Method 2 :<\/p>\n<pre>[root@centos72 ~]# ls -al \/etc\/systemd\/system\/default.target\nlrwxrwxrwx. 1 root root 37 May 30  2015 default.target -&gt; \/lib\/systemd\/system\/multi-user.target\n<\/pre>\n<p>Example 2 :<br \/>\nIf the system running on GUI Mode, &#8220;systemctl get-default&#8221; command will return &#8220;graphical.target&#8221; :<br \/>\nMethod 1 :<\/p>\n<pre>[root@centos72-gui ~]# systemctl get-default\ngraphical.target\n<\/pre>\n<p>Method 2 :<\/p>\n<pre>[root@centos72-gui ~]# ls -al \/etc\/systemd\/system\/default.target\nlrwxrwxrwx. 1 root root 36 Jun  5  2015 \/etc\/systemd\/system\/default.target -&gt; \/lib\/systemd\/system\/graphical.target\n<\/pre>\n<p>However, you can still use the runlevel command as it was left intact for backward compatibility:<\/p>\n<pre>[root@centos72 ~]# runlevel\nN 3\n<\/pre>\n<pre>[root@centos72-gui ~]# runlevel\nN 5\n<\/pre>\n<p>In case you are required to change from your CentOS 7 from Non-GUI (text-based) mode to GNOME Desktop mode, you have to ensure the following group of packages has been installed properly :<\/p>\n<p>a) Server with GUI (This is for server)<br \/>\nb) GNOME Desktop<br \/>\nc) Graphical Administration Tools<\/p>\n<p>2. How to Install Gnome GUI in CentOS 7 :<\/p>\n<pre># yum groupinstall \"GNOME Desktop\" \"Graphical Administration Tools\" \"Server with GUI\"\n<\/pre>\n<p>3. How to list all currently loaded and available targets :<\/p>\n<pre># systemctl list-units -t target\nUNIT                 LOAD   ACTIVE SUB    DESCRIPTION\nbasic.target         loaded active active Basic System\ncryptsetup.target    loaded active active Encrypted Volumes\ngetty.target         loaded active active Login Prompts\ngraphical.target     loaded active active Graphical Interface\nlocal-fs-pre.target  loaded active active Local File Systems (Pre)\nlocal-fs.target      loaded active active Local File Systems\nmulti-user.target    loaded active active Multi-User System\nnetwork.target       loaded active active Network\npaths.target         loaded active active Paths\nremote-fs-pre.target loaded active active Remote File Systems (Pre)\nremote-fs.target     loaded active active Remote File Systems\nslices.target        loaded active active Slices\nsockets.target       loaded active active Sockets\nswap.target          loaded active active Swap\nsysinit.target       loaded active active System Initialization\ntimers.target        loaded active active Timers\n<\/pre>\n<p>In below example, the following target are required to be laoded :<\/p>\n<pre>graphical.target     loaded active active Graphical Interface\nmulti-user.target    loaded active active Multi-User System\n<\/pre>\n<h2>How to Change default runlevel<\/h2>\n<p>4. How to Change default runlevel from Non-GUI (text-based) mode to GNOME Desktop in CentOS 7 \/ RHEL 7<\/p>\n<pre># systemctl set-default multi-user.target\n<\/pre>\n<p>5. How to Change default runlevel from GNOME Desktop to Non-GUI (text-based) mode in CentOS 7 \/ RHEL 7<\/p>\n<pre># systemctl set-default graphical.target\n<\/pre>\n<p>Resource :<br \/>\n<a href=\"https:\/\/access.redhat.com\/articles\/754933\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/access.redhat.com\/articles\/754933<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In CentOS 7 and RHEL 7, the systemd process replaces the init process for starting services at boot time and also for changing the runlevels. It uses \u201ctargets\u201d instead of&#8230;<\/p>\n","protected":false},"author":6,"featured_media":6672,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2055],"tags":[1261,1536],"class_list":["post-6665","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","tag-centos-7-2","tag-linux"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/6665","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=6665"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/6665\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/6672"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=6665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=6665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=6665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}