How to install multiple Ghost instances on the same server
Install a second Ghost Instance on your VPS in a few lines. Allowing you to save a lot of money on hosting.
If you haven’t created a Ghost Instance yet, head over to Digital Ocean and get started in a few minutes.
Have been using wordpress for many years, but I’ve grown tired of the overly complex layout and the slow interface. I started looking at other blogging solutions and Ghost seemed liked one of the best alternatives.
I’ve been using ghost for a year now and it is probably the best alternative to Wordpress.
I moved all of my websites from Wordpress to Ghost. In doing so I was able to save tons of money by running multiple Ghost Blogs on the same VPS. So far I’ve been able to run 3 websites on a single 1gb Digital Ocean VPS without any issues.
Let’s get started.
First of all I assume that you already have a ghost blog running on your server and you are familiar with the host client.
Creating a new sudo user
You have two choice for your secondary ghost instance on your server. You can either create a new user or you can just use the root user. I’ll show you how to create a new user.
Step 1 - Connecting to your server as root
SSH in to your server as the root user:
ssh root@your_server_ip_address
Step 2 - Creating the user
Use the adduser
command to add a new user to your system:
adduser user
Be sure to replace user
with the user name that you want to create. You will be prompted to create and verify a password for the user:
Output
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Next you’ll be asked some information. You can leave everything empty.
Output
Changing the user information for sammy
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n]
Step 3 - Adding the user to the sudo Group
Use the usermod
command to add the user to the sudo group:
usermod -aG sudo user
Again, be sure to replace user
with the username you just added. By default, on Ubuntu, all members of the sudo group have full sudo
privileges.
Installing the new ghost instance
In order to run ghost you need to create a new folder where ghost is running. In order to do that you need to create a new folder in /var/www
cd /var/www
sudo mkdir yourwebsitename
sudo chown user:user ./yourwebsitename
cd yourwebsitename
Don't forget to change yourwebsitename
and user
to the corresponding names.
You’ll then need to copy the credentials from your existing Ghost Instance.
Go to var/www/<ghost_instance>
and open vim config.production.json
Copy the database password
Then log in as the root user and type mysql
create database <database_name>;
GRANT ALL PRIVILEGES ON <database_name>.* TO 'ghost'@'localhost';
FLUSH Privileges;
Log back as your user for this instance. Go to /var/www/<new_website>
and run ghost install
You’ll be prompted with a few question.
Enter your blog URL: https://<yourwebsitename>
? Enter your MySQL hostname: localhost
? Enter your MySQL username: ghost
? Enter your MySQL password: <yourpassword> # The one you extracted from config.production.json
? Enter your Ghost database name: <databasename>
After running all of these, you should be good and have two ghost instances running on the same server.