"CentOS ntp 설치"의 두 판 사이의 차이

98번째 줄: 98번째 줄:
echo includefile /etc/ntp/crypto/pw >> /etc/ntp.conf
echo includefile /etc/ntp/crypto/pw >> /etc/ntp.conf
echo keys /etc/ntp/keys >> /etc/ntp.conf
echo keys /etc/ntp/keys >> /etc/ntp.conf
service ntpd start
service ntpd restart
chkconfig ntpd on
chkconfig ntpd on
ntpq -p
ntpq -p

2012년 10월 2일 (화) 02:02 판

ntp 설치

1 설치 확인

설치 안됨
[root@jmnote ~]# rpm -qa ntp*
설치됨
[root@jmnote ~]# rpm -qa ntp*
ntpdate-4.2.4p8-2.el6.centos.x86_64
ntp-4.2.4p8-2.el6.centos.x86_64

2 설치

[root@jmnote ~]# yum install ntp -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ntp.x86_64 0:4.2.4p8-2.el6.centos will be installed
--> Processing Dependency: ntpdate = 4.2.4p8-2.el6.centos for package: ntp-4.2.4p8-2.el6.centos.x86_64
--> Running transaction check
---> Package ntpdate.x86_64 0:4.2.4p8-2.el6.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================
 Package           Arch             Version                           Repository      Size
===========================================================================================
Installing:
 ntp               x86_64           4.2.4p8-2.el6.centos              Daum           444 k
Installing for dependencies:
 ntpdate           x86_64           4.2.4p8-2.el6.centos              Daum            58 k

Transaction Summary
===========================================================================================
Install       2 Package(s)

Total download size: 501 k
Installed size: 1.2 M
Downloading Packages:
(1/2): ntp-4.2.4p8-2.el6.centos.x86_64.rpm                          | 444 kB     00:00     
(2/2): ntpdate-4.2.4p8-2.el6.centos.x86_64.rpm                      |  58 kB     00:00     
-------------------------------------------------------------------------------------------
Total                                                      571 kB/s | 501 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : ntpdate-4.2.4p8-2.el6.centos.x86_64                                     1/2 
  Installing : ntp-4.2.4p8-2.el6.centos.x86_64                                         2/2 
  Verifying  : ntp-4.2.4p8-2.el6.centos.x86_64                                         1/2 
  Verifying  : ntpdate-4.2.4p8-2.el6.centos.x86_64                                     2/2 

Installed:
  ntp.x86_64 0:4.2.4p8-2.el6.centos                                                        

Dependency Installed:
  ntpdate.x86_64 0:4.2.4p8-2.el6.centos                                                    

Complete!

3 설치 위치

[root@localhost ~]# whereis ntp
ntp: /etc/ntp /etc/ntp.conf
[root@localhost ~]# which ntpq
/usr/sbin/ntpq
[root@localhost ~]# which ntpdate
/usr/sbin/ntpdate
[root@localhost ~]# which ntpd
/usr/sbin/ntpd
[root@localhost ntp]# service ntpd status
ntpd is stopped
  • 설정파일 ntp.conf는 /etc에 있다.
  • ntpq, ntpdate, ntpd는 /usr/sbin에 있다.
  • ntpd는 중지된 상태이다.

4 동기화 서버 설정

echo driftfile /var/lib/ntp/drift > /etc/ntp.conf
echo restrict default kod nomodify notrap nopeer noquery >> /etc/ntp.conf
echo restrict -6 default kod nomodify notrap nopeer noquery >> /etc/ntp.conf
echo restrict 127.0.0.1 >> /etc/ntp.conf
echo restrict -6 ::1 >> /etc/ntp.conf
echo server 1.kr.pool.ntp.org >> /etc/ntp.conf
echo server 1.asia.pool.ntp.org >> /etc/ntp.conf
echo server 2.asia.pool.ntp.org >> /etc/ntp.conf
echo includefile /etc/ntp/crypto/pw >> /etc/ntp.conf
echo keys /etc/ntp/keys >> /etc/ntp.conf
service ntpd restart
chkconfig ntpd on
ntpq -p

5 즉시 동기화

명령어
ntpdate 서버주소
실행 예시
[root@localhost ntp]# ntpdate time.windows.com

6 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}