In this guide we are going to set up and install Ghost on a Vultr server. It is intended for self hosters that are looking for a complete tutorial on how to choose and configure the right Vultr instance. If you don't want to install it yourself and focus more on writing you can always choose Ghost Pro.
Get the right Vultr Cloud Compute
In order to install Ghost on Vultr you first need to purchase a virtual machine from them. Vultr offers a lot of servers starting from only $2.5/month, up to $320/month. For a Ghost installation you will need at least 1GB memory. So the minimul Vultr server that you can use is the $5 one.
Choosing the right server also depends on how much traffic you will have. If you don't have a lot you can try a minimum one and scale it if you need. You can also try a better server from the start, but keep in mind that downgrading is currently not supported.
We also run on Vultr and we got the 4GB memory system. We host all our Ghost themes and the main website on it and we are very pleased on how it runs.
Operating System
The official recommendation is Ubuntu 16.04. When you deploy your new instance, after you select the desired Server Location, you have to choose the Server Type. Simply select Ubuntu and then 16.04 x64. Some other operating systems could work but they are not officially supported.
Manage DNS Domain
After you deployed your Cloud instance you have to set the DNS. In order to do that you need to point your domain to the DNS nameservers:
- ns1.vultr.com
- ns2.vultr.com
After you pointed your domain you have to add your records:
- Type A | Name Leave blank | Data Your Vultr instance IP
- Type NS | Name Leave blank | Data ns1.vultr.com
- Type NS | Name Leave blank | Data ns2.vultr.com
You could have a lot more records that you want to add, like subdomains, private mail and more. This is just a small example that fits for those who want to install Ghost on the main domain.
If you want to install it on a subdomain like www you have to add another record:
- Type A | Name www | Data Your Vultr instance IP
You will find a lot more information on how to set Vultr DNS here.
If you use CloudFlare you will have to point your domain to the CloudFlare's DNS nameservers. Then add your records to CloudFlare.
- Type A | Name yourdomain.com | Data Your Vultr instance IP
For a www subdomain add:
- Type A | Name www | Data Your Vultr instance IP
Access your Vultr VPS
In order to connect to your VPS via SSH, you must have following:
Server Information
To access your instance you have to connect with the default access credentials that you'll find inside Server Information section that can be accessed from my.vultr.com.
There you'll see:
- IP Address
- Username: Default root
- Password (Click the eye to see it)
SSH Client Software or Vultr Console
There are multiple ways to connect to your VPS:
- OpenSSH - Mac & Linux computers have an SSH client program installed by default.
- PuTTY - Windows doesn't include a SSH client. You can download most common one, PuTTY.
- Vultr Console - Can be accessed from Server Information on my.vultr.com. The console software does not support cut & paste.
OpenSSH
The basic syntax for SSH is ssh root@SERVER_IP_ADDRESS
. Example: ssh root@192.102.0.1
. Replace 192.102.0.1
with your IP Address that you found in Server Information. The first time you attempt to connect you'll see a warning because it's your first time and the remote server is not recognized. Type yes
to continue to connect. Copy and paste your password and that's it.
PuTTY
After you installed PuTTY you need to start it and add your Server IP Address. Port 22 is the default one and you should leave it like this. The first time you attempt to connect you'll see a warning, PuTTY Security Alert
, because it's your first time and the remote server is not recognized. Click yes
to continue to connect.
PuTTY will ask for your username. Type root
. Press Enter and you will be asked for your password. Copy and paste your password from Server Information, press Enter and you're done.
Vultr Console
You will be prompted to add your username, root
. Write your password. Unfortunately you can't paste it there. You might see a warning because it's your first connection. Click yes
and that is all.
For security purposes you must change your password. You can do this by executing passwd
. Simply follow the instructions and you're done.
Create a new user
For security purposes you should create a new user.
Type: adduser [user]
The new user has regular privileges. Most likely you'll run administrative tasks. You have to add the new user to the "supergroup" group.
Type: usermod -aG sudo [user]
.
-a
appends to the group
-G
is the groups to append the user
Now log in as the new user: su - [user]
.
Update Packages
Update package lists: sudo apt-get update
.
Upgrade installed packages: sudo apt-get upgrade
.
Install Nginx
Type apt-get install Nginx
.
We need to configure the firewall software to allow access to the HTTP and HTTPS services. Nginx registers itself as a service with ufw
upon installation.
You can enable this by typing: sudo ufw allow 'Nginx Full'
.
You can also list the applications by typing: sudo ufw app list
. You should see:
Available applications: Nginx Full Nginx HTTP Nginx HTTPS OpenSSH
Verify the changes by typing: sudo ufw status
. You shoud see:
Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere Nginx HTTP ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) Nginx HTTP (v6) ALLOW Anywhere (v6)
Install MySQL
Type sudo apt-get install mysql-server
.
You'll be asked to create a root password during the installation. Choose a good one and make sure you remember it.
Install Node.js
Set up the current APT repository and add the PGP key to the system's APT keychain:
Type curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash
Then install Node.js:
Type sudo apt-get install -y nodejs
Type node -v
too see the version that your have.
Install Ghost-CLI
Type: sudo npm i -g ghost-cli
Install Ghost
You need to install Ghost via the CLI.
Create a new folder:
Type sudo mkdir -p /var/www/ghost
Don't install Ghost in the /root
folder.
For each installation you should create a new folder.
Give access to the user that you recently created:
Type sudo chown [user]:[user] /var/www/ghost
Navigate to the new directory:
Type cd /var/www/ghost
Now install Ghost:
Type: ghost install
- Enter your blog Url: Write the url and include the protocol. e.g.
http://example.com
for HTTP orhttps://example.com
. - Enter your MySQL hostname [localhost]: Type
localhost
if you installed MySQL on the same server. - Enter your MySQL username: Type your MySQL username if you recently created one. Else type
root
. - Enter your MySQL password: Type the password assigned for the username that you wrote in the previous step.
- Enter your Ghost database name: Enter the name of the database that you want to assign the new installation.
- Do you wish to set up "ghost" MySQL user?: Type
y
. - Do you wish to set up Nginx?: Type
y
. - Do you wish to set up SSL?: Ghost-CLI uses Let's Encrypt as a certification service. If you want to set up ssl type
y
and the CLI will generate the certificates for you. If you have your own certificates you have to set them yourself. If you don't want ssl simply skip this step. - Enter your email (used for SSL certificate generation)
- Do you wish to set up systemd?: Type
y
. - Do you want to start Ghost?: Type
y
.
Go to your url and you should see a new Ghost installation.
If you have problems with Ghost installation you can always ask in comments or you can join Ghost's official Slack channel and you will sure get your answer for any question.
That is all.