NTP

2015年8月20日
星期四

17:34

CentOS 7配置本地时区和TIME ZONE

#用tzselect配置时区和time zone

[root@localhost Asia]# /usr/bin/tzselect

Please identify a location so that time zone rules can be set correctly.

Please select a continent or ocean.

1) Africa

2) Americas

3) Antarctica

4) Arctic Ocean

5) Asia

6) Atlantic Ocean

7) Australia

8) Europe

9) Indian Ocean

10) Pacific Ocean

11) none - I want to specify the time zone using the Posix TZ format.

#选择时区

#? 11

Please enter the desired value of the TZ environment variable.

For example, GST-10 is a zone named GST that is 10 hours ahead (east) of UTC.

#键入CST+0中国时区

#UTC为国际时区

CST+0

awk: cmd. line:5: warning: escape sequence `\.' treated as plain `.'

The following information has been given:

TZ='CST+0'

Therefore TZ='CST+0' will be used.

Local time is now:    Thu May 12 18:13:06 CST 2016.

Universal Time is now:    Thu May 12 18:13:06 UTC 2016.

Is the above information OK?

1) Yes

2) No

#? 1

You can make this change permanent for yourself by appending the line

TZ='CST+0'; export TZ

to the file '.profile' in your home directory; then log out and log in again.

Here is that TZ value again, this time on standard output so that you

can use the /usr/bin/tzselect command in shell scripts:

CST+0

[root@localhost Asia]# /usr/bin/tzselect

Please identify a location so that time zone rules can be set correctly.

Please select a continent or ocean.

1) Africa

2) Americas

3) Antarctica

4) Arctic Ocean

5) Asia

6) Atlantic Ocean

7) Australia

8) Europe

9) Indian Ocean

10) Pacific Ocean

11) none - I want to specify the time zone using the Posix TZ format.

#? 5

Please select a country.

1) Afghanistan         18) Israel         35) Palestine

2) Armenia         19) Japan         36) Philippines

3) Azerbaijan         20) Jordan         37) Qatar

4) Bahrain         21) Kazakhstan     38) Russia

5) Bangladesh         22) Korea (North)     39) Saudi Arabia

6) Bhutan         23) Korea (South)     40) Singapore

7) Brunei         24) Kuwait         41) Sri Lanka

8) Cambodia         25) Kyrgyzstan     42) Syria

9) China         26) Laos         43) Taiwan

10) Cyprus         27) Lebanon         44) Tajikistan

11) East Timor         28) Macau         45) Thailand

12) Georgia         29) Malaysia         46) Turkmenistan

13) Hong Kong         30) Mongolia         47) United Arab Emirates

14) India         31) Myanmar (Burma)     48) Uzbekistan

15) Indonesia         32) Nepal         49) Vietnam

16) Iran         33) Oman         50) Yemen

17) Iraq         34) Pakistan

#? 9

Please select one of the following time zone regions.

1) Beijing Time

2) Xinjiang Time

#? 1

The following information has been given:

China

Beijing Time

Therefore TZ='Asia/Shanghai' will be used.

Local time is now:    Fri May 13 02:13:32 CST 2016.

Universal Time is now:    Thu May 12 18:13:32 UTC 2016.

Is the above information OK?

1) Yes

2) No

#? 1

You can make this change permanent for yourself by appending the line

TZ='Asia/Shanghai'; export TZ

to the file '.profile' in your home directory; then log out and log in again.

Here is that TZ value again, this time on standard output so that you

can use the /usr/bin/tzselect command in shell scripts:

Asia/Shanghai

[root@localhost Asia]# date

Thu May 12 18:13:40 CST 2016

[root@localhost Asia]# clock

Thu 12 May 2016 06:13:44 PM CST -0.396667 seconds

[root@localhost Asia]#

#加入全局环境变量

vi /etc/profile

export TZ='CST+0'

#硬件和系统时间同步(可选)

date -s 14:20:50

hwclock  --show 或者

clock  --show

设置硬件时间

hwclock --set --date="06/18/14 14:55" (月/日/年时:分:秒)或者# clock --set --date="06/18/14 14:55" (月/日/年时:分:秒)

硬件时钟与系统时钟同步:

# hwclock --hctosys 或者 # clock --hctosys  hc代表硬件时间,sys代表系统时间,即用硬件时钟同步系统时钟

系统时钟和硬件时钟同步:

# hwclock --systohc或者# clock --systohc  即用系统时钟同步硬件时钟

修改配置文件来修改时区

CentOS 6搭建局域网NTP服务器

#########服务器:#########

一、时间服务器端配置

修改配置文件vi /etc/ntp.conf

1、客户端选择

1)允许任何客户端

restrict default nomodify

2)允许特定客户端

restrict 192.168.18.0 mask 255.255.255.0 nomodify

server 192.168.0.84

*二选一

2、指定时间服务器

1)指定特定时间服务器,注释掉默认server服务器

server time-b.nist.gov

2)开启本地时间服务器,上述外网time-b.nist.gov失效时,内网充当时间服务器。

server 127.127.1.0 # local clock

fudge 127.127.1.0 stratum 10

3、重启时间服务

service ntpd restart

4、根据实际需求设置防火墙端口

udp 123

#########客户端#########

一、linux客户端

1、linux客户端修改配置文件,注释掉其它时间服务器,指定内网时间服务器,重启ok。

vim /etc/ntp.conf

