Centos 7 How To Change Runlevel
On today's post I am going to walk you guys through the process of changing run-levels. This is ideal for situations for example where have a Centos installation that boots up into a graphical user interface and you wish to boot into Command Line only. So let's get down to business and do this :)
Checking The Current Runlevel
You can still use the command "runlevel" to check the current run-level however here are two more ways to achieve the same goal.
systemctl get-default
ll /etc/systemd/system/default.target
Output Showing Current Runlevel:
So graphical.target is my current runlevel this makes sense as I am running the Gnome desktop environment.
# systemctl list-units --type=target
We will now go ahead and change the default runlevel to a runlevel3
( this is will run nothing but a multi-user.target)
We achieve this by issuing the following command:
# systemctl set-default multi-user.target
We now confirm the changes / confirm the default runlevel:
# systemctl get-default
We should be now presented with the following as output indicating that the default runlevel has changed.
multi-user.target
Awesome stuff :) we have changed the runlevel all we need to do now is to reboot the system and check out our new runlevel in action:
reboot