GNU/Linux >> Belajar Linux >  >> Cent OS

Cara menginstal NTPD di CentOS Linux – panduan instalasi CentOS ntp

Bagaimana cara menginstal NTPD di CentOS Linux (desktop dan server)?

Anda dapat melakukannya dengan mudah menggunakan NTPD , NTP berarti Protokol Waktu Jaringan. NTPD adalah daemon sistem yang membantu server untuk menyinkronkan tanggal dan waktu dengan server NTPD CentOS global. Alat ini tersedia untuk desktop atau server yang menjalankan segala jenis distribusi Linux. Dalam hal ini, kami akan menunjukkan cara menginstal NTPD di CentOS Linux.

Network Time Protocol, alias NTP adalah protokol internet yang mendengarkan pada port UDP 123. Ini memungkinkan mesin dan server untuk menyinkronkan waktu melalui jaringan untuk mendapatkan tanggal dan waktu yang akurat.

Dari waktu ke waktu, jam sistem internal komputer cenderung memiliki masalah waktu, ini terutama terlihat saat bekerja dengan server linux ketika Anda perlu mereplikasi data melalui beberapa host, seperti yang terjadi pada replikasi basis data apache atau mysql. Itulah mengapa memiliki server CentOS ntp dapat banyak membantu Anda untuk selalu memiliki waktu yang akurat dan tepat.

Instal NTPD di CentOS:cara mudah

Hubungkan ke server Anda sebagai root, lalu instal paket yang diperlukan NTP:

yum install ntp ntpdate ntp-doc

Perintah ini akan menginstal:

ntp :ntpd server/daemon, diperlukan untuk menyinkronkan waktu sistem.
ntpdate :alat sistem yang digunakan untuk mengkonfigurasi tanggal dan waktu melalui NTP.
ntp-doc :jika Anda perlu membaca dokumentasi NTP.

Tambahkan NTPD ke boot sistem Anda

chkconfig ntpd on

Uji NTPD

Perintah ini akan menyinkronkan jam sistem server dengan server pool.ntp.org. Ini juga berguna untuk menguji apakah server Anda dapat terhubung ke server NTP Global Time

ntpdate 0.pool.ntp.org

Jika berfungsi dengan baik, hasilnya akan seperti ini:

13 Jul 17:18:43 ntpdate[19460]: adjust time server 38.229.71.1 offset 0.266345 sec

Jika Anda menjalankan firewall, Anda mungkin melihat masalah ini:

[[email protected]:~]ntpdate pool.ntp.org
13 Jul 16:08:47 ntpdate[2765]: sendto(time-b.timefreq.bldrdoc.gov): Operation not permitted
13 Jul 16:08:47 ntpdate[2765]: sendto(time01.muskegonisd.org): Operation not permitted
13 Jul 16:08:48 ntpdate[2765]: sendto(mirror): Operation not permitted

Agar sinkronisasi NTPD berfungsi dengan baik, Anda harus membuka port UDP 123 di firewall iptables Anda.

Setelah Anda melihatnya berfungsi, Anda siap untuk menghentikan pengujian dan memulai daemon server yang sebenarnya
Mulai server NTP. Berikut ini akan terus menyesuaikan waktu sistem dari server NTP upstream. Tidak perlu menjalankan ntpdate:

/etc/init.d/ntpd start

Itu saja, pada titik ini Anda seharusnya dapat menginstal NTPD di CentOS tanpa masalah.

Jika Anda perlu mengubah konfigurasi NTPD, Anda dapat mengedit file ini:

nano -w /etc/ntpd.conf

Ini berisi konfigurasi default:

 
[email protected] [~]# cat /etc/ntp.conf 
For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery

# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1 
restrict -6 ::1

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

#broadcast 192.168.1.255 autokey	# broadcast server
#broadcastclient			# broadcast client
#broadcast 224.0.1.1 autokey		# multicast server
#multicastclient 224.0.1.1		# multicast client
#manycastserver 239.255.254.254		# manycast server
#manycastclient 239.255.254.254 autokey # manycast client

# Enable public key cryptography.
#crypto

includefile /etc/ntp/crypto/pw

# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography. 
keys /etc/ntp/keys

# Specify the key identifiers which are trusted.
#trustedkey 4 8 42

# Specify the key identifier to use with the ntpdc utility.
#requestkey 8

# Specify th For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery

# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1 
restrict -6 ::1

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

#broadcast 192.168.1.255 autokey	# broadcast server
#broadcastclient			# broadcast client
#broadcast 224.0.1.1 autokey		# multicast server
#multicastclient 224.0.1.1		# multicast client
#manycastserver 239.255.254.254		# manycast server
#manycastclient 239.255.254.254 autokey # manycast client

# Enable public key cryptography.
#crypto

includefile /etc/ntp/crypto/pw

# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography. 
keys /etc/ntp/keys

# Specify the key identifiers which are trusted.
#trustedkey 4 8 42

# Specify the key identifier to use with the ntpdc utility.
#requestkey e key identifier to use with the ntpq utility.
#controlkey 8

# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats

Setup Windows NTP Client

Jika Anda menjalankan mesin microsoft windows dan Anda perlu menyinkronkan waktu dengan server NTP Linux Anda, Anda dapat mengatur sinkronisasi waktu ini dengan mengikuti langkah-langkah berikut:

1. Pindah ke Time, di sisi kanan Taskbar.
2. Klik Pengaturan Tanggal dan Waktu.
3. Klik Tab Waktu Internet – Klik Pengaturan.
4. Centang / Aktifkan 'Sinkronisasi dengan server waktu Internet'
5. Masukkan IP server ntp Anda pada kolom 'Server0.
6. Klik Perbarui sekarang – Klik OK.

Semua selesai, sekarang klien Windows NTP Anda harus disinkronkan dengan server CentOS NTP Anda.

Semua selesai, pada titik ini Anda seharusnya memiliki ntp di CentOS yang berfungsi setelah mengikuti instalasi centos ntp kami langkah demi langkah. CentOS ntp server adalah cara terbaik untuk menyinkronkan pengaturan server di seluruh jaringan.

Jika Anda perlu membaca lebih lanjut tentang NTP, ikuti tautan ini:

  • Dokumentasi Resmi NTPD
  • Dokumentasi TLDP NTPD
Cara menginstal NTPD di CentOS Linux – Panduan instalasi CentOS ntp terakhir diubah:7 Februari 2017 oleh Esteban Borges
Cent OS
  1. Cara debootstrap di CentOS Linux

  2. Cara menginstal Erlang di Rocky Linux/Alma Linux/CentOS 8

  3. Cara Menginstal Klien FreeIPA di Rocky Linux/Alma Linux/CentOS 8

  1. Cara menginstal Ansible di CentOS 8 Linux

  2. Cara menginstal PHP 8 di CentOS 8 Linux

  3. Cara Menginstal Kernel Linux 5.0 di CentOS 7

  1. Cara menginstal VirtualBox di CentOS 8 Linux

  2. Cara menginstal Skype di CentOS 8 Linux

  3. Cara Menginstal Anaconda di CentOS 7