修改服务器时间和时区

修改服务器时间和时区

1. 修改服务器时间
如果单纯修改服务器时间,通过ntpdate命令即可完成。

# yum install ntpdate -y
# ntpdate ntp1.aliyun.com

或者修改chronyd的配置文件

# vi /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
server ntp1.aliyun.com
....

重启chronyd服务

# systemctl restart chronyd

2. 修改服务器时区
首先确认服务器当前设置的时区

# timedatectl
      Local time: Thu 2020-11-26 10:15:24 CST
  Universal time: Thu 2020-11-26 02:15:24 UTC
        RTC time: Thu 2020-11-26 02:15:24
       Time zone: America/New_York (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

然后拷贝/usr/share/zoneinfo/ 主 时 区 / 主时区/ /次时区 到/etc/localtime

# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值