linux-centOS8 system time file solution

Problem Description:

        When the system is first configured, it is easy for the time zone to be incorrect and the time to be inconsistent with the local time.

problem solved:

       1. First don’t panic, we need to check what our current time zone is, the command is as follows

                timedatectl

                This command will display the current date, time and time zone settings

        2. When we find that the time zone currently used by our system is inconsistent with the time zone of our location, we need to change the time zone to calibrate the time. At this time, we must first check which time zones the current system supports. The command is as follows 

                timedatectl list-timezones

                This will list all available time zone names

        3. Then we can select the time zone we need and set it. If it is not needed, it needs to be downloaded separately. The download method will not be explained here, because the general system will include time zones around the world. The setting command is as follows

                timedatectl set-timezone Asia/Shanghai

                Note that you need to use sudo or root privileges to run this command.

        4. Generally the problem has been solved at this point, but there is still a certain probability that other problems will occur. Here is a description of the problem I encountered.

                a. The time has not changed after the modification.

                solution:

                        If you are using the NTP time synchronization service, you may need to restart the service for the changes to take effect. For example, if you are using the systemd-timesyncd service, use the following command:

                        sudo systemctl restart systemd-timesyncd

                        If you are using another time synchronization service, you will need to check the documentation for that service to learn how to restart the service.

                b. Set the time zone of Shanghai, China, but found that the time is actually 8 hours ahead of China Standard Time

                solution:

                        Although the time zone is correct, the time status used is incorrect.

                        

                         As shown in the figure above, the CST state used is obviously wrong. It is 8 hours ahead of the current time, but the UTC below is correct. At this time, we need to switch to UTC. The command is as follows

                                sudo timedatectl set-timezone UTC

                        At this time, when we use the first command to check the details of the time, we find that the time is completely consistent.

                        

Conclusion:

                At this point, when I encounter a problem, I just say it is perfect, solved, and completed, hahahahahahahaha

                I hope you guys can give me some advice. I am new to the world of Linux and the article has many shortcomings. I welcome your suggestions. By the way, I would like to remind you that before making any modifications to the system settings, you must test them first and be careful not to crash the official server. , be sure to back up important data before proceeding.

 

 

        

Guess you like

Origin blog.csdn.net/zjb1697922408/article/details/130636748