CentOS 6 and 7 to modify the default startup mode

centos6:

 

Linux English interpretation / etc / inittab down in:

This file describes how the INIT process should set up  the system in a certain run-level.The inittab file describes which processes are started  at  bootup  and during  normal operation.

Popular to say that some of the procedures and controls at the level Linux boot.

runlevel English explanation:
# Used by the Default runlevel at The runlevels the RHS are:.
# 0 - the HALT (the Do the NOT the SET initdefault to the this)
# 1 - Single the User the MODE
# 2 - Multiuser, the without NFS (at The Same, AS 3, IF Networking do not have have you)
# 3 - Full Multiuser the MODE
# 4 - unused
# 5 - X11
# 6 - reboot (the do the nOT the sET initdefault to the this)
to translate the above translation is:
# 0 - stop (do not set the initdefault 0)
# 1 - single-user mode  
# 2 - multiuser, without the NFS (no network)
# 3 - full multi-user mode (normal operating level, in fact text mode)  
# 4 - did not use the  
# 5 - X11 ( Xwindow)  
# 6 - restart

In the inittab file all valid statements comply with the following format:

id:runlevels:action:process

id: is the identification name, which could be named, less than four characters, to note is distinguished name can not be repeated, it is unique.

runlevels: This line represents the level that applies to run (six levels shown above); in addition sysinit, boot, bootwait three processes will ignore this setting. This can be selected, for example, to run two, three level, you write 123

action: indicates entering corresponding runlevels, init process should run as command fields, field values and explanations common in the appendix.
    respawn: init representation should monitor this process, even after its end should be restarted.
    wait: init should run this process once, and wait for the next step after its end.
    once: init need to run this process again.
    boot: Start running with the system, so its value runlevel invalid.
    bootwait: Start running with the system, and init should wait for it to end.
    off: no sense.
    The default run level after the system starts; due to enter the corresponding operational level will activate the corresponding level of the process, so its field specified process does not make sense: initdefault. If this record does not exist in inittab file, system-level inquiry into the running on the console startup.
    sysinit: command ready to run at system startup. For example, this command will clear / tmp. You can view /etc/rc.d/rc.sysinit understand the script to run those operations.
    powerwait: init allowed when the power is cut off the system. Of course, the premise is to monitor UPS and UPS and informs init the power has been cut off in the software. RH linux default, this option is not listed.
    powerfail: with powerwait, but the process is running init does not wait for the end. RH linux default, this option is not listed.
    powerokwait: When the power monitoring software report "Power Recovery", init operations to be performed.
    powerfailnow: When ups power is running out, init operation to be performed, and powerwait / powerfail different detected yo.
    ctrlaltdel: init allows the user presses C trl + A lt + D el when the key combination to reboot the system console keyboard. Note that if the system is in a public place, the system administrator may be C trl + A lt + D el configured key combination for the other behavior, such as ignoring the like. I was set to print a curse of ^ o ^ kbrequest:. To monitor the action taken when specific keyboard key combination is pressed, it is not perfect.
    ondemand: A process marked with an ondemand runlevel will be executed whenever the specified ondemand runlevel is called However, no runlevel change will occur (ondemand runlevels are 'a', 'b', and 'c').

process: the program is executed

 

For example:

id: 3: initdefault: # a rear boot into the command line
x: 5: once: / etc / X11 / prefdm -nodaemon # represents the start mode performed at a time prefdm -nodaemon xwindow

 

Practical experience:

If you want to boot directly into the "command line", edit / etc / inittab file, set to id: 3: initdefault:

If you want to go directly to "Window Mode" is set to id: 5: initdefault:

 

centos7:

 

In the virtual machine installed a new CentOS 7, a graphical interface to start slow, want to adjust in accordance with previous experience running change level, enter:

vi / etc / inittab

Then discover with not the same as before, no longer work in inittab settings:

# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To view current default target, run:
# systemctl get-default
#
# To set a default target, run:
# systemctl set-default TARGET.target
#

Carefully read the tips above
runlevel similar multi-user.target previous 3
graphical.target similar to the previous runlevel 5

According to the above tips, see the current default target enter the command:


[root@localhost ~]# systemctl get-default
graphical.target
[root@localhost ~]# 
当前为graphical.target

