Server time is running fast or not allowed (Linux)

  

1. Log in to the machine and use the date command to view it.

2. Execute the following command:

#echo -e "0.asia.pool.ntp.org\ 1.asia.pool.ntp.org\ 2.asia.pool. Ntp.org\ 3.asia.pool.ntp.org\ 210.72.145.44">/etc/ntp/step-tickers #ntpdate -u 0.asia.pool.ntp.org #echo -e "server 0.asia.pool.ntp.org prefer\ server 1.asia.pool.ntp.org\ server 2.asia.pool.ntp.org\ server 3.asia.pool.ntp.org\ server 210.72.145.44" >>/etc/ntp.conf #service ntpd start #chkconfig --level 35 ntpd on

3. Use date to see if the time has been synchronized to the national standard time

A method

When we use the CentOS system, there may be problems in the time zone. Sometimes it will go wrong after the change. Let's learn a way to change this situation. If it is not installed, and you are using the CentOS system, use the command yum install ntp

then: ntpdate us.pool.ntp.org.

Because the CentOS system is compiled with the source code of rhas, many places are exactly the same.

The time zone of rhas5 exists in the form of a file. The current time zone file is in /etc/localtime

Then where are the files in other time zones stored?

Under /usr/share/zoneinfo

We use East Eight District, Beijing, Shanghai time

#cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #reboot

After reboot, date view time, view current time zone date -R, view/modify Linux time zone and time

1. Time zone

1 View the current time zone date -R

2. Modify the set time zone Method (1) tzselect method (2) RedHat Linux and CentOS only timeconfig method (3) Applies to Debian dpkg-reconfigure tzdata

3. Copy the corresponding time zone file and replace the CentOS system time zone file; or create a link file cp /usr/share/zoneinfo/$main time zone/$time zone /etc/localtime can be used in China: cp /usr/share/Zoneinfo/Asia/Shanghai /etc/localtime

Second, time

1. View time and date date

2. Set the time and date Set the CentOS system date to Command dated June 10, 1996 date -s 06/22/96 Command to set the CentOS system time to 1:52 pm 0 pm date -s 13:52:00

3. Current Time and date are written to the BIOS Avoid failure after restart hwclock -w

Third, timing synchronization time # /usr/sbin/ntpdate 210.72.145.44 > /dev/null 2>&1

So we are done About setting the time zone for modifying the CentOS system. I hope everyone can learn more.

Copyright © Windows knowledge All Rights Reserved