ubuntu20.04时区设置为上海

将系统时间设置为时区为上海,24小时制方便查看日志,cron保证集群时间同步。

apt install chrony -y

systemctl status chrony

systemctl enable --now chrony

find / -name Shanghai

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 

echo "LC_TIME=en_DK.UTF-8" >> /etc/default/locale

apt install ntpdate -y

ntpdate time1.aliyun.com

echo "*/5 * * * * ntpdate time1.aliyun.com &> /dev/null && hwclock -w" >> /var/spool/cron/crontabs/root

reboot

个人网站:https://cxupup.com

posted @ 2022-04-28 00:22  两个黄鹂鸣翠柳丶  阅读(612)  评论(0)    收藏  举报