How to synchronize system time in Debian? Debian system time configuration (NTP service)

A. Update the source and install ntpdate

apt-get update

apt-get install ntpdate

ntpdate ntp1.aliyun.com

Modify time zone

  1. Modify and set the Linux server time zone

    Method A command: "tzselect"

    Method B RedHat Linux and CentOS only Command: “timeconfig”

    Method C is for Debian command: “dpkg-reconfigure tzdata”

Modify through /etc/profile

echo “export TZ=‘UTC’” >> /etc/profile

source /etc/profile updates system variables

Use this method to modify the time zone configuration

[root@Matrix_061001 ~]echo "export TZ='Asia/Shanghai'" >> /etc/profile
[root@Matrix_061001 ~]source /etc/profile

NTP and RTC time synchronization

[root@Matrix_061001 ~]cat /etc/default/ntpdate
#Configuration script used by ntpdate-sync script

NTPSERVERS="ntp1.aliyun.com"

#Set to "yes" to write time to hardware clock on success
UPDATE_HWC

Guess you like

Origin blog.csdn.net/qq_33468857/article/details/132495221