RedHat/CentOS/Scientific Linux/Debian/Ubuntu/Solaris: Quick NTP Client config

Here you get a running NTP client in 1 minute:
RedHat/CentOS/Scientific Linux
Install NTP in Debian/Ubuntu
Solaris (9,10,11)
RedHat/CentOS/Scientific Linux
sudo yum install ntp
chkconfig ntpd on
Make saure you have a few server in the ntp.conf
# cat /etc/ntp.conf |grep server
# Use public servers from the pool.ntp.org project.
server 0.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org
#or for Redhat
server 0.rhel.pool.ntp.org server 1.rhel.pool.ntp.org server 2.rhel.pool.ntp.org
check for the servers by using
# ntpq -pn remote refid st t when poll reach delay offset jitter ================================================================== 54.247.170.181 194.109.22.18 3 u 8 64 3 36.923 12.195 11.683 94.247.49.238 .GPS. 1 u 6 64 3 27.578 2.822 3.068 46.51.185.173 193.190.230.65 2 u 8 64 3 17.190 3.408 2.773
Set the server and time by selecting one serer to contact:
service ntpd stop ntpdate -b 0.rhel.pool.ntp.org service ntpd start
check date:
date
#apt-get install ntp ntpdate ntp-server
This will install all the required packages for NTP
Make saure you have a few server in the ntp.conf
cat /etc/ntp.conf |grep server
server ntp0.pipex.net
server ntp1.pipex.net
server 0.debian.pool.ntp.org iburst
server 1.debian.pool.ntp.org iburst
server 2.debian.pool.ntp.org iburst
server 3.debian.pool.ntp.org iburst
The 2 Pipex Servers are 2 optional servers I like to use cause they just work fine.
Check for the servers by using
# ntpq -pn remote refid st t when poll reach delay offset jitter ================================================================== 54.247.170.181 194.109.22.18 3 u 8 64 3 36.923 12.195 11.683 94.247.49.238 .GPS. 1 u 6 64 3 27.578 2.822 3.068 46.51.185.173 193.190.230.65 2 u 8 64 3 17.190 3.408 2.773
Set the server and time by selecting one serer to contact:
service ntpd stop ntpdate -b 0.rhel.pool.ntp.org service ntpd start
check date:
date
cp /etc/inet/ntp.client /etc/inet/ntp.conf vi /etc/inet/ntp.conf and replace multicastclient 224.0.1.1 with server [ip-of-the-NTP-Server]
Then restart ntp
Solaris9
/etc/init.d/xntpd stop
/etc/init.d/xntpd startSolaris 10 & Solaris 11
svcadm disable svc:/network/ntp:default
svcadm enable svc:/network/ntp:default
Note: Be very careful when setting NTP time on running database or cluster servers.
A change in time can cause inconsistency.
On Clustered Nodes it is advised to shut-down the cluster prior to changing the time.
Firewall Configuration for NTP
NTP servers communicate with one another using UDP with a destination port of 123. Unlike most UDP protocols, the source port isn’t a high port (above 1023), but 123 also. You’ll have to allow UDP traffic on source/destination port 123 between your server and the Stratum 1/2 server with which you are synchronizing.
Tips & Tricks: Changing timezone
How do I change my system timezone from the command line without using redhat-config-date?
In order to change the timezone of your system you will need to access the file /etc/sysconfig/clock directly:
#ZONE="Europe/Dublin" ZONE="GMT" UTC=false ARC=false
Note: If your system’s BIOS has UTC set to true, then set UTC to true. If it has it set to false, set it to false. UTC in the configuration file must always reflect your BIOS settings.
In order to get the particular zone you wish to use you must associate ZONE with a file located in /usr/share/zoneinfo. It is wise to note the directory structure because if you need to set the timezone to that of Berlin which is located in the Europe directory you will then have to set your ZONE variable to the following :
ZONE="Europe/Berlin"
Or perhaps you need to set the timezone to that of Eastern Europe (Kiev) :
ZONE="Europe/Kiev"
Finally save the file /etc/sysconfig/clock and on next reboot the system will be set to the defined timezone.
For the time on the machine to reflect the change timezone we need to link the zoneinfo file to /etc/localtime. This can be done as follows :
If you are setting your timezone to “Europe/Kiev” link the following file to /etc/localtime :
# ln -sf /usr/share/zoneinfo/Europe/Kiev /etc/localtime
Now by typing the date command to display the time you should see if reflect the newly linked timezone :
# date Mon Nov 5 21:41:19 EET 2012