在云服务器 ECS Linux 系统中,以 Centos6.5 为例,可以通过如下两种方式,修改系统时区:

可以使用命令 tzselect,修改时区。操作示例:

[root@localhost ~]# 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) east China - Beijing, Guangdong, Shanghai, etc.
2) Heilongjiang (except Mohe), Jilin
3) central China - Sichuan, Yunnan, Guangxi, Shaanxi, Guizhou, etc.
4) most of Tibet & Xinjiang
5) west Tibet & Xinjiang
#? 1 The following information has been given: China
east China - Beijing, Guangdong, Shanghai, etc. Therefore TZ='Asia/Shanghai' will be used.
Local time is now: Tue Jul 19 22:05:59 CST 2016.
Universal Time is now: Tue Jul 19 14:05:59 UTC 2016.
Is the above information OK?
1) Yes
2) No
#? yes
Please enter 1 for Yes, or 2 for 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

通过修改配置文件修改时区


也可以直接通过修改配置文件来变更时区。

  1. vi /etc/sysconfig/clock
  2. ZONE=Asia/Shanghai(查/usr/share/zoneinfo下面的文件)
  3. rm /etc/localtime
  4. ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@localhost zoneinfo]# ll /etc/localtime
-rw-r--r--. 1 root root 2819 Jun 29 2015 /etc/localtime
[root@localhost zoneinfo]# cat /etc/sysconfig/clock
ZONE="America/Los_Angeles"
UTC=true
ARC=false
[root@localhost ~]# cd /usr/share/zoneinfo
[root@localhost zoneinfo]# ll
总用量 560
drwxr-xr-x. 2 root root 4096 Jun 29 2015 Africa
drwxr-xr-x. 6 root root 4096 Jun 29 2015 America
drwxr-xr-x. 2 root root 4096 Jun 29 2015 Antarctica
drwxr-xr-x. 2 root root 4096 Jun 29 2015 Arctic
drwxr-xr-x. 2 root root 4096 Jun 29 2015 Asia
drwxr-xr-x. 2 root root 4096 Jun 29 2015 Atlantic
drwxr-xr-x. 2 root root 4096 Jun 29 2015 Australia
drwxr-xr-x. 2 root root 4096 Jun 29 2015 Brazil
drwxr-xr-x. 2 root root 4096 Jun 29 2015 Canada
-rw-r--r--. 1 root root 2102 Oct 30 2008 CET
drwxr-xr-x. 2 root root 4096 Jun 29 2015 Chile
-rw-r--r--. 1 root root 2294 Oct 30 2008 CST6CDT
-rw-r--r--. 2 root root 2411 Oct 30 2008 Cuba
-rw-r--r--. 1 root root 1876 Oct 30 2008 EET
-rw-r--r--. 2 root root 9307 Oct 30 2008 Egypt
-rw-r--r--. 2 root root 3533 Oct 30 2008 Eire
-rw-r--r--. 1 root root 118 Oct 30 2008 EST
-rw-r--r--. 1 root root 2294 Oct 30 2008 EST5EDT
drwxr-xr-x. 2 root root 4096 Jun 29 2015 Etc
drwxr-xr-x. 2 root root 4096 Jun 29 2015 Europe
-rw-r--r--. 1 root root 255 Oct 30 2008 Factory
-rw-r--r--. 7 root root 3661 Oct 30 2008 GB
-rw-r--r--. 7 root root 3661 Oct 30 2008 GB-Eire
-rw-r--r--. 10 root root 118 Oct 30 2008 GMT
-rw-r--r--. 10 root root 118 Oct 30 2008 GMT0
-rw-r--r--. 10 root root 118 Oct 30 2008 GMT-0
-rw-r--r--. 10 root root 118 Oct 30 2008 GMT+0
-rw-r--r--. 10 root root 118 Oct 30 2008 Greenwich
-rw-r--r--. 2 root root 1135 Oct 30 2008 Hongkong
-rw-r--r--. 1 root root 119 Oct 30 2008 HST
-rw-r--r--. 2 root root 1141 Oct 30 2008 Iceland
drwxr-xr-x. 2 root root 4096 Jun 29 2015 Indian
-rw-r--r--. 2 root root 1622 Oct 30 2008 Iran
-rw-r--r--. 1 root root 4082 Oct 30 2008 iso3166.tab
-rw-r--r--. 3 root root 2197 Oct 30 2008 Israel
-rw-r--r--. 2 root root 481 Oct 30 2008 Jamaica
-rw-r--r--. 2 root root 331 Oct 30 2008 Japan
-rw-r--r--. 2 root root 211 Oct 30 2008 Kwajalein
-rw-r--r--. 2 root root 599 Oct 30 2008 Libya
-rw-r--r--. 1 root root 2102 Oct 30 2008 MET
drwxr-xr-x. 2 root root 4096 Jun 29 2015 Mexico
drwxr-xr-x. 2 root root 4096 Jun 29 2015 Mideast
-rw-r--r--. 1 root root 118 Oct 30 2008 MST
-rw-r--r--. 1 root root 2294 Oct 30 2008 MST7MDT
-rw-r--r--. 4 root root 2427 Oct 30 2008 Navajo
-rw-r--r--. 2 root root 2434 Oct 30 2008 NZ
-rw-r--r--. 2 root root 2018 Oct 30 2008 NZ-CHAT
drwxr-xr-x. 2 root root 4096 Jun 29 2015 Pacific
-rw-r--r--. 2 root root 2679 Oct 30 2008 Poland
-rw-r--r--. 2 root root 3439 Oct 30 2008 Portugal
drwxr-xr-x. 19 root root 4096 Jun 29 2015 posix
-rw-r--r--. 3 root root 3519 Oct 30 2008 posixrules
-rw-r--r--. 2 root root 405 Oct 30 2008 PRC
-rw-r--r--. 1 root root 2294 Oct 30 2008 PST8PDT
drwxr-xr-x. 19 root root 4096 Jun 29 2015 right
-rw-r--r--. 2 root root 724 Oct 30 2008 ROC
-rw-r--r--. 2 root root 380 Oct 30 2008 ROK
-rw-r--r--. 2 root root 402 Oct 30 2008 Singapore
-rw-r--r--. 3 root root 2721 Oct 30 2008 Turkey
-rw-r--r--. 2 root root 118 Oct 30 2008 UCT
-rw-r--r--. 6 root root 118 Oct 30 2008 Universal
drwxr-xr-x. 2 root root 4096 Jun 29 2015 US
-rw-r--r--. 6 root root 118 Oct 30 2008 UTC
-rw-r--r--. 1 root root 1873 Oct 30 2008 WET
-rw-r--r--. 2 root root 2194 Oct 30 2008 W-SU
-rw-r--r--. 1 root root 18724 Oct 30 2008 zone.tab
-rw-r--r--. 6 root root 118 Oct 30 2008 Zulu

