1.1garbled solution appears
Change language
Export. Gb2312echo $LANGen _us. GB2312
The character set currently used by the system
1 , Echo $LANG
2 , see the language of your current remote connection tool (software's character set)
#1. The character set currently used by the system echo $LANGen _us. Gb2312#2. See the character set of your remote connected software export. UTF-8 Echo $LANGen _us. Utf-8zh_cn. UTF-8 Chinese
/etc/syscionfig/i18n Permanent effect
### Restore the original English environment
\cp/etc/sysconfig/i18n.bak/etc/sysconfig/i18n
source/etc/sysconfig/i18n
[Email protected] ~]# echo $LANG
en_US. UTF-8
1.2GenevaUpdateYumSource Information
#: Update yum source information
Mv/etc/yum.repos.d/centos-base.repo/etc/yum.repos.d/centos-base.repo.backupwget-o/etc/yum.repos.d/ Centos-base.repo http://mirrors.aliyun.com/repo/Centos-6.repomv/etc/yum.repos.d/epel.repo/etc/yum.repos.d/ Epel.repo.backupmv/etc/yum.repos.d/epel-testing.repo/etc/yum.repos.d/epel-testing.repo.backupwget-o/etc/ Yum.repos.d/epel.repo Http://mirrors.aliyun.com/repo/epel-6.repo
1.3GenevaCloseSELinux
#: Close SELinux
Sed-i ' s#selinux=.* #SELINUX =disabled#g '/etc/selinux/configsed-i ' s/selinux=enforcing/selinux=disabled/'/etc/ Selinux/configgrep Selinux=disabled/etc/selinux/configsetenforce 0getenforce
1.4 toCloseiptables
# in: Close iptables
/etc/init.d/iptables stop/etc/init.d/iptables stopchkconfig iptables off
1.5 .Compact boot-up self-starter
#: Compact boot-up self-boot entry
Chkconfig|egrep-v "Crond|sshd|network|rsyslog|sysstat" |awk ' {print "Chkconfig", $, "Off"} ' |bashexportchkconfig-- List|grep 3:on
1.6 -Extractusernamecan take advantagesudo
#: Right Oldboy can use sudo
Useradd oldboyecho 123456|passwd--stdin oldboy\cp/etc/sudoers/etc/sudoers.oriecho "Oldboy ALL= (All) Nopasswd:all" ; >/etc/sudoerstail-1/etc/sudoersvisudo-c
1.7 ,Character Set
#: Set the system Chinese character set
Cp/etc/sysconfig/i18n/etc/sysconfig/i18n.oriecho ' lang= ' en_US. UTF-8 "' >/etc/sysconfig/i18nsource/etc/sysconfig/i18necho $LANG
1.8Enlarge file Descriptor
#: Increase file descriptors
Echo ' *-nofile 65535 ' >>/etc/security/limits.conf
Tail-1/etc/security/limits.conf
Ulimit-shn 65535
Ulimit-n
1.9Optimizing system Kernel Information
# One: Optimize system kernel information
cat >>/etc/sysctl.conf<<eofnet.ipv4.tcp_fin_timeout = 2net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_tw_recycle = 1net.ipv4.tcp_syncookies = 1net.ipv4.tcp_keepalive_time = 600net.ipv4.ip_local_port_range = 4000 65000net.ipv4.tcp_max_syn _backlog = 16384net.ipv4.tcp_max_tw_buckets = 36000net.ipv4.route.gc_timeout = 100net.ipv4.tcp_syn_retries = 1net.ipv4.tcp_synack_retries = 1net.core.somaxconn = 16384net.core.netdev_max_backlog = 16384net.ipv4.tcp_max_orphans = 16384# The following parameters are optimized for the iptables firewall, the firewall does not meet the prompts, can be ignored. net.nf_conntrack_max = 25000000net.netfilter.nf_conntrack_max = 25000000 Net.netfilter.nf_conntrack_tcp_timeout_established= 180net.netfilter.nf_conntrack_tcp_timeout_time_wait =120net.netfilter.nf_conntrack_tcp_timeout_close_wait =60net.netfilter.nf_conntrack_tcp_timeout_fin _waiT =120net.core.wmem_default = 8388608net.core.rmem_default = 8388608net.core.wmem_max = 16777216net.core.rmem_max = 16777216eofsysctl -p
1.10installation system common small software
Yum Install Lrzsz nmap tree Dos2unix nc-y
1.11Small function Optimization
ps1= "\[\e[32;1m\][\[email protected]\h \w]\\$\[\e[0m\]" >>/ETC/BASHRC # # small function Optimization
1.12SSHSlow connection speed optimization
Sed-i.bak ' [email protected] #UseDNS [email protected]@g; [Email protected]^gssapiauthentication [email protected] [email protected] '/etc/ssh/sshd_config
/etc/init.d/sshd Reload
1.13LinuxSummary of basic optimization and security highlights
instead of root Login management system, and the normal user login through sudo authorization management.
Change the default remote connection SSH service port, prevent the root user from connecting remotely, or even change ssh The service only listens to the intranet IP.
Schedule automatically updates the server time so that it synchronizes with the Internet time.
04. yum
Close SELinux and iptables in the work scenario, if an external IP is generally turned on iptables, high-concurrency high-traffic servers may not be enabled.
The number of file descriptors is adjusted, and the number of file descriptors is consumed by the opening of processes and files.
07. inodes centos6 centos5
08. crond sshd network rsyslog sysstat
09.Linux Kernel parameter Optimization /etc/sysctl.conf , perform sysctl-p effective.
Change the system character set to "zh_cn." UTF-8"so that it supports Chinese and prevents garbled problems.
11. /etc/passwd /etc/shadow /etc/group /etc/gshadow /etc/inittab
chattr lsattr oldboy
empty /etc/issue,/etc/issue.net, remove the screen display before the system and kernel version login.
Clear the redundant system virtual user account.
Add a password for the grub boot menu.
prevent the host from being ping.
patching and upgrading software with known vulnerabilities.
This article is from the "12203165" blog, please be sure to keep this source http://12213165.blog.51cto.com/12203165/1922779
Linux system optimization