Changing Your Oracle Linux 10 Hostname: A Home Lab Guide to Local and Network Visibility
Aaron Rose
Software Engineer & Technology Writer
Introduction
Welcome to the cutting edge of home lab computing! If you're running the latest Oracle Linux 10 on your mini PC, you've got a robust and powerful system at your fingertips. One of the first steps in personalizing your setup is changing your system's hostname to something more descriptive and memorable. While this might seem like a simple task, ensuring that your new hostname is visible to other devices on your network requires a few extra steps.
This guide will walk you through the entire process, from changing the name on the machine itself to making sure every other device in your home can find your mini PC by its new name. Let's get started! 💻
Step 1: Changing the Local Hostname
First, you'll need to open a terminal on your Oracle Linux 10 mini PC. This is where we'll execute all the necessary commands.
Check your current hostname
It's always good practice to know where you're starting. The hostnamectl
command will show you the current hostname and other system details.
hostnamectl
Set the new static hostname
Now, let's set the new name for your machine. Choose a name that is easy to remember and uses only letters, numbers, and hyphens. A hostname can be up to 63 characters long, and for best compatibility, it should only contain lowercase letters, numbers, and hyphens.
sudo hostnamectl set-hostname home-server
Replace home-server
with your desired hostname. The hostnamectl
command is the modern, recommended way to do this on systems using systemd
, like Oracle Linux 10, as it automatically updates the /etc/hostname
file for you, ensuring the name is persistent across reboots.
Update the /etc/hosts
file
The /etc/hosts
file is a critical component for local name resolution, mapping IP addresses to hostnames on your machine. To ensure your system can correctly resolve its own new name, we need to update this file.
For this task, we'll use nano
, a simple and beginner-friendly text editor.
sudo nano /etc/hosts
Inside the file, you'll see lines that look similar to this:
127.0.0.1 localhost
127.0.1.1 old-hostname
While many systems use 127.0.1.1
for local hostname resolution, for a home lab server with a static IP address, the most reliable approach is to add a line that maps your server's LAN IP directly to its new hostname.
Look for a line with your server's local IP address (e.g., 192.168.1.50
) and change the hostname on that line to the new name. If no such line exists, add it.
127.0.0.1 localhost
127.0.1.1 old-hostname
192.168.1.50 home-server
Pro Tip: For a home server, setting a static IP address is highly recommended for reliability. You can configure this through your router's settings using a DHCP reservation or directly on your Linux system using a tool like nmcli
.
Once you have made the changes, press Ctrl+X
to exit, Y
to save the changes, and Enter
to confirm the filename.
Step 2: Ensuring Network Visibility
Changing the hostname on the machine itself doesn't automatically make it visible to other devices on your network. For that, you need to update your network's DNS server, which is almost always your home router.
Option A: Update Your Router (Most Effective)
This is the recommended method because it ensures every device on your network can find your mini PC by its new name without any manual configuration.
Log in to your router's web interface. You can do this by typing its IP address (often
192.168.1.1
or192.168.0.1
) into your browser.Find the DHCP or LAN settings. Look for sections like "DHCP Server," "LAN Settings," or "Address Reservation."
Find your mini PC's entry. Your router may list it by its MAC address or its previous hostname.
Change the hostname. There should be a field to set a name for the device's IP address or MAC address. Change this to
home-server
and save the settings.
Note on router variability: Every router's interface is different. If you can't find these settings, search for terms like "DHCP Reservation" or "Static Lease" in your router's manual or support forums.
Option B: Manually Edit Other Machines' hosts
Files
If you cannot configure your router, you can manually add the new hostname and IP address to the hosts
file on each computer that needs to access your mini PC.
- On Windows: Edit
C:\Windows\System32\drivers\etc\hosts
(as an administrator). - On Linux/macOS: Edit
/etc/hosts
(as root).
Add a line with your mini PC's IP address and the new hostname:
192.168.1.50 home-server
Step 3: Apply and Verify Changes
The final step is to apply and verify that the new hostname is working as expected.
Apply the changes
A full reboot is the most thorough way to ensure all services pick up the new name.
sudo reboot
Alternatively, you can restart the specific services responsible for hostname management and networking.
sudo systemctl restart systemd-hostnamed
sudo systemctl restart NetworkManager
(The systemd-hostnamed
service manages the system's hostname, while NetworkManager
handles network connections and DNS resolution.)
Verify the change locally
After the reboot (or service restart), log back into your mini PC and run hostnamectl
again. You should see "Static hostname: home-server" in the output. You can also test local name resolution by pinging yourself:
ping -c 4 home-server
If it successfully pings, your local configuration is correct.
Verify network visibility
From another computer on your home network, open a command prompt or terminal and try to ping your mini PC using its new name.
# On a Windows computer
ping home-server
# On another Linux/macOS computer
ping -c 4 home-server
If you receive successful ping replies, congratulations! Your Oracle Linux 10 mini PC is now fully configured and accessible by its new name.
Troubleshooting
"ping: unknown host" error: This means the new hostname is not being resolved. Check your router's settings and your
/etc/hosts
file for any typos or incorrect IP addresses.systemctl
command fails: If you see an error, double-check that you typed the service name correctly (systemd-hostnamed
andNetworkManager
).
Conclusion
We hope this guide has been helpful! Enjoy your newly-named Oracle Linux 10 home lab server.
Aaron Rose is a software engineer and technology writer at tech-reader.blog and the author of The Rose Theory series on math and physics.
Comments
Post a Comment