服务Linux系统下安装和配置NTP服务(linux安装ntp)

NTP 服务是利用传播服务在网络中进行时间同步的机制,使管理员得以维护网络上数据的可靠性。它可以使各台计算机的时钟保持同一个时间,并且简化统一调整时间的工作,避免过多的手工调整时间易出错的现象。如今,NTP 已成为大多数发行版的默认组件,而 linux 系统中安装和配置 NTP 服务十分简单便捷,以下指南将会帮助您快速的完成 NTP 服务的安装和配置 。

成都创新互联公司主营潼南网站建设的网络公司,主营网站建设方案,重庆App定制开发,潼南h5小程序制作搭建,潼南网站营销推广欢迎潼南等地区企业咨询

## 一、安装 NTP 服务

1. 首先,我们需要安装 NTP 服务,在 Ubuntu 中,系统上已经默认安装了 NTP 服务,可以直接使用如下命令完成检查:

“`shell

# check whether ntp is installed

dpkg -s ntp


2. 如果未安装,可通过 apt 来完成,首先需要更新一下本地软件仓库:

```shell
# update repository
sudo apt-get update

3. 然后执行安装:

“`shell

# install ntp

sudo apt-get install ntp


## 二、配置 NTP

1. NTP 使用的时间源文件位于 `/etc/ntp.conf`,通过执行 `vim` 编辑,将注释的行取消掉,或者更改里面的 servers IP 地址就可以修改 NTP 服务所属的时间源,这里我们使用国家授时中心国家大学科学院地址 `ntp.csie.ntu.edu.tw`,配置如下:

``` conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.tw.pool.ntp.org
server 1.tw.pool.ntp.org
server ntp.csie.ntu.edu.tw
# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details. The web page
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

restrict -4 default kod notrap nomodify
restrict -6 default kod notrap nomodify

2. 然后启动要 NTP 服务:

“`shell

# start ntp service

sudo service ntp start


3. 最后再检查一下 NTP 是否真的开启:

```shell
# check if ntp service is running
sudo ntpq -p

如果返回了之前配置的时间源,即可确定 NTP 服务已经成功安装和配置。

创新互联-老牌IDC、云计算及IT信息化服务领域的服务供应商,业务涵盖IDC(互联网数据中心)服务、云计算服务、IT信息化、AI算力租赁平台(智算云),软件开发,网站建设,咨询热线:028-86922220

文章题目:服务Linux系统下安装和配置NTP服务(linux安装ntp)
浏览地址:http://www.hantingmc.com/qtweb/news20/121970.html

网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联