Shopex产品服务器系统优化

1. 关闭不需要的服务
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

新建a.sh文件,复制粘贴以上内容到文件中,运行sh a.sh

2. 对TCP/IP网络参数进行调整
echo 'net.ipv4.tcp_syncookies = 1' >> /etc/sysctl.conf
sysctl -p
3. 修改shell命令的history 记录个数
vim /etc/profile
	HISTSIZE=100
4. 定时校正服务器时间
yum install ntp
crontab -e
	*/5 * * * * ntpdate ntp.api.bz
5. 停止打印服务
/etc/rc.d/init.d/cups stop
chkconfig --list cups 确认是否关闭
6. 停止ipv6
ifconfig -a
vim /etc/modprobe.conf
	alias net -pf -10 off
	alias ipv6 off
echo "IPV6INIT = no " >> /etc/sysconfig/network-scripts/ifconfig-eth0
shutdown -r now
7. 调整linux 最大文件打开数

vim /etc/rc.local

ulimit -SHn 65535
8. 关闭写磁盘I/0功能

vim /etc/fstab

   /dev/sda5 /data/ ext3 noatime,nodiratime 0 0
9. 优化内核TCP参数
vim /etc/sysctl.conf
	net.ipv4.neigh.default.gc_stale_time = 120
	net.ipv4.conf.all.rp_filter = 0
	net.ipv4.conf.default.rp_filter = 0
	net.ipv4.conf.default.arp_announce = 2
	net.ipv4.conf.all.arp_announce = 2
	net.ipv4.tcp_max_tw_buckets = 5000
	net.ipv4.tcp_syncookies = 1
	net.ipv4.tcp_max_syn_backlog = 20000
	net.ipv4.tcp_synack_retries = 2
	net.ipv4.conf.lo.arp_announce=2
	net.ipv4.tcp_fin_timeout = 30
	net.ipv4.tcp_keepalive_time = 1200
	net.ipv4.tcp_tw_reuse = 1
	net.ipv4.tcp_tw_recycle = 1
	net.ipv4.ip_local_port_range = 1024 65000
sysctl -p

评论

评论正在提交中...请稍后
评论提交成功...
  1. #1

    凯哥自媒体 (2016-12-22 11:52:16) 沙发
    分享的不错,谢谢

  2. #2

    Suvan (2016-12-22 19:01:49) 板凳
    小万的随性笔记长期更新shopex产品相关文章以及日常工作中服务器、代码相关的日常笔记,感谢您的关注,欢迎常来逛逛~~