Change NTP and Timezone CentOS/RHEL 7.x
Pre-installation, checking your current OS Version :
[root@host02 ~]# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
INSTALL NTP AND NTPDATE
[root@host02 ~]# yum install ntpdate ntp -y
Sync your time to NTP Server (global)
Because we are in Indonesia we use this one :
[root@host02 ~]# ntpdate -u 0.id.pool.ntp.org
10 Mar 22:20:12 ntpdate[8437]: step time server 202.146.247.134 offset 140.931464 sec
just a second, your current time is being synchronize with the NTP Server
Re-check your pool NTP server for your location.
Check after synchronizing :
[root@host02 ~]# date
Thu Mar 10 22:20:16 EST 2016
[root@host02 ~]# timedatectl
Local time: Fri 2016-03-11 10:44:01 WIB
Universal time: Fri 2016-03-11 03:44:01 UTC
RTC time: Fri 2016-03-11 03:44:01
Time zone: Asia/Jakarta (WIB, +0700)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
CONFIG YOUR MACHINE TO NTP SERVER
[root@host02 ~]# vi /etc/ntp.conf
Add some NTP Server, such as below :
# 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
server 0.id.pool.ntp.org
server 1.id.pool.ntp.org
server 2.id.pool.ntp.org
server 3.id.pool.ntp.org
START AND ENABLE SERVICE
[root@host02 ~]# systemctl start ntpd
[root@host02 ~]# systemctl enable ntpd
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.
CHECK STATUS SERVICE
[root@host02 ~]# systemctl status ntpd
● ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2016-03-10 22:21:00 EST; 12s ago
Main PID: 8446 (ntpd)
CGroup: /system.slice/ntpd.service
└─8446 /usr/sbin/ntpd -u ntp:ntp -g
FIND YOUR LOCATION :
[root@host02 ~]# timedatectl list-timezones
SET YOUR TIMEZONE :
[root@host02 ~]# timedatectl set-timezone Asia/Jakarta
ENSURE YOUR LOCALTIME :
[root@host02 ~]# ls -l /etc/localtime
lrwxrwxrwx. 1 root root 34 Mar 11 10:24 /etc/localtime -> ../usr/share/zoneinfo/Asia/Jakarta
Subscribe to:
Posts (Atom)