• CentOS修改系统时间


    有的时候CentOS的时区不是我们想要的时区,就需要修改一下。下面介绍一下修改时区的方法:

    首先,登录到server上,输入date查看时间及时区:

    1 [root@robot-sv8-pod6 ~]# date
    2 
    3 Thu Jan  4 21:37:53 EST 2018

    可以看到时区是美东时间,现在我需要把它修改为美国西部时间,即太平洋时间。

    输入tzselect,选2) Americas>49) United States>21) Pacific>1) Yes

     1 [root@robot-sv8-pod6 ~]# teselect
     2 -bash: teselect: command not found
     3 [root@robot-sv8-pod6 ~]# tzselect
     4 Please identify a location so that time zone rules can be set correctly.
     5 Please select a continent or ocean.
     6  1) Africa
     7  2) Americas
     8  3) Antarctica
     9  4) Arctic Ocean
    10  5) Asia
    11  6) Atlantic Ocean
    12  7) Australia
    13  8) Europe
    14  9) Indian Ocean
    15 10) Pacific Ocean
    16 11) none - I want to specify the time zone using the Posix TZ format.
    17 #? 2
    18 Please select a country.
    19  1) Anguilla              19) Dominican Republic    37) Peru
    20  2) Antigua & Barbuda     20) Ecuador               38) Puerto Rico
    21  3) Argentina             21) El Salvador           39) St Barthelemy
    22  4) Aruba                 22) French Guiana         40) St Kitts & Nevis
    23  5) Bahamas               23) Greenland             41) St Lucia
    24  6) Barbados              24) Grenada               42) St Maarten (Dutch)
    25  7) Belize                25) Guadeloupe            43) St Martin (French)
    26  8) Bolivia               26) Guatemala             44) St Pierre & Miquelon
    27  9) Brazil                27) Guyana                45) St Vincent
    28 10) Canada                28) Haiti                 46) Suriname
    29 11) Caribbean NL          29) Honduras              47) Trinidad & Tobago
    30 12) Cayman Islands        30) Jamaica               48) Turks & Caicos Is
    31 13) Chile                 31) Martinique            49) United States
    32 14) Colombia              32) Mexico                50) Uruguay
    33 15) Costa Rica            33) Montserrat            51) Venezuela
    34 16) Cuba                  34) Nicaragua             52) Virgin Islands (UK)
    35 17) Curacao               35) Panama                53) Virgin Islands (US)
    36 18) Dominica              36) Paraguay
    37 #? 49
    38 Please select one of the following time zone regions.
    39  1) Eastern (most areas)              16) Central - ND (Morton rural)
    40  2) Eastern - MI (most areas)         17) Central - ND (Mercer)
    41  3) Eastern - KY (Louisville area)    18) Mountain (most areas)
    42  4) Eastern - KY (Wayne)              19) Mountain - ID (south); OR (east)
    43  5) Eastern - IN (most areas)         20) MST - Arizona (except Navajo)
    44  6) Eastern - IN (Da, Du, K, Mn)      21) Pacific
    45  7) Eastern - IN (Pulaski)            22) Alaska (most areas)
    46  8) Eastern - IN (Crawford)           23) Alaska - Juneau area
    47  9) Eastern - IN (Pike)               24) Alaska - Sitka area
    48 10) Eastern - IN (Switzerland)        25) Alaska - Annette Island
    49 11) Central (most areas)              26) Alaska - Yakutat
    50 12) Central - IN (Perry)              27) Alaska (west)
    51 13) Central - IN (Starke)             28) Aleutian Islands
    52 14) Central - MI (Wisconsin border)   29) Hawaii
    53 15) Central - ND (Oliver)
    54 #? 21
    55 
    56 The following information has been given:
    57 
    58         United States
    59         Pacific
    60 
    61 Therefore TZ='America/Los_Angeles' will be used.
    62 Local time is now:      Thu Jan  4 18:40:32 PST 2018.
    63 Universal Time is now:  Fri Jan  5 02:40:32 UTC 2018.
    64 Is the above information OK?
    65 1) Yes
    66 2) No
    67 #? 1
    68 
    69 You can make this change permanent for yourself by appending the line
    70         TZ='America/Los_Angeles'; export TZ
    71 to the file '.profile' in your home directory; then log out and log in again.
    72 
    73 Here is that TZ value again, this time on standard output so that you
    74 can use the /usr/bin/tzselect command in shell scripts:
    75 America/Los_Angeles
    View Code

    然后需要更改系统时区,即删除原来的local time,将新的时区链接到localtime。

    [root@robot-sv8-pod6 ~]# rm -f /etc/localtime
    [root@robot-sv8-pod6 ~]# ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
    [root@robot-sv8-pod6 ~]# date
    Thu Jan  4 18:55:23 PST 2018
  • 相关阅读:
    windows 安装 composer
    css 3 波浪特效
    phpstudy composer 安装YII2
    weUI weui-navbar 实现
    YII 多表联查 纵表
    YII2 models非常好用的控制输出数据【重写Fields】
    重写Fields 控制models 数据输出字段
    Plugin with id com.android.application not found
    react native
    java.lang.IllegalArgumentException: Missing either @POST URL or @Url parameter.
  • 原文地址:https://www.cnblogs.com/nurruden/p/8203060.html
Copyright © 2020-2023  润新知