You are on page 1of 5

3/28/2017 CentOS / RHEL 7 : How to change runlevels (targets) with systemd

THE GEEK DIARY SOLARIS VXVM VCS LINUX INTERVIEW QUESTIONS ORACLE

BLOG POST

CentOS / RHEL 7 : How to change runlevels (targets) with systemd

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.

SysVinit V/s systemd runlevels


Here is a comparison between SysVinit runlevels V/s systemd targets.

SYSVINIT SYSTEMD TARGET FUNCTION


RUNLEVEL

0 runlevel0.target, poweroff.target System halt/shutdown

1, s, single runlevel1.target, rescue.target Single­user mode

2, 4 runlevel2.target, runlevel4.target, User­defined/Site­specific runlevels. By


multi­user.target default, identical to 3.

3 runlevel3.target, multi­user.target Multi­user, non­graphical mode, text console
only

5 runlevel5.target, graphical.target Multi­user, graphical mode

6 runlevel6.target, reboot.target Reboot

emergency emergency.target Emergency mode

Changing runlevels with systemd


The runlevel target can be changed by using the systemctl isolate command :

http://thegeekdiary.com/centos­rhel­7­how­to­change­runlevels­in­rhel7­with­systemd/ 1/5
3/28/2017 CentOS / RHEL 7 : How to change runlevels (targets) with systemd

Build Your Best Cloud


Be Sure with IBM Bluemix.
Cloud Infrastructure, Platform,
Hybrid, and Cognitive.

# systemctl isolate multi‐user.target

To view what targets are available you can issue the list­units option with the type target

# systemctl list‐units ‐‐type=target

Run level 3 is emulated by multi­user.target. This is done by symbolic link and can be used
interchangeably

# systemctl isolate multi‐user.target 
# systemctl isolate runlevel3.target 
# ls ‐l /usr/lib/systemd/system/runlevel3.target 
lrwxrwxrwx 1 root root 17 Oct 18 11:41 /usr/lib/systemd/system/runlevel3.target ‐> multi‐user.target

Run level 5 is emulated by graphical.target. This is also done by symbolic link and can be used
interchangeably

# systemctl isolate graphical.target 
# systemctl isolate runlevel5.target 
# ls ‐l /usr/lib/systemd/system/runlevel5.target 
lrwxrwxrwx 1 root root 16 Oct 18 11:41 /usr/lib/systemd/system/runlevel5.target ‐> graphical.target

Changing the default runlevel


The default runlevel can be changed by using the set­default option.

# systemctl set‐default multi‐user.target

To get the currently set default, you can use the get­default option.

# systemctl get‐default

http://thegeekdiary.com/centos­rhel­7­how­to­change­runlevels­in­rhel7­with­systemd/ 2/5
3/28/2017 CentOS / RHEL 7 : How to change runlevels (targets) with systemd

The default runlevel in systemd can also be set using the below method (not recommended though).

# ln ‐sf /lib/systemd/system/.target /etc/systemd/system/default.target

The default target can also be set in the kernel line during boot by adding the following option :

systemd.unit=multi‐user.target

SHARE THIS

Facebook Twitter Google+ Buffer Pin It Email

Filed Under: CentOS/RHEL 7

Some more articles you might also be interested in …


1. CentOS / RHEL 7 : Beginners guide to firewalld
2. CentOS / RHEL 7 : Tips on Troubleshooting NTP / chrony Issues
3. CentOS / RHEL 7 : Unable to start/enable iptables
4. CentOS / RHEL 7 : Configuring an NFS server and NFS client
5. RHEL 7 – RHCSA Notes – input / output redirection
6. CentOS / RHEL 7 : How to change / set hostname
7. RHEL 7 – RHCSA Notes : Create hard and soft links.
8. RHEL 7 – RHCSA Notes : Configure a system to use time services
9. CentOS / RHEL 7 : Chrony V/s NTP (Differences Between ntpd and chronyd)
10. CentOS / RHEL 7 : How to open the Firewall port for Samba server using FirewallD

About Sandeep
India based Unix Admin, Cloud Evangelist and a
Virtualization lover. I am Sandeep Patil. I work as a Unix
Administrator and love playing around with Linux, Solaris
and various other virtualization and HA solutions. The
Geek Diary blog is all about howtos, basics and concepts
on various Linux/UNIX related topics. I hope you find the In the Right Cloud?
blog useful.  Be Sure. Flexible, Scalable,
Secure: Control Your Cloud
Follow The blog On : Twitter, Facebook, Google+ with IBM Bluemix®.

http://thegeekdiary.com/centos­rhel­7­how­to­change­runlevels­in­rhel7­with­systemd/ 3/5
3/28/2017 CentOS / RHEL 7 : How to change runlevels (targets) with systemd

Search this website …

Enter your email here

SIGN UP NOW

 
742 196
Fans Followers

 
523 298
Subscribers Followers

http://thegeekdiary.com/centos­rhel­7­how­to­change­runlevels­in­rhel7­with­systemd/ 4/5
3/28/2017 CentOS / RHEL 7 : How to change runlevels (targets) with systemd

CHEAT SHEETS SOLARIS INTERVIEW QUESTIONS

LDOMs (OVM for SPARC) Command line The ultimate Solaris Volume Manager (SVM)
reference interview questions

Solaris Volume Manager (SVM) command line The ultimate Solaris zones (containers) interview
reference questions

Solaris ZFS command line reference The ultimate Solaris networking interview
questions
RHEL 7 – RHCSA Notes (Cheat Sheets)
The ultimate ZFS interview questions
CentOS / RHEL 7 : firewalld Cheat Sheet HARDWARE CHEAT SHEETS

Most Commonly used ALOM commands

Most Commonly used ILOM commands

Most Commonly used LOM commands

Most commonly used XSCF commands

Most Commonly used RSC commands

How to login into console from ILOM, ALOM,
LOM, ELOM, XSCF, RSC

Archives Contact Us Copyright

http://thegeekdiary.com/centos­rhel­7­how­to­change­runlevels­in­rhel7­with­systemd/ 5/5

You might also like