Redhat/CentOS 6.x/7.x修改系统时区

简介:

一,需求分析说明

    由于项目游戏发行海外版本,游戏里的活动需要按海外时间进行,而海外阿里云主机默认是以东8区北京时间计时,故需要更改时区和时间!

二,修改linux系统时区 

1,修改默认时区

#ln -sf /usr/share/zoneinfo/Europe/London /etc/timezone 

2,选择时区

#tzselect

运行命令会出现交互提示,以欧洲伦敦为例

[root@ALISG]# 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.
#? 8
Please select a country.
 1) land Islands      18) Greece            35) Norway
 2) Albania          19) Guernsey            36) Poland
 3) Andorra          20) Hungary            37) Portugal
 4) Austria          21) Ireland            38) Romania
 5) Belarus          22) Isle of Man        39) Russia
 6) Belgium          23) Italy            40) San Marino
 7) Bosnia & Herzegovina  24) Jersey            41) Serbia
 8) Britain (UK)      25) Latvia            42) Slovakia
 9) Bulgaria          26) Liechtenstein        43) Slovenia
10) Croatia          27) Lithuania            44) Spain
11) Czech Republic      28) Luxembourg        45) Sweden
12) Denmark          29) Macedonia            46) Switzerland
13) Estonia          30) Malta            47) Turkey
14) Finland          31) Moldova            48) Ukraine
15) France          32) Monaco            49) Vatican City
16) Germany          33) Montenegro
17) Gibraltar          34) Netherlands
#? 8

The following information has been given:
    Britain (UK)

Therefore TZ='Europe/London' will be used.
Local time is now:    Fri Jul 28 07:43:08 BST 2017.
Universal Time is now:    Fri Jul 28 06:43:08 UTC 2017.
Is the above information OK?
1) Yes
2) No
#? 1

You can make this change permanent for yourself by appending the line
    TZ='Europe/London'; 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:
Europe/London

选择时区然后 添加到配置文件最后:

#vim /etc/profile   
TZ='Europe/London';export TZ 
#cat /etc/sysconfig/clock 
ZONE="UTC" 
退出再登录查看时间 
#date 
2017年 07月 28日 星期四 08:07:30 BST 
3,写入硬件时钟 
#sudo hwclock -w 










本文转自 dyc2005 51CTO博客,原文链接:http://blog.51cto.com/dyc2005/1951722,如需转载请自行联系原作者
目录
相关文章
|
22天前
|
关系型数据库 MySQL Linux
卸载、下载、安装mysql(Linux系统centos7)
卸载、下载、安装mysql(Linux系统centos7)
|
3月前
|
Java Linux Shell
linux自动部署jar包,注册系统服务(基于Centos7)
linux自动部署jar包,注册系统服务(基于Centos7)
95 0
|
4月前
|
监控 安全 Linux
CentOS7下部署ARL资产侦察灯塔系统
CentOS7下部署ARL资产侦察灯塔系统
190 3
|
6天前
|
Linux
CentOS 系统常用命令详解
本文介绍了CentOS中11个常用的命令,包括`ls`(列出文件和目录)、`cd`(切换目录)、`pwd`(显示当前目录)、`mkdir`(创建目录)、`rm`(删除文件/目录)、`cp`(复制文件/目录)、`mv`(移动/重命名文件)、`cat`(查看文件内容)、`grep`(搜索文件内容)和`top`(显示系统进程信息)以及`yum`(包管理器)。学习这些命令能提升系统管理和操作效率。
14 0
|
25天前
|
Linux
centos7系统自动同步北京时间教程
通过以上步骤,你的CentOS 7系统会自动同步北京时间,并且设置时区为Asia/Shanghai。这将确保你的系统时间始终与北京时间保持同步。 买CN2云服务器,免备案服务器,高防服务器,就选蓝易云。百度搜索:蓝易云
33 4
|
2月前
|
关系型数据库 MySQL 数据库
虚拟机Linux-Centos系统网络配置常用命令+Docker 的常用命令
虚拟机Linux-Centos系统网络配置常用命令+Docker 的常用命令
52 0
|
2月前
|
关系型数据库 MySQL Linux
【VMware安装+centos 7Linux系统+MySQL安装】——在Linux系统中安装MySQL步骤,以及遇见的各种问题(如:vm两个虚拟网卡消失、vm网络适配器有感叹号等等)
【VMware安装+centos 7Linux系统+MySQL安装】——在Linux系统中安装MySQL步骤,以及遇见的各种问题(如:vm两个虚拟网卡消失、vm网络适配器有感叹号等等)
193 0
|
3月前
|
关系型数据库 Linux Shell
Centos系统上安装PostgreSQL和常用PostgreSQL功能
Centos系统上安装PostgreSQL和常用PostgreSQL功能
|
4月前
|
监控 Linux
CentOS7中使用一键脚本部署Librenms网络监控系统
CentOS7中使用一键脚本部署Librenms网络监控系统
109 1
|
4月前
|
安全 Linux Anolis
CentOS to 龙蜥衍生版 KeyarchOS 系统迁移体验 | 开发者说
CSDN 知名博主使用龙蜥衍生版 KeyarchOS 迁移使用体验,欢迎阅读。

热门文章

最新文章