Install Ghost CLI and Create Directory

Sam Julien
InstructorSam Julien

Share this video with your friends

Send Tweet
Published 2 years ago
Updated 2 years ago

To run Ghost, we first need to install the ghost cli. This can be done with npm now that Node.js is installed on the server.

After installing the CLI we will create a directory /var/www/ghost that the actual installation of Ghost will occur in. We'll update the permissions of this file to include the ghost-admin user that we are logged in as.

Instructor: [0:00] We're ready to install the Ghost CLI, which is a handy tool for installing and running Ghost. We can do that with npm. We can say npm i -g, for global, and then ghost-cli. Notice here that I'm already logged into our EC2 server with SSH, and I've already switched over to the Ghost admin account. Let's let that run.

[0:22] I'll go ahead and fast forward, so you don't have to sit here. It's done. We can make sure that it's installed correctly by running Ghost help. You can see that the Ghost help outputs all of its options. Let's clear that out.

[0:35] Before we install Ghost itself and run it, we need to create a directory that our Ghost server will live in. We can do that with sudo mkdir, and we're going to pass it the -p flag. That's going to create subdirectories if they don't exist. We're going to put this in /var/www/ghost. You're going to need to enter the password for the admin. Great.

[1:02] Now we need to change the owner and the group for that directory. We're going to say sudo chown, which stands for change owner. This command first takes a user, which will be ghost-admin followed by a colon and then the group, which we also made ghost-admin, and then the name of the directory, so /var/www/ghost. Great.

[1:25] Lastly, we just need to change the permissions. We're going to say sudo chmod to change permissions. We're going to type 775. What this means is that we're going to give the user read, write and execute permissions. That's what the 7 means.

[1:40] We're going to do the same thing for the group -- read, write and execute. That's also what the 7 means, and then 5 is going to stand for read and execute, and that's for others. For everybody else, they can only read and execute. We'll add some links alongside the video so you can learn about chown and chmod.

[1:57] We just type in the directory again, so /var/www/ghost. That's done. Let's just lastly cd into that, so cd /var/www/ghost. Now we are ready to install ghost.