**时区提示:Local time zone must be set--see zic manual page 2018的解决办法 **

问题描述:在centos服务器上执行date命令时,显示的时间信息中的时区不正常,如下:

[root@iZ2zeb7m4nlZ bin]# date
Fri Oct 26 02:34:44 Local time zone must be set--see zic manual page 2018

即显示Local time zone must be set--see zic manual

解决办法:

1)查看软连接是否在本地时区,这里我选择上海时区

[root@iZ2zeb7m4nlZ bin]# rm -rf /etc/localtime 
[root@iZ2zeb7m4nlZ bin]# ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@iZ2zeb7m4nlZ bin]# ll /etc/localtime 
lrwxrwxrwx 1 root root 33 Oct 26 03:25 /etc/localtime -> /usr/share/zoneinfo/Asia/Shanghai

2)接着执行

[root@iZ2zeb7m4nlZ bin]# export TZ='Asia/Shanghai'
[root@iZ2zeb7m4nlZ bin]# vim /etc/profile

注意:以上是在root用户下生效的操作,如果在普通用户下,可能还会出现"Local time zone must be set--see zic manual",这就需要在普通用户下执行"export TZ='Asia/Shanghai'",以及把这个命令写入到普通用户的/etc/profile文件里。