VestaCP is an open source hosting control panel. VestaCP provides a set of features to manage Domains, DNS, Mail, Databases, Cron Jobs, Backups and many more.

In this tutorial, you are going to learn how to install Vesta Control Panel on Google Cloud with Ubuntu 18.04.

Create the VM Instance

Go to Compute Engine >> VM Instances and click Create Instance

In Name provide a name for your Instance

In Region choose the region closest to your visitors

In Machine Type choose 3.75 GB memory 1vCPU

In Boot disk click Change and choose Ubuntu 18.04 LTS. In Size enter your required size, the minimum should be 20 GB and click Select

In Firewall check both Allow HTTP traffic and Allow HTTPS traffic

Click Create

It will take a while before the VM instance will be available for you.

Reserve your IP address

If your IP address has a valid license you can proceed to reserve your IP address by going to VPC Networks >> External IP Addresses reserve your IP address to Static.

Setup Cloud DNS

Please follow this guide to setup Cloud DNS and point your domain to Google Cloud.

Once you have created DNS Zone, you need to create one additional A record for VestaCP subdomain in your Cloud DNS.

Click Add record set

In Name enter panel

Select Resource Record Type to "A"

IPv4 Address with the IP address of your instance that you have reserved earlier.

Leave everything to default.

Click Create.

Setup Firewall rules

VestaCP uses a custom port to manage the server, so you need to create a firewall to provide access to this port.

Go to VPC Network >> Firewall rules and click Create Firewall rules.

In Name enter vestacp

In Targets select All instances in the network

In Source filter select IP ranges

In Source IP ranges enter 0.0.0.0/0

In Protocols and ports check TCP and enter 8083

Click Create.

Connect your VM Instance

Go to Compute Engine >> VM Instances and click the SSH button right next to your instance to open the terminal window in the browser.

Set up Hostname in Google Cloud

Google Compute Engine won’t preserve the hostname (panel.yourdomainname.com) you set and changes it to default hostname automatically. To preserve the hostname follow the below simple steps.

cd /etc/dhcp/dhclient-exit-hooks.d/
sudo nano set-hostname.sh

Paste the following contents and hit Ctrl+X followed by Y to save the filter. Remember to replace yourdomainname.com with your domain name

#!/bin/sh
hostname panel.yourdomainname.com
/scripts/fixetchosts

Set correct permissions to the file you created

chmod 744 set-hostname.sh

Now you are ready to install VestaCP on Google Cloud.

Generate Install Command

Before installation go to VestaCP website and generate the installation command.

Scroll down to Advanced Install Settings and select the following.

  • In Web select nginx + apache
  • In FTP select vsftpd
  • In DNS select named
  • In Firewall select iptables + fail2ban
  • If you need Softaculous select yes
  • In DB select MySQL
  • In Hostname enter panel.yourdomainname.com
  • In Email enter your email address
  • In Password enter your admin login password

Click Generate Install Command.

Install VestaCP on Google Cloud

Update your server and download the installation script.

sudo su
sudo apt update
sudo apt upgrade
cd /tmp
curl -O http://vestacp.com/pub/vst-install.sh

Now paste the generated command with the -f at the last to force install VestaCP.

If you don’t use the -f appended you will receive an error similar to this.

Please remove admin user account before proceeding.

Execute the command with the -f option. So, The command looks similar to the one below.

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 yes --softaculous yes --mysql yes --postgresql no --hostname panel.yourdomainname.com --email youremail@mail.com --password your_password -f
Install Vesta Control Panel

Once the installation is completed you will be greeted with the login credentials

Congratulations, you have just successfully installed Vesta Control Panel

https://panel.yourdomainname.com:8083
username: admin
password: your_password

Verify the Installation

Now, go to your web browser and visit your Vesta Control Panel by typing the URL (https://panel.yourdomainname.com:8083).

Here you will get a warning of insecure website, just proceeed to the website. We will install SSL certificate later to fix this issue.

Verify Vesta Control panel Installation

Now login to your dashboard with the username and your password.

Install FREE SSL Certificate

Go to WEB section and hit EDIT which will show when you hover the mouse on hostname/subdomain.

Under Aliases remove everything from the box.

Navigate below You’ll see “SSL Support” checkbox mentioned at the bottom, check the box and select/check “Let’s Encrypt Support

Click Save.

Set Up Cronjob

Create a cronjob to check the certificate daily and installs them if changed.

nano /etc/cron.daily/vestassl

Paste the following lines.

!/bin/bash

cert_src="/home/admin/conf/web/ssl.panel.yourdomainname.com.pem"
key_src="/home/admin/conf/web/ssl.panel.yourdomainname.com.key"
cert_dst="/usr/local/vesta/ssl/certificate.crt"
key_dst="/usr/local/vesta/ssl/certificate.key"

if ! cmp -s $cert_dst $cert_src
then
# Copy Certificate
cp $cert_src $cert_dst

#Copy Keyfile
cp $key_src $key_dst

#Change Permission
chown root:mail $cert_dst
chown root:mail $key_dst

#Restart Services
service vesta restart &> /dev/null
service exim4 restart &> /dev/null
service dovecot restart &> /dev/null
fi

Hit Ctrl+X followed by Y and Enter to Save and Exit.

Set up correct permissions.

chmod +x /etc/cron.daily/vestassl

Restart VestaCP Services

Once done, you can start the cronjob and restart the services to apply the changes of SSL Installation.

sh /etc/cron.daily/vestassl

You can also restart the services using the below comands.

service vesta restart
service exim4 restart
service dovecot restart

Now close the existing VestaCP tab in your browser and login again you will have your SSL certificate installed successfully.

Conclusion

Now you have learned how to install Vesta Control panel on Ubuntu 18.04 in Google Cloud.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

4 Comments

  1. mohommed shariqq Reply

    ok i got, but what if i need to add more websites, should i need to create more zones in cloud dns?

    • CloudBooklet Reply

      You just add domains in Vestacp and at your domain registrar create hostnames pointing to the External IP address and use them as custom nameservers.

      • mohommed shariqq Reply

        Ok, Thank you very much for replying, I thought you will ignore this, I’m a newbie in cloud.

  2. When I run ‘sh /etc/cron.daily/vestassl’ to restart vesta I get the following error

    /etc/cron.daily/vestassl: 1: /etc/cron.daily/vestassl: !/bin/bash: not found
    root@cp:/home/acn_shawnc_gmail_com# !/bin/bash
    bash: !/bin/bash: event not found

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Like this post...

Signup for FREE Cloudbooklet Newsletter
SUBSCRIBE
close-link
Please help us get 1000 likes in Facebook. Thank You!
LIKE NOW

Stay Connected!

Get latest tutorials on Google Cloud and Open Source topics
SUBSCRIBE
close-link