installing NTP on CentOS 6

10,347

Solution 1

I was having a problem getting NTP up and running as well. I found that the ntp package is no longer supported in RHEL 8 and so no longer supported in CentOS and its versions. The synchronization of clocks of computers over a network can now be implemented by the chrony package using chronyd.

The chrony package is a versatile implementation of the Network Time Protocol(NTP) and works both as an NTP server and as an NTP client.

This package should already be included by default starting from RHEL 8 and CentOS 7. If it is not included for some reason you can install it, start it, check status, and enable it using the commands below:

# sudo dnf install chrony

To start :

# systemctl start chronyd

Make sure it is working by checking the status

# systemctl status chronyd

Status

And finally, enable chrony

# systemctl enable chronyd

enter image description here

Now your server will be able to automatically correct its system clock to align with the global servers.

Solution 2

It seems like your active repo do not provide all needed packages. Try to add a repo (ex. EPEL)

For a detailed howto install see http://fedoraproject.org/wiki/EPEL

After that try again to install ntp with

yum install ntp
Share:
10,347
brno792
Author by

brno792

Updated on June 04, 2022

Comments

  • brno792
    brno792 almost 2 years

    I am running CentOS Linux release 6.0 (Final) on amazon ec2.

    I'm trying to install NTP (network time protocol), but am getting errors.

    Im logged in as root and am in the root directory. I type yum -y install ntp and get "No package ntp available".

    I have also tried install ntp , sudo install ntp, yum install ntp, yum install -y ntp all yield the same "No package ntp available" message.

    When I type yum search ntp I get "No Matches found".

    Based on everything I've researched, yum should find ntp and the install commands should install it and start the daemon ntpd. Please advise.

  • brno792
    brno792 over 10 years
    just tried that. ran the 'rpm -Uvh fedora-epel ... url' command. Now my yum.repos.d directory also has epel.repo and epel-testing.repo. I still get the 'No package ntp available' when running 'yum install ntp'
  • deagh
    deagh over 10 years
    please verify that EPEL is active with 'yum repolist all' then clean your local cache with 'yum clean all' and try it again 'yum install ntp'
  • brno792
    brno792 over 10 years
    just ran those commands again. it shows 'epel' is enabled. ntp package still not available. 'c6-media' and 'debug' are disabled however. How do I enable those? Could there be other repos missing? Base for example? but i dont get why thats not here, nothing was deleted from original distro setup.
  • deagh
    deagh over 10 years
    check if enabled=1 within '/etc/yum.repos.d/CentOS-Base.repo'. Mainly [base], [updates] and [extras]. If this file is missing check your nearest centOS mirror.
  • brno792
    brno792 over 10 years
    CentOS-Base.repo is missing, which makes no sense to me. But thats how the ec2 server came. How do I install CentOS-Base.repo if I need it? Thanks. Im pretty new to linux and centos.
  • deagh
    deagh over 10 years
    Check this link for a valid 'CentOS-Base.repo' pastebin.com/fgrtYNzP I have no CentOS6 installation handy. Maybe you have to adjust the 'gpgkey' to fit your version.