配置时间同步并将系统时间写入硬件时钟和配yum

第一步要挂载光驱  mount /dev/cdrom (挂载位置)

安装时间同步时使用yum命令来安装    

第二步就是配置yum命令的配置文件, yum配置文件位于 /etc/yun.repos.d 目录 , 屏蔽掉多余的文件留下一个要用的

在里面配置

[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///y                                                                        #光盘挂载的位置

baseurl=http://192.168.*.*/yum/centos/7.0/updates/x86_64       #网络位置                 

#上面2种任选一种

gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

如图编辑

:wq保存后安装时间同步协议 输入 yum install ntp -y 

安装完成后配置要时间同步的服务器或主机的地址

使用vi命令进入 /etc/ntp.conf 配置  找到

restrict 2.cn.pool.ntp.org nomodify notrap noquery
restrict 1.asia.pool.ntp.org nomodify notrap noquery
restrict 2.asia.pool.ntp.org nomodify notrap noquery
在前面加上#号屏蔽掉 然后在下面添加上一条命令
server 127.0.0.1 
:wq保存退出
systemctl restart ntpd.service  重启协议
sudo hwclock -w 吧时间写入到硬件
(扩展 :修改centos7的系统时间是
date设置系统时钟。 
 # date -s "2012-05-18 04:53:00"(月/日/年 时:分:秒))
原文地址:https://www.cnblogs.com/jw15330/p/5946268.html