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
Section titled “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.
Check the current hostname:
hostnameApply the new hostname to the running session. Replace new-hostname with the name you want:
hostnamectl set-hostname new-hostnameEdit /etc/hostname and replace the old hostname with the new one:
vi /etc/hostnameEdit /etc/hosts and update the entries that still name the old hostname:
vi /etc/hostsSave 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:
cd /etc/one-context.d/List the contents so you can see which script is present:
ls -laFor most VMs, move 05-hostname:
mv 05-hostname /root/For a KVM-based server, the equivalent script is named net-15-hostname:
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
Section titled “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:
exec bashYour prompt now shows the new hostname.
Hostname change broke service startup
Section titled “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
Section titled “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:
vi /etc/sysctl.confAdd lines naming your full hostname and its domain, replacing the example values:
kernel.hostname = hostname.domainname.comkernel.domainname = domainname.comApply the settings:
sysctl -p /etc/sysctl.confcPanel now uses the hostname you set.
Installing Node.js and npm on CentOS or RHEL
Section titled “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 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.