zoukankan      html  css  js  c++  java
  • ubuntu 设置时区

    ubuntu 设置时区


    参考资料 https://www.jianshu.com/p/ef851a01d9de
    https://blog.gmem.cc/ntp-under-ubuntu

     1 # 时区的设置
     2 
     3 ## 旧版用
     4 tzselect
     5 dpkg-reconfigure tzdata
     6 cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
     7 
     8 ## 新版用
     9 timedatectl list-timezones
    10 timedatectl list-timezones | grep Shanghai
    11 timedatectl set-timezone Asia/Shanghai
    12 
    13 # 时间的同步
    14 
    15 apt -y install rdate
    16 rdate -s time-b.nist.gov
    17 
    18 apt -y install ntpdate
    19 ntpdate cn.pool.ntp.org
    20 ## ntp.ubuntu.com
    21 
    22 systemctl restart systemd-timesyncd.service
    23 timedatectl set-ntp true
    24 配置文件位置是 /etc/systemd/timesyncd.conf、/timesyncd.conf.d/
    25 
    26 
    27 ## 更新硬件 CMOS时间
    28 hwclock --systohc
    29 
    30 # 命令设置日期时间
    31 
    32 date -s 11/03/2009
    33 date -s 17:55:55
    34 
    35 # 日期查询
    36 
    37 timedatectl
    38 date -R
    39 
    40 日历: cal
    41 
    42 # 其它
    43 
    44 报错 21 Feb 03:04:30 ntpdate[19759]: the NTP socket is in use, exiting 
    45 
    46 解决方法,停止npdd服务 /etc/init.d/ntpd stop
    47 
    48 
    49 要成为NTP服务器,可以安装chrony、ntpd,或者open-ntp。推荐chrony。
  • 相关阅读:
    配置文件配置网络
    安装Linux centos 7.3
    java二维字符数组的输入
    前端保存JSON文件到本地
    在Springboot中使用swagger2
    Vue better-scroll使用指南
    解决端口占用问题
    CheckSum(校验和)计算
    区分按字寻址与按字节寻址
    进制转换
  • 原文地址:https://www.cnblogs.com/yisuo/p/13217579.html
Copyright © 2011-2022 走看看