1. We can look at the current date and time of a CentOS server by typing "date" in the SSH terminal or PuTTy.exe.
2. You ll notice that it?s probably not what you want. CentOS uses the file /etc/localtime to determine what the timezone you want to use is. If the contents of that file aren?t what you?re looking for?we?ll need to replace it. First, lets get rid of that file since it?s wrong anyway. We?ll rename it to localtime.bak.
3 .Since CentOS now no longer has a proper localtime file, you can run the date command again and see that it just uses the universal time now.
We need a new /etc/localtime file with the right stuff. Rather than make a new file, we?ll create a symlink to an already existing timezone file. They're all located in /usr/share/zoneinfo. Find the one you want in there. For this example, I?m setting the server to central time. So /usr/share/zoneinfo/Asia/Manila will work for me. Just find whichever timezone file corresponds to the one you want to set your server to.
Now, let's make that link.
Run the date command again and you should be good to go!
4. Restart your server to take effect1. We can look at the current date and time of a CentOS server by typing "date" in the SSH terminal or PuTTy.exe.
2. You ll notice that it?s probably not what you want. CentOS uses the file /etc/localtime to determine what the timezone you want to use is. If the contents of that file aren?t what you?re looking for?we?ll need to replace it. First, lets get rid of that file since it?s wrong anyway. We?ll rename it to localtime.bak.
3 .Since CentOS now no longer has a proper localtime file, you can run the date command again and see that it just uses the universal time now.
We need a new /etc/localtime file with the right stuff. Rather than make a new file, we?ll create a symlink to an already existing timezone file. They're all located in /usr/share/zoneinfo. Find the one you want in there. For this example, I?m setting the server to central time. So /usr/share/zoneinfo/Asia/Manila will work for me. Just find whichever timezone file corresponds to the one you want to set your server to.
Now, let's make that link.
Run the date command again and you should be good to go!
4. Restart your server to take effect