In this example, I am replacing Solaris' bundled xntpd with ntp 4.2.0 on a Solaris 2.6 system. I obtained
the ntp, readline, and ncurses packages from Sunfreeware. Note: the latter
two packages are needed for ntpq and
ntpdc.
1. Uncompress the packages.
$ gzip -d
ntp-4.2.0-sol26-sparc-local.gz
$ gzip -d readline-4.3-sol26-sparc-local.gz
$ gzip -d ncurses-5.4-sol26-sparc-local.gz
2. Install the packages.
# pkgadd -d ./ntp-4.2.0-sol26-sparc-local
# pkgadd -d ./readline-4.3-sol26-sparc-local
# pkgadd -d
./ncurses-5.4-sol26-sparc-local
3. Configure ntp. I
recommend using three ntp
servers from pool.ntp.org;
you may specify your country code when selecting servers from the ntp pool for the most accurate
results. Please see http://www.pool.ntp.org/
for more information.
# vi /etc/ntp.conf
driftfile /etc/ntp.drift
server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org
4. If /etc/ntp.drift does
not exist, run touch /etc/ntp.drift
as the root user.
5. Create an ntpd startup and shutdown script.
# vi /etc/init.d/ntpd
#!/bin/sh
PATH=/bin:/usr/bin
NTPD=/usr/local/bin/ntpd
case $1 in
'start' )
$NTPD -g -q
$NTPD
;;
'stop' )
kill `ps -ef | awk '$NF ~ /ntpd/ { print $2 }'` > /dev/null
2>&1
;;
*)
echo "usage: $0 {start|stop}"
esac
On a Solaris 8 system, I slightly modify the script to use pkill.
#!/bin/sh
PATH=/bin:/usr/bin
NTPD=/usr/local/bin/ntpd
case $1 in
'start')
$NTPD -g -q
$NTPD
;;
'stop')
pkill -fx $NTPD
;;
*)
echo "usage: $0 {start|stop}"
esac
5. Configure permissions on the ntpd
startup and shutdown script.
# chown root:root /etc/init.d/ntpd
# chmod 555 /etc/init.d/ntpd
6. Configure system startup files to start ntpd at boot instead of xntpd.
$ cd /etc/rc2.d
# mv S74xntpd .NOS74xntpd
# ln -s /etc/init.d/ntpd S74ntpd
7. Shutdown xntpd.
# /etc/init.d/xntpd stop
8. Start ntpd.
# /etc/init.d/ntpd start
Back to brandonhutchinson.com.