centos7设置时间和时区

1、安装ntp服务软件包:yum install ntp

2、将ntp设置为缺省启动:systemctl enable ntpd

3、修改启动参数,增加-g -x参数,允许ntp服务在系统时间误差较大时也能正常工作:vi /etc/sysconfig/ntpd

4、启动ntp服务:service ntpd restart

5、将系统时区改为上海时间(即CST时区):ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

6、输入date命令查看时间是否正确

猜你喜欢

转载自www.cnblogs.com/hujiapeng/p/9426145.html