[不花钱站长]:从免费域名开始[0元] Oracle永久免费VPS[0元] VPS环境搭建免费脚本[0元] 秒变大盘挂载免费网盘[0元] 小白免费采集器1天500W[0元] CF免费DNS+CDN服务[0元]
[零基础网赚]:撸本站免费源码[0元] 网站强引免费蜘蛛法[0元] 图片视频文件免费存储[0元] 外链轻松发布免费友链[0元] 入坑免费教程学习源代码[0元] 网上百种+赚钱联盟推荐[?元]

↑↑VPS推荐网 WWW.VPS.COM.IN 稳定 便宜 免备案↑↑


您现在的位置是:首页 > 全球[VPS测评] >  免费VPS,国外永久免费VPS

VPS修改时区方法→怎样修改linux云服务器系统的时区?

全球[VPS测评]来源:VPS推荐网点击:552
【性价之王】【线路之王】【价格之王】【配置之王】
【免费之王】【香港首推】【梯子之王】【独服之王】
VPS修改时区方法→怎样修改linux云服务器系统的时区?前言

如果你的 Linux 系统时区配置不正确,必需要手动调整到正确的当地时区。NTP 对时间的同步处理只计算当地时间与 UTC 时间的偏移量,因此配置一个 NTP 对时间进行同步并不能解决时区不正确的问题。所以大家在用了国外云计算服务商如 Microsoft Azure 或其它 VPS、虚拟机时,需要注意是否与中国大陆的时区一致。

教程

查看Linux当前时区

你可以使用如下命令非常容易地就查看到 Linux 系统的当前时区:

root@mcheng:~# dateMon 09 May 2022 02:24:05 AM EDTroot@mcheng:~# ls -l /etc/localtimelrwxrwxrwx 1 root root 30 Aug 16 2021 /etc/localtime -> /usr/share/zoneinfo/US/Easternroot@mcheng:~# dateMon 09 May 2022 02:24:05 AM EDTroot@mcheng:~# ls -l /etc/localtimelrwxrwxrwx 1 root root 30 Aug 16 2021 /etc/localtime -> /usr/share/zoneinfo/US/Easternroot@mcheng:~# dateMon 09 May 2022 02:24:05 AM EDTroot@mcheng:~# ls -l /etc/localtimelrwxrwxrwx 1 root root 30 Aug 16 2021 /etc/localtime -> /usr/share/zoneinfo/US/Eastern

获取时区TZ值

要更改 Linux 系统时区首先得获知你所当地时区的 TZ 值,使用 tzselect 命令即可查看并选择已安装的时区文件。

执行 tzselect 命令:

