linux设置时区同步时间】的更多相关文章

linux设置时区同步时间 一.运行tzselect sudo tzselect 在这里我们选择亚洲 Asia,确认之后选择中国(China),最后选择北京(Beijing) 如图:   二.复制文件到/etc目录下 sudo cp /usr/share/zoneinfo/Asia/Shanghai  /etc/localtime   三.更新时间 sudo ntpdate time.windows.com   四.写入硬件 sudo hwclock -w…
在/etc/init.d/下新建zhjdate脚本,添加如下内容: #!/bin/bash# chkconfig: 345 63 37#chkconfig:345 63 37 (数字345是指在运行级别为3.4.5时启动:数字63是指启动的优先级:数字 37是指停止的优先级)/usr/sbin/ntpdate us.pool.ntp.org >> /var/log/ntpdate.log STEP 2:修改脚本属性#chmod 755 zhjdateSTEP 3:配置脚本自启动#chkconf…
没有设置开机同步时间的话,重启之后时间不对. 如果装机时没正确设置时区,先设置时区:# tzsetup 用date命令手工设置时间一方面不方便,另一方面也依赖于本地管理员的时钟的正确性,那么网络上不同的管理员管理的计算机时间必然有偏差,不同计算机的时间偏差就会对一些要求时间同步的服务产生影响.解决这种问题的方法很简单,连接到一个能提供精确时间的服务器上进行时间同步. 当计算机连接到了Internet之后,那么就能同Internet上存在的很多时间服务器通信,以获得精确的时间.TCP/IP协议中,…
首先查看时间发现和百度的时间不一样 [root@www ~]# dateWed Dec 5 14:00:32 CST 2018 1.配置ntp服务器,设置时区同步,请参照ntp篇  https://www.cnblogs.com/effortsing/p/10011459.html 上面操作完后时间仍然无法同步,需要操作下面才可以 2.设置vmare虚拟机时区: 2.1 设置时区为上海 ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime…
1.设置时区 编辑 /etc/sysconfig/clock 修改 ZONE="Asia/Shanghai" 然后  cp  /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 2.修改时间 date  -s  月日时分秒年 设置为2015/10/11  13:24:33 date -s 10111324332015 3.写入到cmos hwclock  -w 4.自动同步时间 ntpdate  time.windows.com 这个时间服…
Core-Switch-1#show clockCore-Switch-1#show ntp statusCore-Switch-1#conf tCore-Switch-1(config)# clock timezone GMT +8   //设置时区Core-Switch-1(config)#service timestamps debug datetime msec localtime show-timezone   //debug 时间为本地时间Core-Switch-1(config)#…
因为公司运营海外游戏,服务器也多数放在国外,有时候要求服务器时区和时间要与所服务的地区一致,这里就涉及到更改服务器时区和时间的问题: 下面以一台在美国的服务器为例,我们的IDC提供商是一家德国公司,服务器虽在美国,但服务器时间全是德国柏林时间,而我们的游戏主要又是在阿根廷等南美国家推广,游戏运营活动时间的换算很让人恶心: 把服务器时间更换为阿根廷的  buenos-aires 布宜诺斯艾利斯  西三区区时: 下面是我服务器的当前时间 德国柏林时间: 1.使用tzselect命令对时区进行更改:…
.删除本地时间并设置时区为上海 rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 1 yum install ntp ntpdate 2 ntpdate -u ntp.sjtu.edu.cn 202.120.2.101 3 date(同步成功后 查看日期时间  有时候同步不上 需要多同步几次) 4 写入硬件 hwclock -w 以下是国内常见的NTP服务器 ntp.sjtu.edu.cn 2…
1.设置时区(同步时间前先设置) timedatectl set-timezone Asia/Shanghai 2.安装组件 yum -y install ntp systemctl enable ntpd systemctl start ntpd 3.同步时间 ntpdate -u cn.pool.ntp.org…
一.设置时区 1. 执行 tzselect 2. 弹出洲级地域选项: Please identify a location so that time zone rules can be set correctly. Please select a continent, ocean, "coord", or "TZ". ) Africa ) Americas ) Antarctica ) Asia ) Atlantic Ocean ) Australia ) Euro…
查看当前时区和时间 $ date $ ls -l /etc/localtime 查看所有可用时区 $ timedatectl list-timezones | grep Asia 设置时区 $ timedatectl set-timezone time_zone 例如:timedatectl set-timezone America/Chicago 修改时间 $ timedatectl set-time YYYY-MM-DD $ timedatectl set-time HH:MM:SS…
一.查看和修改Linux的时区 1. 查看当前时区命令 : "date -R" 2. 修改设置Linux服务器时区方法 A命令 : "tzselect" 方法 B 仅限于RedHat Linux 和 CentOS命令 : "timeconfig" 方法 C 适用于Debian命令 : "dpkg-reconfigure tzdata" 3. 复制相应的时区文件,替换系统时区文件:或者创建链接文件cp /usr/share/zo…
错误信息: 错误原因分析: 由于 xntpd 已经绑定到了该 Socket.运行 ntpdate 时,它会首先进行广播,然后侦听端口 123. 如果 xntpd 正在运行,而有一个进程已经在侦听该端口了,则会使 ntpdate 无法在上面运行.运行下列命令,即可找出 xntpd 的 PID 解决方案: 出现:pts/0    00:00:00 grep xntpd 表示没有找到pid.使用lsof –i:123 输出: -bash: lsof: command not found 说明没有安装l…
最近遇到一个问题,由于两台服务器时间的问题,经常导致用户登录由于时间差问题而报错,再三百度,最后整理了一下修改linux定时同步的操作(本方法适用于有自己时间服务器,没有的只限于借鉴) 首先确认,我们的服务是否已经安装了ntp服务 如果没有安装,需要先安装ntp服务 安装完ntp之后,编辑ntp.conf vi /etc/ntp.conf 可以看到文件中内容 # For more information about this file, see the man pages # ntp.conf(…
1.安装服务 yum install ntp ##安装ntp服务,这个和ntpdate不一样哦,用这个比较好 systemctl start ntpd.service ###启动服务 systemctl enable ntpd ###设置开机自启 ntpq -p ###查看同步 2.使用服务查看信息 [root@localhost ~]# ntpq -p remote refid st t when poll reach delay offset jitter =================…
设置当前日期: date -s 08/06/2015 设置当前时间:date -s 10:03:00 写入BIOS: clock -w 显示当前日期时间: date…
修改为上海的时区: 查看当前时区 date cp -vf /usr/share/zoneinfo/Asia/Shanghai  /etc/localtime vim /etc/sysconfig/clock ZONE="Asia/Shanghai" UTC=true ARC=false 查看修改后的时区 date 修改日期时间: 只修改日期,输入:date -s 2007-08-03 只修改时间,输入:date -s 14:15:00 同时修改日期时间,注意要加双引号,日期与时间之间有…
1.安装 yum install  ntp 安装下就可以了. 2.寻找一个网络时间服务器,比如一些国家授时中心 微软公司授时主机(美国) time.windows.com 台警大授时中心(台湾) asia.pool.ntp.org 中科院授时中心(西安) 210.72.145.44 网通授时中心(北京) 219.158.14.130 3.我们的电脑怎样去同步授时中心的时间 ntpdate asia.pool.ntp.org 上面此命令就是去同步授时中心的时间…
$ sudo cp /usr/share/zoneinfo/Asia/ShangHai /etc/localtime 上述是修改系统时区 同步时间 1.  安装ntpdate工具 $ sudo apt-get install ntpdate 2.  设置系统时间与网络时间同步 $ ntpdate cn.pool.ntp.org 3.  将系统时间写入硬件时间 $ hwclock –systohc…
ntp配置完成后时间仍然不准有下面两种情况: ntp服务端配置完ntp服务器后,查看时间和百度的时间不一样按照下面解决 ntp客户端同步完ntp服务器后,查看客户端的时间和百度不一致,按照下面解决 1.配置ntp服务器,设置时区同步,请参照ntp篇  https://www.cnblogs.com/effortsing/p/10011459.html 上面操作完后时间仍然无法同步,需要操作下面才可以 2.设置vmare虚拟机时区: 2.1 设置时区为上海 ln -s /usr/share/zon…
简化版 同步时间 #直接用域名同步中国上海时间 ntpdate -u ntp.api.bz # hwclock --hctosys 或者 # clock --hctosys hc代表硬件时间,sys代表系统时间,即用硬件时钟同步系统时钟系统时钟和硬件时钟同步: # hwclock --systohc或者# clock --systohc 即用系统时钟同步硬件时钟 clock --systohc #同步完硬件时钟后,需要做定时同步时间 vim /etc/crontab #输入:*/1 * * *…
有装过Linux系统的人,可能都会有这样的经历,就是该机器安装windows系统时,时间正确,但是安装了linux系统后,尽管时区选择正确,也会发现系统时间不对.这是由于安装系统时采用了UTC,那么什么是UTC呢,简单的说UTC就是0时区的时间,是国际标准,而中国处于UTC+8时区. 另外还有一种时间是当地时间,而windows采用的就是当地时间.所以安装linux系统时,不要选择使用UTC.   工具/原料   linux  date  tzselect 方法/步骤   1 修改系统时间. l…
修改日期时间的工具 date hwclock timedatectl date工具的使用 作用:显示和设置系统时间 选项: -d <字符串> 显示字符串所指的日期与时间,比如:"-1 day" 表示当前日期的前一天,必须要加双引号 -s <字符串> 设置当前的时间和日期 #年月日使用(-)分隔,时分秒使用(:)分隔 #时间日期格式: %T:time,显示时分秒,24小时制(hh:mm:ss) %F:full date,显示年月日,%Y-%m-%d #范例: 显示…
在一些大公司经常出现这样一个情况:公司或一些机关单位的内部业务系统的应用服务器以及数据都是做的多机集群部署而且基本都是linux系统,而且都是内部网,不与外网通讯的.这样经常就会出现一个情况,我发送任务的时间还晚于对方任务接收的时间.这样经常令我们头痛,那为什么会出现这样一个情况呢,其实就是linux机器的系统没有定时同步导致的,这个问题不仅linux系统有,windows系统也会出现这样的问题,比如我们的windows系统很久没开过机了,那么我们就会发现windows系统上的时间不对了,但是为…
1.调整时区 tzselect 选择Asia -> China -> Beijing Time 2.设置为默认时区 cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 3.同步时间 sudo apt-get install ntpdate ntpdate us.pool.ntp.org 4.测试 date -R…
1:使用date命令查看时区 [root@db-server ~]# date -R   Sun, 11 Jan 2015 07:10:28 -0800   [root@db-server ~]#   如上RFC 2822 format所示,上面命令输出了-0800表示西八区,是美国旧金山所在的时区,下面表示我们国家的东八区(+0800) [root@lnx01 ~]# date -R   Sun, 11 Jan 2015 23:06:02 +0800   2:查看clock系统配置文件 [ro…
查看当前时间状态 timedatectl status 设置时区 sudo dpkg-reconfigure tzdata Asia shanghai…
所有节点都要确保已安装ntpd(在步骤4已安装) 1.首先选择一台服务器作为时间服务器. 假设选定为node1.sunny.cn服务器为时间服务器. 2.ntp服务器的配置 修改ntp.conf文件: vi /etc/ntp.conf 一共修改三处内容,将#去掉,并且将网段修改正确. restrict 192.168.2.2 mask 192.168.2.255 nomodify notrap 将以下4个server进行#注释掉. #server 0.centos.pool.ntp.org ib…
1:使用date命令查看时区 [root@db-server ~]# date -R   Sun, 11 Jan 2015 07:10:28 -0800   [root@db-server ~]#   如上RFC 2822 format所示,上面命令输出了-0800表示西八区,是美国旧金山所在的时区,下面表示我们国家的东八区(+0800) [root@lnx01 ~]# date -R   Sun, 11 Jan 2015 23:06:02 +0800   2:查看clock系统配置文件 [ro…
Centos7为例:修改时区 timedatectl list-timezones |grep Shanghai #查找中国时区的完整名称 Asia/Shanghai timedatectl set-timezone Asia/Shanghai #其他时区以此类推 Centos7:同步时间 ntpdate pool.ntp.org…