If you move your Symbiosis Cloud Server between groups or accounts or rename it, or just don’t like the default
servername.group.account.uk0.bigv.io style name that you end up with, it’s possible to change the hostname of the server.
It’s a little more complicated than changing it with a non-Symbiosis server as Symbiosis expects to find some of it’s configuration in
/srv/servername.group.account.uk0.bigv.io and will get a bit upset if it can’t find things it expects to be able to find, but it’s fairly simple to change it.
You will need…
- A basic understanding of the command line and SSH. This should be reasonably simple, and is mostly copy and paste over SSH.
- A server running Symbiosis. This is mainly written for Symbiosis Jessie – if you’re still running Symbiosis Wheezy of older, it’s probably a good time to upgrade.
- A domain name pointing to the server. This can be any domain name as long as it’s publicly visible – it can be a domain on the local server already, or just the updated name in the Cloud Server panel if you’ve moved it.
Step 1. Create a variable to hold the new hostname
First of all, you should set the new name of the server in a variable to save typing it over and over (remember to replace the text with the new hostname the server will have).
This can be the URL for a domain it’s already hosting, or just the name of the server in the Bytemark Panel, however the domain should point to the server already, and will need to be a fully qualified domain name (with dots) such as ‘
Step 2. Rename some directories
Now you should be able to copy and paste this into your SSH session:
oldname=$HOSTNAME sudo hostname $newname
Enter the admin user’s password if asked to do so. Now, copy and paste this block into the SSH session — it will swap the SSL certificates to use the new domain name:
if [ ! -d /srv/$newname/ ]; then mv /srv/$oldname/ /srv/$newname/; fi sudo symbiosis-ssl --verbose --force $newname sudo rm /etc/ssl/ssl.combined /etc/ssl/ssl.crt /etc/ssl/ssl.key sudo ln -s /srv/$newname/config/ssl/current/ssl.combined /etc/ssl/ssl.combined sudo ln -s /srv/$newname/config/ssl/current/ssl.crt /etc/ssl/ssl.crt sudo ln -s /srv/$newname/config/ssl/current/ssl.key /etc/ssl/ssl.key sudo symbiosis-httpd-configure sudo service apache2 reload echo $newname | sudo tee /etc/hostname | sudo tee /etc/mailname
Step 3. Update the hosts file
Next, you’ll need to update the hosts file with the new name of the server. Type or copy and paste this into your SSH session:
sudo nano /etc/hosts
You’ll updated each instance of the old name to the new name for your IP addresses, with the full name first, followed by the ‘short name’ (the part before the first dot), then save your changes and exit by pressing Ctrl+o, Enter, Ctrl+x.
Step 4. Reboot your server
Finally, reboot the server with
sudo reboot and you should be up and running again shortly.