centos7 开机默认进入命令行模式

centos7不再使用inittab方式来设置开机不自启图形界面

multi-user.target相当于之前的更改运行级别为3,意思就是命令行。
graphical.target相当于之前的更改运行级别为5,意思就是图形界面(graphical中文意思是图形)。

systemctl get-default

systemctl set-default graphical.target 修改启动模式为图形界面,

systemctl set-default multi-user.target 修改为命令行

Linux系统的7个运行级别(runlevel)

运行级别0:系统停机状态,系统默认运行级别不能设为0,否则不能正常启动
运行级别1:单用户工作状态,root权限,用于系统维护,禁止远程登陆
运行级别2:多用户状态(没有NFS)
运行级别3:完全的多用户状态(有NFS),登陆后进入控制台命令行模式
运行级别4:系统未使用,保留
运行级别5:X11控制台,登陆后进入图形GUI模式
运行级别6:系统正常关闭并重启,默认运行级别不能设为6,否则不能正常启动

运行级别的原理:
1。在目录/etc/rc.d/init.d下有许多服务器脚本程序,一般称为服务(service)
2。在/etc/rc.d下有7个名为rcN.d的目录,对应系统的7个运行级别
3。rcN.d目录下都是一些符号链接文件,这些链接文件都指向init.d目录下的service脚本文件,命名规则为K+nn+服务名或S+nn+服务名,其中nn为两位数字。
4。系统会根据指定的运行级别进入对应的rcN.d目录,并按照文件名顺序检索目录下的链接文件
对于以K开头的文件,系统将终止对应的服务
对于以S开头的文件,系统将启动对应的服务
5。查看运行级别用:runlevel
6。进入其它运行级别用:init N
7。另外init0为关机,init 6为重启系统
由于现在的Linux系统安装完后就运行在第5个级别,即系统启动后直接进入图形界面,而不用在字符模式下登录后用startx或者xinit 来起动图形界面。建议在系统安装完成后把系统的默认运行等级设置在第3级,在字符终端登录后,再手工输入startx 命令起动图形界面。可以用如下的方法修改:
用文本编辑器修改 /etc/inittab文件,把代码:

id:5:initdefault:这一行,修改成代码:

id:3:initdefault:

保存后就reboot重起,系统就默认启动到字符界面。不同运行级别之间的 差别的在于系统默认起动的服务的不同,如运行级别3默认不启动X图形界面服务,而运行级别5 却默认起动。本质上是没有区别的,更无所谓不同级别间功能强弱的问题。用户完全可自给定义不同级别的默认服务。在任何运行级别,用户都可用init 命令来切换到其他运行级别。

将centos7原主机名改为’NMserver-7.test.com’

1、方法一使用hostnamectl命令

[root@bogon ~]# hostnamectl set-hostname NMServer-7.test.com

原文链接:,转发请注明来源!

