CentOS minimum post-installation optimization
After adding a new server, the next step is to install the system. The CentOS series is recommended here, and everyone is holding a principle when using the server: the fewer application packages the system installs, the more stable the server, so we install the system
Select the minimum installation when possible. As for the server's single-machine performance optimization, this week the principle of stability and security, try not to change the system's original configuration (CentOS own file and memory mechanism is excellent).
1. Turn off services that you do not need
It is well known that the fewer services you have, the less resources your system will consume, so you should turn off services that you do not need.
The benefit of shutting down unwanted services is to reduce the use of memory and CPU events. The commands are as follows:
#ntsysv
Close Iptables, SELinux
#service iptables Stop
#chkconfig iptables off
#sed-I/^selinux/s/enforcing/disabled/g/etc/selinux/config
2. Turn off the unwanted TTY
By default, the CentOS Linux system opens 6 consoles, which can be accessed by ALT+F1 to Alt+f6, and 6 consoles reside in memory by default, with Ps-aux | grep TTY can view
In fact there is no need to use so much, the CentOS 6.0 start TTY configuration is changed from/etc/inittab to/etc/init/start-ttys.conf, and the default 6 TTY can be changed to 2 by executing the following command:
Find TTY [1-6] and change to TTY [1-2]
#vim/etc/init/start-ttys.conf
#
# This service starts the configured number of Gettys.
Start on stopped RC runlevel=[2345]
Env Active_consoles=/dev/tty[1-2]
Env X_tty=/dev/tty1
Task
Script
. /etc/sysconfig/init
For TTY in $ (echo $ACTIVE _consoles); Do
["$RUNLEVEL" = "5"-a "$tty" = "$X _tty"] && continue
Initctl Start TTY tty= $tty
Done
End Script
Open/etc/sysconfig/init again, find Active_consoles=/dev/tty[1-6] modified to active_consoles=/dev/tty[1-2], then restart the server
3. Adjust the TCP/IP network parameters
Adjusting TCP/IP network parameters can enhance the ability to anti-SYN flood, the command is as follows:
#echo ' Net.ipv4.tcp_syncookies=1 ' >>/etc/sysct.conf
Let this kernel change take effect immediately, as shown in the following command:
#sysctl-P
4. Modify the shell command History record number is 100, do not restart the system let it take effect
#sed-I/^histsize/s/1000/100/g/etc/profile
#source/etc/profile
5. Time to correct server timing
#yum Install NTP
Edit the/etc/crontab file and add a line at the end:
* * * * root/sbin/ntpdate ntp.api.bz >>/dev/null 2 > &1
6. Stop Printing Service
If you are not ready to provide a print service, you can stop the print service, which is set to start automatically by default, with the following command:
#/etc/rc.d/init.d/cups stop
#chkconfig cups off
7. Adjust the maximum number of open files for Linux
..........
8. Start the network card
..........
9. Turn off the write disk I/O function
#
10.CPU model
#cat/proc/cpuinfo |grep name|awk-f: ' {print $} ' |uniq-c
This article is from the "A-B" blog, please be sure to keep this source http://51inte.blog.51cto.com/4403468/1744051
CentOS minimum post-installation optimization