I recently procured a PogoPlug V2 from Ebay, hoping to use it as a small linux server for various tasks. A PogoPlug is a small internet-enabled device that allows attached external hard drives to be accessed from anywhere, whether on the local network or on the wider internet, with minimal hassle.
Unfortunately the PogoPlug does not have a hardware clock, and will consistently think it is 1st of January 1970 after reboots. Not very handy, especially as I was planning to use it to report measurements to external services, and this was time-sensitive.
So, to set the time on each reboot, I installed and enabled the Network Time Protocol client, ntp. Here’s how to do that, and how to set your timezone correctly.
First up, update the package manager to have the latest packages available. You may be asked if you want to update pacman itself, and a bunch of other stuff. In my case it grabbed the latest linux kernel version, and took a fair amount of time. Run this command a few times to make sure everything is the latest it can be.
$ pacman -Syu
Next up, install ntp.
$ pacman -S ntp
To enable ntp on startup, edit
ntpd to the DAEMONS array, and removing
# before: DAEMONS=(hwclock syslog-ng network netfs crond sshd) DAEMONS=(syslog-ng network netfs crond sshd ntpd)
Next you should configure ntp by editing
/etc/ntp.conf. A list of local ntp servers can be found at http://www.pool.ntp.org/. I chose to use the UK servers.
Comment out any existing lines that begin with ‘server’, and add in those you want to use. Append
iburst to the end, this specifies how the servers are polled.
server 0.uk.pool.ntp.org iburst server 1.uk.pool.ntp.org iburst server 2.uk.pool.ntp.org iburst server 3.uk.pool.ntp.org iburst
Next, set your timezone. A complete list of zones can be found in
/usr/share/zoneinfo. I went with
Europe/London. Edit the
TIMEZONE variable in
/etc/rc.conf, changing it to your chosen zone.
That’s it! You should now have the correct time and timezone.
$ date Fri Sep 16 19:58:09 BST 2011