PDA

View Full Version : Sync with NTP server on CentOS problem


Sammy
6th November 2008, 14:18
Hello !

I have a CentOS 4.4 server running with Directadmin.

The server clock is not correct, and I thought I could set this up once and for all useing the setup here in the tutorials.

14 Synchronize The System Clock
If you want to have the system clock synchronized with an NTP server do the following:

yum install ntp
chkconfig --levels 235 ntpd on
ntpdate 0.pool.ntp.org
/etc/init.d/ntpd start

So I logged in as root through Putty.exe on a Win PC
and this was the output..


[root@server /]# yum install ntp

Dependencies Resolved

==================================================
Package Arch Version Repository Size
==================================================
Updating:
ntp i386 4.2.0.a.20040617-8.el4.centos base 1.2 M
Installing for dependencies:
shadow-utils i386 2:4.0.3-66.RHEL4 base 594 k

Transaction Summary
==================================================
Install 1 Package(s)
Update 1 Package(s)
Remove 0 Package(s)
Total download size: 1.8 M
Is this ok [y/N]: y

Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
error: cannot open Packages index using db3 - Permission denied (13)
error: cannot open Packages database in /var/lib/rpm

Dependency Installed: shadow-utils.i386 2:4.0.3-66.RHEL4
Updated: ntp.i386 0:4.2.0.a.20040617-8.el4.centos
Complete!

[root@server /]# chkconfig --levels 235 ntpd on

[root@server /]# ntpdate 0.pool.ntp.org

Error : Servname not supported for ai_socktype
5 Nov 18:20:56 ntpdate[29521]: can't find host 0.pool.ntp.org

5 Nov 18:20:56 ntpdate[29521]: no servers can be used, exiting

[root@server /]#



What did I do wrong..
What does the two error messages cannot open Packages mean..

How to set it up?

Sammy :)

falko
7th November 2008, 13:58
Please try this:
yum clean all
yum makecache

Sammy
8th November 2008, 13:20
Thanks for helping out falko.

However - it did not solve the problem.

I still get the errors:

error: cannot open Packages index using db3 - Permission denied (13)
error: cannot open Packages database in /var/lib/rpm


I googled the error messages and came up with this suggestion:

Try running:

rpm --rebuilddb


However I don't want to do something that may mess up the server,
since it's already running a few domains that has a lot of visitors.

Can I use the above command without messing it up..?
- Or do You suggest anything else?

Sammy :)

falko
9th November 2008, 15:12
Haven't tried that command, but if you are unsure, you can test it on a test machine first.