1.配置yum仓库
rm -f /etc/yum.repos.d/*
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
2.安装基础优化包
yum install -y net-tools vim tree htop iftop gcc gcc-c++ glibc\
iotop lrzsz sl wget unzip telnet nmap nc psmisc\
dos2unix bash-completion bash-completion-extra sysstat \
rsync nfs-utils httpd-tools
3.关闭防火墙
systemctl disable firewalld
systemctl stop firewalld
4.关闭selinux
sed -i '/^SELINUX=/c SELINUX=disabled' /etc/selinux/config
5. 调整最大打开文件数量
echo '* - nofile 65535' >> /etc/security/limits.conf
6.修改ip和主机的脚本
#!/bin/bash
old_ip= `hostname -l|awk -F '[. ]+' '{print $4}'`
read -p 'Please lnput Your New IP: ' new_ip
read -p 'Please lnput Your New HostName: 'new_h
sed -i "s#old_ip#$new_ip#g" /etc/sysconfig/network-scripts/ifcfg-eth{0,1}
hostnamectl set-hostname $new_h
systemctl restart network