- Configuring source and domestic source epel
/etc/yum.repos.d/ cd
mkdir repo_bak
mv * .repo repo_bak /
# source file basis
wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/Centos-7. repo
#epel source file
wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
# regenerate the cache yum
yum Clean All
yum makecache
# upgrade the system
yum update -y - Mounting base dependencies
yum install -y htop lrzsz nmap screen man expect \
gcc gcc-c++ autoconf automake bzip2-devel \
openssl-devel multitail kernel-devel \
pam-devel zlib-devel perl-devel tcp_wrappers-devel - Close selinux
-i Sed 'S / the SELINUX = ^. * / the SELINUX = Disabled / G' / etc / selinux / config
the setenforce 0
# selinux provided See
getenforce - Turn off the default mail service
# (Default port 25)
systemctl disable postfix
systemctl STOP postfix
# view the system default listening ports
netstat -nlput | grep -v "Proto" | grep "LISTEN" - Set system environment variables
# Add execute permissions
chmod A + the X-/etc/rc.d/rc.local
# set the environment variable
cat >> / etc / profile << EOF$(date +%F)
VI = Alias 'Vim'
Alias = grep '= Auto --color grep'
# 300 seconds is provided to a user operation field without disconnecting the terminal
Export the TMOUT = 300
# The value to prevent users from changing readonly
readonly the TMOUT
the EOF
Source / etc / Profile
#vimrc provided
CAT >> / etc / << the vimrc the EOF
sET = TabStop. 4
sET = softtabstop. 4
sET = shiftwidth. 4
sET expandtab
the EOF - Open File Set Descriptor
cat >/etc/security/limits.conf <<EOF
##### $(date) #####
* soft noproc 65535
* hard noproc 65535
* soft nofile 409600
* hard nofile 409600
EOF - Optimize system kernel parameters
Optimize the kernel parameter ### ###
IF [-f '/etc/sysctl.conf.bak'!]; The then
\} CP /etc/sysctl.conf{,.bak
CAT> << /etc/sysctl.conf EOF$(date)
# Modify the maximum number of connections
net.nf_conntrack_max = 655360
net.netfilter.nf_conntrack_tcp_timeout_established = 1200
# socket is closed by the end of this time it must parameter FIN-WAIT-2 state, default is 60 seconds.
net.ipv4.tcp_fin_timeout = 2
the number of retries before #socket waste, heavily loaded web server is recommended to decrease
net.ipv4.tcp_orphan_retries. 1 =
# indicate on reuse. TIME-WAIT sockets allow re-used for new TCP connection.
=. 1 net.ipv4.tcp_tw_reuse
# represents enable the rapid recovery of TCP connection of TIME-WAIT sockets.
= 1 net.ipv4.tcp_tw_recycle
# indicate on SYN Cookies. When the SYN queue overflow occurs, enable cookies to deal with, can prevent a small amount of SYN ***.
=. 1 net.ipv4.tcp_syncookies
# represents the time when only use keepalive, TCP transmission frequency of keepalive messages. The default is 2 hours to 10 minutes.
= 600 net.ipv4.tcp_keepalive_time
# indicates a port range outgoing connections. By default small: 32768-61000, instead 1024-65000.
net.ipv4.ip_local_port_range = 1024 65000
# SYN increase the queue length, the default is 1024. The number of network connections may accommodate more wait for a connection.
net.ipv4.tcp_max_syn_backlog = 262144
number #imewait, the default is 180,000.
6000 = net.ipv4.tcp_max_tw_buckets
# route cache refresh rate, when a route fails how long jump to another route, the default is 300.
= 100 net.ipv4.route.gc_timeout
# kernel abandoning transmission of SYN + ACK before the connection time
net.ipv4.tcp_syn_retries. 1 =
# Number of transmitted core abandon the SYN packet to establish a connection before.
=. 1 net.ipv4.tcp_synack_retries
# mediation systems simultaneously initiated number of TCP connections, the default is 128. highly concurrent request, the default value may cause connection timeout or retransmission.
= 262144 net.core.somaxconn
# This parameter determines, when the rate of the fast rate of the received data packet network device packages than those processing cores, the maximum allowed number of packets to the queue.
= 262144 net.core.netdev_max_backlog
# to set the system up to the number of TCP sockets are not linked to any user file handle. To prevent simple DoS ***.
= 262144 net.ipv4.tcp_max_orphans
the EOF
Fi
# refresh system kernel parameters:
/ sbin / sysctl -p
After installation of the system configuration and optimization CentOS7
Guess you like
Origin blog.51cto.com/marse/2448415
Recommended
Ranking