This guide overcomes a small limitation inside of SolusVM where you cannot change the Template name being used by a Virtual Server without re-installing the Virtual Servers operating system. It involves a small database change and after this the Template name inside of the Virtual Server list should change.
In order to access the MySQL database contained inside the master or externally (dependant upon setup), you must cat the SolusVM configuration file on the master. To do this run the following:
cat /usr/local/solusvm/includes/solusvm.conf
3i30xjDO4bjbWkP:1kKyKHGiyHZOFxf:o0lYkkx2b3Ba03ohTG5wmq5xanTA2Z:localhost:Q4oicEAFInKjriuqtGihckGTZlyjBCMFXJwctDjSAbbCOYORJ4
Layout of file: <DATABASENAME>:<USER>:<PASSWORD>:<HOST>:<the key is the last entry>
Take note of the username and the password as these are what are needed to login to the MySQL CLI.
To access the MySQL database issue the following command:
mysql -u <USERNAME_HERE> -p
Example below:
mysql -u1kKyKHGiyHZOFxf -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 609458
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
When propted use the password which you aquired from the SolusVM config file.
List the current databases inside of MySQL with the following command:
show databases;
Example:
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| 3i30xjDO4bjbWkP |
| mysql |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)
Now we select the SolusVM database from the list of databases, we know the SolusVM database name from the SolusVM config file we cat earlier:
use <SOLUS_VM_DATABASE_HERE>
Example of how this should look:
MariaDB [(none)]> use 3i30xjDO4bjbWkP;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
List the tables inside of the SolusVM database with the following command:
show tables;
An example of how this looks:
MariaDB [3i30xjDO4bjbWkP]> show tables;
+----------------------------+
| Tables_in_3i30xjDO4bjbWkP |
+----------------------------+
| adminacl |
| administrators |
| adminlog |
| adminnotes |
| adminwhitelist |
| api |
| apilog |
| authenticationlog |
| backupservers |
| bandwidthstatistics |
| buycpanel |
| callback |
| callbacklog |
| centralbackup |
| clientapi |
| clientlog |
| clientloginsessions |
| clients |
| configuration |
| consolesessions |
| crontab |
| customemailtemplates |
| dnsplans |
| dnsservergroups |
| dnsservers |
| emailtemplates |
| ftpservers |
| hvmtemplates |
| inet6 |
| inet6assignedips |
| internalips |
| ipaddresses |
| ipblocknodes |
| ipblocks |
| ipv6 |
| isos |
| keymaps |
| kvmdata |
| kvmtemplates |
| license |
| links |
| mediagroups |
| mediasync |
| migrations |
| migrations_exthdd |
| nodegroups |
| nodes |
| pdns |
| plans |
| proxydomains |
| reinstalls |
| s_bandwidth |
| secondaryhdd |
| serial_console_connections |
| smslog |
| syscheck |
| systememails |
| systemmessages |
| templates |
| updater |
| version |
| vncsessions |
| vserver_tmp_speed |
| vservers |
| vzdata |
| xendata |
+----------------------------+
66 rows in set (0.01 sec)
Showing the database tables allows us to make an educated decision as to which table may contain the information we need to update. Judging by the list of tables that were returned it looks like the vservers table may be of interest and it may contain the property attached to the Virtual Server that needs changing.
The best way to check that it does contain the property we wish to change is to describe the table structure with the following:
desc vservers;
An example of what it looks like returned:
MariaDB [3i30xjDO4bjbWkP]> desc vservers;
+---------------------+--------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+--------------+------+-----+---------------------+----------------+
| vserverid | int(11) | NO | PRI | NULL | auto_increment |
| clientid | int(11) | NO | MUL | NULL | |
| ctid | int(11) | NO | | NULL | |
| nodeid | int(11) | NO | MUL | NULL | |
| mainipaddress | varchar(30) | NO | | NULL | |
| consoleusername | varchar(100) | NO | | NULL | |
| consolepassword | varchar(200) | NO | | NULL | |
| hostname | varchar(100) | NO | | NULL | |
| disabled | int(1) | NO | | 0 | |
| disabledreseller | int(1) | NO | | 0 | |
| type | varchar(20) | NO | | openvz | |
| disk | varchar(30) | NO | | NULL | |
| diskused | int(100) | NO | | NULL | |
| bandwidth | varchar(100) | NO | | NULL | |
| bandwidthused | text | NO | | NULL | |
| ram | varchar(30) | NO | | NULL | |
| burst | varchar(30) | NO | | NULL | |
| ramused | text | NO | | NULL | |
| template | varchar(200) | NO | | NULL | |
| templatename | varchar(200) | NO | | NULL | |
| rootpassword | varchar(200) | NO | | NULL | |
| bwsuspend | int(1) | NO | | 0 | |
| networkspeed | int(10) | NO | | 0 | |
| cachestatus | varchar(30) | NO | | NULL | |
| qbackup | int(1) | NO | | 0 | |
| bwemailone | int(1) | NO | | 0 | |
| centralbackup | int(20) | NO | | 0 | |
| centralbackupserver | int(20) | NO | | NULL | |
| notes | text | YES | | NULL | |
| templateid | int(11) | NO | | 0 | |
| kernel | int(11) | NO | | 0 | |
| extra | text | NO | | NULL | |
| mediagroups | text | NO | | NULL | |
| pxeenabled | int(1) | NO | | 0 | |
| unsuspendontally | int(1) | NO | | 0 | |
| bwover | varchar(20) | NO | | 0 | |
| widgetlayout | varchar(400) | NO | | NULL | |
| kvmswap | varchar(10) | NO | | 1024 | |
| creationdate | timestamp | NO | | CURRENT_TIMESTAMP | |
| reinstalldate | timestamp | NO | | 0000-00-00 00:00:00 | |
| fstype | int(1) | NO | | 0 | |
| noipv4 | int(1) | NO | | 0 | |
| claimv6back | int(1) | NO | | 0 | |
| reinstallpm | int(4) | NO | | 30 | |
| rescue | int(2) | NO | | 0 | |
| rescuepass | varchar(15) | NO | | NULL | |
| rescuemode | tinyint(3) | NO | | 0 | |
| rescuemodepassword | varchar(150) | YES | | NULL | |
+---------------------+--------------+------+-----+---------------------+----------------+
48 rows in set (0.00 sec)
As you can see the templatename field is contained within there and this is the field which we require an update for.
Now that we know the location of the table and field which requires updating the next step is to select our Virtual Server from the vservers table to ensure it exists and correctly lists. To do this we use the vserverid this can be obtained from within the Virtual Server list within the SolusVM interface.
Select with the following:
select * from vservers where vserverid = <VSERVER_ID_HERE>;
A example of what the output may look like:
MariaDB [3i30xjDO4bjbWkP]> select * from vservers where vserverid = 66;
+-----------+----------+------+--------+----------------+------------------+--------------------------+--------------------+----------+------------------+------+-------------+----------+---------------------+---------------+------------+-------+---------+----------+-----------------------------------------+--------------------------------------+-----------+--------------+-------------+---------+------------+---------------+---------------------+-------+------------+--------+-------+-------------+------------+------------------+--------+--------------+---------+---------------------+---------------------+--------+--------+-------------+-------------+--------+------------+------------+--------------------+
| vserverid | clientid | ctid | nodeid | mainipaddress | consoleusername | consolepassword | hostname | disabled | disabledreseller | type | disk | diskused | bandwidth | bandwidthused | ram | burst | ramused | template | templatename | rootpassword | bwsuspend | networkspeed | cachestatus | qbackup | bwemailone | centralbackup | centralbackupserver | notes | templateid | kernel | extra | mediagroups | pxeenabled | unsuspendontally | bwover | widgetlayout | kvmswap | creationdate | reinstalldate | fstype | noipv4 | claimv6back | reinstallpm | rescue | rescuepass | rescuemode | rescuemodepassword |
+-----------+----------+------+--------+----------------+------------------+--------------------------+--------------------+----------+------------------+------+-------------+----------+---------------------+---------------+------------+-------+---------+----------+-----------------------------------------+--------------------------------------+-----------+--------------+-------------+---------+------------+---------------+---------------------+-------+------------+--------+-------+-------------+------------+------------------+--------+--------------+---------+---------------------+---------------------+--------+--------+-------------+-------------+--------+------------+------------+--------------------+
| 66 | 1 | 0 | 2 | 51.254.236.87 | testserver | VppVip4PRVsO3CPEX6Uq0Q== | testserver | 0 | 0 | kvm | 10737418240 | 0 | 1073741822926258176 | 7941974 | 1073741824 | 0 | | | CentOS 7 - 64 Bit - Install Puppet Auto | lY5y9Q8flcYhfhd+insSbp+iGPXaWx/TnrY= | 0 | 0 | online | 0 | 0 | 0 | 0 | NULL | 0 | 0 | | 1,2 | 0 | 0 | 0 | | 1024 | 2018-11-10 07:35:40 | 0000-00-00 00:00:00 | 0 | 0 | 0 | 30 | 0 | | 0 | NULL |
+-----------+----------+------+--------+----------------+------------------+--------------------------+--------------------+----------+------------------+------+-------------+----------+---------------------+---------------+------------+-------+---------+----------+-----------------------------------------+--------------------------------------+-----------+--------------+-------------+---------+------------+---------------+---------------------+-------+------------+--------+-------+-------------+------------+------------------+--------+--------------+---------+---------------------+---------------------+--------+--------+-------------+-------------+--------+------------+------------+--------------------+
1 row in set (0.00 sec)
Now that we know the vserverid is being returned by a select the next stage is to update the templatename field with the following:
update vservers set templatename = '<NEW_TEMPLATE_NAME_HERE>' where vserverid = <VSERVER_ID_HERE>;
Rela example of how this may look:
MariaDB [3i30xjDO4bjbWkP]> update vservers set templatename = 'Custom' where vserverid = 66;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Now we can check to ensure that the templatename field has change for our Virtual Server with the following:
select * from vservers where vserverid = <VSERVER_ID_HERE>;
Example output:
MariaDB [3i30xjDO4bjbWkP]> select * from vservers where vserverid = 66;
+-----------+----------+------+--------+----------------+------------------+--------------------------+--------------------+----------+------------------+------+-------------+----------+---------------------+---------------+------------+-------+---------+----------+--------------+--------------------------------------+-----------+--------------+-------------+---------+------------+---------------+---------------------+-------+------------+--------+-------+-------------+------------+------------------+--------+--------------+---------+---------------------+---------------------+--------+--------+-------------+-------------+--------+------------+------------+--------------------+
| vserverid | clientid | ctid | nodeid | mainipaddress | consoleusername | consolepassword | hostname | disabled | disabledreseller | type | disk | diskused | bandwidth | bandwidthused | ram | burst | ramused | template | templatename | rootpassword | bwsuspend | networkspeed | cachestatus | qbackup | bwemailone | centralbackup | centralbackupserver | notes | templateid | kernel | extra | mediagroups | pxeenabled | unsuspendontally | bwover | widgetlayout | kvmswap | creationdate | reinstalldate | fstype | noipv4 | claimv6back | reinstallpm | rescue | rescuepass | rescuemode | rescuemodepassword |
+-----------+----------+------+--------+----------------+------------------+--------------------------+--------------------+----------+------------------+------+-------------+----------+---------------------+---------------+------------+-------+---------+----------+--------------+--------------------------------------+-----------+--------------+-------------+---------+------------+---------------+---------------------+-------+------------+--------+-------+-------------+------------+------------------+--------+--------------+---------+---------------------+---------------------+--------+--------+-------------+-------------+--------+------------+------------+--------------------+
| 66 | 1 | 0 | 2 | 51.254.236.87 | testserver | VppVip4PRVsO3CPEX6Uq0Q== | testserver | 0 | 0 | kvm | 10737418240 | 0 | 1073741822926258176 | 7941974 | 1073741824 | 0 | | | Custom | lY5y9Q8flcYhfhd+insSbp+iGPXaWx/TnrY= | 0 | 0 | online | 0 | 0 | 0 | 0 | NULL | 0 | 0 | | 1,2 | 0 | 0 | 0 | | 1024 | 2018-11-10 07:35:40 | 0000-00-00 00:00:00 | 0 | 0 | 0 | 30 | 0 | | 0 | NULL |
+-----------+----------+------+--------+----------------+------------------+--------------------------+--------------------+----------+------------------+------+-------------+----------+---------------------+---------------+------------+-------+---------+----------+--------------+--------------------------------------+-----------+--------------+-------------+---------+------------+---------------+---------------------+-------+------------+--------+-------+-------------+------------+------------------+--------+--------------+---------+---------------------+---------------------+--------+--------+-------------+-------------+--------+------------+------------+--------------------+
1 row in set (0.00 sec)
As you can see the templatename for the Virtual Server in question has now changed successfully.