Centos 7.4 server time synchronization configuration method [based on NTP service]

Centos 7.4 server time synchronization configuration method [based on NTP service]

This article describes how to configure time synchronization on a CentOS 7.4 server. Share with you for your reference, the details are as follows:

1. Install NTP server using yum

#yum -y install ntp

2. Start the ntp service

#systemctl start ntpd

3. Set the system to start automatically

#systemctl enable ntpd

4. Modify the startup parameters and add -g -x parameters to allow the ntp service to work normally even when the system time error is large

#vi /etc/sysconfig/ntpd
OPTIONS="-g -x"

5. Read the current time

#timedatectl

6. Set the time zone to Asia/Shanghai

#timedatectl set-timezone Asia/Shanghai

7. Enable NTP server synchronization

#timedatectl set-ntp yes

8. Check the server time. If it is still out of sync, manually sync the server time.

#/usr/sbin/ntpdate ntp.api.bz

The error "the NTP socket is in use, exiting" appears.
8 Nov 09:57:02 ntpdate[4726]:the NTP socket is in use, exiting

9. The reason for this error is that the system ntpd server is running. By checking with ps aux | grep ntpd, you can see that ntpd is running.

Solution:

#systemctl stop ntpd 
#/usr/sbin/ntpdate ntp.api.bz

10. Last viewed time

#timedatectl

I hope this article will help you configure your CentOS server.

You may also be interested in:
  • Install Memcached and PHP Memcached extension under CentOS
  • Centos7.4 server installation of apache and solutions to problems encountered during the installation process
  • Tutorial on installing lamp-php7.0 in Centos7.4 environment
  • Detailed installation tutorial of Docker under CentOS
  • Centos7.5 configuration java environment installation tomcat explanation
  • The best way to start a jar package project under Centos7 server
  • Complete steps to install FFmpeg in CentOS server
  • Alibaba Cloud Centos7 installation and configuration of SVN
  • How to add Nginx to system services in CentOS7
  • Install and build a server environment of PHP+Apache+MySQL on CentOS

<<:  Detailed explanation of the usage of two types of temporary tables in MySQL

>>:  Vue.js Textbox with Dropdown component

Recommend

MySQL slow query: Enable slow query

1. What is the use of slow query? It can record a...

Three.js sample code for implementing dewdrop animation effect

Preface Hello everyone, this is the CSS wizard - ...

A complete tutorial on using axios encapsulation in vue

Preface Nowadays, in projects, the Axios library ...

How to automatically number the results of MYSQL query data

Preface In fact, I have never encountered this ki...

A brief analysis of the differences between undo, redo and binlog in MySQL

Table of contents Preface 【undo log】 【redo log】 【...

html base url tag

Its function is to set a global style. Then your s...

Solve the problem of using swiper plug-in in vue

Since I used this plugin when writing a demo and ...

How to pass parameters to JS via CSS

1. Background that needs to be passed through CSS...

Linux disk management LVM usage

1. Introduction to LVM When we manage Linux disks...

Overview of the definition of HTC components after IE5.0

Before the release of Microsoft IE 5.0, the bigges...

Quickly solve the problem that the mysql57 service suddenly disappeared

one, G:\MySQL\MySQL Server 5.7\bin> mysqld --i...

JS cross-domain solution react configuration reverse proxy

Cross-domain solutions jsonp (simulate get) CORS ...

How to use html table (to show the visual effect of web page)

We know that when using HTML on NetEase Blog, we ...

Detailed explanation of MySQL precompilation function

This article shares the MySQL precompilation func...