Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-13-2015, 10:10 AM   #1
LQ Newbie
Registered: Oct 2015
Location: Saudia Arabia
Posts: 1

Rep: Reputation: Disabled
How to permanently change Host-name in Linux ??

i am new to linux and want to change the host name when i do it with
host name new-name , it doesn't change permanently.
Can any one help me in this ??

My linux version as below

[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-300.10.1.el5uek #1 SMP Wed Feb 22 17:37:40 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
Old 10-13-2015, 10:18 AM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,837
Blog Entries: 14

Rep: Reputation: 1092Reputation: 1092Reputation: 1092Reputation: 1092Reputation: 1092Reputation: 1092Reputation: 1092Reputation: 1092
That tells you kernel version but not Linux distro. However, your kernel ending in uek suggests Oracle's Unbreakable Linux (uek = unbreakable enterprise kernel). You can cat /etc/issue or other files in /etc to determine Linux distro.

Anyway Oracle's Linux was derived from RedHat Enterprise Linux (RHEL) so you can probably change it by editing /etc/sysconfig/network to change the hostname there. Also don't forget to update your /etc/hosts file to show the new name.

If you do a reboot after changing these the next boot should have the new hostname.
1 members found this post helpful.
Old 10-13-2015, 10:18 AM   #3
LQ Guru
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 14.1, 14.2
Posts: 5,145

Rep: Reputation: 503Reputation: 503Reputation: 503Reputation: 503Reputation: 503Reputation: 503
See this link. It describes both temporary and permanent changes to hostname.

Old 10-13-2015, 06:08 PM   #4
Doug G
Registered: Jul 2013
Posts: 734

Rep: Reputation: Disabled
If you have Fedora/Centos the command line hostnamectl program makes it easy to manage the host name
Old 10-13-2015, 06:28 PM   #5
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,133
Blog Entries: 2

Rep: Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836
Originally Posted by Doug G View Post
If you have Fedora/Centos the command line hostnamectl program makes it easy to manage the host name
Keep in mind that hostnamectl is a systemd command, so it is not present in CentOS/RHEL versions older than 7.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to change USB device permission permanently on Linux LXer Syndicated Linux News 0 09-17-2015 12:03 AM
[SOLVED] How to change host name permanently in CentOS 6.2 ? rohitkanojia Linux - Newbie 3 05-14-2012 12:17 AM
[SOLVED] how to change permanently a script in etc joham34 Linux - Newbie 6 04-29-2010 07:52 AM
Can't permanently change path SuperRunt Linux - Newbie 11 02-02-2005 11:59 PM
can't change tcp_sack permanently kentri9 Linux - Networking 1 10-30-2004 05:20 PM

All times are GMT -5. The time now is 02:52 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration