How to change timezone on a Linux server (CentOS)

We run CentOS for many of our server builds and this question often comes up. Hope this helps.

Here are the steps:

  1. Make a backup copy of the default localtime file.
  2. [code]
    mv /etc/localtime /etc/localtime.bak
    [/code]

  3. Create a symbolic link to a new localtime file
  4. [code]
    ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
    [/code]

Be sure to replace “America/Los_Angeles” with the directory (if your zone has one) and filename of the timezone you want to use. Then test your change by running the command “date” from the command line.

Chris

Chris started building web sites and web applications in 1996, after installing Linux and discovering httpd. It was a career in freshwater fisheries and geographic information systems (GIS) that led Chris to the web, and to start Lanexa.net in 1998. Chris has a strong background in Linux/Unix systems administration, HTML, CSS, PHP, as well as Oracle and MySQL database administration. Chris is a proven leader, having lead the development of ecommerce platforms for Fortune 500 companies, as well as start ups. He is able to bridge the gap between Marketing and IT, and turn business requirements into development objectives, and he delivers results. When Chris is not working on web sites, he is usually chasing his kids around or playing mandolin. Finalist, San Diego Magazine's Top Tech Exec Awards, 2012, 2013 Council Member, Magento X-Commerce Merchant Council, 2011

Leave a Reply

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