Sync with NTP server on CentOS problem

Discussion in 'HOWTO-Related Questions' started by Sammy, Nov 6, 2008.

  1. Sammy

    Sammy New Member

    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.

    Code:
    [B]14 Synchronize The System Clock[/B]
    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..
    Code:
    
    [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 :)
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Please try this:
    Code:
    yum clean all
    yum makecache
     
  3. Sammy

    Sammy New Member

    Thanks for helping out falko.

    However - it did not solve the problem.

    I still get the errors:

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

    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 :)
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Haven't tried that command, but if you are unsure, you can test it on a test machine first.
     

Share This Page