关闭防火墙,Selinux
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
配置yum源
mkdir /etc/yum.repos.d/OldRepo
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/OldRepo/
curl -so /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
curl -so /etc/yum.repos.d/Centos-7.repo http://mirrors.aliyun.com/repo/Centos-7.repo
sed -i '/aliyuncs.com/d' /etc/yum.repos.d/Centos-7.repo /etc/yum.repos.d/epel-7.repo
时间同步
yum install -y ntpdate
ntpdate ntp1.aliyun.com
hwclock -w
echo "*/20 * * * * $(which ntpdate) ntp1.aliyun.com > /dev/null 2>&1 && $(which hwclock) -w" > /var/spool/cron/root
chmod 600 /var/spool/cron/root
快速启动
sed -i 's/timeout=.*/timeout=1/g' /boot/grub2/grub.cfg
快速关机
cat <<EOF >>/etc/systemd/system.conf
DefaultTimeoutStartSec=15s
DefaultTimeoutStopSec=15s
EOF
systemctl daemon-reload
资源限制
cat <<EOF >>/etc/security/limits.conf
# add limits
* soft nofile 65536
* hard nofile 65536
* soft nproc 65536
* hard nproc 65536
* soft memlock unlimited
* hard memlock unlimited
EOF
使用脚本
curl https://gitee.com/yx571304/my_oschina/raw/master/init.sh | sh