Set time zones and update times
Set time zone
Today, when the test, found time is not correct, check the time zone:
Data-r
Results The time zone is: +0000
What I need is East eight, which is not shown here, so you need to set a time zone
First, the Operation Tzselect
sudo tzselect
Here we choose Asian Asia, confirm then choose China, finally choose Beijing (Beijing)
Second, copy the file to the/ETC directory
sudo cp/usr/share/zoneinfo/asia/shanghai/etc/localtime
Third, update time
sudo ntpdate time.windows.com
Four, the system time to write hardware time
Hwclock--SYSTOHC
Add another article
First, select the time zone
sudo tzconfig, if the command does not exist please use dpkg-reconfigure Tzdata
Then follow the prompts to select the corresponding number of Asia, after the selection will display a bunch of new prompts-enter the city name, such as Shanghai or Chongqing, and then use sudo date-s "" To modify the local time.
Follow the prompts to select the time zone.
Second, in order to prevent the system restart after the time zone changes, enter the following command
sudo cp/usr/share/zoneinfo/asia/shanghai/etc/localtime
Third, manual online synchronization time
1. Install Ntpdate Tools
# sudo apt-get install ntpdate
2. Set the system time and network time synchronization
# ntpdate Cn.pool.ntp.org
3. Write system time to hardware time
# HWCLOCK–SYSTOHC
Cn.pool.ntp.org is a public NTP server located in China that synchronizes your time (if your time is different from the server, you may not be able to sync time yo, even the commands like sudo reboot can't be executed).
Set up automatic synchronization online time
1. Install NTP tool
# sudo apt-get install NTP
2. Set up a network time synchronization server
#vim/etc/ntp.conf
Server ntp.ubuntu.com
3. Start Service
#/ETC/INIT.D/NTP Start
NTP service is a very special thing, if it is turned on, other servers can also get time to this server, but it itself to the server up to take time, a bit like DNS