Instructions for changing the time zone on CentOS 7 - HOSTVN Blog




The timedatectl command is a new utility on CentOS 7, which is part of the systemd system and service manager, replacing the date command. In this article, HOSTVN will guide you to change the time zone on CentOS 7 easily with the timedatectl command.



Instructions for changing the time zone on CentOS 7


1. How to find and set time zone on CentOS 7


To display the current time and date on your system, use the timedatectl command as follows:





Screenshot_152

To view all available time zones, run the following command:





Screenshot_153

To find the local time zone according to your location, run the following command:





Screenshot_154 - change the time zone on CentOS

To set the time zone on CentOS 7, you run the command like the following.






2. Set the Vietnamese time zone on CentOS 7


To set the time zone Vietnam You use the following command





If you use PHP you will need to make further changes to the file /etc/php.ini. Open the file /etc/php.ini Find to the line





And corrected to





Change the time zone on CentOS

Then you restart php-fpm or apache / nginx if using php






3. Time synchronization with NTP Server


NTP stands for Network Time Protocol is an internet protocol, used to synchronize the system clock between computers. Utilities timedatectl Allows you to automatically synchronize the system clock Linux to a remote server group using NTP.


You will need to install it first NTP with the following command





To start automatic time synchronization with the remote NTP server, run the following command.






4. Conclusion


Through this article HOSTVN I showed you how to change the time zone on CentOS 7, if you have any comments you can leave a comment below. Also you can see more Instructions on how to install LEMP on Centos 7.



email-business-leaderboard-blog-v3.png