October 1, 2016

Setting time on a Linux machine

Had to work with a CentOS VM in VirtualBox format for a bit, and needed to sync the time since it didn't have Guest Additions, and couldn't connect to internet so ntp daemon wouldn't work.

Steps:

sudo rm /etc/localtime
sudo ln -s /usr/share/zoneinfo/EST5EDT etc/localtime
sudo date MMDDhhmmYYYY
sudo hwclock --systohc

It's interesting that Unix keeps separate time from the system time, and how VirtualBox does not sync the virtual BIOS clock with the host computer when it's been turned on or restored. Makes sense I suppose, the VM is not running on host time.

On a side note, it's been quite some time since I've worked on Linux... Brought back some memories when I used to run Slackware on an old machine with two NICs, configuring iptables to work as my home firewall...