Changing the Time Zone by Creating a Symlink # Mission accomplished! You’ve successfully changed your system’s time zone. To verify the change, invoke the timedatectl command again: timedatectl Local time: Tue 13:55:09 EST Once you identify which time zone is accurate to your location, run the following command as root or sudoįor example, to change the system’s timezone to America/New_York you would type: sudo timedatectl set-timezone America/New_York To view all available time zones, use the timedatectl command or list the files in the /usr/share/zoneinfo directory: timedatectl list-timezones. The time zone naming convention usually uses a “Region/City” format. The system time zone is configured by symlinking the /etc/localtime file to a binary time zone’s identifier in the /usr/share/zoneinfo directory.Īnother way to check the time zone is to view the path the symlink points to using the lsĬommand: ls -l /etc/localtime lrwxrwxrwx 1 root root 27 Dec 3 16:29 /etc/localtime -> /usr/share/zoneinfo/Etc/UTCīefore changing the time zone, you’ll need to find out the long name of the time zone you want to use. The output above shows that the system’s time zone is set to UTC. To view the current time zone, invoke the timedatectl command without any options or arguments: timedatectl Local time: Tue 16:30:44 UTC
It is available on all modern systemd-based Linux systems. Timedatectl is a command-line utility that allows you to view and change the system’s time and date. This tutorial covers the steps necessary to set or change the time zone in Linux. The time zone is also used for logs timestamps. For example, the cron daemon uses the system’s time zone for executing cron jobs. Using the correct time zone is essential for many systems related tasks and processes. Typically the time zone is set during the installation of the operational system, but it can be easily changed at a later time. The next task is inserting it in the default bind configuration: cd /etc/bindĪdd the following lines in the bottom and make sure to edit the file name with the real values: zone "hostinger-tutorials.A time zone is a geographic region that has the same standard time. Save the file by pressing CTRL+X and confirm the changes. (ġh ) Negative caching TTL of 1 IN NS IN NS. BIND data file for hostinger-tutorials.xyz Use the following example and replace all IP address and domain instances with your actual domain name and the dedicated IP of your VPS: Using the nano command, create a new zone file for your domain: nano hostinger-tutorials.xyz Then, create a separate folder for your DNS zone files: mkdir -p zonesĪccess the newly created directory: cd zones Connect to your VPS via SSH and go to: cd /etc/bind The next step is setting up a DNS zone for your domain on the virtual server. On Hostinger, you may easily do it using the domain management panel. Each entry needs to point to the VPS dedicated IP address. Start by creating new child nameservers for your domain. This method will switch the location of your DNS zone to the VPS, which means that all future DNS-related changes will have to be made through the newly created zone. Pointing a domain to VPS via custom nameservers is a bit trickier, as you will need to set up a new DNS zone on the virtual server. Method 2 – Pointing Domain to VPS via Custom Nameservers You may also do this using the dig command via terminal: dig A +short hostinger-tutorials.xyz However, most DNS checkup tools provide instant results. Keep in mind that DNS propagation can take up to 24 hours, thus you may have to wait at least a few hours before everything starts working. Option 1 – Using two A records NameĪfter pointing the domain to your VPS, it’s time to check whether the records were added correctly. Below, you’ll find a demonstration of how the entries should look like in your DNS zone. Using A record for the domain and CNAME for the Start by finding the current A record value and replace it with the dedicated IP address located earlier.Using two A records – one for the www subdomain and another for the domain itself.There are two approaches to choose from at this point: Now that you know where your domain is pointed, navigate to the provider and open up your domain’s DNS zone.