CentOS6.5和7區別是什麼?選擇CentOS7版本怎麼樣?

CentOS的 7和6之間的最大區別,在於初始化技術的差異。

  • CentOS 7使用的初始化技術是Systemd。
  • 另外,服務啟動、開機啟動文件、網絡命令等,都表明和6有差異。

現在就讓我們先了解 Linux 系統CentOS 初始化技術的演變吧!

一、系統初始化技術

  1. Sysvinit技術
  2. Upstart技術
  3. Systemd技術

Sysvinit的技術

特性:

  • 1)系統的第一個過程是init;
  • 2)init進程是所有進程的父進程,不能被kill(殺死);
  • 3)大多數Linux分發init系統都跟SystemV兼容,稱為sysvinti
  • 4)代表系統:CentOS 5 CentOS 6

優勢:

  • Sysvinit 運作良好,概念簡單明了。
  • 它主要取決於shell腳本。

弱勢:

  • 1)按特定順序執行– > 啟動太慢。
  • 2)很容易掛起,fstab和NFS掛載問題。

Upstart技術

CentOS 6使用SysVinit 代替啟動技術來啟動。

Upstart的rc.sysinit 腳本進行了很多優化,以減少系統初始化啟動時間。

但是,為了簡化管理員的操作,CentOS 6不會突出或直接不支持許多新功能。

代表系統:CentOS 6,Ubuntu14。

  • systemd 從CentOS 7,Ubuntu15開始使用。

Systemd技術

新系統中使用的技術(RedHat7,CentOS 7,Ubuntu15等)

  • 設計的目的是解決sysvinit本來的缺點,有效提高系統啟動速度;
  • 與Sysvinit兼容,減少轉移的成本;

主要優點:

  1. 並行啟動
  2. 使用PID 1 的進程處理

二、yum源的優化

在CentOS 6中,默認是從官方來源下載rpm包。

  • 由於使用國外資源的速度緩慢,CentOS 7在這裡得到了優化。
  • 當我們使用安裝軟件時,默認情況下不再從官方網站下載。
  • 相反,它會自動找到離自己地理位置最近的Yum源開始下載。

三、命令

如果你在安裝系統時選擇minimal(最小的一個),它將安裝在比以前版本更小的包中。例如:VIM,使用ifconfig,route路由,setup設置參數,netstat等等。許多命令都沒有了。

在系統安裝後,可以添加下列軟件包:

yum install lrzsz tree net-tools nmap vim bash-completion lsof dos2unix nc telnet ntp wget rng-tools psmisc screen -y
#lrzsz
 支持用于上传和下载linux的windowns平台。
 可以在windowns远程连接工具上使用。
#net-tools
 CentOS  7.2.11
 默认没有ifconfig命令。网络工具提供了一些网络命令。
#bash-completion
 自动命令完成工具。
#rng-tools
 生成随机数字池的工具。
 有了这个工具,tomcat启动速度非常快。
#psmisc
 这包含killall命令。
#screen
 创建一个新窗口并将任务置于后台。

四、字符集修改

字符集配置文件 ▼

/etc/locale.conf 

命令行只一步就到位 ▼

[root@CentOS 7 ~] # localectl set-locale LANG = zh_CN.UTF-8
[root@CentOS 7 ~] # localectl status
System Locale: LANG=zh_CN.UTF-8
VC Keymap: us
X11 Layout: us

五、啟動管理

/etc/rc.local 

此文件仍然存在,但如果我們想繼續使用此方法,則需要為其添加執行權限 ▼

chmod +x /etc/rc.d/rc.local

查看計劃任務狀態 ▼

systemctl status crond.service

關閉計劃任務 ▼

systemctl stop crond.service

查看操作的情形 ▼

systemctl status crond.service

查看當前在運行的服務 ▼

systemctl list-unit-files|grep enable 

禁用郵件服務 ▼

systemctl disable postfix.service

檢查是否啟用郵件服務 ▼

systemctl list-unit-files|grep postfix

關閉防火牆 ▼

systemctl stop firewalld.service

開啟服務▼

systemctl is-enable

# 關閉服務 ▼

systemctl disable

以/etc/rc.d/rc.local/ 開啟啟動:

CentOS 7中的/etc/rc.d/rc.local 需執行以下命令,來提供可執行權限 ▼

chmod +x /etc/rc.d/rc.local

六、runlevel(運行級別)

/etc/inittab 是一個無效的system target 替代

  • 始終對下次登錄有效

切換到5 ▼

systemctl get-default graphical.target

切換到3 ▼

systemctl get-default multi-user.target

臨時生效 ▼

INIT3

只有五個運行級別 ▼

[root@centos7 ~]# ls -lh /usr/lib/systemd/system/runlevel*.target
lrwxrwxrwx. 1 root root 15 Mar 20 22:31 /usr/lib/systemd/system/runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root 13 Mar 20 22:31 /usr/lib/systemd/system/runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root 17 Mar 20 22:31 /usr/lib/systemd/system/runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Mar 20 22:31 /usr/lib/systemd/system/runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Mar 20 22:31 /usr/lib/systemd/system/runlevel4.target -> multi-user.target
lrwxrwxrwx. 1 root root 16 Mar 20 22:31 /usr/lib/systemd/system/runlevel5.target -> graphical.target 
lrwxrwxrwx. 1 root root 13 Mar 20 22:31 /usr/lib/systemd/system/runlevel6.target -> reboot.target

七、配置yum源代碼

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

官方EPEL來源 ▼

wget http://dl.fedorMaroject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh epel-release-latest-7.noarch.rpm

 

希望陳溈亮博客( https://www.chenweiliang.com/ ) 分享的《CentOS6.5和7區別是什麼?選擇CentOS7版本怎麼樣? 》,對您有幫助。

歡迎分享本文鏈接:https://www.chenweiliang.com/cwl-692.html

歡迎加入陳溈亮博客的Telegram 頻道,獲取最新更新!

🔔 率先在頻道置頂目錄獲取寶貴的《ChatGPT 內容行銷AI 工具使用指南》! 🌟
📚 這份指南蘊含價值巨大,🌟難逢的機遇,切勿錯失良機! ⏰⌛💨
喜歡就分享和按贊!
您的分享和按贊,是我們持續的動力!

 

2人評論了“CentOS6.5和7區別是什麼?選擇CentOS7版本怎麼樣?”

發表評論

您的電子郵箱地址不會被公開。 必填項已用 * 標註

滾動到頂部