|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
欢迎大家来到仓酷云论坛!装置后,一入手下手有点儿有力吐槽的感到,变更这么年夜?
1、Runlevel
起首一条,本来一向用的CentOS-6.5-x86_64-minimal.iso光盘镜像(400M摆布无图形体系玲珑便利),而7今朝最小的镜像是CentOS-7.0-1406-x86_64-livecd.iso(700M摆布),默许装置后是启动图形界面,按本来的习气要改成启动下令行,了局发明:
- [root@localhost~]#cat/etc/inittab#inittabisnolongerusedwhenusingsystemd.##ADDINGCONFIGURATIONHEREWILLHAVENOEFFECTONYOURSYSTEM.##Ctrl-Alt-Deleteishandledby/etc/systemd/system/ctrl-alt-del.target##systemdusestargetsinsteadofrunlevels.Bydefault,therearetwomaintargets:##multi-user.target:analogoustorunlevel3#graphical.target:analogoustorunlevel5##Tosetadefaulttarget,run:##ln-sf/lib/systemd/system/<targetname>.target/etc/systemd/system/default.target#
复制代码
好吧,systemd金瓯无缺了(它管的器材良多良多,学Centos7起首要弄定systemd)。
- [root@localhost~]#ls-Xl/etc/systemd/system/*.targetlrwxrwxrwx.1rootroot367月823:12/etc/systemd/system/default.target->/lib/systemd/system/graphical.target
复制代码
我们来看看夙昔的runlevel都酿成甚么样了?
- [root@localhost~]#ls-Xl/lib/systemd/system[root@localhost~]#ls-Xl/lib/systemd/system/runlevel*.targetlrwxrwxrwx.1rootroot157月500:45/lib/systemd/system/runlevel0.target->poweroff.targetlrwxrwxrwx.1rootroot137月500:45/lib/systemd/system/runlevel1.target->rescue.targetlrwxrwxrwx.1rootroot177月500:45/lib/systemd/system/runlevel2.target->multi-user.targetlrwxrwxrwx.1rootroot177月500:45/lib/systemd/system/runlevel3.target->multi-user.targetlrwxrwxrwx.1rootroot177月500:45/lib/systemd/system/runlevel4.target->multi-user.targetlrwxrwxrwx.1rootroot167月500:45/lib/systemd/system/runlevel5.target->graphical.targetlrwxrwxrwx.1rootroot137月500:45/lib/systemd/system/runlevel6.target->reboot.target
复制代码
修正默许启动runlevel为multi-user(貌似runlevel234没区分了)
- [root@localhost~]#ln-sf/lib/systemd/system/multi-user.target/etc/systemd/system/default.target[root@localhost~]#ll-X/etc/systemd/system/*.targetlrwxrwxrwx.1rootroot377月1009:42/etc/systemd/system/default.target->/lib/systemd/system/multi-user.target
复制代码
尝尝init6还好用不。
- [root@localhost~]#init6Connectionto192.168.150.180closedbyremotehost.Connectionto192.168.150.180closed.
复制代码
成,好用。:)
由于我从桌面版Linux毗连Centos7体系提醒酿成了中文,以是必要把Centos7的root用户言语改一下,回到原汁原味。
- [root@localhost~]#cp.bashrc.bashrc-back[root@localhost~]#echoexportLANG="en_Us.UTF-8">>/root/.bashrc
复制代码
2、Services
- [root@localhost~]#chkconfigNote:ThisoutputshowsSysVservicesonlyanddoesnotincludenativesystemdservices.SysVconfigurationdatamightbeoverriddenbynativesystemdconfiguration.Ifyouwanttolistsystemdservicesusesystemctllist-unit-files.Toseeservicesenabledonparticulartargetusesystemctllist-dependencies[target].iprdump0:off1:off2:on3:on4:on5:on6:offiprinit0:off1:off2:on3:on4:on5:on6:offiprupdate0:off1:off2:on3:on4:on5:on6:offlivesys0:off1:off2:off3:on4:on5:on6:offlivesys-late0:off1:off2:off3:on4:on5:on6:offnetconsole0:off1:off2:off3:off4:off5:off6:offnetwork0:off1:off2:off3:off4:off5:off6:offrhnsd0:off1:off2:on3:on4:on5:on6:offvboxadd0:off1:off2:on3:on4:on5:on6:offvboxadd-service0:off1:off2:on3:on4:on5:on6:offvboxadd-x110:off1:off2:off3:on4:off5:on6:off
复制代码
SysV已快退居二线了,想设置办事得用systemctl,先看看默许启动的办事吧。(假如不必grep过滤一下,输入了局有260多行)
- [root@localhost~]#systemctllist-unit-files|grepenabledtmp.mountenabledaccounts-daemon.serviceenabledatd.serviceenabledauditd.serviceenabledavahi-daemon.serviceenabledbluetooth.serviceenabledchronyd.serviceenabledcrond.serviceenableddbus-org.bluez.serviceenableddbus-org.fedoraproject.FirewallD1.serviceenableddbus-org.freedesktop.Avahi.serviceenableddbus-org.freedesktop.NetworkManager.serviceenableddbus-org.freedesktop.nm-dispatcher.serviceenableddisplay-manager.serviceenableddmraid-activation.serviceenabledfirewalld.serviceenabledgdm.serviceenabledgetty@.serviceenabledirqbalance.serviceenablediscsi.serviceenabledkdump.serviceenabledlibstoragemgmt.serviceenabledlvm2-monitor.serviceenabledmdmonitor.serviceenabledmicrocode.serviceenabledmultipathd.serviceenabledNetworkManager-dispatcher.serviceenabledNetworkManager.serviceenabledpackagekit-offline-update.serviceenabledpostfix.serviceenabledrngd.serviceenabledrsyslog.serviceenabledrtkit-daemon.serviceenabledsmartd.serviceenabledspice-vdagentd.serviceenabledsysstat.serviceenabledsystemd-readahead-collect.serviceenabledsystemd-readahead-drop.serviceenabledsystemd-readahead-replay.serviceenabledtuned.serviceenabledavahi-daemon.socketenableddm-event.socketenablediscsid.socketenablediscsiuio.socketenabledlvm2-lvmetad.socketenableddefault.targetenabledmulti-user.targetenabledremote-fs.targetenabled
复制代码
默许竟然没有启动sshd,晕!看看监听端口:
- [root@localhost~]#netstat-lntpActiveInternetconnections(onlyservers)ProtoRecv-QSend-QLocalAddressForeignAddressStatePID/Programnametcp00127.0.0.1:250.0.0.0:*LISTEN2090/master
复制代码
公然没有22,尝尝老举措:
- [root@localhost~]#chkconfigsshdonNote:Forwardingrequesttosystemctlenablesshd.service.ln-s/usr/lib/systemd/system/sshd.service/etc/systemd/system/multi-user.target.wants/sshd.service
复制代码
能用,可是指令被转发到systemctlenablesshd.service,今后把持办事就用这个指令了。尝尝:
禁用sshd:
- [root@localhost~]#ls-Xl/etc/systemd/system/*.targetlrwxrwxrwx.1rootroot367月823:12/etc/systemd/system/default.target->/lib/systemd/system/graphical.target0
复制代码
启用sshd:
- [root@localhost~]#ls-Xl/etc/systemd/system/*.targetlrwxrwxrwx.1rootroot367月823:12/etc/systemd/system/default.target->/lib/systemd/system/graphical.target1
复制代码
看看:
- [root@localhost~]#ls-Xl/etc/systemd/system/*.targetlrwxrwxrwx.1rootroot367月823:12/etc/systemd/system/default.target->/lib/systemd/system/graphical.target2
复制代码
实在启用和禁用办事就是在以后“runlevel”的设置文件目次(/etc/systemd/system/multi-user.target.wants/)里,
创建/usr/lib/systemd/system内里对应办事设置文件的软链接;禁用办事就是删除此软链接。
有乐趣就本人看看/usr/lib/systemd/system里的文件,语法跟旧版/etc/init.d/里的办事剧本完整分歧,也不克不及再用/etc/init.d/sshdrestart之类的指令启动办事器了。
先尝尝旧***启动办事:
- [root@localhost~]#ls-Xl/etc/systemd/system/*.targetlrwxrwxrwx.1rootroot367月823:12/etc/systemd/system/default.target->/lib/systemd/system/graphical.target3
复制代码
用新***折腾一下:
- [root@localhost~]#ls-Xl/etc/systemd/system/*.targetlrwxrwxrwx.1rootroot367月823:12/etc/systemd/system/default.target->/lib/systemd/system/graphical.target4
复制代码
假如没有毛病,就不会输入任何信息,这个,,,,得习气一下。
3、收集
setup工具仍是保存了,但有区分,没有了收集设置,多了RHN(Centos究竟是跟RedHat一家子了)
[root@localhost~]#setup
好吧,我们看看收集设置。
- [root@localhost~]#ls-Xl/etc/systemd/system/*.targetlrwxrwxrwx.1rootroot367月823:12/etc/systemd/system/default.target->/lib/systemd/system/graphical.target5
复制代码
先改改主机名:
<divclass="cnblogs_code"style="margin:5px0px;padding:5px;border:1pxsolidrgb(204,204,204);overflow:auto;color:rgb(0,0,0);font-family:CourierNew!important;background-color:rgb(245,245,245);">
[code][root@localhost~]#echo"hostnamecenots7.localdomain">>/etc/sysconfig/network[root@localhost~]#rebootConnectionto192.168.150.180closedbyremotehost.Connectionto192.168.150.180closed.xw@Opt9010:~$sshroot@192.168.150.180root@192.168.150.180spassword:Last |
|