PhotonOS is VMware’s minimalist Linux based OS that has been heavily optimized for vSphere environments. Many of VMware’s appliance and OVAs are based on this super light weight platform. The problem with appliances and OVAs, is that I have yet to find or launch one that is set to MY timezone by default. I guess that is the price I have to pay for living in Hawaii.
While having the timezone mis-configured probably won’t hurt the VM itself most of the time, it definitely makes reading timestamps and logs more difficult. I mean come on, we’ve all been there before, add or subtracting your timezone offset to figure out what time an event actually happened since we probably don’t live in the GMT or UTC timezones. Much to our luck, setting the timezone PhotonOS using SSH (or the console’s CLI) is pretty easy after you log in as ‘root’.
Enter the command below to get a list of all available timezones.
ls -lsa /usr/share/zoneinfo | more
If you live in a region that is divided into subregions, such as the ‘Pacific’, we can use the following command instead to list those zones.
ls -lsa /usr/share/zoneinfo/Pacific | more
Once you have found the name of your desired timezone you can use the following command to set it. I’m using “Pacific/Honolulu” as my desired timezone.
set Pacific/Honolulu timezone
Then make a symbolic link from localtime to “Pacific/Honolulu”, or your desired timezone…
ln -sf /usr/share/zoneinfo/Pacific/Honolulu /etc/localtime
The final step is to check and visually confirm that the timezone is correct. To do this, we simply run the following command.
Now we can finally make some sense out of our logs!!!