Ubuntu Server System set time zone and update times

Source: Internet
Author: User
Tags time zones local time set time

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.