How to set up a computer with proper domain name????

Dani AI

Generated

was right that Red Hat derivatives use a distro-specific place to store the persistent hostname; reported the same machine is also running Ubuntu 10.04, so the files and tools differ between Debian-based and Red Hat-based systems. Two concepts are important: the short hostname (single name) and the fully qualified domain name (FQDN — host.domain.tld). An FQDN only appears correctly if the name resolves (DNS or /etc/hosts).

Common, practical steps (check/run as root or with sudo):

# check current values
hostname
hostname -f

# set the runtime hostname (does not survive reboot)
sudo hostname new-shortname

# on systemd systems make it persistent
sudo hostnamectl set-hostname host.yourdomain.com

On Debian/Ubuntu (including older releases like 10.04) the persistent short name is kept in the distro hostname file and the FQDN is normally supplied by a hosts entry that maps the host IP to the FQDN and the short name. Edit the hostname file to contain the short name, add an appropriate line to the hosts file mapping IP -> FQDN shortname, then restart networking or reboot to apply.

On Red Hat / CentOS, older releases used the distribution network config; newer, systemd-based releases accept the hostnamectl method above. In any case, either create a proper DNS A record for host.domain.tld or put a hosts entry so hostname -f returns the desired FQDN.

Troubleshooting notes: verify FQDN with hostname -f; test resolution with getent hosts host.yourdomain.com or dig/host; check that DHCP/NetworkManager or cloud-init aren’t overwriting the hostname; avoid restarting networking over an SSH session without an alternate access plan.

Member Avatar for Member #299005

The exact details depend on the Linux distribution you're using. Maybe you can tell us more...

Is it if my linux distribution is red hat then what about it
thank you

Member Avatar for Member #299005

In red hat / fedora the network configuration file is:
/etc/sysconfig/network
Set HOSTNAME= to your full domain name (like: "") and restart the network.

I am using linux i.e red hat....ubuntu 10.04..
when i run the command /etc/sysconfig/network, it says that there is no such file or directory...also there is no such syconfig file or directory...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.