標籤:des http io os ar 使用 for sp 檔案
隨著VPS主機使用的深化,老左從開始使用面板工具操作VPS,再到後來的一鍵安裝包,現在基本上能自學自用VPS管理網站/備份網站維護。但是需要深入的營運還需要時日,比如剛才看到一篇CentOS系統內容精簡最佳化的文章還是值得分享的。但是在操作之前,最好建議在我們安裝系統之後操作,而不要在有網站運行之後操作,以免系統出現問題。
第一步、刪除不必要的內建軟體包
yum remove Deployment_Guide-en-US finger cups-libs cups ypbindyum remove bluez-libs desktop-file-utils ppp rp-pppoe wireless-tools irda-utilsyum remove sendmail* samba* talk-server finger-server bind* xinetdyum remove nfs-utils nfs-utils-lib rdate fetchmail eject ksh mkbootdisk mtoolsyum remove syslinux tcsh startup-notification talk apmd rmt dump setserial portmap yp-toolsyum groupremove "Mail Server" "Games and Entertainment" "X Window System" "X Software Development"yum groupremove "Development Libraries" "Dialup Networking Support"yum groupremove "Games and Entertainment" "Sound and Video" "Graphics" "Editors"yum groupremove "Text-based Internet" "GNOME Desktop Environment" "GNOME Software Development"
第二步、升級centos系統
yum update #更新系統yum clean all #清理全部快取檔案
第三步、禁用seLinux
sestatus #先執行看seLinux狀態,如果不是disabled,就需要執行下面步驟,否則不要執行vi /etc/selinux/configSELINUX=disabled #禁用SeLinuxSELINUX=enforcing #使用SeLinux
第四步、禁止IPV6(執行後需要reboot重啟)
vi /etc/modprobe.conf #開啟檔案,把下面兩行加到最後alias net-pf-10 offalias ipv6 off
第五步、初始化防火牆
touch /etc/sysconfig/iptablesiptables -Fiptables -Xiptables -Zservice iptables saveservice iptables restart
第六步、禁止無用服務
#! /bin/bashservice acpid offservice atd stopservice auditd stopservice avahi-daemon stopservice avahi-dnsconfd stopservice bluetooth stopservice conman stopservice cpuspeed stopservice cups stopservice dnsmasq stopservice dund stopservice firstboot stopservice hidd stopservice httpd stopservice ibmasm stopservice ip6tables stopservice irda stopservice kdump stopservice lm_sensors stopservice mcstrans stopservice messagebus stopservice microcode_ctl stopservice netconsole stopservice netfs stopservice netplugd stopservice nfs stopservice nfslock stopservice nscd stopservice ntpd stopservice oddjobd stopservice pand stopservice pcscd stopservice portmap stopservice psacct stopservice rdisc stopservice restorecond stopservice rpcgssd stopservice rpcidmapd stopservice rpcsvcgssd stopservice saslauthd stopservice sendmail stopservice setroubleshoot stopservice smb stopservice vncserver stopservice winbind stopservice wpa_supplicant stopservice xfs stopservice ypbind stopservice yum-updatesd stopchkconfig acpid offchkconfig atd offchkconfig auditd offchkconfig avahi-daemon offchkconfig avahi-dnsconfd offchkconfig bluetooth offchkconfig conman offchkconfig cpuspeed offchkconfig cups offchkconfig dnsmasq offchkconfig dund offchkconfig firstboot offchkconfig hidd offchkconfig httpd offchkconfig ibmasm offchkconfig ip6tables offchkconfig irda offchkconfig kdump offchkconfig lm_sensors offchkconfig mcstrans offchkconfig messagebus offchkconfig microcode_ctl offchkconfig netconsole offchkconfig netfs offchkconfig netplugd offchkconfig nfs offchkconfig nfslock offchkconfig nscd offchkconfig ntpd offchkconfig oddjobd offchkconfig pand offchkconfig pcscd offchkconfig portmap offchkconfig psacct offchkconfig rdisc offchkconfig restorecond offchkconfig rpcgssd offchkconfig rpcidmapd offchkconfig rpcsvcgssd offchkconfig saslauthd offchkconfig sendmail offchkconfig setroubleshoot offchkconfig smb offchkconfig vncserver offchkconfig winbind offchkconfig wpa_supplicant offchkconfig xfs offchkconfig ypbind offchkconfig yum-updatesd off
這樣通過上述6步驟,就可以完成對centos精簡和最佳化。
6步驟實現CentOS系統內容精簡最佳化