Solve the problem that the time zone cannot be set in Linux environment

Solve the problem that the time zone cannot be set in Linux environment

When changing the time zone under Linux, it is always impossible to change

I changed it to Asia/Shanghai, but the time zone is always +0000 instead of +0800 as I want.

According to the online method

A: tzselect: Execute the tzselect command-->Select Asia-->Select China-->Select east China - Beijing, Guangdong, Shanghai, etc-->then enter 1.

B: Modify the configuration file to change the time zone

1. Modify /etc/sysconfig/clock ZONE=Asia/Shanghai

2. rm /etc/localtime3. Link to the Shanghai time zone file

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

After completing the above process, restart the machine and you will see that the time zone has been changed.

These require a reboot to take effect

Later I found that I only needed to

Simply set up in /etc/profile

export TZ='CST-8', it will take effect immediately and everything will be done.

The above method is very simple. If you have a better method, please contact the editor to supplement it. Thank you for your support of 123WORDPRESS.COM.

You may also be interested in:
  • Teach you several ways to check the time zone in Linux system

<<:  Basic usage analysis of Explain, a magical tool for MySQL performance optimization

>>:  TypeScript interface definition case tutorial

Recommend

Example code for using HTML ul and li tags to display images

Copy the following code to the code area of ​​Drea...

What is web design

<br />Original article: http://www.alistapar...

Docker container log analysis

View container logs First, use docker run -it --r...

Use Grafana+Prometheus to monitor MySQL service performance

Prometheus (also called Prometheus) official webs...

Website Color Schemes Choosing the Right Colors for Your Website

Does color influence website visitors? A few year...

MySQL5.7 master-slave configuration example analysis

MySQL5.7 master-slave configuration implementatio...

Summary of seven sorting algorithms implemented in JavaScript (recommended!)

Table of contents Preface Bubble Sort Basic Algor...

How to configure CDN scheduling using Nginx_geo module

Introducing the Geo module of Nginx The geo direc...

How to install common components (mysql, redis) in Docker

Docker installs mysql docker search mysql Search ...

Webpack file packaging error exception

Before webpack packaging, we must ensure that the...

How to build an ELK log system based on Docker

Background requirements: As the business grows la...

Paragraph layout and line breaks in HTML web pages

The appearance of a web page depends largely on i...

iview implements dynamic form and custom verification time period overlap

Dynamically adding form items iview's dynamic...

How to view version information in Linux

How to view version information under Linux, incl...

How to deploy nextcloud network disk using docker

NextCloud You can share any files or folders on y...