备注:修改完时区需要重启生效,查看时区可以使用命令 date -R

云服务器 ECS Linux 服务器修改时区的两种方式的更多相关文章

  1. linux 设置开机启动项两种方式

    原文链接:http://blog.csdn.net/karchar/article/details/52489572 有时候我们需要Linux系统在开机的时候自动加载某些脚本或系统服务. 在解问题之前 ...

  2. Linux部署springboot项目,两种方式

    部署jar包(官方推荐) 在linux服务器上运行Jar文件时通常的方法是: $ java -jar test.jar 这种方式特点是ssh窗口关闭时,程序中止运行.或者是运行时没法切出去执行其他任务 ...

  3. linux 下部署nodejs(两种方式)

    本次博客的编写时用的系统环境,刚装好的Centos 6.4  64位虚拟机. 另外关于linux 其他系统的安装 可以参考https://github.com/joyent/node/wiki/Ins ...

  4. 云服务器 ECS Linux CentOS 修改内核引导顺序

    由于 CentOS 7 使用 grub2 作为引导程序,所以和 CentOS 6 有所不同,并不是修改 /etc/grub.conf 来修改启动项,需要如下操作: 1. 查看系统内部有多少个内核: c ...

  5. U-boot mkimage指定Linux内核地址时的两种方式

    http://blog.csdn.net/embededswordman/article/details/6704197 uImage的制作是使用的u-boot工具mkimage,build完u-bo ...

  6. Linux下安装Oracle的两种方式------有图形界面安装和静默安装

    本文参考文章 http://blog.csdn.net/zonej/article/details/50680857 http://blog.csdn.net/tongzidane/article/d ...

  7. Linux下 磁盘扩容的两种方式

    Hadoop扩容 概述 Hadoop存储容量或计算能力不能满足日益增长的需求时,就需要扩容. 扩容有两个方案: 1) 增加磁盘 2) 增加节点 方案一:扩大虚拟磁盘 扩大容量 将虚拟的Linux关闭, ...

  8. 文件处理seek以及修改内容的两种方式

    f.seek(offset,whence)offset代表文件的指针的偏移量,单位是字节byteswhence代表参考物,有三个取值# 0:参照文件的开头# 1:参照当前文件指针所在位置# 2: 参照 ...

  9. Centos修改IP的两种方式

    nmtui命令调出修改窗口:nmtui    重启网卡:/etc/init.d/network restart 或者:service network restart 方式二: 进入网络配置文件目录 首 ...

