收藏文章 楼主

linux centos 更新同步时间 修改时间时区为北京

版块:linux   类型:普通   作者:小绿叶技术博客   查看:973   回复:0   获赞:0   时间:2020-04-27 11:35:19

# centos7 更新同步时间

yum install -y ntpdate # 安装工具

tzselect                                                                    # 设置选择时区,顺序:4 选择asina 再选择china  再北京再 yes  选择序号


rm -rf /etc/localtime ; ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

                                                                                # 将之前的删除,然后创建软连接到文件:/etc/localtime

echo "

LANG="en_US.utf8"

LC_TIME=en_DK.UTF-8

" > /etc/default/locale                                            # 将时间设置为 24小时模式, reboot 重启服务器 生效



ntpdate -u cn.pool.ntp.org # 同步时间

timedatectl list-timezones                                      # 列出时区


timedatectl set-timezone Asia/Shanghai # 设置区域


systemctl start ntpd # 启动时间

systemctl enable ntpd # 开机启动:自动同步



# centos8 更新时间

rpm -ivh http://mirrors.wlnmp.com/centos/wlnmp-release-centos.noarch.rpm

dnf  install wntp -y

ntpdate ntp3.aliyun.com 

echo "*/3 * * * * ntpdate ntp3.aliyun.com  &> /dev/null" > /tmp/crontab

crontab /tmp/crontab



其他网络时间服务器地址如下:(也可以自己去搜索下)


time.nist.gov (美国)

ntp.fudan.edu.cn (复旦) )(国内用户推荐使用此服务器)

timekeeper.isi.edu

subitaneous.cpsc.ucalgary.ca

usno.pa-x.dec.com

time.twc.weather.com

swisstime.ethz.ch

ntp0.fau.de

ntp3.fau.de

time-a.nist.gov

time-b.nist.gov

time-nw.nist.gov

nist1-sj.glassey.com


210.72.145.44 也是一个不错的地址,速度很快!

提供企业建站服务,免费网防系统,提交信息登录 http://yundun.ddoss.cn 邮箱: proposal@ddoss.cn 
回复列表
默认   热门   正序   倒序

回复:linux centos 更新同步时间 修改时间时区为北京

头像

用户名:

粉丝数:

签名:

资料 关注 好友 消息