# 工具安装
yum -y install wget vim ntp net-tools tree openssh
# 更换阿里源
mv /etc/yum.repos.d/CentOS-Base.repo{,.bak}
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 关闭selinux、firewalld
systemctl stop firewalld.service
systemctl disable firewalld.service
firewall-cmd –state
sed -i ‘/^SELINUX=.*/c SELINUX=disabled’ /etc/selinux/config
sed -i ‘s/^SELINUXTYPE=.*/SELINUXTYPE=disabled/g’ /etc/selinux/config
grep –color=auto ‘^SELINUX’ /etc/selinux/config
setenforce 0
# 设置hostname
Host=controller.www.local
hostnamectl set-hostname ParseError: KaTeX parse error: Expected 'EOF', got '#' at position 6: Host #̲ hostnameHost
# echo $Host>/etc/hostname
# 查看本机IP
ip add|sed -nr ‘s#^.*inet (.*)/24.*$#\1#gp’
# 时间同步
/usr/sbin/ntpdate ntp6.aliyun.com
echo “*/3 * * * * /usr/sbin/ntpdate ntp6.aliyun.com &> /dev/null” > /tmp/crontab
crontab /tmp/crontab
# 升级、重启
yum update -y && reboot
# 修改时区
timedatectl list-timezones # 列出所有时区,
timedatectl set-local-rtc 1 # 将硬件时钟调整为与本地时钟一致, 0 为设置为 UTC 时间
timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime # 系统底层修改时区