server x.x.x.x

2、客户端校验

ntpq -p查询上级时间服务器

ntpstat 查询状态

ntpdate

CentOS7配置时间和CentOS6搭建局域网NTP的更多相关文章

  1. centos6.7搭建局域网ntp服务器

    修改/etc/ntp.conf文件 restrict xxx nomodify notrap nopeer noquery             #xxx 此处配置本地IP地址restrict 12 ...

  2. 配置树莓派3和局域网NTP服务器实现内网时间校准

    一.配置局域网NTP服务器 1.安装ntp-4.2.8p5-win32-setup.exe 下载地址:https://www.meinbergglobal.com/english/sw/ntp.htm ...

  3. 大数据项目之_15_帮助文档_NTP 配置时间服务器+Linux 集群服务群起脚本+CentOS6.8 升级到 python 到 2.7

    一.NTP 配置时间服务器1.1.检查当前系统时区1.2.同步时间1.3.检查软件包1.4.修改 ntp 配置文件1.5.重启 ntp 服务1.6.设置定时同步任务二.Linux 集群服务群起脚本2. ...

  4. AIX配置时间服务器(NTP)

    xntpd是关于网络时间协议的守护进程,它遵循了因特网时间服务器的通用标准.在启动 xntpd 时, xntpd 会读取 /etc/ntp.conf 配置文件来确定网络中系统时钟服务器,以 ntp 服 ...

  5. Centos7安装Docker 基于Dockerfile 搭建httpd运行环境

    Centos7安装Docker 基于Dockerfile 搭建httpd运行环境 docker docker搭建 docker build 本文档完成目标内容如下 使用Docker搭建http服务器一 ...

  6. centos7系统下 docker 环境搭建

    运行环境: VMware Workstation Pro 在虚拟机中安装centos7系统, 选择最小安装, 网络连接方式选择的桥接(与宿主机在同一IP段)centos7一定要安装64位, docke ...

  7. [Kubernetes]CentOS7下Etcd集群搭建

    Etcd简要介绍 Etcd是Kubernetes集群中的一个十分重要的组件,用于保存集群所有的网络配置和对象的状态信息 Etcd构建自身高可用集群主要有三种形式: ①静态发现: 预先已知 Etcd 集 ...

  8. CentOS7配置网络ip地址

    CentOS7配置网络ip地址 CentOS 7.x版本中没有ifcfg-eth0文件 只有ifcfg-ens33文件(为了符合日常习惯) (1)将文件ifcfg-ens33重命名为ifcfg-eth ...

  9. Linux yum的配置 , python环境管理, nginx搭建简单学习

    Linux yum的配置 , python环境管理, nginx搭建简单学习 一丶配置yum的数据仓库 ### yum 工具, 方便,自行解决软件之间的依赖关系. # 配置yum源仓库 (可以使用,清 ...

随机推荐

  1. 4G DTU采用的4G通信模块介绍

      4g通信模块一种基于4G网络进行数据传输的工业级通讯终端,其主要作用是将采集到的传感器数据.仪表数据,传输至服务器/上位机.监控中心.众山研发生产的4g无线通讯设备--4G DTU是一款物联网数据 ...

  2. MONGODB01 - Prematurely reached end of stream 错误定位及修复

    最近项目在运行过程,当一段时间没有操作mongo,再次访问报错,如下 org.springframework.data.mongodb.UncategorizedMongoDbException: P ...

  3. python框架Django中MTV框架之VIew(业务控制器)

    MTV框架之VIew(业务控制器) 关注公众号"轻松学编程"了解更多. 1.什么是视图 视图层=路由表(urls.py)+视图函数(views.py) 其角色相当于MVC中的Con ...

  4. 读书笔记:《数据结构与算法分析Java语言描述》

    目录 第 3 章 表.栈和队列 3.2 表 ADT 3.2.1 表的简单数组实现 3.2.2 简单链表 3.3 Java Collections API 中的表 3.3.1 Collection 接口 ...

  5. 基于synchronized锁的深度解析

    1. 问题引入 小伙伴们都接触过线程,也都会使用线程,今天我们要讲的是线程安全相关的内容,在这之前我们先来看一个简单的代码案例. 代码案例: /** * @url: i-code.online * @ ...

  6. Ubuntu 18.04 Java JDK/JRE 安装命令

    安装默认版本 sudo apt install default-jdk Java 8 sudo apt install openjdk-8-jdk 如果我们在服务器上安装了多个Java版本,我们可以使 ...

  7. 解决git push出现error: failed to push some refs to 错误

    错误截图 背景 码云上创建了空项目 本地项目绑定了远程仓库,尝试git push,然后报了错 解决办法 使用强制命令git pull origin master --allow-unrelated-h ...

  8. JavaScript封装一个函数效果类似内置方法concat()

    JavaScript封装一个函数效果类似内置方法concat() 首先回忆concat()的作用: concat() 方法用于连接两个或多个数组.该方法不会改变现有的数组,而仅仅会返回被连接数组的一个 ...

  9. redmine系统部署

    1.下载railsinstaller.注意版本,我用的是老版的 railsinstaller-3.2.0.exe 下载地址 http://railsinstaller.org/en 国外的网站比较慢, ...

  10. abp(net core)+easyui+efcore实现仓储管理系统——出库管理之六(五十五)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统--ABP总体介绍(一) abp(net core)+ ...