centos7系列和之前版本的centos系統的區別


  • centos7使用最新的systemd技術優化系統的速率

區別一:網卡名稱的區別

  修改方法:安裝菜單出現時按TAB輸入net.ifnames=0 biosdevname=0

已經安裝好系統的參考方法,請參考http://oldboy.blog.51cto.com/2561410/1722101

區別二:setup命令的改變


centos7中setup命令由最新的umtui代替

區別三:主機名等相關配置文件

1.在centos7中主機名的配置文件被更改為/etc/hostname

永久修改主機名的方法

 

2.字符集的配置文件被修改為/etc/locale.conf

修改字符集的方法


區別四:/etc/rc.local要想使用必須加上可執行權限

區別五:運行級別的設置

之前的啟動級別文件/etc/inittab已經不能用了

[root@centos7 ~]# cat /etc/inittab 
# 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
#

 

查看運行級別的命令已經更改為:

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

 修改運行級別的命令也已經修改

[root@centos7 ~]# systemctl set-default multi-user.target 
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/multi-user.target.

 之前的0-6運行級別已經修改為新的表示形式(運行級別2,3,4已經統一為multi-user.target)

[root@centos7 ~]# ll /usr/lib/systemd/system/runlevel*.target
lrwxrwxrwx. 1 root root 15 11月 14 16:01 /usr/lib/systemd/system/runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root 13 11月 14 16:01 /usr/lib/systemd/system/runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root 17 11月 14 16:01 /usr/lib/systemd/system/runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 11月 14 16:01 /usr/lib/systemd/system/runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 11月 14 16:01 /usr/lib/systemd/system/runlevel4.target -> multi-user.target
lrwxrwxrwx. 1 root root 16 11月 14 16:01 /usr/lib/systemd/system/runlevel5.target -> graphical.target
lrwxrwxrwx. 1 root root 13 11月 14 16:01 /usr/lib/systemd/system/runlevel6.target -> reboot.target

區別五:chkconfig說管理的/etc/init.d/下的腳本只保留了兩個其他的命令腳本都已經更換了編碼方式並且更換了路徑

以sshd的編碼方式來舉例子

  • centos6:
[root@lb01 ~]# file /etc/init.d/sshd 
/etc/init.d/sshd: Bourne-Again shell script text executable
  • centos7:
[root@centos7 ~]# file /usr/sbin/sshd
/usr/sbin/sshd: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=dffebd4e9197e9684e7319708745c401d034e4dc, stripped

chkconfig所管理的服務也已全部更換為systemctl管理格式見下表

查看所管理服務的方法:

[root@centos7 ~]# systemctl list-unit-files 
UNIT FILE                                     STATE   
proc-sys-fs-binfmt_misc.automount             static  
dev-hugepages.mount                           static  
dev-mqueue.mount                              static  
proc-sys-fs-binfmt_misc.mount                 static  
sys-fs-fuse-connections.mount                 static  
sys-kernel-config.mount                       static  
sys-kernel-debug.mount                        static  
…………

tips.安裝bash-completion可以補全systemctl的相關命令即使他們用空格隔開,可以通過yum安裝

參考資料:

https://access.redhat.com/documentation/zh-CN/red_hat_enterprise_linux/  :紅帽官方中文說明


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM