查看服务器时间及所在时区

[root@localhost ~]# date -R
Fri, 07 Dec 2018 04:38:28 -0500

修改时区

先使用 tzselect 根据提示选择所在地区,最终生成时区

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.

然后编辑 /etc/profile 文件,添加 TZ='Asia/Shanghai'; export TZ,编辑完成后保存,运行 source /etc/profile

再次使用 date -R 查看时间

Fri, 07 Dec 2018 17:42:28 +0800

同步时间

安装 ntpdate

[root@localhost ~]# yum install ntpdate -y

前往 http://www.ntp.org.cn 查询可用的NTP服务,同步时间

[root@localhost ~]# ntpdate cn.ntp.org.cn

如同步出现错误 no server suitable for synchronization found,可尝试使用

[root@localhost ~]# ntpdate -u cn.ntp.org.cn

或者将域名改为ip

centos修改时区并同步时间的更多相关文章

  1. centos修改时区,同步时间

    查看当前系统时区 ls -la /etc/localtime 查看支持的时区 timedatectl list-timezones # 查看所有时区 timedatectl list-timezone ...

  2. Linux修改时区以及同步时间

    Centos7为例:修改时区 timedatectl list-timezones |grep Shanghai #查找中国时区的完整名称 Asia/Shanghai timedatectl set- ...

  3. centos7 修改时区,同步时间,Mysql修改时区

    查看时区 timedatectl status [root@localhost nova-back]# timedatectl status Local time: Thu 2019-05-23 15 ...

  4. centos 修改时区以及修正时间

    1.查看系统当前的时区 [app@127-0-0-1 shine]$ timedatectl Local time: Wed 2019-10-23 17:56:17 CST Universal tim ...

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

    怎么让CentOS集群自动同步时间?首先机器要连外网,这样才能从互联网上同步时间,这是首先要了解的.好了,主要的方法如下: 在除了运行ntpd之外的机器上,执行: [html] # chkconfig ...

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

    CentOS集群自动同步时间的一种方法 之前有篇日志是手动同步时间的 http://www.ahlinux.com/os/201304/202456.html 之所以这么干,是因为我们实验室的局域网只 ...

  7. Debian CentOS修改时区

    Debian修改时区: dpkg-reconfigure tzdata https://wiki.debian.org/TimeZoneChanges CentOS修改时区: timedatectl ...

  8. 修改centos服务器时区并同步最新时间

    rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime ntpdate cn.pool.ntp.org ...

  9. centos修改时区,设置时间

    在我们使用CentOS系统的时候,也许时区经常会出现问题,有时候改完之后还是会出错,下面我们就来学习一种方法来改变这个状况.如果没有安装,而你使用的是 CentOS系统 那使用命令 yum insta ...

随机推荐

  1. ==、Equals 、ReferenceEquals它们的异同

    链接 string foobar = "foobar"; string foobar2 = new StringBuilder().Append("foo"). ...

  2. Redis数据类型String

    set和get Set带空格的字符串值,这时候就需要使用双引号了,否则会出错 getset getset设置某个key-value,然后把设置之前的值返回来 incr,incrby 和 decr,de ...

  3. java.net.NoRouteToHostException: No route to host解决方法

    当访问192.168.10.98上的tomcat时候,tomcat日志异常 然后查看tomcat服务器上的防火墙 查看service层的防火墙: 至此问题解决: 永久关闭防火墙: 1.首先查看防火墙状 ...

  4. .net 本地日志的添加

    /// <summary> /// 写入日志到文本文件 /// </summary> /// <param name="userName">用户 ...

  5. js处理有序列表、js处理无序列表

    有序列表.无序列表 显示id为s下所有的li..隐藏同样 $("#s li").show();

  6. 各种Handler

    ArrayHandler:把结果集中的第一行数据转成对象数组. ArrayListHandler:把结果集中的每一行数据都转成一个对象数组,再存放到List中. BeanHandler:将结果集中的第 ...

  7. 业务线--node中间层做一个透传的项目

    1,node中间层总结 1,ejs引入vue的js,路由层(直接透传,自定义行的),比较浅层的一层 中间件的引入 ? ) { // 与rd约定,接口成功返回code===0,其余为失败 console ...

  8. [linux]主机访问虚拟机web服务(CentOS)

    目的为了实现主机和虚拟机的通信,访问虚拟机中架设的web服务.按理说通过虚拟机ip + web服务端口,即可在浏览器访问虚拟机的web服务.但是由于CentOS的防火墙问题,对应web端口无法访问.通 ...

  9. STL 中 使用迭代器删除元素的问题

    在vector中删除,大家都知道,直接erase的话,这种写法很有问题.因为erase(iter)之后iter指针就变成野指针了,此时继续iter++就会出问题. for(auto iter = v. ...

  10. GMA Round 1 三角形

    传送门 三角形 在△ABC中已知$sin2A+sin2B+sin2C=\frac{3\sqrt{3}}{2}$,求$cos\frac{A}{2}*cos\frac{B}{2}*cos\frac{C}{ ...