1、使用SSH 或者KVM登陆到主机系统界面,进入root账户
VMware vCenter Server Appliance 6.7.0.10000 Type: vCenter Server with an embedded Platform Services Controller Connected to service * List APIs: "help api list" * List Plugins: "help pi list" * Launch BASH: "shell" Command>
2、载入 BASH
输入shell
Command> shell Shell access is granted to root root@photon-machine [ ~ ]# root@photon-machine [ ~ ]# root@photon-machine [ ~ ]# root@photon-machine [ ~ ]# date Sat Jul 25 16:15:41 UTC 2020
3、先修改时区
找到新时区文件所在位置,在/usr/share/zoneinfo/$主时区/$次时区 目录下
# cd /usr/share/zoneinfo/Asia
root@photon-machine [ ~ ]# cd /usr/share/zoneinfo/Asia root@photon-machine [ /usr/share/zoneinfo/Asia ]# root@photon-machine [ /usr/share/zoneinfo/Asia ]# ls Aden Ashgabat Barnaul Choibalsan Dhaka Hebron Jakarta Kashgar Kuala_Lumpur Makassar Omsk Qyzylorda Seoul Tbilisi Tomsk Vientiane Almaty Ashkhabad Beirut Chongqing Dili Ho_Chi_Minh Jayapura Kathmandu Kuching Manila Oral Rangoon Shanghai Tehran Ujung_Pandang Vladivostok Amman Baghdad Bishkek Chungking Dubai Hong_Kong Jerusalem Katmandu Kuwait Muscat Phnom_Penh Riyadh Singapore Tel_Aviv Ulaanbaatar Yakutsk Anadyr Bahrain Brunei Colombo Dushanbe Hovd Kabul Khandyga Macao Nicosia Pontianak Saigon Srednekolymsk Thimbu Ulan_Bator Yangon Aqtau Baku Calcutta Dacca Gaza Irkutsk Kamchatka Kolkata Macau Novokuznetsk Pyongyang Sakhalin Taipei Thimphu Urumqi Yekaterinburg Aqtobe Bangkok Chita Damascus Harbin Istanbul Karachi Krasnoyarsk Magadan Novosibirsk Qatar Samarkand Tashkent Tokyo Ust-Nera Yerevan
备份时区文件
# mv /etc/localtime /etc/localtime-old
替换时区文件
# cp Shanghai /etc/localtime
# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
或者创建新时区链接文件,例如修改成亚洲-上海时区
# ln –s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
root@photon-machine [ /usr/share/zoneinfo/Asia ]# ls /etc/ adjtime cron.d environment iproute2 locale-gen.conf netconfig photon-release rpm statetab vmware-cis-license vmware-vapi alternatives cron.daily exports issue localtime NetworkManager pki rsyncd.conf statetab.d vmware-content-library vmware-vcha anacrontab cron.deny fstab issue.DoD login.access networks profile rsyslog.conf sudoers vmware-eam vmware-vpx applmgmt cron.hourly gnutls issue.net login.defs nscd.conf profile.d rwtab sudoers.d vmware-imagebuilder vmware-vpxd-svcs at.deny cron.monthly group krb5.conf logrotate.conf nsswitch.conf protocols rwtab.d sysconfig vmware-mbcs vmware-vsan-dps audisp cron.weekly group- krb5.keytab logrotate.d ntp.conf rc0.d securetty sysctl.conf vmware-netdump vmware-vsan-health audit dbus-1 grub.d krb5.lotus.conf lsb-release ntp.conf.orig rc1.d security sysctl.d vmware-perfcharts vmware-vsm bash.bashrc ddclient gshadow ld.so.cache lvm odbc.ini rc2.d services systemd vmware-pod wgetrc bash_completion.d default gshadow- ld.so.conf machine-id odbcinst.ini rc3.d shadow tdnf vmware-rbd X11 bindresvport.blacklist dhcp hostname ld.so.conf.d mail openldap rc4.d shadow- tmpfiles.d vmware-rhttpproxy xdg binfmt.d dhcpd.conf.template HOSTNAME libaudit.conf mime.types opt rc5.d shadow.bak udev vmware-sca xinetd.conf certs dhcpd.deploy.conf hosts libnss-ato.conf mke2fs.conf os-release rc6.d shells va vmware-sps xinetd.d chkconfig.d dircolors hosts.allow likewise modprobe.d pam.d rc.d skel vimrc vmware-sso yum.repos.d cloud dnsmasq.conf httpd limits modules-load.d passwd rc.status slsh.rc vmsyslog.conf.d vmware-syslog cloudvm_stats.conf dnsmasq.d init.d limits.conf mtab passwd- resolv.conf ssh vmware vmware-tools cron.allow dodscript.sh inputrc locale.conf named.conf permissions.local rpc ssl vmware-analytics vmware-upgrade root@photon-machine [ /usr/share/zoneinfo/Asia ]# root@photon-machine [ /usr/share/zoneinfo/Asia ]# mv /etc/localtime /etc/localtime-old root@photon-machine [ /usr/share/zoneinfo/Asia ]# root@photon-machine [ /usr/share/zoneinfo/Asia ]# cp Shanghai /etc/localtime root@photon-machine [ /usr/share/zoneinfo/Asia ]# root@photon-machine [ /usr/share/zoneinfo/Asia ]# ls /etc/ adjtime cron.d environment iproute2 locale-gen.conf named.conf permissions.local rpc ssl vmware-analytics vmware-upgrade alternatives cron.daily exports issue localtime netconfig photon-release rpm statetab vmware-cis-license vmware-vapi anacrontab cron.deny fstab issue.DoD localtime-old NetworkManager pki rsyncd.conf statetab.d vmware-content-library vmware-vcha applmgmt cron.hourly gnutls issue.net login.access networks profile rsyslog.conf sudoers vmware-eam vmware-vpx at.deny cron.monthly group krb5.conf login.defs nscd.conf profile.d rwtab sudoers.d vmware-imagebuilder vmware-vpxd-svcs audisp cron.weekly group- krb5.keytab logrotate.conf nsswitch.conf protocols rwtab.d sysconfig vmware-mbcs vmware-vsan-dps audit dbus-1 grub.d krb5.lotus.conf logrotate.d ntp.conf rc0.d securetty sysctl.conf vmware-netdump vmware-vsan-health bash.bashrc ddclient gshadow ld.so.cache lsb-release ntp.conf.orig rc1.d security sysctl.d vmware-perfcharts vmware-vsm bash_completion.d default gshadow- ld.so.conf lvm odbc.ini rc2.d services systemd vmware-pod wgetrc bindresvport.blacklist dhcp hostname ld.so.conf.d machine-id odbcinst.ini rc3.d shadow tdnf vmware-rbd X11 binfmt.d dhcpd.conf.template HOSTNAME libaudit.conf mail openldap rc4.d shadow- tmpfiles.d vmware-rhttpproxy xdg certs dhcpd.deploy.conf hosts libnss-ato.conf mime.types opt rc5.d shadow.bak udev vmware-sca xinetd.conf chkconfig.d dircolors hosts.allow likewise mke2fs.conf os-release rc6.d shells va vmware-sps xinetd.d cloud dnsmasq.conf httpd limits modprobe.d pam.d rc.d skel vimrc vmware-sso yum.repos.d cloudvm_stats.conf dnsmasq.d init.d limits.conf modules-load.d passwd rc.status slsh.rc vmsyslog.conf.d vmware-syslog cron.allow dodscript.sh inputrc locale.conf mtab passwd- resolv.conf ssh vmware vmware-tools root@photon-machine [ /usr/share/zoneinfo/Asia ]# root@photon-machine [ /usr/share/zoneinfo/Asia ]# date Sun Jul 26 00:27:27 CST 2020
设置与硬件同步
# hwclock -w
重启机器生效
# reboot
4、修改时间的方法
使用# date -s修改日期
root@photon-machine [ ~ ]# date -s 2020-07-25 Sat Jul 25 00:00:00 CST 2020
使用# date -s修改时间
root@photon-machine [ ~ ]# date -s 17:10:15 Sat Jul 25 17:10:15 CST 2020
将当前时间和日期写入BIOS,避免重启后失效
# hwclock -w
参考博客:
https://www.jianshu.com/p/123adfc84b9c?utm_campaign