Difference between revisions of "Hostname, Change Your"

From PCLinuxOSHelp Knowledge Base
Jump to: navigation, search
m (Web page is in the process of being updated to reflect the use of the NetworkManager and NMCLI -- Network config in PCC no longer exists.)
m (update to reflect the use of edit_hostname.sh)
Line 6: Line 6:
 
</font></i></b>
 
</font></i></b>
  
As in most everything in Linux, there are many different ways that you can do something. In this HowTo, I will list just a couple ways that you can change your hostname.
+
=== Changing Your Hostname yet another way ===
  
First we will look at changing our hostname using PCC (The PCLOS Control Center)
+
From your desktop press the "Alt" key and "F2" key. This will open a window at the top of you screen.
  
In your task bar look for the PCC logo [[file:Pcc.png]] Click on it to open PCC
 
  
[[file:Open-pcc.png]]
+
[[file:Run-command.png]]]
  
  
In the left hand pane click on "Network & Internet" than in the right hand pane select "Host Definitions"
+
In the line enter
  
 +
'''''kdesu kwrite'''''
  
[[file:Select-network-and-hostname.png]]
 
  
 +
[[file:Enter-command.png]]
  
It will open a window that will display the current information. There should be two entries displayed. We are only interested with the first entry ''"localhost.localdomain"''
 
  
 +
or use your favorite text editor. When you are finished press enter. After a few moments, you should than be greeted with a password dialog box.
  
[[file:Host-definitions.png]]
 
  
 +
[[file:Dialogbox.png]]
  
Click on that entry to highlight it and than click on the "Modify" button to the right side of the window. This will open a "Modify Entry" box.
 
  
 +
In this box enter your root users password, when you are done press OK.
  
[[file:Host-definitions-modify.png]]
 
  
 +
[[file:Enter-password.png]]
  
The only changes we want to make in this box is to the "Host Name" and the "Host Aliases" lines.
 
  
In the "Host Name" line add the name you are going to use. As for my example I am using '''workbox'''.
+
Your text editor should now open. In our example "kwrite" will open.
  
  
[[file:Make-changes.png]]
+
[[file:Kwrite-opens.png]]
  
  
My entry should now look like this
+
Click on the "OPEN" button and open the following file.
  
'''''workbox.localhost.localdomain'''''
+
''/etc/sysconfig/network''
  
In the "Host Aliases" line, which should be blank I enter my hostname. Again in my example I entered
 
  
'''''workbox'''''
+
[[file:Select-file.png]]
  
When you have finished, click "OK" The window will close. You should notice that your host name has now changed.
 
  
 +
We are only interested in on line in this file. This is the first line starting with
  
[[file:Changes-made.png]]
+
'''''HOSTNAME=localhost.localdomain'''''
  
 +
Now we want to change it to reflect our new hostname. In this example we want to change it to read.
  
If everything is correct than click "OK" at the bottom left of the window. If something is not right repeat the above process till it is correct.
+
'''''HOSTNAME=workbox.localhost.localdomain'''''
  
We can now close out the PCC window.
 
  
You have now changed your hostname. Be aware that your changes '''''WILL NOT''''' show up till after you restart your computer.
+
[[file:Edit-file.png]]
  
=== Changing Your Hostname yet another way ===
 
  
From your desktop press the "Alt" key and "F2" key. This will open a window at the top of you screen.
+
[[file:Named-changed.png]]
  
  
[[file:Run-command.png]]]
+
When you have finished click on "SAVE" Once saved you can than close your editor. Your changes will now take effect the next time you reboot your computer.
  
  
In the line enter
+
''' Also Note: ''' I've found that I need to add DHCP_HOSTNAME=<myhostname> to /etc/sysconfig/network for my router to "see" the hostname.
  
'''''kdesu kwrite'''''
 
  
 +
=== Changing Your Hostname yet another way ===
  
[[file:Enter-command.png]]
+
Open synaptic and install the package edit_hostname
 
 
 
 
or use your favorite text editor. When you are finished press enter. After a few moments, you should than be greeted with a password dialog box.
 
 
 
 
 
