Best Practice Cyberpanel Install With Additional Step

Best practice Cyberpanel install

As we know Cyberpanel has installer that will perform all installation steps. But sometmes, we need more additional steps for example like setup OpenLiteSpeed admin password, view Mysql root password so we can easily manage all database, raise PHPMyadmin upload limit, setup more secure SFTP account, and some adjustment in PHP configuration.
Even I think this is best practice for Cyberpanel installation steps, but maybe you will no needed all of these steps. Choose only what you will needed.

Table Of Contents


Cyberpanel Installation

This is standar perform that ypu can found in Cyberpanel official site.
Minimum Requirement

  • Centos 7.x (Recommended minimal version)
  • Python 2.7
  • 1024MB or above Ram.
  • 10GB Disk Space

If all requirement match with your machine, so we just can start installation by running this command:for Cyberpanel Free Edition

sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)

As we can see the command above wll check whether we can run with curl or wget. When you prompt with admin password, I suggest to choosing “set”  and give your Cyberpanel admin. I think this is will saving our time.

At the end of installation you will found all installation information including your admin password (see picture above). Please save this information to a safe place. Now you can access your Cyberpanel dashboard at address https://your-ip-address:8090 with username: admin ad password that you specified before. You will also have notice if your firewall configuration level is at network level or not (ie: Google Cloud Firewall).

When your firewall configuration at network level, so you wll have to manually configured as guided above.

 

Issue SSL For Hostname

So now you have access admin dashboard with IP address, but if you feel your IP address s hard to remembering, you can make your access address with hostname, for example:  https://your.hostname:8090. Since the access will need valid SSL certificate, you will seeing warning invalid SSL certificate every tryin to access your admin dashboard with your hostname.

Now we’ll need to issue valid SSL certificate for your hostname.

1. First you need create A records for your sub domain that you choose for Cyberpanel hostname to Cyberpanel server IP Address.

Note: If you DNS hosted at Cloudflare, make sure your proxy status of hostname records is turn to grey since Cloudflare not providing proxy access to port 8090 and 7080.

2. Login to your Cyberpanel, and go to menu: Websites -> Create Website  then create website with your sub domain that you created before. Make sure SSL option is checked.

 

3. After create website, now go to menu SSL -> Hostname SSL.  Select your sub domain on dropdown menu, and click Issue Hostname button. If issue success, you will got notification (see picture above):
SSL Issued. You can now access CyberPanel at: https://"domain":8090

 

.

Setup OpenLiteSpeed Admin Password

OpenLiteSpeed admin control panel has different port with Cyberpanel. Access to OpenLiteSpeed admin panel is at port 7080. However since at first installation, password for OpenLiteSpeed admin never defined, so we will need to setup or reset OpenLiteSpeed admin password.

Logged in to your server console, then running this command:

/usr/local/lsws/admin/misc/admpass.sh

You’ll asked for username (admin) and new password (at least 6 character).

 

 

Lowering Log Level To Saving Storage

In many cases logs file (error or access) can be huge. In my experience it can be 15 GB for error logs. So we need to adjusted error and access logs so their space on storage becomes small.

  1. Login to OpenLiteSpeed admin panel at https://your-hostname-or-ip-address:7080
  2. Go to Server Configuration menu, then choose tab Log.

  3. Update Log Level configuration for error logs from DEBUG into WARNING or ERROR  (see picture above).
  4. Update access log retention day from 30 to lower days, for example 7 days only (see picture above).
  5. Dont forget to restart gracefully OpenLiteSpeed after you have made all changes above.

Error logs in Cyberpanel will still remain, currently no such mechanism to auto delete logs, so we will need setup cron jobs for removing error logs periodically.

Error logs at Cyberpanel saved inside directory: /usr/local/lsws/logs/ When we check file format for each logs, we can remove all error logs with command:

rm -rf /usr/local/lsws/logs/error.log.*

Now we start create cron jobs for root user to execute command above in every specified time.

    • Log on your server console with user root
    • run command  crontab -e
    • Adding remove command above to cron job list, for example remove error logs every month:
      0 0 1 * * root rm -rf /usr/local/lsws/logs/error.log.*

 

MySQL Root Password

Cyberpanel has feature for adding MySQL user and database through control panel. But since it will create one database one user, if you only using Cyberpanel for personal use, maybe you’ll find not easy to manage several database in PHPMyAdmin because you have to logged in with different user for each database.

Using root password will allowing us to manage several database. So we need to knowing MySQL root password.

Just type command in console: cat /etc/cyberpanel/mysqlPassword   you’ll see MySQL root password. Then you can log in as root user at: https://your-hostname:8090/phpmyadmin/

 

Raise Upload Limits For PHPMyadmin

Default upload size limit for fresh installation Cyberpanel only 2MB, if you want to increase these upload limit here are few steps you can try:

  1. Login into Cyberpanel as admin
  2. Go to menu   PHP -> Edit PHP Config
  3. Select choose Advanced tab then select tp PHP version 7.0
  4. You will need to edit PHP.ini editor directly:
    • Find post_max_size and change value from 8 MB to 400MB (or as you needed, keep ratio 4:1 to upload_max_filesize could be best option)
    • Find upload_max_filesize and change value from 2MB to 100MB (or as you needed)
  5. Click button Save Changes
  6. Last, restart lscpd service by running this command on your server console: systemctl restart lscpd

SFTP Secure Account Setup

Cyberpanel providing file manager and FTP feature, but just in case you prefer to using SFTP to access your file, you can assign SFTP account each home directory. Why assign per each home directory? because using root as SFTP is bad idea since it will changing file ownership.

  1. Login to Cyberpanel
  2. Go to menu: Websites -> List Websites
  3. Click on “Manage” beside home directory that you need to assign SFTP account.
  4. You will be directed to website managament, click on “Setup SSH Access”
  5. You will found your SSH username and  need to set up new password for that username
  6. Save your username and password, you will need that credentials for login to SFTP.
  7. Now you will need to make sure your current server configuration allowed SSH user login with password (if you not plan to authentication key):

    • Entering your server console as root, then view / edit your SSHD config with your favorite edtor, depend on your OS, the location may vary, for example in Centos here the location: /etc/ssh/sshd_config
    • Find line PasswordAuthentication yes if that line is commented by # remove that comment
    • Save the editor
    • Restart SSH service using this command: service sshd restart
  8. Now you can tryin login into your SFTP with username and password above

Best Practice Cyberpanel Install Conclusions

As I write before, all steps above just optional, but in many cases can be useful. Maybe you will need some additional adjustment like change PHP configuration or others depend on your needs.