A. 更新源,并安装ntpdate
apt-get update
apt-get install ntpdate
ntpdate ntp1.aliyun.com
修改时区
-
修改设置Linux服务器时区
方法 A 命令 : “tzselect”
方法 B 仅限于RedHat Linux 和 CentOS 命令 : “timeconfig”
方法 C 适用于Debian 命令 : “dpkg-reconfigure tzdata”
通过/etc/profile来修改
echo “export TZ=‘UTC’” >> /etc/profile
source /etc/profile 更新系统变量
采用本方式进行修改时区配置
[root@Matrix_061001 ~]echo "export TZ='Asia/Shanghai'" >> /etc/profile
[root@Matrix_061001 ~]source /etc/profile
NTP和RTC时间同步
[root@Matrix_061001 ~]cat /etc/default/ntpdate
#Configuration script used by ntpdate-sync scriptNTPSERVERS="ntp1.aliyun.com"#Set to "yes" to write time to hardware clock on success
UPDATE_HWC