首先查看时间发现和百度的时间不一样

[root@www ~]# date
Wed 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 设置时区为上海

2.1  然后通过tzselect命令来修改时区

执行tzselect命令 --> 选择Asia --> 选择China --> 选择Beijing — 选择yes ,
执行完tzselect命令选择时区后,时区并没有更改,将export TZ=Asia/Shanghai   添加到/etc/profile文 件中去,然后退出并重新登陆即可。

sed -i '$a\export TZ=Asia/Shanghai' /etc/profile && source /etc/profile && date

下面是执行过程

[root@www ~]# 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: Wed Dec 5 13:57:48 CST 2018.
Universal Time is now: Wed Dec 5 05:57:48 UTC 2018.
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@www ~]# sed -i '$a\export TZ=Asia/Shanghai' /etc/profile

[root@www ~]# sed -i '$d' /etc/profile

查看时间已经正常

[root@www ~]# date
Wed Dec 5 14:11:49 CST 2018

https://blog.csdn.net/weixin_38323645/article/details/83046172

vmware虚拟机设置时区、时间的更多相关文章

  1. 给vmware虚拟机设置Ip,使用xshell远程连接Centos

    参考下面两位的分享才弄好,发表之前先对原作者表示感谢! 给Centos配置网络以及使用xshell远程连接Centos http://www.cnblogs.com/fuly550871915/p/4 ...

  2. VMWare虚拟机设置固定ip上网方法

    转自:http://blog.csdn.net/cyberrusher/article/details/7269795 1. 在VMWare工具栏中打开:编辑--->虚拟机网络编辑器, 打开VM ...

  3. Vmware虚拟机设置静态IP地址

    一.安装好虚拟后在菜单栏选择编辑→ 虚拟网络编辑器,打开虚拟网络编辑器对话框,选择Vmnet8 Net网络连接方式,随意设置子网IP,点击NAT设置页面,查看子网掩码和网关,后面修改静态IP会用到. ...

  4. VMWare 虚拟机设置网络访问

    使用桥接模式 将本机IP设置为和虚拟机IP在同一个可以上网的网段中

  5. vmware 虚拟机设置 redhat 桥接模式

    1.设置 vmware 网络模式 2.设置 linux 网络模式

  6. Vmware虚拟机设置主机端口映射

    转载自:https://blog.csdn.net/Mrqiang9001/article/details/80820321

  7. VMware虚拟机怎么从U盘启动

    VMware虚拟机怎么从U盘启动 发布时间:2016-01-12 18:50发布者:系统城-xtcjh浏览数:41951 VMware Workstation虚拟机可以安装各种操作系统,很多用户就想在 ...

  8. VMware中Linux系统时间与主机同步以及时区设置

    网络上有各种资料,但最简单的一种方法就是修改虚拟机的配置文件 *.vmx .修改 tools.syncTime = "FALSE" 为 tools.syncTime = " ...

  9. VMware 12安装虚拟机Mac OS X 10.10使用小技巧(虚拟机Mac OS X 10.10时间设置,虚拟机Mac OS X 10.10通过代理上网,Mac OS X 10.10虚拟机优化,VMware虚拟机相互复制)

    1:修改Mac OS 系统时间 2:Mac OS系统 通过代理上网 VMware 12安装Mac OS X 10.10虚拟机优化心得 虚拟显卡硬伤,所以必须要优化下才能用,优化的原则就是能精简的精简, ...

随机推荐

  1. hive创建分区表

    #创建分区表CREATE TABLE if not exists data_center.test_partition (id int,name string,age int)PARTITIONED ...

  2. JavaWEB开发05_Bootstrap

    上次课内容:什么JQ : write less do more 写更少的代码,做更多的事情 javascript函数库 基本选择器: ​ ID选择器: #ID名称 ​ 类选择器: .类名 ​ 元素选择 ...

  3. JavaScript基础——JavaScript函数(笔记)

    avaScript 函数(笔记) JavaScript 是函数式编程语言,在JavaScript脚本中可以随处看到函数,函数构成了JavaScript源代码的主体. 一.定义函数 定义函数的方法有两种 ...

  4. python 的pip安装

    C:\Python27>C:\Python27\Scripts\pip.exe install gevent gevent是安装的模块名

  5. jquery text选择器 语法

    jquery text选择器 语法 作用::text 选择器选取类型为 text 的 <input> 元素.大理石平台检定规程 语法:$(":text") jquery ...

  6. idea2018.3.6安装与破解教程(亲测可用、破解到2100年)

    最近,帮室友进行idea安装,之前自己安装借鉴的博客已404,在网上找了好几个都无效,想着总结一份备用. 此博客是又找了一台电脑,边安装边写的. 目录 (已安装好的,可以直接看idea2018.3.6 ...

  7. JS框架_(Typed.js)彩色霓虹灯发光文字动画

    百度云盘 传送门 密码:8oei 发光文字动画效果: <!doctype html> <html> <head> <meta charset="ut ...

  8. zabbix服务端连接客户端报错Received empty response from Zabbix Agent at [192.168.10.105]. Assuming that agent dropped connection because of access permissions

    这是zabbix WEB报的问题:Received empty response from Zabbix Agent at [192.168.10.105]. Assuming that agent ...

  9. 在mac中,npm安装或者卸载失败,提示没有权限

    在终端输入 sudo chown -R $USER /usr/local 输入开机密码

  10. web 多屏互动显示方案

    1 基于 local storage 实现的信息传递 相关插件 lsbridge.js https://github.com/krasimir/l... 且项目中有非常简单易懂的示例你需要了解的一些关 ...