如果linux使用的是默认的时间时区和语言,会与我们的中文环境不符,可以按照以下步骤进行修改。
1. 修改时间时区
tzselect
根据提示选择中国时区。
2. 修改语言
vi /etc/sysconfig/i18n
文件内容如下:
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
将en_US修改为zh_CN,修改后如下:
LANG="zh_CN.UTF-8"
SYSFONT="latarcyrheb-sun16"
3. 如果没有ntpdate ,安装ntpdate
yum install -y ntpdate
4. 设置定时
crontab -e
*/1 * * * * /usr/sbin/ntpdate us.pool.ntp.org;
# 也可以同步阿里云的时间
# */1 * * * * /user/sbin/ntpdate ntp4.aliyun.com;
5. 执行命令
sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
sudo ntpdate cn.pool.ntp.org
6. 最后,重启
reboot
7. 测试:
date
结果为
2019年 06月 10日 星期一 19:23:33 CST
修改成功!