綜合架構(gòu)規(guī)劃
shutdown 關(guān)機(jī)
編輯網(wǎng)卡配置文件
vim /etc/sysconfig/network-scripts/ifcfg-eth1
圖形化界面編輯網(wǎng)卡
nmtui
模板機(jī)設(shè)置
①主機(jī)host優(yōu)化
先備份下hosts \cp /etc/hosts{,.bak}
cat >/etc/hosts <<EOF
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.1.5 lb01
172.16.1.6 lb02
172.16.1.7 web01
172.16.1.8 web02
172.16.1.9 web03
172.16.1.31 nfs01
172.16.1.41 backup
172.16.1.51 db01 db01.etiantian.org
172.16.1.61 m01
EOF
②優(yōu)化yum源
③關(guān)閉selinux
sed -i 's#SELINUX=enforcing#SELINUX=disabled#' /etc/selinux/config
grep SELINUX=disabled /etc/selinux/config
setenforce 0
getenforce
④關(guān)閉iptables 防火墻
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
⑤普通用戶提權(quán)(可選)
⑥英文字符集
⑦時(shí)間同步
yum install -y ntpdate
echo '#time sync by white at 2020-3-02' >>/var/spool/cron/root
echo '*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com >/dev/null 2>&1' >>/var/spool/cron/root
crontab -l
⑧加大文件描述符
ulimit -a
查看當(dāng)前的打開文件限制
yum install -y lsof
echo '* - nofile 65535'>>/etc/security/limits.conf
tail -1 /etc/security/limits.conf
⑨安裝常用軟件
yum install -y tree vim wget bash-completion bash-completion-extras lrzsz net-tools sysstat iotop iftop htop unzip telnet ntpdate nmap dos2unix nc sl lsof
⑩優(yōu)化ssh
[root@oldboyedu ~]# egrep -n '^(GSSAPIA|UseDNS)' /etc/ssh/sshd_config
79:GSSAPIAuthentication no
115:UseDNS no
[root@oldboyedu ~]# systemctl restart sshd.service
克隆后主機(jī)配置(需一臺(tái)一臺(tái)進(jìn)行配置)
需要的配置:
hostnamectl set-hostname web01
sed -i 's#200#7#g' /etc/sysconfig/network-scripts/ifcfg-eth[01]
sed -i '/UUID/d' /etc/sysconfig/network-scripts/ifcfg-eth[01]
systemctl restart network
echo "123456" >/etc/rsync.password
chmod 600 /etc/rsync.password
備份服務(wù)器
hostnamectl set-hostname backup
sed -i 's#200#41#g' /etc/sysconfig/network-scripts/ifcfg-eth[01]
sed -i '/UUID/d' /etc/sysconfig/network-scripts/ifcfg-eth[01]
systemctl restart network
echo "123456" >/etc/rsync.password
chmod 600 /etc/rsync.password
存儲(chǔ)服務(wù)器
hostnamectl set-hostname nfs01
sed -i 's#200#31#g' /etc/sysconfig/network-scripts/ifcfg-eth[01]
sed -i '/UUID/d' /etc/sysconfig/network-scripts/ifcfg-eth[01]
systemctl restart network
echo "123456" >/etc/rsync.password
chmod 600 /etc/rsync.password
備份服務(wù)器
作用:
①數(shù)據(jù)備份的服務(wù)器
②進(jìn)行日志的統(tǒng)一保存
查找backup目錄下所有包含error的文件
grep -r "error" /backup/