How to Install VestaCP on a VPS (Ubuntu, CentOS, Debian)

Install VestaCP on Ubuntu 18.04 & CentOS 7

What is VestaCP Web Control Panel?

Vesta Control panel (VestaCP) is an open source and light weight web hosting control panel with its core written in bash. Using VestaCP, one can manage web sites, mail server, database and much more with its clean and intuitive interface. This control panel does not consume too much server resources and runs efficiently. This can be gauged from the fact that a server with as low as  512 MB RAM and 1 Ghz CPU can serve 5000 to 8000 visitors daily with a site powered by VestaCP.

VestCP is one of the best cPanel alternatives you can get for free! with all the features you can expect from a standard web hosting control panel.

So lets dive into it and we will see How to install VestaCP on CentOS 7 and Ubuntu 18.04 and go in depth and do some basic configurations and settings required to run the control panel.

Pre-requisites (minimum system requirement)

  • 512 MB RAM
  • 20 GB Hard disc space
  • 1 Ghz CPU
  • Fresh server/VPS with either CentOS 7 or Ubuntu 18 installed
  • Root or SUDO credentials (SSH access)

Set FQDN of your server

The process of configuring FQDN (fully Qualified Domain Name) of CentOS 7 or Ubuntu 18.04 is same. Therefore, to configure FQDN in either Ubuntu 18.04 or CentOS 7.3, first set up the host-names of the system using hostnamectl command.

hostnamectl set-hostname vesta

Next edit /etc/hosts and add a line with following format towards the end of the file.
Format: IP_ADDRESS HOSTNAME.DOMAIN.TLD HOSTNAME

vi /etc/hosts
...
123.456.78.9 vesta.yourdomain.com vesta
...

Close and save the file. To verify FQDN of your system, type the following command from the terminal:

hostname -f
vesta.yourdomain.com

Note: If you are hosting your server in a cloud service provider like AWS, Linode, or DigitalOcean then you may also need to edit /etc/cloud/cloud.cfg and change the value of parameter preserve_hostname to true so that hostname persists after your server reboot.

Install VestaCP

1. Download the install script for VestaCP

To install VestaCP, you need to download the automated install script from their site. To do that, make a CURL request to grab it.

curl -O http://vestacp.com/pub/vst-install.sh
chmod u+x vst-install.sh

2. Generate the Install command

VestaCP provides an easier way to generate an install command for you. Visit the VestaCP install page and scroll down to the “Advanced install settings” section to choose the option that best suits your requirements.

Once you are done with choosing right options as per your requirements, hit the “Generate Install Command” button.

VestaCP Install Script

VestaCP will generate and show you the install command. Copy the command and paste it to a notepad. Make sure you have supplied correct hostname that you have configured in the first step.

VestaCP Install Script

3. Runt and Install VestaCP

Now to install VestaCP, run the above install command in the terminal that you have generated just now.

bash vst-install.sh --nginx yes --apache yes --phpfpm no --named yes --remi yes --vsftpd yes --proftpd no --iptables yes --fail2ban yes --quota no --exim yes --dovecot yes --spamassassin yes --clamav no --softaculous no --mysql yes --postgresql no --hostname vestacp.best-web-hosting.org --email [email protected] --password Str0ngP@ssw0rd

You will be prompted for a confirmation for installing the same. Type “Y” to continue with the installation of VestaCP.

VestCP Install Command

The installation will start immediately and it will take around 15 minutes to complete the process. Once done, the install script will show the confirmation of successful installation along with URL of VestaCP admin page, username and password in the terminal.

The installation of VestaCP is complete in your system. You can now login to the VestaCP control panel using the URL and username/password provided at the end of installation.

4. Configure VestaCP

Point your favorite web browser to https://vesta.yourdomain.com:8083 to login for the first time. The browser will warn you about the insecure page. You can safely add the page to the exception list.

Make sure you have added the firewall rule for port 8083 to enable TCP traffic on it. By default VestaCP use 8083 port number.

Type the supplied user name/password and hit the “Login” button. You will be redirected to VestaCP admin dashboard.