Modify the command mode multi-user.target:

[root@localhost ~]# systemctl set-default multi-user.target
rm '/etc/systemd/system/default.target'
ln -s '/usr/lib/systemd/system/multi-user.target' '/etc/systemd/system/default.target'

Look at the current start-up mode:

[root@localhost ~]# systemctl get-default
multi-user.target

 

Remarks:

Under CentOS7

Using the graphical interface ctrl + alt + f2 is switched to the command line

In the command-line interface ctrl + alt + F2 to switch back to the graphical interface

Init command 3 input in the command to switch to the command line

Init 5 command to switch to input graphical interface

Linux English interpretation / etc / inittab down in:

This file describes how the INIT process should set up  the system in a certain run-level.The inittab file describes which processes are started  at  bootup  and during  normal operation.

Popular to say that some of the procedures and controls at the level Linux boot.

runlevel English explanation:
# Used by the Default runlevel at The runlevels the RHS are:.
# 0 - the HALT (the Do the NOT the SET initdefault to the this)
# 1 - Single the User the MODE
# 2 - Multiuser, the without NFS (at The Same, AS 3, IF Networking do not have have you)
# 3 - Full Multiuser the MODE
# 4 - unused
# 5 - X11
# 6 - reboot (the do the nOT the sET initdefault to the this)
to translate the above translation is:
# 0 - stop (do not set the initdefault 0)
# 1 - single-user mode  
# 2 - multiuser, without the NFS (no network)
# 3 - full multi-user mode (normal operating level, in fact text mode)  
# 4 - did not use the  
# 5 - X11 ( Xwindow)  
# 6 - restart

In the inittab file all valid statements comply with the following format:

id:runlevels:action:process

id: is the identification name, which could be named, less than four characters, to note is distinguished name can not be repeated, it is unique.

runlevels: This line represents the level that applies to run (six levels shown above); in addition sysinit, boot, bootwait three processes will ignore this setting. This can be selected, for example, to run two, three level, you write 123

action: indicates entering corresponding runlevels, init process should run as command fields, field values and explanations common in the appendix.
    respawn: init representation should monitor this process, even after its end should be restarted.
    wait: init should run this process once, and wait for the next step after its end.
    once: init need to run this process again.
    boot: Start running with the system, so its value runlevel invalid.
    bootwait: Start running with the system, and init should wait for it to end.
    off: no sense.
    The default run level after the system starts; due to enter the corresponding operational level will activate the corresponding level of the process, so its field specified process does not make sense: initdefault. If this record does not exist in inittab file, system-level inquiry into the running on the console startup.
    sysinit: command ready to run at system startup. For example, this command will clear / tmp. You can view /etc/rc.d/rc.sysinit understand the script to run those operations.
    powerwait: init allowed when the power is cut off the system. Of course, the premise is to monitor UPS and UPS and informs init the power has been cut off in the software. RH linux default, this option is not listed.
    powerfail: with powerwait, but the process is running init does not wait for the end. RH linux default, this option is not listed.
    powerokwait: When the power monitoring software report "Power Recovery", init operations to be performed.
    powerfailnow: When ups power is running out, init operation to be performed, and powerwait / powerfail different detected yo.
    ctrlaltdel: init allows the user presses C trl + A lt + D el when the key combination to reboot the system console keyboard. Note that if the system is in a public place, the system administrator may be C trl + A lt + D el configured key combination for the other behavior, such as ignoring the like. I was set to print a curse of ^ o ^ kbrequest:. To monitor the action taken when specific keyboard key combination is pressed, it is not perfect.
    ondemand: A process marked with an ondemand runlevel will be executed whenever the specified ondemand runlevel is called However, no runlevel change will occur (ondemand runlevels are 'a', 'b', and 'c').

process: the program is executed

 

For example:

id: 3: initdefault: # a rear boot into the command line
x: 5: once: / etc / X11 / prefdm -nodaemon # represents the start mode performed at a time prefdm -nodaemon xwindow

 

Practical experience:

If you want to boot directly into the "command line", edit / etc / inittab file, set to id: 3: initdefault:

If you want to go directly to "Window Mode" is set to id: 5: initdefault:

Guess you like

Origin www.cnblogs.com/JiaoTou/p/11343939.html