我们在安装Linux服务器的时候,可能会为了图方便,直接安装为系统默认的时区和语言,比如英语。但是,当系统安装启动后,我们会发现系统的时间是12小时制,这个与我们习惯的24小时制有一定的区别,看系统时间的时候可能会感觉有点怪怪的。所以,这个时候,我们就需要将系统的时区修改为5) Asia -  9) China - 1) Beijing Time。

# date
Sun Apr 17 00:49:40 EDT 2022# tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.1) Africa2) Americas3) Antarctica4) Arctic Ocean5) Asia6) Atlantic Ocean7) Australia8) Europe9) 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) Palestine2) Armenia               19) Japan                 36) Philippines3) Azerbaijan            20) Jordan                37) Qatar4) Bahrain               21) Kazakhstan            38) Russia5) Bangladesh            22) Korea (North)         39) Saudi Arabia6) Bhutan                23) Korea (South)         40) Singapore7) Brunei                24) Kuwait                41) Sri Lanka8) Cambodia              25) Kyrgyzstan            42) Syria9) China                 26) Laos
10) Cyprus                27) Lebanon               44) Tajikistan
11) East Timor                                      45) Thailand
12) Georgia               29) Malaysia              46) Turkmenistan30) 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
#? 1The following information has been given:ChinaBeijing TimeTherefore TZ='Asia/Shanghai' will be used.
Local time is now:      Sun Apr 17 12:50:04 CST 2022.
Universal Time is now:  Sun Apr 17 04:50:04 UTC 2022.
Is the above information OK?
1) Yes
2) No
#? 1You can make this change permanent for yourself by appending the lineTZ='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# rm /etc/localtime
rm: remove symbolic link ‘/etc/localtime’? y# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime# date
Sun Apr 17 12:50:30 CST 2022

如果我们需要同步本地服务器的时间,可以通过与中国国家授时中心的NTP服务器来进行时间同步。

# yum install -y ntpdate
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.ustc.edu.cn* updates: mirrors.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package ntpdate.x86_64 0:4.2.6p5-29.el7.centos.2 will be installed
--> Finished Dependency ResolutionDependencies Resolved=========================================================================================================================================================Package                          Arch                            Version                                            Repository                     Size
=========================================================================================================================================================
Installing:ntpdate                          x86_64                          4.2.6p5-29.el7.centos.2                            base                           87 kTransaction Summary
=========================================================================================================================================================
Install  1 PackageTotal download size: 87 k
Installed size: 121 k
Downloading packages:
ntpdate-4.2.6p5-29.el7.centos.2.x86_64.rpm                                                                                        |  87 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionInstalling : ntpdate-4.2.6p5-29.el7.centos.2.x86_64                                                                                                1/1 Verifying  : ntpdate-4.2.6p5-29.el7.centos.2.x86_64                                                                                                1/1 Installed:ntpdate.x86_64 0:4.2.6p5-29.el7.centos.2                                                                                                               Complete!// 中国国家授时中心的NTP官方服务器
# ntpdate -u ntp.ntsc.ac.cn
17 Apr 12:59:04 ntpdate[1348]: adjust time server 114.118.7.161 offset -0.001488 sec

【Linux】Linux服务器时区设置和时间同步相关推荐

  1. Linux 时间、时区设置

    Linux 时间.时区设置 CentOS 7: Chrony https://chrony.tuxfamily.org/index.html https://www.cnblogs.com/zydev ...

  2. linux est 时间,Linux中的时区设置

    我通过将zoneinfo文件复制到/ etc / localtime,在我的Linux机器上将时区设置为GMT 6,但是date命令仍然将时间显示为UTCtime-6.任何人都可以向我解释这种行为吗? ...

  3. Linux服务器时区设置

    ​ 首先要知道有Linux服务器有2种时钟类型 1.硬件时钟(RTC time) 可以通过hwcolock或clock命令操作硬件时钟通过date修改时间,当系统下次重启时,系统时钟还会从硬件时钟去取 ...

  4. linux下时区设置和时间同步

    一.时区设置: [root@master ~]# tzselect Please identify a location so that time zone rules can be set corr ...

  5. linux云服务器常用设置

    前面的话 由于在云服务器上配置自己的网站,将Linux里的常用设置记录如下 更改shell 默认地, ubuntu系统默认的shell是dash,但更常用的shell是bash 通过下面命令可以将da ...

  6. linux ftp服务器防火墙设置,【许望】linux(RHEL) 下 FTP(vsftpd) 服务器的防火墙配置...

    linux(RHEL) 下 FTP(vsftpd) 服务器的防火墙配置 FTP服务器在与客户端通讯的过程中会用到两个端口,一个是控制端口,通常是21/tcp,一个是数据端口,运行在主动模式下的FTP服 ...

  7. linux ftp服务器防火墙设置,Linux 为FTP 服务器添加iptables规则--案例分析

    一.故障描述 由于开发提出需求,为他们搭建内部Linux习下ftp服务器,搭建好后,提交给他们,测试可以正常使用.后来过了一段时间后,有一天无法登陆了.于是去ftp主机上检查问题,ftp的配置文件没有 ...

  8. Linux web服务器初始化设置

    1.Linux系统安装   软件包安装    Development Libraries    Development Tools    Editors    Base    System Tools ...

  9. linux修改服务器时区为上海

    同事用默认官方的镜像给开发安装好系统之,开发同事发现时区是utc 需要修改成cst  操作如下 tzselect<<EOF5911EOFyes |cp /usr/share/zoneinf ...

最新文章

  1. java爬树方法_Java-grandMother.java
  2. 输入一行字符,判断单词数
  3. 标定板标定和九点标定的区别_射频导纳物位计的标定方法
  4. RocketMQ源码解析:Filtersrv
  5. Java表示0到200的质因数_java记——循环 求一个数的所有质因数
  6. [Java基础]List集合子类特点
  7. 《人月神话》阅读笔记03
  8. nodejs 最简单的文件接收
  9. 游戏match(【CCF】NOI Online能力测试2 提高组第三题 )
  10. 搭建内网文件共享服务器,如何搭建共享服务器实现办公室文件共享?
  11. 根据经纬度查询附近地点
  12. 人工神经网络预测血药浓度计算公式
  13. curl调用接口方法
  14. scratch少儿编程实例教程(模拟动画片项目式教学)——幻影龙动画编程
  15. 细数APDL中的流程控制命令
  16. QTableView 基本使用
  17. 江南大学计算机科学考研书目,2019江南大学计算机考研初试科目、参考书目、复试线...
  18. Firebase 教程 —— 一个实时聊天室
  19. python版权问题_最令人头疼的Python问题
  20. 【转】五分钟理解什么是接口

热门文章

  1. Centos7 内存、磁盘释放空间
  2. 心随手动,驱动短视频热潮的引擎
  3. python getattribute方法_Python:__ getattribute__方法和描述符
  4. 机器学习(十三)k-svd字典学习
  5. 10-131 4-3 查询速度低于任何PC的便携式电脑
  6. VC++仿QQ自动伸缩窗口
  7. Android基础入门教程——10.9 WallpaperManager(壁纸管理器)
  8. MySQL常见的高可用架构
  9. php单例模式代码,PHP 单例模式实现
  10. linux修改是时间格式,linux修改时区,时间格式