VestaCP Login Page

4.1 Change admin password

To change the admin password of VestaCP, navigate to the admin settings page through admin menu from right top corner of the dashboard. Apart from changing admin password, you can also change some other settings like language, package, nameserver through this page.

VestaCP Login - Change Password

Note: If you want to update default name servers then make sure you have already pointed DNS A record for your chosen domain (i.e. ns1.domain.tld) to the IP address of your VestaCP server.

4.2 Start/Stop/Configure services

To configure services, choose the “server” menu from right top corner of the page. Now hover the mouse to the services that you want to configure by clicking the “Configure” button.Moreover, you can also stop, restart services by hovering the mouse over appropriate service.

4.3 Configure firewall

To configure firewall rules, click the firewall link from top menu bar. Now hover the mouse over the rules that you want to edit, delete or suspend. If you want to add a new rule, click the green plus icon.

VestaCP Firewall Configuration

Choose appropriate action and protocol followed by port number, IP address and hit the “Add” button and you are done.

4.4 Customize Packages

During installation of VestaCP, 4 packages (bundled unit of resources) are created. The “default” package is allocated to admin user. But the requirements for resources for different types of users will vary and hence it is always a good idea to create customized packages as per user’s requirements.

To create a package, click “Packages” from the menu bar followed by green plus icon. Provide the name of the package and choose the option that best suits the requirement. Click infinity symbol for unlimited number of domains, DNS, mail accounts and like.

VestaCP Packages

Make sure to change the name servers value to the one that you have configured previously. In our case, it is ns1.best-web-hosting.org and ns2.best-web-hosting.org

4.5 Access phpMyAdmin

Since we have chosen MySQL as database for VestaCP installation therefore sooner or later you have to manage MySQL database for various tasks. VestaCP provides phpMyAdmin (a free software intended to handle the administration of MySQL). It will make your database administration task a freeze.

To access phpMyAdmin, point your browser to https://yourdomain.com/phpmyadmin/ and login with root user with password being the same as VestaCP admin.

It is always a good practice to have different password for VestaCP admin and MySQL. To change the password for the MySQL root user go to MySQL shell and update the password.

mysql -u root -p
mysql> use mysql;
mysql> UPDATE mysql.user SET authentication_string=PASSWORD('mysql.password') WHERE User='root';

4.6 Install Lets Encrypt

To install Lets Encrypt certificate for the host, navigate to the “Web” section and hover the mouse over the chosen host and click “Edit” button.

VestaCP Letsencrypt

Now tick the both SSL option and Lets Encrypt Support and hit the save button.

Let’s encrypt will fetch and store the SSL certificate and key in /home/username/conf/web folder and lists them as ssl.domain_name.crt and ssl.domain_name.key. But VestaCP stores the hostname SSL certificates in /usr/local/vesta/ssl folder and list them as certificate.crt and certificate key.

To put the lets encrypt certificates in right place, first take a backup of old certificates of the host.

mv /usr/local/vesta/ssl/certificate.crt /usr/local/vesta/ssl/certificate.crt.bak
mv /usr/local/vesta/ssl/certificate.key /usr/local/vesta/ssl/certificate.key.bak

Next create a symbolic link to the certificate and key file for the chosen host in the /usr/local/vesta/ssl folder and restart VestaCP.

ln -s /home/admin/conf/web/ssl.vesta.tuxlab.org.in.crt /usr/local/vesta/ssl/certificate.crt
ln -s /home/admin/conf/web/ssl.vesta.tuxlab.org.in.key /usr/local/vesta/ssl/certificate.key
service vesta restart

Refresh the VestaCP admin page in the browser. A green padlock icon in the browser address bar signifies successful installation of Lets Encrypt certificate.

VestaCP Letsencrypt

Conclusion

If you have come at this point that means you have installed VestaCP successfully and configured few settings using the steps described in this article.

For more on VestaCP control panel like how to uninstall it, where are the configuration file location and how to migrate the VestaCP browse the official documentation from here.