yum安装ntp服务

一.安装NTP软件包:

yum -y install ntp /*yum安装NTP服务*/

chkconfig --add ntpd /*添加NTP*/

chkconfig ntpd on /*开机自启动NTP*/

二.修改NTP配置文件:

vi /etc/ntp.conf

***************************************************************

# For more information about this file, see the man pages

# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift

restrict default ignore 设置默认策略为拒绝所有访问方式的请求

# Permit time synchronization with our time source, but do not

# permit the source to query or modify the service on this system.

restrict default kod nomodify notrap nopeer noquery

restrict -6 default kod nomodify notrap nopeer noquery

# Permit all access over the loopback interface. This could

# be tightened as well, but to do so would effect some of

# the administrative functions.

restrict 127.0.0.1

restrict -6 ::1

Hosts on local network are less restricted.

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap 允许局域网内机器同步时间

# Use public servers from the pool.ntp.org project.

# Please consider joining the pool (http://www.pool.ntp.org/join.html).

server 0.CentOS.pool.ntp.org

server 1.centos.pool.ntp.org 设置同步服务器

server 2.centos.pool.ntp.org

server 127.127.1.0 # local clock

fudge 127.127.1.0 stratum 10 外界同步源无法联系时,使用本地时间为同步服务

# Enable public key cryptography.

#crypto

includefile /etc/ntp/crypto/pw

# Key file containing the keys and key identifiers used when operating

# with symmetric key cryptography.

keys /etc/ntp/keys

# Specify the key identifiers which are trusted.

#trustedkey 4 8 42

# Specify the key identifier to use with the ntpdc utility.

#requestkey 8

# Specify the key identifier to use with the ntpq utility.

#controlkey 8

# Enable writing of statistics records.

#statistics clockstats cryptostats loops

***************************************************************

时间同步

命令:

# ntpdate ip (同步时间服务器ip)

#hwclock -w //将时间写入硬件

例子

ntpdate 210.167.182.10

同步时间服务器:

server

ntp-sop.inria.frserver 210.72.145.44(中国国家授时中心服务器IP地址)

server ntp.sjtu.edu.cn(上海交通大学网络中心NTP服务器地址)

执行:

# ntpdate 210.167.182.10 (同步时间服务器ip)

#hwclock -w //将时间写入硬件

时间: 2024-08-03 12:05:24

yum安装ntp服务的相关文章

CentOS7版本安装ntp服务

centos从7.0以后,ntp做成了一个服务,也就是说可以运行一个守护进程来自动同步时间,而不用像5和6的版本一样把命令写入计划任务中,这个在做集群服务的时候非常有帮助. 安装ntp [[email protected] ~]# yum install ntp ntpdate -y 配置文件/etc/ntp.conf [[email protected] ~]# vim /etc/ntp.conf # server 0.asia.pool.ntp.org server 1.asia.pool.

linux centos7 安装ntp服务并启动,设置开机重启

yum list |grep ntpd yum -y install ntp systemctl start ntpd systemctl status ntpd systemctl enable ntpd systemctl list-unit-files|grep ntpd yum确认是否安装yum安装启动ntpd服务查看状态设置开机启动查看是否设置开机启动 原文地址:https://blog.51cto.com/weiruoyu/2453315

centos7 安装ntp服务并启动,设置开机重启

yum list |grep ntpd yum -y install ntp systemctl start ntpd systemctl status ntpd systemctl enable ntpd systemctl list-unit-files|grep ntpd yum确认是否安装yum安装启动ntpd服务查看状态设置开机启动查看是否设置开机启动 原文地址:https://blog.51cto.com/11263100/2453322

yum安装telnet服务

1.查看有无安装telnet [[email protected] ~]# rpm -qa |grep telnet 2.查看yum 源 [[email protected] ~]# yum list |grep telnet telnet.x86_64                              1:0.17-48.el6              @base telnet-server.x86_64                       1:0.17-48.el6    

centos7配置YUM安装DNS服务

1.配置DNS地址 vim /etc/resolv.conf nameserver 192.168.1.100 #注:这里的地址是你DNS服务器本机的地址 2.安装dns服务 yum install bind bind-utils 3.启动服务 启动DNS服务:service named start 重启DNS服务:systemctl restart  named.service 设置开机启动:systemctl enable named 4.编辑dns配置文件 vim /etc/named.c

linux yum安装ntp 时间同步

yum install ntp -y vi /etc/ntp.connf修改如下 ntpdate -u cn.pool.ntp.org 同步时间 别的服务器 同步 ntpdate IP地址 例ntpdate 192.168.80.100 原文地址:http://blog.51cto.com/14150862/2343624

centos6.6 yum安装telnet服务端和客户端

查看telent是否安装: rpm -qa | grep telnet 查看yum源上telnet有哪些软件可安装: yum search telnet telnet服务端:telnet-server telnet客户端:telnet 安装 注意,需要root权限来安装 yum -y install telnet-server yum -y install telnet 安装服务端之后其他设备就可以telnet这台设备了(这台设备有telnet服务) 安装服务端之后这台设备就可以telnet其他

服务器 CentOS上yum安装Nginx服务

一.更改yum源为网易的源加快速度 vi /etc/yum.repos.d/CentOS-Base.repo 更改内容如下 # CentOS-Base.repo # # This file uses a new mirrorlist system developed by Lance Davis for CentOS. # The mirror system uses the connecting IP address of the client and the # update status

yum安装各种服务

1.rz/sz yum install lrzsz 2.wget yum install wget 3.mysql yum install mysql-server 4.ssh yum install openssh-clients 5.