CentOS 7 版本不再使用该文件定义系统运行级别,相关运行级别设置无效:
[sywu@c1-11r2-rac1etc]$cat/etc/centos-releaseCentOSLinuxrelease7.0.1406(Core) [sywu@c1-11r2-rac1etc]$cat/etc/inittab #inittabisnolongerusedwhenusingsystemd. # #ADDINGCONFIGURATIONHEREWILLHAVENOEFFECTONYOURSYSTEM. # #Ctrl-Alt-Deleteishandledby/etc/systemd/system/ctrl-alt-del.target # #systemduses'targets'insteadofrunlevels.Bydefault,therearetwomaintargets: # #multi-user.target:analogoustorunlevel3#graphical.target:analogoustorunlevel5# #Tosetadefaulttarget,run: # #ln-sf/lib/systemd/system/<targetname>.target/etc/systemd/system/default.target #id:3:initdefault:#无效[sywu@c1-11r2-rac1etc]$
新版本的运行级别都定义在/lib/systemd/system下:
[sywu@c1-11r2-rac1system]$ls-ltr/lib/systemd/system/runlevel*lrwxrwxrwx.1rootroot137月3014:22/lib/systemd/system/runlevel1.target->rescue.target lrwxrwxrwx.1rootroot157月3014:22/lib/systemd/system/runlevel0.target->poweroff.target lrwxrwxrwx.1rootroot177月3014:22/lib/systemd/system/runlevel2.target->multi-user.target lrwxrwxrwx.1rootroot177月3014:22/lib/systemd/system/runlevel3.target->multi-user.target lrwxrwxrwx.1rootroot177月3014:22/lib/systemd/system/runlevel4.target->multi-user.target lrwxrwxrwx.1rootroot167月3014:22/lib/systemd/system/runlevel5.target->graphical.target lrwxrwxrwx.1rootroot137月3014:22/lib/systemd/system/runlevel6.target->reboot.target
可以针对不同需要设置不同的运行级别:
如设置命令行级别方法:
ln-sfsystemdrunlevel3.targetsystemd.target 或 lnsfsystemdlti.targetsystemd.target 或 systemctlset-defaultmulti-user.target
设置窗口级别方法:
lnsfsystemdrunlevel5.targetsystemdsfsystemdraphical.targetsystemd.target 或 systemctlset-defaultgraphical.target原文链接:https://www.f2er.com/centos/377530.html