Introduction
Using Virtuozzo, the system hostname is changed on boot when not properly configured on the host server. When this happens, the cPanel license check will see a new hostname and potentially flag the license.
Procedure
With host access
To set the hostname with Virtuozzo, use the vzctl command on the host node.
(host)# vzctl set $ContainerName --hostname "something.example.com" --save
Without host access
If you are unable to make the change via vzctl from the host node, you can alternatively set the hostname in either the /etc/rc.local if your container is using CentOS 6, or, if you are using CentOS 7, the recommendation is to create a systemd unit file.
Please note this workaround is not advised and is meant to only be used as a last resort if the host cannot or will not set the hostname from the host for the container.
CentOS 7
You can copy the following to your server and modify the hostname to your desired hostname.
- Using your favorite editor, add the following script and modify the $hostname section with the desired hostname.
nano /etc/systemd/system/hostname.service
Example:
# A simple service unit file to set the hostname after vz.
# A startup configurations for systemd.
# By Aaron Horsley
# Licensed under GPL V2
[Unit]
Description=Override the hostname set on boot by VZ
[Service]
Type=oneshot
ExecStart=/usr/bin/hostnamectl set-hostname $hostname.domain.tld
[Install]
WantedBy=local-fs-pre.target - Then enable the service.
systemctl enable /etc/systemd/system/hostname.service
CentOS 6
For CentOS 6, or use of the rc.local
simply add the following to the end of the file and save/etc/rc.local
nano /etc/rc.local
/usr/bin/hostnamectl set-hostname $hostname.domain.tld
Comments
0 comments
Article is closed for comments.