How to change Systemd Runlevel/Target in CentOS/Fedora

Fedora Linux is using systemd to manage system service. The /etc/inittab is no longer used by systemd. The old method of editing /etc/inittab to change system runlevel does not work anymore.

systemd uses ‘targets’ instead of runlevels. By default, there are two main targets:

multi-user.target: analogous to runlevel 3graphical.target: analogous to runlevel 5

To set a default target, run:

# ln -s /lib/systemd/system/.target /etc/systemd/system/default.target

Change the runlevel to ‘multi-user’ (3):

# rm -f /etc/systemd/system/default.target; ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target

Change the runlevel to ‘graphical’ (5):

# rm -f /etc/systemd/system/default.target; ln -s /lib/systemd/system/graphical.target /etc/systemd/system/default.target

For old system, to change the runlevel of the server upon boot up edit the /etc/inittab

sudo vi /etc/inittab

Around line 18 you will see a line as shown below.

id:5:initdefault:

You simply change the "5" in this case to the runlevel you desire. (In my case 3) Save the file and exit.

Comments

Popular posts from this blog

Check MySQL query history from command line

Installing chocolatey on Windows

Fixed: ImportError: No module named utilities.common.tools