The new Ghost 2.0 introduces many new features including, a powerful new editor, multi-language support, custom homepages, dynamic routes, custom structures, and much more. Ghost is a clean and lightweight platform designed for bloggers who want to focus on blogging and nothing else. Unlike WordPress and other content management systems which are based on PHP, Ghost is simple in design and function. No additional packages and servers are needed, just JavaScript. In this post, we’re going to show you how to install Nginx as a proxy, MariaDB, and use the Let’s Encrypt SSL certificate to secure the Ghost website. For more about Ghost, please visit its homepage. To get started with installing Ghost on Ubuntu Linux, follow the steps below:
How to install Nginx on Ubuntu Linux
In this post, we’re going to install the Nginx HTTP server to serve as a proxy for Ghost. Nginx is lightweight and should be perfect to run with Ghost. To install Nginx, run the commands below: After installing Nginx, the commands below can be used to stop, start and enable the Nginx service to always start up with the server boots. Once Nginx is installed, open a web browser and browse to the server hostname or IP address. If you see an Nginx welcome page, Nginx is successfully installed and running on Ubuntu.
How to install MariaDB on Ubuntu Linux
We’re going to be using a database server with Ghost. If you’re looking for a truly open-source database server, then MariaDB is a great place to start. To install MariaDB run the commands below: After installing MariaDB, the commands below can be used to stop, start and enable the MariaDB service always to start up when the server boots. After that, run the commands below to secure the MariaDB server by creating a root password, disallowing remote root access removing anonymous, and more. When prompted, answer the questions below by following the guide. The latest MariaDB servers come with a root user set to use the auth_socket authentication method by default. The auth_socket plugin authenticates users that connect from the local host through the Unix socket file. This means that you can’t authenticate as a root by providing a password. This can cause issues with some apps that need to connect to the database via root. To fix that, you’ll need to change the default authentication mechanism from auth_socket to mysql_native_password. However, doing so might introduce security risks since root users shouldn’t be used to connect remotely to the database. A recommended method is to create a dedicated user to connect remotely to your database servers. Since you don’t want to connect to the MariaDB database server from phpMyAdmin as the root user, you should probably create a separate account instead of connecting with the root. Run the commands below to log on to the MariaDB server. Then run the SQL commands below to create a new user for Ghost to use to connect to the database. Then grant the user full access to manage the database server. If you see a similar screen as shown above, then the server was successfully installed.
Create Ghost Database on Ubuntu Linux
Now that you’ve installed all the servers above, continue below to start configuring the servers. First, run the commands below to create a blank Ghost database. To log on to MariaDB, run the commands below. Then create a database called ghost Next, use the Ghost account created above and give it access to the ghost database. Finally, save your changes and exit.
How to install Node.js on Ubuntu Linux
Since Ghost is based on Node.js run the commands below to download Node.js version 14 LTS packages from its repository Next, run the commands below to install Node.js and the required packages for Ghost to function. An Nginx webserver will be needed for this. s Next, run the commands below to include the Yarn repository and enable it. Once the repository is enabled, install yarn with:
How to download and install Ghost
We’ll install Ghost using the official Ghost CLI utility. This utility allows you to install or update Ghost in a single command. Run the commands below to install the Ghost install tool. We’re going to create a folder for Ghost content in the /var/www/ghost directory. To create the folder run the commands below. Next, change the folder ownership to your account so you can run the Ghost tool to download Ghost packages. Next, change into the directory and install Ghost. To start the installation, run the command below. The command will install and configure Ghost, configure Nginx as a reverse proxy, and secure the site with a free let’s encrypt SSL certificate. You should begin to see Ghost changing for packages that are required. Once all is validated, Ghost should begin downloading its package dependencies to install. Next, set up the database connection with the info created above. When asked if you want to set up Nginx, type yes. When prompted with questions below, choose yes. If all went well, you should then see a complete setup message similar to the one below. After that, open your browser and browse to the Ghost admin interface using the server hostname or IP address followed by /ghost/ To get started click on the Create your account button to create your account and start configuring Ghost. That should do it! Conclusion: This post showed you how to install Ghost CMS on Ubuntu with Nginx. If you find any error above or have something to add, please use the comment form below.