root@DMIT-SIeyeophVm:~# tzselectPlease identify a location so that time zone rules can be set correctly.Please select a continent, ocean, "coord", or "TZ".1) Africa 7) Europe2) Americas 8) Indian Ocean3) Antarctica 9) Pacific Ocean4) Asia 10) coord - I want to use geographical coordinates.5) Atlantic Ocean 11) TZ - I want to specify the time zone using the Posix TZ format.6) Australia#? 4 //通过向导选择你所在大洲Please select a country whose clocks agree with yours.1) Afghanistan 10) Cyprus 19) Japan 28) Macau 37) Qatar 46) Turkmenistan2) Armenia 11) East Timor 20) Jordan 29) Malaysia 38) Russia 47) United Arab Emirates3) Azerbaijan 12) Georgia 21) Kazakhstan 30) Mongolia 39) Saudi Arabia 48) Uzbekistan4) Bahrain 13) Hong Kong 22) Korea (North) 31) Myanmar (Burma) 40) Singapore 49) Vietnam5) Bangladesh 14) India 23) Korea (South) 32) Nepal 41) Sri Lanka 50) Yemen6) Bhutan 15) Indonesia 24) Kuwait 33) Oman 42) Syria7) Brunei 16) Iran 25) Kyrgyzstan 34) Pakistan 43) Taiwan8) Cambodia 17) Iraq 26) Laos 35) Palestine 44) Tajikistan9) China 18) Israel 27) Lebanon 36) Philippines 45) Thailand#? 9 //通过向导选择你所在国家Please select one of the following time zone regions.1) Beijing Time2) Xinjiang Time#? 1 //通过向导选择你所在城市The following information has been given: China Beijing TimeTheore TZ='Asia/Shanghai' will be used.Selected time is now: Mon May 9 14:22:16 CST 2022.Universal Time is now: Mon May 9 06:22:16 UTC 2022.Is the above information OK?1) Yes2) No#? 1 //通过导向确认时间是否正确You can make this change permanent for yourself by appending the line TZ='Asia/Shanghai'; export TZto 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 youcan use the /usr/bin/tzselect command in shell scripts:Asia/Shanghai //确认时区信息root@DMIT-SIeyeophVm:~# tzselectPlease identify a location so that time zone rules can be set correctly.Please select a continent, ocean, "coord", or "TZ".1) Africa 7) Europe2) Americas 8) Indian Ocean3) Antarctica 9) Pacific Ocean4) Asia 10) coord - I want to use geographical coordinates.5) Atlantic Ocean 11) TZ - I want to specify the time zone using the Posix TZ format.6) Australia#? 4 //通过向导选择你所在大洲Please select a country whose clocks agree with yours.1) Afghanistan 10) Cyprus 19) Japan 28) Macau 37) Qatar 46) Turkmenistan2) Armenia 11) East Timor 20) Jordan 29) Malaysia 38) Russia 47) United Arab Emirates3) Azerbaijan 12) Georgia 21) Kazakhstan 30) Mongolia 39) Saudi Arabia 48) Uzbekistan4) Bahrain 13) Hong Kong 22) Korea (North) 31) Myanmar (Burma) 40) Singapore 49) Vietnam5) Bangladesh 14) India 23) Korea (South) 32) Nepal 41) Sri Lanka 50) Yemen6) Bhutan 15) Indonesia 24) Kuwait 33) Oman 42) Syria7) Brunei 16) Iran 25) Kyrgyzstan 34) Pakistan 43) Taiwan8) Cambodia 17) Iraq 26) Laos 35) Palestine 44) Tajikistan9) China 18) Israel 27) Lebanon 36) Philippines 45) Thailand#? 9 //通过向导选择你所在国家Please select one of the following time zone regions.1) Beijing Time2) Xinjiang Time#? 1 //通过向导选择你所在城市The following information has been given: China Beijing TimeTheore TZ='Asia/Shanghai' will be used.Selected time is now: Mon May 9 14:22:16 CST 2022.Universal Time is now: Mon May 9 06:22:16 UTC 2022.Is the above information OK?1) Yes2) No#? 1 //通过导向确认时间是否正确You can make this change permanent for yourself by appending the line TZ='Asia/Shanghai'; export TZto 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 youcan use the /usr/bin/tzselect command in shell scripts:Asia/Shanghai //确认时区信息root@DMIT-SIeyeophVm:~# tzselectPlease identify a location so that time zone rules can be set correctly.Please select a continent, ocean, "coord", or "TZ".1) Africa 7) Europe2) Americas 8) Indian Ocean3) Antarctica 9) Pacific Ocean4) Asia 10) coord - I want to use geographical coordinates.5) Atlantic Ocean 11) TZ - I want to specify the time zone using the Posix TZ format.6) Australia#? 4 //通过向导选择你所在大洲Please select a country whose clocks agree with yours.1) Afghanistan 10) Cyprus 19) Japan 28) Macau 37) Qatar 46) Turkmenistan2) Armenia 11) East Timor 20) Jordan 29) Malaysia 38) Russia 47) United Arab Emirates3) Azerbaijan 12) Georgia 21) Kazakhstan 30) Mongolia 39) Saudi Arabia 48) Uzbekistan4) Bahrain 13) Hong Kong 22) Korea (North) 31) Myanmar (Burma) 40) Singapore 49) Vietnam5) Bangladesh 14) India 23) Korea (South) 32) Nepal 41) Sri Lanka 50) Yemen6) Bhutan 15) Indonesia 24) Kuwait 33) Oman 42) Syria7) Brunei 16) Iran 25) Kyrgyzstan 34) Pakistan 43) Taiwan8) Cambodia 17) Iraq 26) Laos 35) Palestine 44) Tajikistan9) China 18) Israel 27) Lebanon 36) Philippines 45) Thailand#? 9 //通过向导选择你所在国家Please select one of the following time zone regions.1) Beijing Time2) Xinjiang Time#? 1 //通过向导选择你所在城市The following information has been given: China Beijing TimeTheore TZ='Asia/Shanghai' will be used.Selected time is now: Mon May 9 14:22:16 CST 2022.Universal Time is now: Mon May 9 06:22:16 UTC 2022.Is the above information OK?1) Yes2) No#? 1 //通过导向确认时间是否正确You can make this change permanent for yourself by appending the line TZ='Asia/Shanghai'; export TZto 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 youcan use the /usr/bin/tzselect command in shell scripts:Asia/Shanghai //确认时区信息

