我的网上记事本
« »

设置linux服务器时间

# 让linux服务器以精准的时间工作,对VOIP业务至关重要。毕竟话务的计费是以时间为测量单位的。

# 同步时间服务器

# 查看当前时间

date

# 安装ntpdate

yum -y install ntp

# 与时间服务器同步

ntpdate 0.centos.pool.ntp.org

# 将系统时间写入bios

hwclock  –systohc

# 检查是否有变化

date

# 更改时区

# 需要与顾客联系,他需要啥时区就给他设置成该时区

ls -F /usr/share/zoneinfo/

rm /etc/localtime

# 新加坡

ln -sf /usr/share/zoneinfo/Singapore /etc/localtime

# 中国大陆

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

# 科威特

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

# 巴林

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

# 澳大利亚

ln -sf /usr/share/zoneinfo/Australia/Sydney /etc/localtime

# 马来西亚

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

# 印度

ln -sf /usr/share/zoneinfo/Indian/Maldives /etc/localtime

# 美国 太平洋

ln -sf /usr/share/zoneinfo/US/Pacific /etc/localtime

# 美国 New York

ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

# 非洲

ln -sf /usr/share/zoneinfo/Africa/Khartoum /etc/localtime

# 英国 London

ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime

# 沙特阿拉伯

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

# 阿联酋

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

# 完毕.  检查是否有变化

date

# 使用timeconfig更改时区
若不想使用上述方法设置时区,可以使用更为简单的方法:运行 ztselect 或timeconfig 命令。

timeconfig

若你的linux提示找不到timeconfig命令,可以用如下yum命令安装timeconfig:

yum install system-config-date

# openVZ VPS container机器上的时间调整

由于其用的是host机器上的时钟,因此,无需同步时钟,即使你想同步也无法操作。所以,VPS机器上只需做一件事情:配置时区即可。

所有的操作完毕后最好重新启动机器。以防止mysql等使用先前的时间引起CDR错乱。

日志信息 »

该日志于2010-01-27 17:25由 admin 发表在Linux分类下, 你可以发表评论。除了可以将这个日志以保留源地址及作者的情况下引用到你的网站或博客,还可以通过RSS 2.0订阅这个日志的所有评论。

1条评论

发表评论 »

返回顶部