So far, we have been exploring the system and using it as it is. The only thing we have changed is adding a basic YUM repository file to use the installation DVD repository. The setup of your system, the initial configurations, and making later configuration changes and tuning are parts of your role as a system admin.
In this article, we are going to learn how to make some basic system configuration changes. An important topic that you should not miss; so, wish you nice reading!!
Basic System Setup
To effectively use your system (any system: Windows, UNIX, not only Red Hat Linux), it should have:
- A unique hostname (computer name).
- Correct date and time settings.
- A unique IP address: for remote access, and file transfer.
- The Default route (Gateway).
Okay, let’s do them, one by one.
Setting the Hostname
If you haven’t set the hostname during installation, the installation wizard will give your system an initial default hostname localhost.
The hostname of your machine appears in the shell prompt:
To display the hostname of your machine, use the hostname command:
To same command hostname can be used to set the hostname of a Linux machine “temporarily”.
When we say “temporarily”, we mean it will not persist after rebooting the machine.
To set the hostname permanently, we need to set it in the /etc/sysconfig/network configuration file.
Edit the file, and change the HOSTNAME value.
Save and exit the file.
For the new HOSTNAME setting to take effect, we need to reboot the machine.
You will notice the change in the prompt for username.
Then in the shell prompt, and in the output of the hostname command:
Setting the Date and Time
Having correct date and time settings is essential for proper server operations. For example, you can not depend on a log file from a system with wrong date or time. Even worse, some services couldn’t work correctly without correct date and time. For these reasons, we need to ensure our Linux box has the correct date and time.
To set the date and time on a Linux machine, you can do this either manually or automatically.
The Manual Method
We know that the date command displays the system date and time. What you may not be aware of is that the same command could also be used to set the date and time.
The syntax for this is as follows: date [MMDDhhmm[[CC]YY]
Where: MM is the month, DD is the day of month, hh is the hours using the 24-hours format, mm is the minutes, CC is the century, and YY is the year.
To set the time on your system to midnight on 1st of May 2016, use the following command:
Another way to set the date and time manually is using the GUI tool.
From the System menu, select Administration -> Date Time.
As we are logged in as non-root account, and changing the date and time settings requires root privilege, the user is prompted to authenticate as root:
The Date/Time Properties dialog is open:
Now, you can change the date manually from the calendar box, and set the date using the Hour, Minute, and Second boxes. When finished, click OK to save the changes.
The Automatic Method
The Network Time Protocol NTP provides an efficient way to manage clock synchronization in computer systems. In this method, a server called the NTP server keeps a correct date and time settings (by taking these settings from a more reliable time source like the atomic clock). Other computers (NTP clients) periodically query the NTP server for date and time settings. This way, all computers are guaranteed to have the correct date and time. Of course, this way is more efficient and more accurate than the manual way. consider having to maintain correct date and time settings on network containing hundreds of servers and thousands of clients.
To configure your Linux box to be an NTP client, the same graphical tool helps:
Check the “Synchronize date and time over network” checkbox. Once checked, a list box for NTP servers appear, where you can add, delete, or edit NTP servers. When finished, click OK.
In this article, we started to learn how to setup the basic system configuration.
- The hostname command can be used to set the system name, temporarily.
- The date and time can be set either:
- Manually: using the date command, or graphical tool.
In the next article, we are going to continue with system configuration. See you.