tzselect 最终将以 Posix TZ 格式(例如 Asia/Shanghai)输出你所在的时区值,将此记录下来,然后执行:

TZ='Asia/Shanghai'; export TZTZ='Asia/Shanghai'; export TZTZ='Asia/Shanghai'; export TZ

执行完成之后需要重新登录系统或刷新 ~/.bashrc 生效:

ource ~/.bashrcource ~/.bashrcource ~/.bashrc

检验系统当前时间:

root@DMIT-SIeyeophVm:~# dateMon 09 May 2022 02:28:56 PM CSTroot@DMIT-SIeyeophVm:~# dateMon 09 May 2022 02:28:56 PM CSTroot@DMIT-SIeyeophVm:~# dateMon 09 May 2022 02:28:56 PM CST

然后在执行:

sudo rm -f /etc/localtimesudo ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtimesudo rm -f /etc/localtimesudo ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtimesudo rm -f /etc/localtimesudo ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

使用Systemd更改Linux系统时区

如果你使用的 Linux 系统使用 Systemd,还可以使用 timedatectl 命令来更改 Linux 系统范围的时区。在 Systemd 下有一个名为 systemd-timedated 的系统服务负责调整系统时钟和时区,我们可以使用 timedatectl 命令对此系统服务进行配置:

[root@lax ~]# sudo timedatectl set-timezone 'Asia/Shanghai'[root@lax ~]# datetimecal Local time: Mon 2022-05-09 15:10:51 CST Universal time: Mon 2022-05-09 07:10:51 UTC RTC time: Mon 2022-05-09 07:08:53 Time zone: Asia/Shanghai (CST, +0800) NTP enabled: yesNTP synchronized: yes RTC in local TZ: no DST active: n/a[root@lax ~]# dateMon May 9 15:11:14 CST 2022[root@lax ~]# sudo timedatectl set-timezone 'Asia/Shanghai'[root@lax ~]# datetimecal Local time: Mon 2022-05-09 15:10:51 CST Universal time: Mon 2022-05-09 07:10:51 UTC RTC time: Mon 2022-05-09 07:08:53 Time zone: Asia/Shanghai (CST, +0800) NTP enabled: yesNTP synchronized: yes RTC in local TZ: no DST active: n/a[root@lax ~]# dateMon May 9 15:11:14 CST 2022[root@lax ~]# sudo timedatectl set-timezone 'Asia/Shanghai'[root@lax ~]# datetimecal Local time: Mon 2022-05-09 15:10:51 CST Universal time: Mon 2022-05-09 07:10:51 UTC RTC time: Mon 2022-05-09 07:08:53 Time zone: Asia/Shanghai (CST, +0800) NTP enabled: yesNTP synchronized: yes RTC in local TZ: no DST active: n/a[root@lax ~]# dateMon May 9 15:11:14 CST 2022
[免费VPS]历史优惠活动内容
  • #教程#甲骨文(Oracle Cloud)免费VPS申请教程,需要信用卡,虚拟卡会翻车
  • #免费VPS#日主机:美国三网CN2 GIA直连,年付99元起,免费10G防御,附测评
  • #免费VPS#伏羲云:美国CN2线路低19元/月,日本/香港直连VPS月付35起,免费试用2
  • #免费VPS#goorm:免费韩国、美国NAT VPS,速度一般,10分钟休眠
  • #羊毛#EUserv:德国机房永久免费VPS,只提供IPv6,可配合CloudFlare做站
  • #来至LOC#用白票女友的思维申请EUserv免费VPS,不成功你来打我
  • #领免费VPS#青云互联:2核/2G/20G SSD/500G流量/5M/香港直连/月付19
  • #投稿#Vmshell:香港高速CMI线路,8折优惠,免费VPS测试,3日内退款,新增双IP
  • #免费VPS#FTLcloud:4核/4G/50G/10Mbps不限流量/圣何塞/首月0元,
  • #免费VPS#mlklink:1核/512M/10G SSD/1T/500Mbps/洛杉矶/
  • #免费VPS#腾讯云:专属用户领取一年轻量,2核/4G/60G SSD/1T/6Mbps/国
  • #免费VPS#腾讯云:4核/4G/80G SSD/1200G流量/8Mbps/国内轻量/免费
  • 介绍一下免费VPS及国外免费VPS
  • #免费VPS#adman新用户首次付款减500卢布 免费用一个月
  • #免费VPS#华为云抽一个月免费VPS,可选择windows系统
  • #真实测评#华为云抽奖得2核4G免费VPS测评
  • skysilk免费VPS使用12个月教程
  • skysilk的免费VPS安装bbr教程
  • #真实测评#skysilk免费VPS,1美元VPS套餐测评数据
  • #免费VPS#llrry:2CPU 256M内存 10G硬盘 20Mbps不限流量 共享IP
  • #免费VPS#2019年最新国外免费一个月的VPS
  • #免费VPS#Azure:1G内存套餐免费使用1年,可选择香港、日本、新加坡等机房,可选wi
  • #教程#甲骨文(Oracle Cloud)免费VPS申请教程,需要信用卡,虚拟卡会翻车
  • #免费VPS#日主机:美国三网CN2 GIA直连,年付99元起,免费10G防御,附测评
  • #免费VPS#伏羲云:美国CN2线路低19元/月,日本/香港直连VPS月付35起,免费试用2
  • #免费VPS#goorm:免费韩国、美国NAT VPS,速度一般,10分钟休眠
  • #羊毛#EUserv:德国机房永久免费VPS,只提供IPv6,可配合CloudFlare做站
  • #来至LOC#用白票女友的思维申请EUserv免费VPS,不成功你来打我
  • #领免费VPS#青云互联:2核/2G/20G SSD/500G流量/5M/香港直连/月付19
  • #投稿#Vmshell:香港高速CMI线路,8折优惠,免费VPS测试,3日内退款,新增双IP
  • #免费VPS#FTLcloud:4核/4G/50G/10Mbps不限流量/圣何塞/首月0元,
  • #免费VPS#mlklink:1核/512M/10G SSD/1T/500Mbps/洛杉矶/
  • #免费VPS#腾讯云:专属用户领取一年轻量,2核/4G/60G SSD/1T/6Mbps/国
  • #免费VPS#腾讯云:4核/4G/80G SSD/1200G流量/8Mbps/国内轻量/免费
  • #免费VPS#mlklink:1核/512M/10G SSD/1T/500Mbps/洛杉矶/
  • #免费VPS#腾讯云:专属用户领取一年轻量,2核/4G/60G SSD/1T/6Mbps/国
  • #免费VPS#腾讯云:4核/4G/80G SSD/1200G流量/8Mbps/国内轻量/免费
  • #投稿#Vmshell:香港高速CMI线路,8折优惠,免费VPS测试,3日内退款,新增双IP
  • #免费VPS#FTLcloud:4核/4G/50G/10Mbps不限流量/圣何塞/首月0元,
  • #免费VPS#mlklink:1核/512M/10G SSD/1T/500Mbps/洛杉矶/
  • #免费VPS#腾讯云:专属用户领取一年轻量,2核/4G/60G SSD/1T/6Mbps/国
  • #免费VPS#腾讯云:4核/4G/80G SSD/1200G流量/8Mbps/国内轻量/免费
  • VPS主机福利–国外免费vps主机、试用vps主机推荐
  • VPS主机福利–国外免费vps主机、试用vps主机推荐
  • VPS主机福利–国外免费vps主机、试用vps主机推荐
  • VPS主机福利–国外免费vps主机、试用vps主机推荐
  • VPS主机福利–国外免费vps主机、试用vps主机推荐
  • VPS主机福利–国外免费vps主机、试用vps主机推荐
  • VPS主机福利–国外免费vps主机、试用vps主机推荐
  • VPS主机福利–国外免费vps主机、试用vps主机推荐
  • VPS主机福利–国外免费vps主机、试用vps主机推荐
  • VPS主机福利–国外免费vps主机、试用vps主机推荐
  • VPS主机福利–国外免费vps主机、试用vps主机推荐
  • VPS主机福利–国外免费vps主机、试用vps主机推荐
  • digitalocean-9月免费赠送25美元/够用5个月免费VPS
  • digitalocean-9月免费赠送25美元/够用5个月免费VPS
  • turnkeyinternet→免费vps/kvm/8g内存/8核/80gSSD/1g端口/
  • 免费VPS 国外免费vps 国外永久免费vps
  • 【最新版】 那些可以白“女票”的“免费VPS” 海外版(国外免费VPS)推荐
  • 【最新版】 那些可以白“女票”的“免费VPS” 海外版(国外免费VPS)推荐

  • 猜你可能想看的VPS


    转载请注明原文地址:http://140.238.13.167:12355/read-164485.html

    下一篇       上一篇