[[file:Dialogbox.png]]
 
 
 
 
 
In this box enter your root users password, when you are done press OK.
 
 
 
 
 
[[file:Enter-password.png]]
 
 
 
  
Your text editor should now open. In our example "kwrite" will open.
 
  
 +
[[file:synaptic_edit_hostname.png]]
  
[[file:Kwrite-opens.png]]
+
Once installed you can run the file from your menu -> Configuration -> Change Hostname
  
  
Click on the "OPEN" button and open the following file.
+
[[file:run_edit_hostname.png]]
  
''/etc/sysconfig/network''
 
  
 +
when ran a dialog box will ope as below. Simply put your desired host name in the box labeled Enter Hostname.  When finished click on save.  The dialog box will close.
  
[[file:Select-file.png]]
+
[[file:fill_in_the_hostname.png]]
  
 +
Another way to  run the program is from a terminal window.  Open a terminal window as root and typed edit_hostname.sh at the prompt followed by pressing enter.  A dialog box will open.  Enter your chosen hostname in the box labeled Enter Hostname and then click Save.  The dialog box will close. You can simple close the console window.
  
We are only interested in on line in this file. This is the first line starting with
+
[[file:dit_hostname_from_console_window.png]]
 
 
'''''HOSTNAME=localhost.localdomain'''''
 
  
Now we want to change it to reflect our new hostname. In this example we want to change it to read.
+
As with both options, your new host name will appear after you restart your machine.
  
'''''HOSTNAME=workbox.localhost.localdomain'''''
 
  
  
[[file:Edit-file.png]]
 
  
  
[[file:Named-changed.png]]
 
  
  
When you have finished click on "SAVE" Once saved you can than close your editor. Your changes will now take effect the next time you reboot your computer.
 
  
  
''' Also Note: ''' I've found that I need to add DHCP_HOSTNAME=<myhostname> to /etc/sysconfig/network for my router to "see" the hostname.
 
  
 
[[category:HowTo]]
 
[[category:HowTo]]

Revision as of 19:48, 13 December 2021

How To Change your hostname

This webpage is being updated

Changing Your Hostname yet another way

From your desktop press the "Alt" key and "F2" key. This will open a window at the top of you screen.


Run-command.png]


In the line enter

kdesu kwrite


Enter-command.png


or use your favorite text editor. When you are finished press enter. After a few moments, you should than be greeted with a password dialog box.


Dialogbox.png


In this box enter your root users password, when you are done press OK.


Enter-password.png


Your text editor should now open. In our example "kwrite" will open.


Kwrite-opens.png


Click on the "OPEN" button and open the following file.

/etc/sysconfig/network


Select-file.png


We are only interested in on line in this file. This is the first line starting with

HOSTNAME=localhost.localdomain

Now we want to change it to reflect our new hostname. In this example we want to change it to read.

HOSTNAME=workbox.localhost.localdomain


Edit-file.png


Named-changed.png


When you have finished click on "SAVE" Once saved you can than close your editor. Your changes will now take effect the next time you reboot your computer.


Also Note: I've found that I need to add DHCP_HOSTNAME=<myhostname> to /etc/sysconfig/network for my router to "see" the hostname.


Changing Your Hostname yet another way

Open synaptic and install the package edit_hostname


Synaptic edit hostname.png

Once installed you can run the file from your menu -> Configuration -> Change Hostname


Run edit hostname.png


when ran a dialog box will ope as below. Simply put your desired host name in the box labeled Enter Hostname. When finished click on save. The dialog box will close.

Fill in the hostname.png

Another way to run the program is from a terminal window. Open a terminal window as root and typed edit_hostname.sh at the prompt followed by pressing enter. A dialog box will open. Enter your chosen hostname in the box labeled Enter Hostname and then click Save. The dialog box will close. You can simple close the console window.

Dit hostname from console window.png

As with both options, your new host name will appear after you restart your machine.