当前位置: 首页 > news >正文

阿里云主机怎么做两个网站网站注册怎么做

阿里云主机怎么做两个网站,网站注册怎么做,溧水城乡建设局网站,怎么做自助购物网站文章目录Linux时间管理系统时间设置date命令hwclock 命令timedatectl 命令tzselect 命令windows 自动对时自动对时-chronyd 服务部署时间服务器服务端客户端Linux时间管理 系统时间设置 date命令 正常显示当前时间 [rootserver ~ 11:47:29]# date 2025年 09月 16日 星期二 …

文章目录

  • Linux时间管理
    • 系统时间设置
      • date命令
      • hwclock 命令
      • timedatectl 命令
      • tzselect 命令
      • windows 自动对时
      • 自动对时-chronyd 服务
    • 部署时间服务器
      • 服务端
      • 客户端

Linux时间管理

系统时间设置

date命令

正常显示当前时间

[root@server ~ 11:47:29]# date
2025年 09月 16日 星期二 11:49:08 CST[root@server ~ 11:49:08]# LANG=en_US.utf8 date
Tue Sep 16 11:49:39 CST 2025# 设置为特定时间,字符串以英文格式表达
[root@server ~ 11:49:51]# date -s "2022年 11月 11日 星期四 11:30:10 CST"
date: 无效的日期"2022年 11月 11日 星期四 11:30:10 CST"[root@server ~ 11:50:37]# date -s 'Thu Nov 11 11:30:59 CST 2022'
20221111日 星期五 11:30:59 CST

hwclock 命令

# 读取硬件时钟
[root@server ~ 13:26:01]# hwclock -r
2025年09月16日 星期二 13时26分08秒  -0.192821 秒# 将硬件时钟时间设置与系统时间一致
# 或者使用`clock -w`命令
[root@server ~ 13:26:17]# hwclock -w# 将系统时间设置与硬件时钟时间一致
[root@server ~ 13:26:33]# hwclock -s

Linux 中 “硬件时钟” 和 “系统时钟” 有何区别?如何查看硬件时钟的当前时间?

答案:

  • 区别:硬件时钟(RTC,实时时钟)是主板上的时钟芯片,断电后由电池供电;系统时钟是操作系统运行时维护的时钟,依赖系统。
  • 查看硬件时钟:hwclockclock

timedatectl 命令

[root@server ~ 13:26:56]# timedatectl Local time: 二 2025-09-16 13:27:02 CSTUniversal time: 二 2025-09-16 05:27:02 UTCRTC time: 二 2025-09-16 05:27:02Time zone: Asia/Shanghai (CST, +0800)NTP enabled: yes
NTP synchronized: noRTC in local TZ: noDST active: n/a# RTC real time clock,也就是硬件时钟时间。
# NTP enabled: yes,代表对时服务chronyd应开机自启。# 关闭自动对时
[root@server ~ 13:27:12]# timedatectl set-ntp no
[root@server ~ 13:27:24]# timedatectl Local time: 二 2025-09-16 13:27:27 CSTUniversal time: 二 2025-09-16 05:27:27 UTCRTC time: 二 2025-09-16 05:27:27Time zone: Asia/Shanghai (CST, +0800)NTP enabled: no
NTP synchronized: noRTC in local TZ: noDST active: n/a[root@server ~ 13:27:43]# LANG=en_US.utf8
[root@server ~ 13:27:58]# timedatectl set-time '2022-11-10 11:42:54'# 如果自动对时未关闭,显示如下
[root@centos7 ~ 13:27:58]# timedatectl set-time '2022-11-10 11:42:54'
Failed to set time: Automatic time synchronization is enabled# 设置时区
[root@server ~ 11:43:22]# timedatectl set-timezone Asia/Shanghai

tzselect 命令

查询时区名称。

[root@centos7 ~ 14:22:53]# tzselect 
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.1) Africa2) Americas3) Antarctica4) Arctic Ocean5) Asia6) Atlantic Ocean7) Australia8) Europe9) 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) Palestine2) Armenia		  19) Japan		    36) Philippines3) Azerbaijan		  20) Jordan		    37) Qatar4) Bahrain		  21) Kazakhstan	    38) Russia5) Bangladesh		  22) Korea (North)	    39) Saudi Arabia6) Bhutan		  23) Korea (South)	    40) Singapore7) Brunei		  24) Kuwait		    41) Sri Lanka8) Cambodia		  25) Kyrgyzstan	    42) Syria9) 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) Beijing Time
2) Xinjiang Time
#? 1The following information has been given:ChinaBeijing TimeTherefore TZ='Asia/Shanghai' will be used.
Local time is now:	Mon Jul 28 16:03:22 CST 2025.
Universal Time is now:	Mon Jul 28 08:03:22 UTC 2025.
Is the above information OK?
1) Yes
2) No
#? 1You can make this change permanent for yourself by appending the lineTZ='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 /bin/tzselect command in shell scripts:
Asia/Shanghai