发表评论

  • 43 Responses to “centos7 开机默认进入命令行模式”
    • Fbsgprest

      cialis no perscription overnight delivery <a href="http://llecialisjaw.com/ ">http://llecialisjaw.com/ </a> original cialis com

      回复
    • FqbbAniny

      payday loans cda id <a href="http://ascashapply.com/ ">cash advance fee halifax credit card</a> can you take cash out on a harp loan

      回复
    • LabxAniny

      comparativa entre cialis y viagra <a href="https://jecialisbn.com/ ">cialis naturale opinioni</a> cialis pas cher a paris

      回复
    • AhbzAniny

      cash loan limit as per income tax act <a href="http://daymoneygo.com/ ">request letter for cash advance in my company</a> allahabad bank cash credit loan

      回复
    • Nbnhprest

      rx sildenafil <a href="https://vigedon.com/ ">viagra suppliers </a> women cialis

      回复
    • Kvaxboop

      do celebrities loan money <a href="http://rirocash.com/ ">a1 payday loans</a> cash advance osceola parkway

      回复
    • Abcfbopinnots

      pay pal viagra <a href="https://viagriyvik.com/ ">http://viagriyvik.com/ </a> cheap viagra in united states

      回复
    • KbbfIdovE

      viagra 300mg <a href="http://kloviagrli.com/ ">viagra for premature ejaculation </a> viagra free trial coupon

      回复
    • JbbnAniny

      cialis 10mg lilly <a href="http://ljcialishe.com/ ">cialis en madrid</a> tablets cialis 20mg

      回复
    • Fvfcprest

      vipps viagra <a href="http://hopeviagrin.com/ ">brand viagra</a> viagra pill

      回复
    • Jbnvblafe

      10 min payday loans <a href="http://samcash21.com/ ">ustar cash loans</a> can payday loans garnish wages in south carolina

      回复
    • FqhhAniny

      viagra generic canadian pharmacy <a href="http://happyrxpharmacy21.com/ ">canadian pharmacy viagra brand</a> rx price comparison

      回复
    • LbsxAniny

      birth control <a href="https://ssviagriia.com/ ">/viagra/</a> costco pharmacy pricing

      回复
    • AhkdAniny

      trusted overseas pharmacies <a href="http://storerxpharmcanada.com/ ">canadian pharcharmy online</a> pills viagra pharmacy 100mg

      回复
    • Nncsprest

      viagra mail order recomendations <a href="http://lightvigra.com/ ">viagra cialis on line parmacy</a> national pharmacies

      回复
    • Aqcfbopinnots

      fastest delivery of cialis <a href="http://cialisvja.com/ ">cialis</a> cocaine cialis

      回复
    • Kbcxboop

      diuretics <a href="http://xuypharmacyonline.com/">cialis daily</a> dapoxetine

      回复
    • KuikIdovE

      by viagra online <a href="http://viagerkr.com/ ">canada generic viagra</a> viagra australia delivery paypal

      回复
    • JbbvAniny

      canadia online pharmacy <a href="http://canadianpharmnorx.com/ ">costco online pharmacy</a> pharmacy drugstore online

      回复
    • Jbnbblafe

      legal canadian prescription drugs online <a href="http://online21rxon.com/ ">no prescription online pharmacy</a> pharmacy uk

      回复
    • Fhnhprest

      internet pharmacy <a href="https://canadianpharmacy-yy.com/">Estrace</a> Aspirin https://canadianpharmacy-yy.com/ - canadian pharmacy no prescription ’

      回复
    • Ngscprest

      brand viagra canadian pharmacy <a href="http://canadianpharmacy-yy.com/Fitness/how-to-get-a-six-pack.html">over the counter viagra usa</a> viagra price online http://canadianpharmacy-yy.com/Fitness/how-to-get-a-six-pack.html - how to buy female viagra online ’

      回复
    • Kbbgboop

      buy low dose viagra online <a href="http://erectilejyzd.com/#">legit online pharmacy</a> viagraorviagra http://erectilejyzd.com/ - Endep ’

      回复
    • AhmdAniny

      buy cialis online <a href="https://impotencecdny.com/">Terramycin</a> cialis dapoxetine canada https://impotencecdny.com/ - dapoxetine ’

      回复
    • Jnscblafe

      О±П…ОёОµОЅП„О№ОєОї П‡О±ПЂО№ viagra <a href="http://erectilejyzd.com/index.php?called=terms">generic viagra 10 mg price cheap</a> buy voucher for viagra daily online http://erectilejyzd.com/index.php?called=terms - viagra profesional vs. super active vs. viagra ’

      回复
    • Fbgprest

      viagra cheap xm advertising <a href="https://canadianpharmacy-usx.com/organic.htm">supreme suppliers viagra</a> viagra australai https://canadianpharmacy-usx.com/organic.htm - viagra buy online canada ’

      回复
    • FmfvAniny

      generic of cialis <a href="http://sjcialis.com/#">cialis on line</a> when does cialis patent expire http://sjcialis.com/ - buy cialis online in austalia ’

      回复
    • Nmilprest

      adderall and viagra <a href="http://xz-pharmacyonline.com/en/career-opportunities.html">viagra no prescription canada</a> viagra online cheap http://xz-pharmacyonline.com/en/career-opportunities.html - viagra australia ’

      回复
    • Kbbtboop

      cialis canada online <a href="https://xz-pharmacyonline.com/#">legitimate online pharmacies</a> cialisВ® online https://xz-pharmacyonline.com - Biaxin ’

      回复
    • AhmdAniny

      paypal cialis online <a href="http://cialmenshoprx.com/#">cheap generic cialis</a> cialis profesional vs. super active vs. cialis http://cialmenshoprx.com/ - cialis ’

      回复
    • Jnhblafe

      arghentina cialis <a href="http://loncialis.com/#">cialis lion</a> cialis without persciction http://loncialis.com/ - cialis with diapoxetine ’

      回复
    • Fbdhprest

      whats better viagra or cialis <a href="http://21cialismen.com/#">cialis free trial</a> cialis no prescription arizona http://21cialismen.com/ - cialisВ® ’

      回复
    • FsbxAniny

      viagra aus mastercard <a href="http://genericrxxx.com/#">viagra super active,free shipping</a> does viagra go stale http://genericrxxx.com/ - buy viagra pills 365 ’

      回复
    • LcxAniny

      has anyone in australia bought viagra online <a href="http://genqpviag.com/#">viagra for women reviews</a> viagra generics canada http://genqpviag.com/ - viagra 100mg pfizer ’

      回复
    • Nlbxprest

      buy cialis at walmart <a href="http://cialijomen.com/#">cialis dapoxetine overnight shipment</a> cialis generic prices http://cialijomen.com/ - chewable cialis ’

      回复
    • Kbctboop

      brandcialis <a href="http://mycialedst.com/#">cialis dapoxetine</a> cialis (generic) http://mycialedst.com/ - cialis online europe ’

      回复
    • AqbvAniny

      viagra cheap fast shipping <a href="http://acialaarx.com/#">viagra cialis melbourne site:au</a> viagra online ireland http://acialaarx.com/ - viagra online cheap ’

      回复
    • Jvcbxblafe

      brand name cialis online <a href="http://phrcialiled.com/#">cialis soft tabs overnight</a> viagra vs cialis http://phrcialiled.com/ - buycialisonline ’

      回复
    • JbdcAniny

      cialis vs viagra canadian pharmacy <a href="http://llviabest.com/#">online viagra sales new zealand</a> viagra interac online http://llviabest.com/ - ordering viagra online legal ’

      回复
    • Fgnhprest

      buy viagra online without a prescription with overnight delivery <a href="http://ltdviagragogo.com/#">buy viagra no prescription, paypal</a> viagra distributors buying viagra in the uk <a href="http://hdgenericviagraxk.com/#">online viagra pay pal</a> free trial viagra canada brand name viagra <a href="http://buygenericviarga.com/#">works as well as viagra</a> viagra samples free by mail canadian viagra suppliers <a href="http://buyhdpillvia.com/#">buy viagra with paypal</a> lowcost viagra П†П„О·ОЅО± viagra <a href="http://genericviagrix.com/#">viagra coupuns</a> viagra without a prescription johnson pharmacy

      回复
    • Nlbxprest

      generic viagra master card accepted <a href="http://viashoprx.com/#">legal viagra</a> viagra for sale in canada viagraonline\\ <a href="http://xviagarrx.com/#">viagra uk</a> viagra covered on line by insurance viagrasupplierscapetown <a href="http://viagraviagria.com/#">viagracialisevit</a> pfizer viagra without prescription generic viagra, canada <a href="http://asgenviagria.com/#">viagra free delivery uk</a> viagra for sale in the uk viagra rezeptfrei <a href="http://viagengen.com/#">viagra for sela</a> how much does viagra cost with a prescription

      回复
    • Klioboop

      viagra for sale in melbourne <a href="http://bestviagrx.com/#">viagra pills cheap</a> buy viagra on line mastercard that accept viagra top of the line <a href="http://viarxhd.com/#">where to buy viagra in melbourne</a> where can you buy cheap viagra brand viagra with dapoxetine <a href="http://viagetpill.com/#">viagra from canada legitimate msnbc</a> viagra brand viagra 6 free samples <a href="http://pillexrx.com/#">viagra canada</a> viagra with paypal australian viagra online <a href="http://usggrxmed.com/#">best viagra sale sites</a> buy generic viagra mastercard

      回复
    • Stephenpeaky

      otc viagra <a href=" http://sild100fast.com/# ">viagra for sale</a> cheapest viagra online

      回复