最近发现购买的linux vps运行一段时间之后就会发生时间不许的状况。html
能够利用ntp服务与网络时间进行同步,下面的方法适用于ubuntu系统。linux
方法:web
网上同步时间shell
1. 安装ntpdate工具ubuntu
# sudo apt-get install ntpdate
2. 设置系统时间与网络时间同步服务器
# ntpdate cn.pool.ntp.org
3. 将系统时间写入硬件时间网络
# hwclock –systohc
注明:cn.pool.ntp.org是位于中国的公共NTP服务器,用此时间来同步本机的系统时间。架构
由于系统架构的缘由,部分linux vps默认是不容许在客户在vps自行自行同步网络时间,当执行同步时间的操做时,会出现下列错误:工具
# ntpdate cn.pool.ntp.org
20 Aug 23:47:44 ntpdate[17991]: sendto(202.118.1.199): Operation not permittedui
20 Aug 23:47:44 ntpdate[17991]: sendto(114.80.81.13): Operation not permitted
20 Aug 23:47:52 ntpdate[17991]: no server suitable for synchronization found
注:本文首发于度外网络官方博客:http://www.duwaiweb.com/blog/20120821_d584addf-bc39-43f8-bf21-d265fc638285.html