본문 바로가기
OS/리눅스

timeserver

by 헬로웬디 2025. 1. 10.

## how to add timeserver to the rocky 

 

To add and configure a time server (NTP server) on Rocky Linux, you can follow these steps. The most common way to synchronize the system time on Linux is by using chrony (the default NTP implementation in most modern Linux distributions, including Rocky Linux).

 

Step 1: Install Chrony (if not already installed)

Chrony should be installed by default on Rocky Linux. To verify if it's installed, you can run:

rpm -q chrony

 

If it's not installed, you can install it using the following command:

sudo dnf install chrony

 

Step 2: Start and Enable Chrony

Once installed, you need to start the chronyd service and enable it to start automatically on boot:

sudo systemctl start chronyd
sudo systemctl enable chronyd

 

Step 3: Configure Chrony to Use a Time Server

To configure Chrony to use a specific NTP server, you'll need to modify its configuration file.

1. Open the chrony configuration file:

sudo vi /etc/chrony.conf

 

2. Add or modify the server entry to point to the desired NTP server(s). For example:

server time.example.com iburst

 

You can use multiple servers for redundancy, for example:

server time1.example.com iburst
server time2.example.com iburst

 

3. Save and exit the editor.

 

Step 4: Restart Chrony to Apply Changes

After modifying the configuration file, restart the Chrony service to apply the changes:

sudo systemctl restart chronyd

 

Step 5: Verify Chrony is Synchronizing Time

To ensure Chrony is synchronizing the time correctly, you can check its status with the following command:

chronyc tracking

This will show the current synchronization status, including the server being used and the offset from the correct time.

Additionally, you can check the NTP servers Chrony is using:

chronyc sources

This will list the NTP servers and show whether they are reachable.

 

Step 6: Check System Time

Finally, verify that the system time is synchronized correctly:

date

This will show the current system time, which should now be synced with the NTP server you configured.

 

 

  • Time Zone
    timedatectl list-timezones | grep Seoul
    sudo timedatectl set-timezone UTC

 

 

  • System Clock Synchronization 
    네트워크 시간 프로토콜(NTP) 서비스를 사용하여 글로벌 표준 시간과 일치하도록 보장함 의미합니다. 시스템의  internal clock이 타임 서버와 외부 시간 소스에 주기적으로 시간을 확인하여 OS 시간을 자동으로 조정되고 유지합니다. timedatectl 맥락에서 시스템 시계 동기화는 NTP(네트워크 시간 프로토콜) 설정에 의해 제어됩니다. NTP 동기화를 활성화하면, NTP 서비스가 실행되면서  타임 서버와 시간을 동기화합니다.
#  NTP 동기화 활성화
sudo timedatectl set-ntp true

#  NTP 동기화 비활성화
sudo timedatectl set-ntp false

 

  • RTC in local TZ
    RTC(Real-Time Clock)은 시간과 날짜를 추적하는 하드웨어 장치인데, 시스템의  전원이 꺼져 있을 때도 시간을 유지하는 기능이 있습니다. 즉, 컴퓨터가 꺼지더라도 RTC는 배터리 전원을 사용하여 시간을 계속 기록합니다. RTC는 로컬 시간과 UTC의 형식을 표시합니다.   그림처럼  RTC in local TZ: no  는 시스템 시계가 UTC 시간으로 설정되어 있다는 의미입니다.
# RTC를 UTC로 설정
sudo timedatectl set-local-rtc 0

# RTC를 로컬 시간으로 설정
sudo timedatectl set-local-rtc 1

 

 

 
 
 
 

 

 

'OS > 리눅스' 카테고리의 다른 글

crontab  (0) 2025.02.24
Apache2의 SSL 구성  (0) 2025.01.19
USER ID 및 GROUP ID 변경하는 방법  (0) 2024.09.24
[Rocky] sudo-enabled 사용자 생성하기  (0) 2024.09.15