Crazy Tech India Logo
  • 0
  • Account  
    •   Login
    •   -----
    •   Forgot Password?
  •   Home
  •   Store
    • Browse All
    • -----
    • Linux Shared hosting
    • Windows Shared Hosting
    • Linux Reseller
    • KVM VPS
    • Baremetal cloud server
    • Dedicated servers
    • Others Product
    • Openstack cloud
    • OpenVZ VPS
    • Lab As a Service
    • Register a New Domain
  •   Announcements
  •   Knowledgebase
  •   Network Status
  •   Contact Us
  1. Portal Home
  2. Knowledgebase
  3. VPS setup
  4. How to change timezone settings in ubuntu and centos

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

How to enable page break / next page button in wordpress using simple php code
Some users uses plugin for enabling next page or page break button in wordpress editor. This...
Complete Webserver- Ubuntu 14.04, apache, php-fpm, fail2ban, ufw, mariadb-server
A complete webserver for hosting heavy traffic php based CMS websites like wordpress, drupal etc...
how to setup LEMP stack on crazytech vps
If you have opted crazytech india KVM VPS for hosting a high traffic wordpress website then we...
dns server setup with ubuntu 14.04 VPS
We can setup a vps by using bind9 package # apt-get update #apt-get install bind9 # cd...
How to prevent wordpress xmlrpc.php attack
Xmlrpc is a type of attack in which your site goes down and if you see the error log of nginx...

Powered by WHMCompleteSolution

Copyright © 2021 Crazy Tech India. All Rights Reserved.
Choose language
  • العربية
  • Azerbaijani
  • Català
  • 中文
  • Hrvatski
  • Čeština
  • Dansk
  • Nederlands
  • English
  • Estonian
  • Persian
  • Français
  • Deutsch
  • עברית
  • Magyar
  • Italiano
  • Macedonian
  • Norwegian
  • Português
  • Português
  • Română
  • Русский
  • Español
  • Svenska
  • Türkçe
  • Українська

Title

Loading...
Loading...