首页 > 代码库 > 6步骤实现CentOS系统环境精简优化
6步骤实现CentOS系统环境精简优化
随着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系统环境精简优化
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。