How to set up a VPS with WP in minutes!

In my own experience VPSs have come and gone more frequently than my shared hosting accounts.  So one thing I learned with VPSs coming and going more regularly than comfortable to me was to learn to set up a new VPS very fast, and to have my WordPress sites backed up and easy to migrate.

The following is a tutorial for how to set up a VPS with a WordPress site in minutes of getting the VPS.

How to set up the VPS with VestaCP

VestaCP is a free panel for managing the basic elements of a VPS.  It has a very nice cPanel feel to it – but obviously since it is free, isn’t as feature rich as cPanel is.  It is however ideal for a VPS since it is very light in resources.  The script runs with a combo of nginx and apache, and uses the lightness and speed of nginx with the efficiency of file management of apache.

If you need name servers it is very easy to create one’s own name servers with a domain at Namecheap or Name Silo, or one could try Cloudflare as well.  Namecheap allows one to create two name servers with the same IP.  So does Name Silo.  Once you’ve created those private name servers don’t forget to add them to the domain at your domain registrar.

To install VestaCP, VestaCP provides an excellent “menu” for choosing what one wants to include in VestaCP in ONE installation command.  All one needs to do is navigate to its installation page and you will find a menu with default settings with which one can generate one’s own bash command.

The default Install Command will then look something like this:

bash vst-install.sh –nginx yes –apache yes –phpfpm no –vsftpd yes –proftpd no –exim yes –dovecot yes –spamassassin yes –clamav yes –named yes –iptables yes –fail2ban yes –mysql yes –postgresql no –remi yes –quota no

VestaCP of course doesn’t come with a free File Manager, however I’m quite happy with FileZilla and am using SFTP instead of FTP. I also don’t use a mail server.  If mail is needed with my domain later on, I will use a free e-mail host like Zoho or Yandex.  Yandex in particular is very generous with the number of e-mail accounts that are allowed for use with one’s domain.

My choices for the Install Command are:

WEB:  nginx + apache
FTP:  No
MAIL: No
DNS: Named
FIREWALL:  iptables + fail2ban
DB:  mySQL
REPOSITORY: Remi
FILE SYSTEM QUOTA: No
HOSTNAME:   domain.net

In summary these are the commands I use with a minimal installation of CentOS-7:

yum -y update
yum install wget ( may already be installed)
yum -y install curl (may already be installed)
curl -O http://vestacp.com/pub/vst-install.sh
bash vst-install.sh –nginx yes –apache yes –phpfpm no –vsftpd no –proftpd no –exim no –dovecot no –spamassassin no –clamav no –named yes –iptables yes –fail2ban yes –mysql yes –postgresql no –remi yes –quota no –hostname vps.domain.tld –email name@yahoo.com –password 123456

How to install WordPress from the command line

Since the above is so easy to do, it takes under five minutes to install the panel.  Then all one needs to do is add one’s name servers to the panel and create a database for the WordPress site.

I’ve been installing my WordPress installations from the command line, since it is so easy, but since VestaCP now has Softaculous as well, I’ll probably be installing WordPress with Softaculous as well.  Please remember that if you are planning to use Softaculous, you need to load ioncube on your VPS.  This is the command you use for it:

/usr/local/vesta/ioncube/ioncube.sh

If you don’t want to spend any money on Softaculous – here are the commands for setting WordPress up from the command line:

cd /home/admin/web/domain.net/public_html
wget http://wordpress.org/latest.tar.gz
tar --strip-components=1 -xvf latest.tar.gz
rm latest.tar.gz

chown admin -R *

The All-in-one WordPress Migration and Backup tool

https://wordpress.org/plugins/all-in-one-wp-migration/

The above is one of the most powerful backup and restore tools that are on offer for free.  I don’t know how good it is for very large sites, but for smaller to medium sized sites it is faultless.  I haven’t had a single issue with using it in all of my experiences with VPSs.  I previously used the Duplicator tool, and the latter tool always seemed to be finicky with server specifications – also laborious as one has to use FTP to upload the files.  With the All in one WP Migration tool one can save the backup and upload and restore the backup directly from one’s desktop computer.

All one has to do to make the backup is to install the plugin, and then with the plugin immediately make a backup of the WordPress site.  Then when one migrates to a different server all one does is install the plugin and the load the backup directly from one’s computer.  I have a few regular backups that I’ve created into templates of a kind so setting up a new WordPress site is effortless.  All one needs to do after the backup has been imported is to save the Permalinks twice.  One also must be careful to know exactly what the password is of the backup as that is the one WordPress will be needing after the backup has been imported and installed.