centos7 自动同步时间

rm -rf /etc/localtime

ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

vim /etc/sysconfig/clock

ZONE="Asia/Shanghai"

UTC=false

ARC=false

yum install -y ntp

systemctl start ntpd

systemctl enable ntpd

vim /etc/rc.d/rc.local

/usr/sbin/ntpdate ntp1.aliyun.com > /dev/null 2>&1; /sbin/hwclock -w

crontab -e

0 */1 * * * ntpdate ntp1.aliyun.com > /dev/null 2>&1; /sbin/hwclock -w

原文地址:https://www.cnblogs.com/maxuebin/p/12021706.html

时间: 2024-08-01 06:24:45

centos7 自动同步时间的相关文章

怎么让CentOS集群自动同步时间

怎么让CentOS集群自动同步时间?首先机器要连外网,这样才能从互联网上同步时间,这是首先要了解的.好了,主要的方法如下: 在除了运行ntpd之外的机器上,执行: [html] # chkconfig --list | grep ntpd 看看ntpd有没有开机自启动(如果显示的全为off则表明不是开机自启动),如果是开机自启动的,需要执行: [html] # chkconfig ntpd off 关闭ntpd,如果ntpd开着,ntpdate没办法从其他服务器同步时间的. 然后在/etc/rc

centos7上使用chrony自动同步时间

作用: 在linux中,有些服务必须依靠准确的时间,才能够在运行的时候不出差错,例如DNS,LVS,HTTPS等,都需要后台的服务器之间保持时间的同步.而Centos系统中自带的有安装对应的同步时间的服务.centos7中默认安装的是chrony,而Centos6相比在时间服务有所不同,使用了ntp服务来同步时间,而在Centos7上则使用的是chrony服务来同步时间,相较与ntp服务.chrony服务有如下几点优势: 1,更快的同步只需要数分钟而非数小时时间,从而最大程度减少了时间和频率误差

CentOS集群自动同步时间的一种方法

之前有篇日志是手动同步时间的 http://www.ahlinux.com/os/201304/202456.html 之所以这么干,是因为我们实验室的局域网只有一部分IP可以访问外网,服务器所用的IP恰好上不了外网,没法从互联网上同步时间,只好在本地设一台ntp服务器,从这一台机器同步时间了. 可是昨晚上实验室停电,今天早上开机之后发现服务器的时间差了不少(那几台作为服务器的台式机都5.6年了,估计是CMOS电池不行了). 手动一台台地同步时间(执行ntpdate xxx)实在很麻烦. 于是尝

Linux服务器设置自动同步时间

登录Linux服务器的时候,你可能发现与实际时间不一样,需要调整 安装ntpdate >yum install ntp 输入ntpdate time.nist.gov 其中 time.nist.gov 是一个时间服务器. 如此,设置时间OK了.

利用ntp自动同步时间

实验环境:centos 6.10 1.安装ntp工具 yum install -y ntp 2.便宜/etc/ntp.conf文件,添加远程时间服务器 server ntp1.aliyun.com server ntp2.aliyun.com server ntp3.aliyun.com server ntp4.aliyun.com 3.启动ntpd后台进程,设置开机启动 service ntpd start chkconfig ntpd on 原文地址:https://www.cnblogs.

解决 RaspberryPi 树莓派 NTP服务异常 无法自动同步时间

sudo nano /etc/ntp.conf 然后找到 # pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will# pick a different set every time it starts up. Please consider joining the# pool: <http://www.pool.ntp.org/join.html>server 0.debain.pool.ntp.or

CentOS自动同步时间

安装ntpdate yum install ntpdate -y 测试是否正常 ntpdate cn.ntp.org.cn # 正常情况 [[email protected] www]# ntpdate cn.ntp.org.cn 3 Mar 20:52:20 ntpdate[9748]: adjust time server 202.108.6.95 offset -0.017460 sec 设置定时任务 crontab -e */10 * * * * ntpdate cn.ntp.org.c

linux时间自动同步

1,修正本地时区及ntp服务 #yum -y install ntp#rm -rf /etc/localtime#ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime#/usr/sbin/ntpdate -u pool.ntp.org2,自动同步时间#添加下面一段#表示每10分钟同步一次 #crontab -e */10 * * * * /usr/sbin/ntpdate -u pool.ntp.org >/dev/null 2>&

Linux修改时区以及同步时间

Centos7为例:修改时区 1 timedatectl list-timezones |grep Shanghai #查找中国时区的完整名称 2 Asia/Shanghai 3 timedatectl set-timezone Asia/Shanghai #其他时区以此类推 Centos7:同步时间 1 ntpdate pool.ntp.org 原文地址:https://www.cnblogs.com/erdi/p/10298280.html