Knowledgebase
How to change timezone settings in ubuntu and centos Print this Article
NTP is a service in unix/linux which synchronize local server time with public time (NTP) servers.
but the time zone setting in server is a practice i am telling you here-
1.For CentOS 6
In centos there is timezone data available in /usr/share/zoneinfo directory and /etc/localtime is a softlink so in my case if i want to change my centos server timezone as Asia/Kolkata
# rm -rf /etc/localtime
# ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
2. For CentOS 7
# timedatectl list-timezones
# timedatectl set-timezones Asia/Kolkata
3. For ubuntu 14.04
# dpkg-reconfigure tzdata # i dialog box will prompt to choose timezone
4. Change timezone in php.ini
edit the php.ini file
In centos based server
# vim /etc/php.ini
in Ubuntu based server
# vim /etc/php5/apache2/php.ini or # vim /etc/php5/fpm/php.ini
Find the section [Date] then uncomment change the line in the section
date.timezone = Asia/Kolkata
save and exit. You need to restart service .
5. Change the time zone in mysql server
To display current date run query
sql> select now();
+---------------------+
| NOW() |
+---------------------+
| 2016-02-23 12:50:15 |
+---------------------+
# vim /etc/my.cnf
add this line
default-time-zone = '+05:30'
# service mysqld restart (for centos) or service mysql restart ( for ubuntu)
On the fly setting
run this query
sql>SET GLOBAL time_zone = '+05:30';
6. NTP setting
For CentOS
# yum install ntp ntpdate -y
# chkconfig ntpd on
# service ntpd start
For Ubuntu
# apt-get install ntp -y
# service ntp restart
Was this answer helpful?
Also Read
Some users uses plugin for enabling next page or page break button in wordpress editor. This...
A complete webserver for hosting heavy traffic php based CMS websites like wordpress, drupal etc...
If you have opted crazytech india KVM VPS for hosting a high traffic wordpress website then we...
We can setup a vps by using bind9 package # apt-get update #apt-get install bind9 # cd...
Xmlrpc is a type of attack in which your site goes down and if you see the error log of nginx...
Powered by WHMCompleteSolution