一.把ens33命名方式改為eth0命名方式
安裝開始時按Tab,輸入
net.ifnames=0 biosdevname=0
二.分區(qū)方式
常規(guī)分區(qū)
- /boot 一般分配200MB
- swap 內(nèi)存8G以下分配內(nèi)存容量的1.5倍大小,其他設(shè)置為8G
- /分區(qū)分配剩余所有
三. 網(wǎng)絡(luò)設(shè)置
- 進(jìn)入網(wǎng)絡(luò)配置打開網(wǎng)卡開機(jī)自激活選項
- 修改hostname
- 關(guān)閉安全策略
- 設(shè)置時區(qū)
四. 軟件設(shè)置
- 最小化安裝
- 選中右邊1、2、3、6項
五. 安裝完成測試網(wǎng)絡(luò)
- ip add 查看網(wǎng)卡配置
- ping 確認(rèn)外網(wǎng)
六.設(shè)置yum源 epel源為阿里云,并安裝常用工具
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.bak
#備份原repo文件
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
#下載新repo文件
yum clean all #清除緩存
yum makecache #重做緩存
yum repolist #檢查使用的源
#安裝常用軟件
yum -y install net-tools vim lrzsz nmap tree dos2unix nc telnet wget lsof ntpdate bash-completion bash-completion-extras
七. 設(shè)置英文字符集\設(shè)置自動時間同步\加大文件描述
localectl set-locale LANG="en_US.UTF-8" #設(shè)置英文字符集
echo '*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com >/dev/null 2>&1' >>/var/spool/cron/root
#添加ntp對時定時任務(wù)
echo '* - nofile 100000' >>/etc/security/limits.conf
echo "fs.file-max=100000" >>/etc/sysctl.conf
sysctl -p
#設(shè)置系統(tǒng)文件描述符和用戶文件描述符大小
八. 關(guān)閉防火墻和Selinux
systemctl disable firewalld
systemctl stop firewalld
setenforce 0
sed -i.bak 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
九.優(yōu)化ssh連接速度
sed -i.bak 's@#UseDNS yes@UseDNS no@g;s@^GSSAPIAuthentication yes@GSSAPIAuthentication no@g' /etc/ssh/sshd_config
systemctl restart sshd
十.命令提示符加彩色(可選)
echo "export PS1='[\[\e[32;1m\]\u@\[\e[33;1m\]\h\[\e[34;1m\] \W\[\e[0m\]]\$ '" >> /etc/proflie
source /etc/profile