随机推荐

  1. Spring Batch的事务– Part 3: 略过和重试

    原文:https://blog.codecentric.de/en/2012/03/transactions-in-spring-batch-part-3-skip-and-retry/ This i ...

  2. 《Linux设备驱动程序》 笔记1

    驱动程序的任务 通常来讲,驱动(模块)要执行两类任务: 模块中的某些函数作为系统调用的一部分执行(按照既定规则填补必需的系统调用模块) 其他函数负责终端处理 内核中的并发 为什么考虑并发问题: Lin ...

  3. mediawiki 的使用 2

    要想外部电脑能访问你的网站,网站部署好后,在LocalSettings.php 里将这句 $wgServer = "http://localhost"; 改成 $wgServer ...

  4. 可变长参数列表误区与陷阱——va_arg不可接受的类型

    可变长参数列表误区与陷阱--va_arg不可接受的类型 实现一个有可变长参数列表函数的时候,会使用到stdarg.h(这里不讨论varargs.h)中提供的宏. 例如,我们要实现一个简易的my_pri ...

  5. 【MySql】权限不足导致的无法连接到数据库以及权限的授予和撤销

    [环境参数] 1.Host OS:Win7 64bit 2.Host IP:192.168.10.1 3.VM: VMware 11.1.0 4.Client OS:CentOS 6 5.Client ...

  6. C# rmi例子

    接口定义 实体定义,注意需要序列化 using System; namespace Interface { [Serializable] public class DataEntity { publi ...

  7. hdu 5310 Souvenir(BestCoder 1st Anniversary ($))

    http://acm.hdu.edu.cn/showproblem.php?pid=5310 题目大意:要买n个纪念品,可以单个买p元每个,可以成套买q元一套,每套有m个,求最少花费 #include ...

  8. 关于缺省路由传递问题的探讨(下)[ip default-network、ip default-gateway等]

    之前文章介绍的是没有路由协议的环境下,那么在有路由协议的环境下: ip default-network IGRP/EIGRP: IP Default-Network所指定的网络必须在EIGRP进程中通 ...

  9. 实时监控mysql数据库变化

    对于二次开发来说,很大一部分就找找文件和找数据库的变化情况 对于数据库变化.还没有发现比较好用的监控数据库变化监控软件. 今天,我就给大家介绍一个如何使用mysql自带的功能监控数据库变化 1.打开数 ...

  10. Spring Boot 所提供的配置优先级顺序

    按照优先级从高到低的顺序,具体的列表如下所示. 命令行参数. 通过 System.getProperties() 获取的 Java 系统参数. 操作系统环境变量. 从 java:comp/env 得到 ...