Centos 7系統最佳化<一>.

來源:互聯網
上載者:User

標籤:網路   防火牆   系統最佳化   設定檔   firewall   

centos7迷你安裝後有一些組件需要自己安裝,如iptables,wget,vim

[[email protected] yum.repos.d]# cat /etc/redhat-releaseCentOS Linux release 7.2.1511 (Core) [[email protected] yum.repos.d]# uname -r               3.10.0-229.el7.x86_64

1、安裝centos7選擇基本安裝,配置完網路後首先要先關閉firewall:

停止firewall

systemctl stop firewalld.service

禁止firewall開機啟動

systemctl disable firewalld.service

2、安裝iptables防火牆

yum方式安裝iptables

yum install iptables-services

編輯防火牆設定檔

vi /etc/sysconfig/iptables #添加下面三句話到預設的22連接埠這條規則的下面-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT-A INPUT -m state --state NEW -m udp -p udp --dport 161 -j ACCEPT

最後重啟防火牆使配置生效

systemctl restart iptables.service

設定防火牆開機啟動

systemctl enable iptables.service


3,關閉SELINUX

編輯selinux的設定檔

vi /etc/selinux/config#注釋掉下面兩行#SELINUX=enforcing #SELINUXTYPE=targeted #增加一行SELINUX=disabled

儲存,關閉

ESC 

:wq 

重啟系統

shutdown -r now


4,centos7迷你安裝沒有wget工具,這個我們後面下源碼會用到,所以先安裝這個

yum  install -y  wget


5,增加第三方的yum源

有些壞境需要的軟體,centos內建的源裡,我們增加兩個源,方便後面的yum安裝壞境需要的組件,要不一個一個的去下源碼編譯太過麻煩,我這裡只增加了epel和rpmforge兩個源

第一步,源檔案如果衝突,需要有個優先順序,所以先安裝yum-priorities

yum install yum-priorities


第二步,設定CentOS預設yum源的優先順序為最高

cd /etc/yum.repos.d/ #進入yum來源目錄vi CentOS-Base.repo

#在[base]、[updates]、[extras]組下面添加priority=1,在[centosplus]、[contrib]組下面添加priority=2

第三步,安裝epel

rpm -ivh  http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm --replacefilesrpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6vi /etc/yum.repos.d/epel.repo

修改epel yum源優先順序,priority=11

第四步驟,安裝rpmforge yum源

wget http://apt.sw.be/redhat/el7/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpmwget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txtrpm --import RPM-GPG-KEY.dag.txtrpm -ivh rpmforge-release-0.5.3-1.el7.rf.x86_64.rpmvi /etc/yum.repos.d/rpmforge.repo

修改rpmforge yum源優先順序,priority=12

yum update


6.Centos預設內建vi,功能沒vim豐富,安裝vim

yum install vim-enhanced -y


http://www.cnblogs.com/phpinfo/p/3923461.html

Centos7迷你安裝下安裝,編譯lamp環境


本文出自 “蘭芷” 部落格,請務必保留此出處http://7826443.blog.51cto.com/7816443/1728555

Centos 7系統最佳化<一>.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.