CentOS 7 RunLevel Switch

Source: Internet
Author: User

Versions prior to CentOS 7 are defined by the/etc/inittab file to define the system RunLevel:

[[email protected] ~]$ cat/etc/centos-release CentOS release 6.4 (Final) [[email protected] ~]$ cat/etc/ Inittab # Inittab is a used by upstart for the default runlevel.## ADDING other CONFIGURATION here would have NO EFFECT On YOUR system.## SYSTEM initialization was started by/etc/init/rcs.conf## individual runlevels are started by/etc/init/r c.conf## Ctrl-alt-delete is handled by/etc/init/control-alt-delete.conf## Terminal gettys be handled by/etc/init/tty.c  onf and/etc/init/serial.conf,# with configuration in/etc/sysconfig/init.## for information on how to write upstart event handlers, or how# upstart works, see Init (5), init (8), and Initctl (8). # # Default RunLevel.  The runlevels used are:# 0-halt (do not set Initdefault to this) # 1-single user mode# 2-multiuser, without NFS (The same as 3, if you don't have networking) # 3-full multiuser mode# 4-unused# 5-x11# 6-reboot Set Initdefault to this) # Id:3:initdefault:[[email protecTed] ~]$  

The CentOS 7 version no longer uses this file to define the system RunLevel, and the associated run-level settings are invalid:

[Email protected] etc]$ cat/etc/centos-release centos Linux release 7.0.1406 (Core) [[email protected] etc]$ cat/etc/in Ittab # Inittab is no longer used if using systemd.## ADDING CONFIGURATION here'll has no EFFECT on YOUR system.## Ct Rl-alt-delete is handled by/etc/systemd/system/ctrl-alt-del.target## SYSTEMD uses ' targets ' instead of runlevels. By default, there is both main targets:## multi-user.target:analogous to RunLevel 3# graphical.target:analogous to Runle Vel 5## to set a default target, run:## ln-sf/lib/systemd/system/<target Name>.target/etc/systemd/system/default. Target#id:3:initdefault:  

The new version of the runlevel is defined under/lib/systemd/system:

[Email protected] system]$ ls-ltr/lib/systemd/system/runlevel*lrwxrwxrwx. 1 root root 13 July  14:22/lib/systemd/system/runlevel1.target-rescue.targetlrwxrwxrwx. 1 root root 15 July  3 0 14:22/lib/systemd/system/runlevel0.target, poweroff.targetlrwxrwxrwx. 1 root root 17 July  14:22/lib/systemd/system/runlevel2.target-multi-user.targetlrwxrwxrwx. 1 root root 17 July 
   30 14:22/lib/systemd/system/runlevel3.target, multi-user.targetlrwxrwxrwx. 1 root root 17 July  14:22/lib/systemd/system/runlevel4.target-multi-user.targetlrwxrwxrwx. 1 root root 16 July 
   30 14:22/lib/systemd/system/runlevel5.target, graphical.targetlrwxrwxrwx. 1 root root 13 July  14:22/lib/systemd/system/runlevel6.target-Reboot.target

You can set different runlevel for different needs:
If you set a command-line-level method:

Ln-sf/lib/systemd/system/runlevel3.target/etc/systemd/system/default.target
Or
Ln-sf/lib/systemd/system/multi-user.target/etc/systemd/system/default.target
Or
Systemctl Set-default Multi-user.target

To set the window-level method:

Ln-sf/lib/systemd/system/runlevel5.target/etc/systemd/system/default.target or ln-sf/lib/systemd/system/ Graphical.target/etc/systemd/system/default.target
Or
Systemctl Set-default Graphical.target

CentOS 7 RunLevel Switch

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.