--- title: "Troubleshooting hostname and OS configuration" description: "Fix a Linux node hostname that reverts after reboot, change a cPanel hostname, and install Node.js and npm on CentOS or RHEL." content_type: "troubleshooting" product: "node" platform: "MyAccount" url: "/myaccount/node/troubleshooting/hostname-and-config/" relationships: {"troubleshooting-for":["/myaccount/node/how-to/connect-to-a-linux-node/","/myaccount/node/how-to/create-a-node/"]} --- # Troubleshooting hostname and OS configuration Three things come up after launching a node: a hostname that reverts after a reboot, a cPanel server that shows the old hostname, and installing Node.js and npm on CentOS or RHEL. All are ordinary Linux administration tasks. They work the same on any provider. ## Hostname reverts after a reboot You change the hostname, reboot, and it is back to the old value. On E2E Linux nodes this happens because the OpenNebula context package resets the hostname from the original boot configuration on every boot. A context package is a small set of scripts E2E's images run at boot to configure the node, its network, hostname, and credentials, from the settings it was created with. The script that does this is `05-hostname` (or `net-15-hostname` on KVM servers), and it is still in the directory `/etc/one-context.d/`. To make your change permanent, move that script out of the directory. Log into the node as root first. See [Connect to a Linux node](/myaccount/node/how-to/connect-to-a-linux-node). Check the current hostname: ```bash frame="none" hostname ``` Apply the new hostname to the running session. Replace `new-hostname` with the name you want: ```bash frame="none" hostnamectl set-hostname new-hostname ``` Edit `/etc/hostname` and replace the old hostname with the new one: ```bash frame="none" vi /etc/hostname ``` Edit `/etc/hosts` and update the entries that still name the old hostname: ```bash frame="none" vi /etc/hosts ``` Save and exit both files. Now stop the context script from undoing your work on the next reboot. Move the hostname script out of the context directory: ```bash frame="none" cd /etc/one-context.d/ ``` List the contents so you can see which script is present: ```bash frame="none" ls -la ``` For most VMs, move `05-hostname`: ```bash frame="none" mv 05-hostname /root/ ``` For a KVM-based server, the equivalent script is named `net-15-hostname`: ```bash frame="none" mv net-15-hostname /root/ ``` Once the script is moved, the hostname survives reboots. The change will not take full effect on the running system until you reboot or restart the affected services. ## New hostname does not show in the terminal You ran `hostnamectl set-hostname` and it reported success, but the prompt still shows the old name. That is expected: the new name applies to new sessions, not the one you are already in. Open a new shell, or refresh the current one: ```bash frame="none" exec bash ``` Your prompt now shows the new hostname. ## Hostname change broke service startup Some services bind to or log the hostname when they start. If a service fails to start after you change the hostname, restart the affected service. If it still will not start, revert the hostname and plan a maintenance window for the change, then apply it when you can restart the services that depend on it. ## cPanel still shows the old hostname cPanel keeps its own copy of the hostname, separate from the one the operating system uses. If you changed the OS hostname but cPanel still shows the old one, update cPanel's copy after you fix the OS side. In WHM, go to **Networking Setup → Change Hostname** and enter the new hostname. To make the change stick across reboots, add the hostname and domain name to `/etc/sysctl.conf`. Open it: ```bash frame="none" vi /etc/sysctl.conf ``` Add lines naming your full hostname and its domain, replacing the example values: ```bash frame="none" kernel.hostname = hostname.domainname.com kernel.domainname = domainname.com ``` Apply the settings: ```bash frame="none" sysctl -p /etc/sysctl.conf ``` cPanel now uses the hostname you set. ## Installing Node.js and npm on CentOS or RHEL A common follow-up to launching a CentOS or RHEL node is installing Node.js to run an application. It is a straightforward install from your distribution's package source; see [Install Node.js and npm](/myaccount/node/how-to/install-nodejs-and-npm/) for the full steps, including how to confirm the install works with a small test server. If a change here leaves the node unreachable, see [Troubleshooting node networking and connectivity](/myaccount/node/troubleshooting/networking-and-connectivity).