Ubuntu修改时间时区 - willaty

Ubuntu修改时间时区

设定时区:dpkg-reconfigure tzdata

选择Asia,Hong Kong。

sudo apt-get install ntpdate // 安装时间同步工具

sudo ntpdate cn.pool.ntp.org // 与网络服务器同步时间

date // 查看时间是否已同步

sudo hwclock --systohc //将系统时间写入硬件时间

cn.pool.ntp.org是位于中国的公共NTP服务器


修改时区

tzselect

选择合适时区后,

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

拷贝时区到localtime下

修改时间

修改时间

sudo date -s MM/DD/YY //修改日期
sudo date -s hh:mm:ss //修改时间

在修改时间以后,修改硬件CMOS的时间

sudo hwclock --systohc //非常重要,如果没有这一步的话,后面时间还是不准