CentOS安装以后的优化
CentOS安装完毕后,需要进行的优化。
注意:本文所述的优化,是针对于服务器环境的,桌面环境下的CentOS请勿使用本文中的方法进行优化,否则可能导致桌面环境不正常。
1,删除不必要的软件包
yum -y remove Deployment_Guide-en-US finger cups-libs cups ypbind
yum -y remove bluez-libs desktop-file-utils ppp rp-pppoe wireless-tools irda-utils
yum -y remove nfs-utils nfs-utils-lib rdate fetchmail eject ksh mkbootdisk mtools
yum -y remove syslinux tcsh startup-notification talk apmd rmt dump setserial portmap yp-tools
yum -y groupremove “GNOME Desktop Environment”
2,升级整个系统
yum -y update #更新全部更新
yum clean all #清理全部缓存的安装文件以节省空间
3,禁用seLinux
sestatus 先执行这一句看看seLinux状态,如果不是disabled,那么执行如下步骤将其禁用
vi /etc/selinux/config
SELINUX=disabled 禁用SeLinux
SELINUX=enforcing 使用SeLinux
4,停止网卡对ipv6的支持
vi /etc/modprobe.conf 添加如下行到文尾:
alias net-pf-10 off
alias ipv6 off
重启后生效。
5,修改环境变量语言编码,防止出现乱码
vi /etc/profile
找到export PATH ……这一行,在其上面加上一行 LANG=en_US.UTF-8
然后在export PATH ……这一行后面补充一个LANG
修改后需要重新登陆SSH才会生效。
6,初始化防火墙
yum -y install iptables
iptables -F
service iptables save
service iptables restart
6,来个一键优化脚本,自动禁用无用服务,且禁止其开机自启动
#! /bin/bash
service acpid off
service atd stop
service auditd stop
service avahi-daemon stop
service avahi-dnsconfd stop
service bluetooth stop
service conman stop
service cpuspeed stop
service cups stop
service dnsmasq stop
service dund stop
service firstboot stop
service hidd stop
service httpd stop
service ibmasm stop
service ip6tables stop
service irda stop
service kdump stop
service lm_sensors stop
service mcstrans stop
service messagebus stop
service microcode_ctl stop
service netconsole stop
service netfs stop
service netplugd stop
service nfs stop
service nfslock stop
service nscd stop
service ntpd stop
service oddjobd stop
service pand stop
service pcscd stop
service portmap stop
service psacct stop
service rdisc stop
service restorecond stop
service rpcgssd stop
service rpcidmapd stop
service rpcsvcgssd stop
service saslauthd stop
service sendmail stop
service setroubleshoot stop
service smb stop
service vncserver stop
service winbind stop
service wpa_supplicant stop
service xfs stop
service ypbind stop
service yum-updatesd stop
chkconfig acpid off
chkconfig atd off
chkconfig auditd off
chkconfig avahi-daemon off
chkconfig avahi-dnsconfd off
chkconfig bluetooth off
chkconfig conman off
chkconfig cpuspeed off
chkconfig cups off
chkconfig dnsmasq off
chkconfig dund off
chkconfig firstboot off
chkconfig hidd off
chkconfig httpd off
chkconfig ibmasm off
chkconfig ip6tables off
chkconfig irda off
chkconfig kdump off
chkconfig lm_sensors off
chkconfig mcstrans off
chkconfig messagebus off
chkconfig microcode_ctl off
chkconfig netconsole off
chkconfig netfs off
chkconfig netplugd off
chkconfig nfs off
chkconfig nfslock off
chkconfig nscd off
chkconfig ntpd off
chkconfig oddjobd off
chkconfig pand off
chkconfig pcscd off
chkconfig portmap off
chkconfig psacct off
chkconfig rdisc off
chkconfig restorecond off
chkconfig rpcgssd off
chkconfig rpcidmapd off
chkconfig rpcsvcgssd off
chkconfig saslauthd off
chkconfig sendmail off
chkconfig setroubleshoot off
chkconfig smb off
chkconfig vncserver off
chkconfig winbind off
chkconfig wpa_supplicant off
chkconfig xfs off
chkconfig ypbind off
chkconfig yum-updatesd off
本文出自 蓝鹰博客,转载时请注明出处及相应链接。
本文永久链接: http://www.lanyingblog.com/blog/32.html