该命令仅生成时区设置建议,不会自动应用,需手动将建议的时区配置(如TZ='Asia/Shanghai'; export TZ)添加到~/.bashrc等文件中生效。

windows 自动对时

在这里插入图片描述

自动对时-chronyd 服务

主配置路径:/etc/chrony.conf

立即同步时间:chronyc -a makestep

# 修改对时服务器
[root@centos7 ~ 14:27:31]# vim /etc/chrony.conf
# 与时间池对时
# 时间池是包含多个时间服务器的服务器组
pool 2.rocky.pool.ntp.org iburst# 与单个服务器 ntp.aliyun.com 对时
server ntp.aliyun.com iburst# 启用并启动chronyd服务
[root@centos7 ~ 14:32:50]# systemctl enable chronyd --now# 如果之前已经启动,需要重启
[root@centos7 ~ 14:33:00]# systemctl restart chronyd# 验证对时情况
[root@server ~ 14:33:33]# chronyc sources -v
210 Number of sources = 1.-- Source mode  '^' = server, '=' = peer, '#' = local clock./ .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* 203.107.6.88                  2   6    17    20   +468us[  +64us] +/-   22ms

补充:

  • chronyd是 CentOS 7 默认的 NTP(网络时间协议)客户端服务,用于同步系统时间与远程时间服务器。
  • 与传统ntpd的优势:占用资源更少,同步速度更快,在网络不稳定时表现更好,支持更小的时间调整粒度。

部署时间服务器

chrony既可以作为客户端,也可以作为服务端(为客户端提供对时服务)。

服务端

[root@server ~ 14:34:30]# vim /etc/chrony.conf
# 最后添加两条记录# 配置监听地址
bindaddress 10.1.8.10# 配置允许哪些网段主机同步
allow 10.1.8.0/24[root@server ~ 14:35:13]# systemctl restart chronyd# 停止防火墙服务
[root@server ~ 14:35:26]# systemctl stop firewalld.service

客户端

# 修改对时服务器
[root@client ~ 14:35:42]# vim /etc/chrony.conf
# 与单个服务器 10.1.8.10 对时
server 10.1.8.10 iburst[root@client ~ 14:36:00]# systemctl restart chronyd
[root@client ~ 14:36:13]# chronyc sources -v
210 Number of sources = 1.-- Source mode  '^' = server, '=' = peer, '#' = local clock./ .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* server.hxl.cloud              3   6   377    11  -7294us[  -15ms] +/-   22ms
http://www.dtcms.com/a/498483.html

相关文章:

  • 祁县网站建设凌云县城乡建设局网站
  • wordpress 修改后台地址福州seo博客
  • 古风网站建设wordpress文章页版权
  • 做摄影哪个网站专业搜索引擎seo公司
  • 推荐几个做网站比较好的公司网站开发的比较
  • 彩票网站维护会跑路吗大连做网站哪家便宜
  • 手机网站前端设计jsp做网站实例
  • 一级做爰片a视频网站我做的网站手机上不了
  • 自己做微网站东莞网站建设是什么
  • 有限责任公司和有限公司有啥区别seo外链是什么
  • 子目录创建网站基于jsp的网站开发开题报告
  • 开公司如何做网站推广页面网站拥有权
  • WordPress mvc插件宁波优化系统
  • 网站的信息容量电商代运营一般收多少服务费
  • 网站营销建设策划案闵行做网站的公司
  • 网站中有哪些标签需要优化在线做家装设计的网站
  • 恩阳建设局网站兰州专业网站建设公司哪家好
  • 遵义网站建设凤凰军事新闻头条
  • 嘉兴网站排名优化报价wordpress文章列表分页插件
  • 婚纱摄影网站排名推广接单网
  • 深圳手机网站建设多少钱做排名优化
  • 网站开发工具简述婚礼请柬电子版免费制作app
  • 乾县交通建设网站网络棋牌游戏
  • 安阳市网站建设玉林做网站公司
  • 上海设计网站建设wordpress子目录站点
  • 网站开发价钱旅游网站开发文档怎么写
  • 中文域名网站有哪些硅云wordpress多站点
  • 维护网站一年多少钱太平洋手机网报价大全
  • 做家教有什么网站做什么推广最赚钱
  • 定制网站建设公司电话成都专业网站建设哪家好