At the release of version 2.0.1, CyberPanel asked it's users to vote the most need feature and the overwhelming majority voted for the option to use Remote SQL server in CyberPanel. In 2.0.2, remote SQL has been added. This feature is best intended for the people who want to host the database separately from the webserver. If you choose this option during installation, then:
In this guide, we will see the step by step procedure to configure a remote MySQL/MariaDB server.
In case you are using Amazon's RDS or Google's Cloud SQL or Azure's SQL services, you need to make sure that your SQL user has the permission to create new databases. Once that is confirmed, please make sure you have the following information and skip to step 2
Login to your clean server that you want to use for hosting your database.
Run the following command to add the latest version of MariaDB repo to your Linux system irrespective of your OS
sh <(curl https://downloads.mariadb.com/MariaDB/mariadb_repo_setup || wget -O - https://downloads.mariadb.com/MariaDB/mariadb_repo_setup)
For Ubuntu 18/20 use the following command
apt install mariadb-server mariadb-client
For Centos 7
yum install mariadb-server mariadb-client
For Centos 8
dnf install mariadb-server mariadb-client
After the installation is complete, please enable MariaDB so it starts with bootup using the following command
systemctl enable mariadb
Run the following command to secure the installation
sudo mysql_secure_installation
Please set a root password, remove the anonymous account, remove the test database but don't disallow remote root access.
Edit /etc/my.cnf or included configuration files from a sub-directory and change the line with starting with keyword bind to this
bind-address=<your_main_server_IP_here>
Add a firewall rule to allow access to port 3306 from your main server's IP.
Login to your main server ( the server where CyberPanel is to be installed ) and run the following command
mysql -u user_name -h mysql_server_ip -p
Enter the password you selected and it should log you into remote MariaDB installation
Run the installation command here
Now you will be presented with an option on whether you want to install Cyberpanel with Remote MySQL or not, please select Yes by entering Y.
Enter all the details you received or set up in the first part of this tutorial
Continue the installer and it will install CyberPanel with remote MySQL, and all the databases for the websites will be hosted remotely too.
In less than 20 minutes, CyberPanel will be installed on a remote database server.
CyberPanel version v1.9.1 added support for the incremental backups. However, you were not able to restore backups from remote servers. With the release of v1.9.2, you can now restore backups from remote destinations. For this to work, you need to follow these tutorials:
Before moving on with this tutorial, I assume that you already have incremental backups somewhere on an SFTP server or your AWS account. Let say you had a server where you added AWS S3 as a remote destination for remote backups and then you scheduled to run backups every day. You then set up a separate CyberPanel server where you want to use those backups to restore a site, in this article we will see how exactly we can do that.
On a new server, install CyberPanel and then create a site that you want to restore. Now using Add/Remove Destinations for Incremental Backups add the same destination to the new server that you just set up.
Please note that whenever you create an incremental backup a new password-protected repository is created where your backups are hosted, the password is emailed and saved on /home/domain.com/domain.com file. Make sure you have this password in a safe place, otherwise you can't use this feature to restore a site on the new server.
Go directly to :8090/IncrementalBackups/restoreRemoteBackups or Incremental Backup -> Restore from Remote
Restore Meta
On top, you will see a restore point with a path like /home/domain.com/meta.xml. Make sure this is the first thing you restore, this will help create any child-domains, email records or databases that you had in your old server.
After restoring meta, the next thing you need to do is to restore Data, its path will be like /home/domain.com. After restoring data, you can move on to restore databases and email in any order you like, if you don't need any database you can skip as well.