arrow_upward

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cyberpanel with Remote Database
#1
This tutorial is aimed at Cyberpanel users  who may wish to offload database functions on a separate machine for a gain in performance. Remote database is a newer feature of cyberpanel introduced in version 2.0.2 If p4v admin to decide to create a system for users to get a second vps, it could be very useful Wink

I wrote this tutorial, however I didn't do it without some good sources:
#TLDR Check these pages and it'll give you all the information in this tutorial and then some.

https://cyberpanel.net/docs/installing-cyberpanel/
https://cyberpanel.net/docs/remote-sql-for-cyberpanel/
https://www.virtualmin.com/documentation...ase/remote
https://www.webmin.com/deb.html
https://www.digitalocean.com/community/t...d-commands

The closer the physical proximity and lower the latency between the two servers, the better the opportunity for performance gain. For those curious, the specifications of the servers used in writing this tutorial can be found here post #3

It is written using 2 servers using  ubuntu 18. It assumes you have basic knowledge of logging into your server via ssh and familiarity with the command line/terminal.

1. As always it's recommend to update the installation by running the following command from terminal on both servers:
$ apt-get update && apt-get upgrade

When your servers finish the upgrade, you'll need to set up the database server first. It will be required for cyberpanel to complete its installation. While any sql server should work, I chose to use webmin: a sturdy, lightweight open source web panel to facilitate installation and configuration of the sql server.

2. First I  download  the webmin installation:
$ wget http://www.webmin.com/download/deb/webmin-current.deb

3. Then use dpkg to start the installation.
$ dpkg -i webmin-current.deb

Oh no! The installer isn't going. We're missing dependencies!

Before I could get the webmin installation to start, here's what I had to install:
$ apt-get install perl libnet-ssleay-perl libauthen-pam-perl libpam-runtime libio-pty-perl unzip
Try running dpkg again webmin-current.deb, if it still complains about missing dependencies you might want to check here
In a few moments, if everything worked, you will be informed you can log into your webmin server at localhost:10000

4. For security reasons, I recommend creating a sudo user to login to webmin rather than using root.
$ adduser your_name
You will be asked to enter a password twice. The more complex the better. Then add this user to the list of sudoers so you can log in and work inside webmin panel.
$ usermod -aG sudo your_name

5. I recommend running webmin from a non-standard port. Webmin has been  around for years and black-hats often port scan the webmin default ports. You can edit the webmin port in the webmin conf file. look for the line that reads "port=10000" and change the number to something different.
You can edit the webmin conf file with the editor of your choice or by running:
nano /etc/webmin/miniserv.conf

For the purposes of this tutorial I'll assume you changed port=10000 to port=12345. ctrl+x will save your changes to miniserv.conf
Now restart webmin so the port change takes effect.
$ /etc/init.d/webmin restart

6. you should now be able to log into your server via webmin in the browser. Note that your browser will throw an error from self-signed ssl. This is normal. In your browser navigate to
https://123.456.789:12345
where 123.456.789 is your database server ip and 12345 is the port you used in webmin.conf

Enter in the credentials of the sudo user you created. After this you should be logged into webmin. If you've never used webmin before, you'll see lots of links on the left sidebar. Don't panic!

here's a screenshot to show you where to look and help you feel a little more comfortable:
   
7. Click on "Servers" on the left. If you see MySQL Database Server, skip this  step. It wasn't installed for me, so I had to click on "Unused Modules". Scroll down until you see MySQL Database Server. The SQL installer will take a few moments. After it completes, you may need to click "Refresh Modules" to bring it up in the "Servers" sub menu.

Now you've gotten SQL installed, but it needs to be configured.

8. From the "Server" sub menu click on "MySQL Database Server"

9. First click on "Set admin password" - I recommend you use a password generator and use a very strong password here.

10. Next click on "User permissions" then "Create a New User"

*Make sure you give the user the name root. a user named root is required by cyberpanel.
*Make sure to use a strong password
*Make sure you set "Hosts" to the IP of the server you'll use for cyberpanel installation
*Highlight all the permissions so cyberpanel can do what it needs to in the database.
Once you've got everything filled out, create your user

11.  After your remote user is created, click on Database permissions.
For Databases, select "Any"
For Username, input "root"
Hosts: The IP of your cyberpanel installation
Permissions: highlight all

12. Next, go to "Mysql Server Configuration"
For Host, use the IP of your cyberpanel installation
You may wish to change the default port: be forewarned that while this is recommended for security, it can cause complications with some web apps depending on how they're configured.
Scroll down and click "Save and Restart MySQL"

At this point your Remote database should be ready.

13. It is strongly recommended to use a firewall for increased security. I used ufw to close off all ports except those needed for sql, ssh, and webmin, and restrict access to sql to only the Cyberpanel IP.
$ apt-get install ufw
$ ufw deny all
$ ufw allow 123 //whatever port you use for ssh
$ ufw allow 12345 //webmin port
$ ufw allow from 987.654.321 to any port 54321 //cyberpanel's VPS IP, sql port

14. Now we're ready to begin the cyberpanel installation on our other server.
The only dependency I needed was curl.
$ apt-get install curl
$ sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)

This covers the installation of Cyberpanel with OpenLightSpeed WebServer. It doesn't cover the installation of Cyberpanel ENT, although they should be similar.

15. The installer will ask you if you want a full install or a custom install. I chose a custom install, because I don't want to deal with the hassle of setting up services I would prefer to offload for increased performance.

The installer will ask you if you want to install DNS, Postfix, or FTP. This tutorial does not cover the configuration of the full cyberpanel stack, only the minimum required for serving web pages. I chose no for all of these options.

16. The installer will ask you if you want to install Cyberpanel with Remote Database. Choose Yes.
The installer will ask you for the hostname of the remote database server. You can use the IP of your database server here.
The installer will ask you for a mysql port. Use 3306 if you didn't change the port in step 12. If you did, enter that port here.
The installer will ask you for a mysql user. Enter the credentials from the user created in step 10.
The installer will ask you which database has the default mysql schema: 'mysql' worked for me.

17. The installer will ask about a few more additional softwares: Redis, MemCache, Watchdog. This tutorial does not cover the configuration of these programs. I entered no for all options.

Cross your fingers and hope for the best. If everything worked properly in a few minutes the terminal will tell you how to log into your new cyberpanel installation Smile


Messages In This Thread
Cyberpanel with Remote Database - by fitkoh - 12-13-2020, 09:13 PM
RE: Cyberpanel with Remote Database - by fitkoh - 12-17-2020, 05:45 PM


person_pin_circle Users browsing this thread: 1 Guest(s)
Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - Hyper Expert - Shadow Hosting - Bladenode - Hostlease - RackNerd - ReadyDedis - Limitless Hosting