2011年8月29日星期一

转载linux下的设置时区、同步时间

今天,补充一下linux下的设置时区、同步时间的方法,适用于ubuntu centos等主流linux 

ubuntu 的时区文件为/etc/localtime
世界各个时区的文件在/usr/share/zoneinfo下按大洲来分
需要中国北京时间是
sudo cp -f /user/share/zoninfo/Asia/Shanghai /etc/localtime
重启服务器,时区就换过来了。
二、同步时间
安装同步时间软件
sudo apt-get install ntp    //ubuntu
yum -y install ntp       //centos
然后运行命令
sudo ntpdate ntp.ubuntu.com
在中国最好用time.cn99.com最准确


没有评论:

发表评论