centos 5.6 linux安裝系統後的基本最佳化

來源:互聯網
上載者:User

1.關閉不必要的伺服器
 
#ntsysv
 
保留
 
crond
 
Linux計劃任務服務
 
irqbalance
 
用於最佳化中斷分配,以充分利用CPU 多核
 
network
 
sshd
 
syslog
 
Linux 日誌系統(重要)
 
2關閉iptables
 
#services iptables stop && chkconfig iptables off
 
關閉SELinux
 
#vim /etc/selinux/config
 
將檔案中的selinux=""改為desabled  ,並重啟
 
使用setenforce 0 可以不需要重啟關閉SELinux 但是重啟後失效
 
3.關閉不需要的tty
 
#vim /etc/inittab
 
# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6
 
注釋掉後4 個控制台 並執行init q  命令生效
 
4.停止列印服務
 
#/etc/init.d/cups stop
 
#chkconfig cups off
 
5.關閉ipv6
 
#vim /etc/modprobe.conf
 
新增內容
 
alias net-pf-10 off
 
alias ipv6 off
 
儲存退出
 
#echo "IPV6INIT = no" >>/etc/sysconfig/network-scripts/ifcfg-eth0
 
#reboot  重啟生效
 
6.調整Linux 的最大檔案開啟數
 
#vim /etc/rc.d/rc.local
 
新增內容
 
ulimit -SHn 65565
 
7關閉centos的寫磁碟I/O功能
 
一個linux檔案預設有3個時間
 
atime:對此檔案的訪問時間
 
ctime: 此檔案的inode發生變化的時間
 
mtime: 此檔案的修改時間
 
#vim /etc/fstab
 
/dev/sda2    /data     ext3  noatime,nodiratime  0 0
 
8,最佳化Linux 下的核心tcp 參數以提高系統效能
 
#vim /etc/sysctl.config
 
新增內容
 
net.ipv4.tcp_fin_timeout = 30
 
net.ipv4.tcp_keepalive_time = 1200
 
net.ipv4.tcp_syncookise = 1
 
net.ipv4.tcp_tw_reuse = 1
 
net.ipv4.tcp_tw_recycle = 1
 
net.ipv4.ip_local_port_range = 1024 65000
 
net.ipv4.tcp_nax_syn_backlog = 8192
 
net.ipv4.tcp_max_tw_buckets  = 5000
 
#sysctl -p 生效
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.