26th July 2024

How to Change Time and Date Settings on CentOs 6/7 Servers?

After some installations on CentOS servers, the date and time may not be the same as our locale. You can use the “date” and “timedatectl” commands to find out. If you have received a date/time return that is not related to your country and local language, you can quickly update the date via the NTP protocol and keep it up-to-date by using the commands below. Our “time” seemed to be one hour ahead. We didn’t change “timezone“, we just changed “time“. You can change the “timezone” if you want.

CENTOS 6/7

You can apply all the operations that provide synchronization over NTP by executing the following commands in order. After following the steps below, the date of your Centos 7 server will be adjusted to the current time. You can see your active time with the “date” and “timedatectl” commands.

timedatectl set-timezone Europe/Istanbul
firewall-cmd --add-service=ntp --permanent
firewall-cmd --reload
yum install ntp -y
systemctl start ntpd
systemctl enable ntpd
ntpdate -q 0.tr.pool.ntp.org 1.tr.pool.ntp.org
timedatectl set-ntp true

The timezone looks fine with us. With the command (timedatectl set-time “16:37:00”), we entered whatever our current time setting is. According to TimeZone, our server clock was one hour ahead. With the (timedatectl set-time “16:37:00”) command, we have set the server clock back one hour.

timedatectl 
timedatectl set-time "time"
timedatectl 
timedatectl set-time "time"
timedatectl set-time “time”

 

LEARN MORE  Critical BIG-IP iControl REST Vulnerability - CWE-306, CVE-2022-1388

Leave a Reply

Your email address will not be published. Required fields are marked *