In Linux, the UTC format is used as the standard time format by default. Program And specifying a time zone different from the system in the process sequence may cause a time error. For Ubuntu Desktop, you can directly modify the time zone information in graphic mode. But for server, you need to modify the time zone information through tzconfig. Usage (such as setting the time zone to Asia/Chongqing): 1. Select the time zone sudo tzconfig. If the command does not exist, use dpkg-reconfigure tzdata and select the Asia sequence number as prompted, after the selection, a bunch of new prompts will be displayed-enter the city name, such as Shanghai or Chongqing, and then use sudo date-s "to modify the local time. Select the time zone as prompted. 2. To prevent time zone changes after system restart, run the following command: sudo CP/usr/share/zoneinfo/Asia/Shanghai/etc/localtime. 3. Manual Online synchronization time: 1. install ntpdate tool # sudo apt-Get install ntpdate 2. set system time and Network Time Synchronization # ntpdate cn.pool.ntp.org 3. write System Time to hardware time # hwclock -systohccn.pool.ntp.org is a public NTP server located in China to synchronize your time (If your time is different from the server's time cut, you may not be able to synchronize time or even execute commands such as sudo reboot ). 4. Set automatic online synchronization time
1. install the NTP tool # sudo apt-Get install NTP 2. set the network time synchronization server # Vim/etc/NTP. conf server ntp.ubuntu.com 3. start the service #/etc/init. d/NTP startntp service is a special thing. If it is enabled, other servers can also get time from this server, but it must get time from the upper-level server, A bit like DNS