1.關(guān)閉firewalld防火墻和selinux
...
systemctl stop firewalld.service
systemctl disable firewalld.service
sed -i "s#SELINUX=enforcing#SELINUX=disabled#g" /etc/sysconfig/selinux
setenforce 0
...
2.配置iptables共享上網(wǎng)
3.優(yōu)化字符編碼
...
echo export LANG=en_US.UTF-8 >> /etc/profile
source /etc/profile
...
4.配置yum源,安裝需要的軟件
...
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum install lrzsz systat tree vim nmap unzip dos2unix nc lsof iptables -y
...
5.時(shí)鐘優(yōu)化
...
yum -y install ntpdate.x86_64 && ntpdate time1.aliyun.com
...
6.修改文件資源的限制
...
tail -4 /etc/security/limits.conf
soft nofile 65535hard nofile 65535soft noproc 65535hard noproc 65535
...
7.優(yōu)化ssh連接,(也可以修改端口,不過(guò)要注意防火墻配置了)
...
vi /etc/ssh/sshd_config
關(guān)閉root用戶(hù)登錄的功能
79行 GSSAPIAuthentication no
屏蔽DNS查詢(xún)功能
115行 UseDNS no
...
8.設(shè)置自己的主機(jī)名,關(guān)增加到hosts文件中
...
hostnamectl set-hostname 主機(jī)名
echo 主機(jī)名 IP地址 >> /etc/hosts
...