作者:じ☆ve宝贝
发布时间:2016-07-12T13:27:33
# 安装ntp服务
yum install ntp
# 重新启动ntp服务
systemctl restart ntpd
# NTP服务对等端的列表信息
ntpq -p
# 开机自启
systemctl enable ntpd
# 安装 ntpdate
yum install ntpdate
# 开启防火墙端口
iptables -I INPUT -p udp -m udp --sport 123 -j ACCEPT
# 同步时间
# 删除本地时间配置
rm -rf /etc/localtime
# 设置本地时间
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# 跟服务器同步时间
#ntpdate -b pool.ntp.org
ntpdate -b ntp.aliyun.com
# 检查结果
date
# 启动服务
service ntpdate restart
# 开机自启
systemctl enable ntpdate
cd /etc/yum.repos.d/
# 删除所有文件:
# rm -f /etc/yum.repos.d/*
# 重新下载阿里的
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 清理缓存
yum clean all