Ubuntu/centos changing the time zone and synchronizing the system time

Source: Internet
Author: User
Tags local time svn

Share a little experience, the reason for writing this document is because when you do the Jenkins Automation release code, SVN can not get the latest source, the reason is that SVN gets the source code there are two ways: 1, through the system time to generate version number, 2, through the head by default is the time, So we need to synchronize Jenkins and SVN system time, and because I use SVN is on Ubuntu system, Ubuntu default should be South Africa's time zone, so the timing of synchronization is not the same as CentOS, but also involved in the time zone to modify the system

This action applies to Ubuntu CentOS

1. Check the time zone:

[Email protected] ~]# date-r

Tue, 2013 18:23:01 +0800

2. Modify Time Zone

#1 > Select region: Asia

[email protected] ~]# sudo tzselect

[sudo] password for swfsadmin:

Sorry, try again.

[sudo] password for swfsadmin:

Please identify a, so, time zone rules can be set correctly.

Please select a continent or ocean.

1) Africa

2) Americas

3) Antarctica

4) Arctic Ocean

5) Asia

6) Atlantic Ocean

7) Australia

8) Europe

9) Indian Ocean

Pacific Ocean

One) None-i want to specify the time zone using the Posix TZ format.

#? 5

#2 > SELECT Country: China

Please select a country.

1) Afghanistan Israel) Palestine

2) Armenia Japan) Philippines

3) Azerbaijan Jordan PNs) Qatar

4) Bahrain Kazakhstan) Russia

5) Bangladesh Korea (north), Saudi Arabia

6) Korea (south) Bhutan) Singapore

7) Brunei Kuwait) Sri Lanka

8) Cambodia Kyrgyzstan) Syria

9) Laos) Taiwan

(Cyprus) Lebanon) Tajikistan

(one) East Timor) Macau Thailand

(Georgia) Malaysia) Turkmenistan

Hong Kong) Mongolia Arab Emirates

India) Myanmar (Burma) Uzbekistan

(Indonesia) Nepal) Vietnam

Iran) Oman Yemen

() Iraq) Pakistan

#? 9

#3 > select time Zone: GMT

Please select one of the following time zone regions.

1) East China-beijing, Guangdong, Shanghai, etc.

2) Heilongjiang (except Mohe), Jilin

3) Central China-sichuan, Yunnan, Guangxi, Shaanxi, Guizhou, etc.

4) Most of Tibet & Xinjiang

5) West Tibet & Xinjiang

#? 1

#4 > Confirm Verification:

The following information has been given:


East China-beijing, Guangdong, Shanghai, etc.

Therefore tz= ' Asia/shanghai ' would be used.

Local time is now:tue Dec 18:22:10 CST 2013.

Universal time is now:tue Dec 10:22:10 UTC 2013.

is the above information OK?

1) Yes

2) No

#? 1

You can make the permanent to yourself by appending the line

tz= ' Asia/shanghai '; Export TZ

To the file '. Profiles ' in your home directory; Then logs out and logs in again.

Here is the TZ value again, this time

can use The/usr/bin/tzselect command in shell scripts:


3. copy files to/etc directory

sudo cp/usr/share/zoneinfo/asia/shanghai/etc/localtime

#系统同步时间有2中方式: 1, synchronization of the site's 2, synchronous NTPD Service of the test in order to facilitate the direct synchronization of the site if there is ntpd service so direct [[email protected] ~] Ntdate server IP can also

4, Installation Ntpdate

sudo apt-get install-y ntpdate//ubuntu

sudo yum install-y ntpdate

5. Update Time

sudo ntpdate time.windows.com

Error Summary:

Error message:

[email protected] ~]# sudo ntpdate time.windows.com

8 Jan 11:03:59 ntpdate[1343]: The NTP socket is on use, exiting

Error reason: The system has NTPD service turned on

Error Resolution: Stop NTPD Service ntpd stop

This article is from the "Rookie Growth Road" blog, please be sure to keep this source http://francis905.blog.51cto.com/3048056/1732801

Ubuntu/centos changing the time zone and synchronizing the system time

Related Article

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.