Centos 7 查看修改时区,配置时间服务器,

centos 7 查看修改时区

  1. 查看时区
timedatectl

查看结果

  Local time: Sat 2021-04-24 14:29:18 CST
  #系统当前时间                         CST 中国
  Universal time: Sat 2021-04-24 06:29:18 UTC
  #标准时区(格林威治时区)
  RTC time: Sat 2021-04-24 06:29:16
  Time zone: Asia/Shanghai ( CST, +0800)
  选择的时区        上海       中国  +8时区
  NTP enabled: no
  NTP synchronized: no
  RTC in local TZ: no
  DST active: n/a
  1. 列出所有的时区
 timedatectl list-timezones
  1. 修改时区
timedatectl set-timezone Asia/Shanghai
#修改命令                 修改为那个时区
  1. 修改时间 重启后失效
timedatectl set-time "YYYY-MM-DD HH:MM:SS"
  1. 是否NTP服务器同步

timedatectl set-ntp yes #yes或者no
 
ntpdate -u ntp.api.bz   #同步网络时间
  1. 配置时间服务器
# yum -y install ntp
# vim /etc/ntp.conf

# 将下面这四行内容注释掉
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
在下边添加
server ntp.aliyun.com

重新启动该
service ntpd start
systemctl enable ntpd.service
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值