{"id":6295,"date":"2015-05-27T21:00:55","date_gmt":"2015-05-27T13:00:55","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=6295"},"modified":"2023-06-27T09:43:20","modified_gmt":"2023-06-27T09:43:20","slug":"how-to-change-runlevel-on-centos-7-rhel-7","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-change-runlevel-on-centos-7-rhel-7\/","title":{"rendered":"How to Change RunLevel on CentOS 7 \/ RHEL 7"},"content":{"rendered":"<p>In Linux operating systems, specifically Redhat Enterprise Linux (RHEL) and CentOS, the method to change the runlevel via \/etc\/inittab has become obsolete as of RHEL 7 and CentOS 7. These latest versions of Linux operating systems have adopted the systemd system management daemon and rely on the systemctl command to change the runlevel. The runlevel is set by linking to \/etc\/systemd\/system\/default.target. Before proceeding to change the runlevel, it is essential to ensure that the Gnome GUI is already installed.<\/p>\n<p>This tutorial will guide you through the process of checking the current runlevel, displaying the default.target, listing all currently loaded targets, changing the runlevel to Graphical-login, verifying the changed runlevel, and finally rebooting the server to login to the GNOME gui.<\/p>\n<h2>Checking the Current Runlevel<\/h2>\n<p>To check the current runlevel, you can use either of the following commands:<\/p>\n<pre>\r\n# runlevel\r\nN 3\r\n<\/pre>\n<p>or<\/p>\n<pre>\r\n# systemctl get-default\r\nmulti-user.target\r\n<\/pre>\n<h2>Displaying the Default.target<\/h2>\n<p>You can display the default.target by using the list command:<\/p>\n<pre>\r\n# ll \/etc\/systemd\/system\/default.target\r\nlrwxrwxrwx. 1 root root 37 Sep 1 2014 \/etc\/systemd\/system\/default.target -&gt; \/lib\/systemd\/system\/multi-user.target\r\n<\/pre>\n<h2>Listing All Currently Loaded Targets<\/h2>\n<p>To list all currently loaded targets, use the following command:<\/p>\n<pre>\r\n# systemctl list-units -t target\r\n<\/pre>\n<p>This command will display a list of all currently loaded targets, including their load status, active status, and sub status.<\/p>\n<pre>UNIT                LOAD   ACTIVE SUB    DESCRIPTION\r\nbasic.target        loaded active active Basic System\r\ncryptsetup.target   loaded active active Encrypted Volumes\r\ngetty.target        loaded active active Login Prompts\r\nlocal-fs-pre.target loaded active active Local File Systems (Pre)\r\nlocal-fs.target     loaded active active Local File Systems\r\nmulti-user.target   loaded active active Multi-User System\r\nnetwork.target      loaded active active Network\r\npaths.target        loaded active active Paths\r\nremote-fs.target    loaded active active Remote File Systems\r\nslices.target       loaded active active Slices\r\nsockets.target      loaded active active Sockets\r\nswap.target         loaded active active Swap\r\nsysinit.target      loaded active active System Initialization\r\ntimers.target       loaded active active Timers\r\n\r\nLOAD   = Reflects whether the unit definition was properly loaded.\r\nACTIVE = The high-level unit activation state, i.e. generalization of SUB.\r\nSUB    = The low-level unit activation state, values depend on unit type.\r\n\r\n14 loaded units listed. Pass --all to see loaded but inactive units, too.\r\nTo show all installed unit files use 'systemctl list-unit-files'.\r\n<\/pre>\n<h2>Changing the RunLevel to Graphical-login<\/h2>\n<p>To change the RunLevel to Graphical-login, use the following command:<\/p>\n<pre>\r\n# systemctl set-default graphical.target\r\n<\/pre>\n<p>This command will remove the current default.target and create a symbolic link to the graphical.target.<\/p>\n<h2>Verifying the Changed Runlevel<\/h2>\n<p>To verify that the runlevel has been changed, you can use either of the following commands:<\/p>\n<pre>\r\n# runlevel\r\nN 5\r\n<\/pre>\n<p>or<\/p>\n<pre>\r\n# systemctl get-default\r\ngraphical.target\r\n<\/pre>\n<h2>Rebooting the Server<\/h2>\n<p>Finally, to apply the changes, reboot the server. After rebooting, you will be able to login to the GNOME gui.<\/p>\n<h2>Commands Mentioned<\/h2>\n<ul>\n<li><span class=\"fw-bold\"># runlevel<\/span> \u2013 Checks the current runlevel<\/li>\n<li><span class=\"fw-bold\"># systemctl get-default<\/span> \u2013 Gets the default runlevel<\/li>\n<li><span class=\"fw-bold\"># ll \/etc\/systemd\/system\/default.target<\/span> \u2013 Displays the default.target<\/li>\n<li><span class=\"fw-bold\"># systemctl list-units -t target<\/span> \u2013 Lists all currently loaded targets<\/li>\n<li><span class=\"fw-bold\"># systemctl set-default graphical.target<\/span> \u2013 Changes the RunLevel to Graphical-login<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>Changing the runlevel in RHEL 7 and CentOS 7 involves a series of steps that include checking the current runlevel, displaying the default.target, listing all currently loaded targets, changing the runlevel to Graphical-login, verifying the changed runlevel, and finally rebooting the server to login to the GNOME gui. This process is made possible by the systemd system management daemon and the systemctl command.<\/p>\n<p>Remember, before proceeding to change the runlevel, it is essential to ensure that the Gnome GUI is already installed.<\/p>\n<p>By following this tutorial, you should now be able to change the runlevel on your RHEL 7 or CentOS 7 server with ease.<\/p>\n<h2>FAQ<\/h2>\n<ol itemscope itemtype=\"https:\/\/schema.org\/FAQPage\">\n<li itemscope itemprop=\"mainEntity\" itemtype=\"\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is the command to check the current runlevel?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">You can use either &#8220;# runlevel&#8221; or &#8220;# systemctl get-default&#8221; to check the current runlevel.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">How can I display the default.target?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">You can display the default.target by using the list command: &#8220;# ll \/etc\/systemd\/system\/default.target&#8221;.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is the command to list all currently loaded targets?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">You can list all currently loaded targets by using the command: &#8220;# systemctl list-units -t target&#8221;.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">How can I change the RunLevel to Graphical-login?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">You can change the RunLevel to Graphical-login by using the command: &#8220;# systemctl set-default graphical.target&#8221;.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is the command to verify the changed runlevel?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">You can verify the changed runlevel by using either &#8220;# runlevel&#8221; or &#8220;# systemctl get-default&#8221;.<\/span>\n            <\/p>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>In Linux operating systems, specifically Redhat Enterprise Linux (RHEL) and CentOS, the method to change the runlevel via \/etc\/inittab has become obsolete as of RHEL 7 and CentOS 7. These&#8230;<\/p>\n","protected":false},"author":6,"featured_media":6280,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2055,1042],"tags":[1244,1259,1536,1717,1729],"class_list":["post-6295","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-runlevel","tag-centos","tag-centos-7-0","tag-linux","tag-rhel-7","tag-runlevel"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/6295","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=6295"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/6295\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/6280"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=6295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=6295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=6295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}