ubuntu修改时间为北京时间

ubuntu修改时间为北京时间

查看当前时区

root@ubuntu:/# date -R

修改时区

root@ubuntu:/# tzselect

复制文件到/etc目录下

root@ubuntu:/# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

再次查看当前时间

root@ubuntu:/# date -R

网上同步时间

1. 安装ntpdate工具

# sudo apt-get install ntpdate

2. 设置系统时间与网络时间同步

# ntpdate cn.pool.ntp.org

3. 将系统时间写入硬件时间

# hwclock --systohc