{"id":2302,"date":"2019-10-02T07:00:53","date_gmt":"2019-10-02T07:00:53","guid":{"rendered":"https:\/\/blog.ssdnodes.com\/blog\/?p=2302"},"modified":"2025-05-18T18:59:48","modified_gmt":"2025-05-18T18:59:48","slug":"how-to-install-ghost-cms-ubuntu-tutorial","status":"publish","type":"post","link":"https:\/\/www.ssdnodes.com\/blog\/how-to-install-ghost-cms-ubuntu-tutorial\/","title":{"rendered":"How To Install Ghost On Ubuntu 18.04 (Tutorial)"},"content":{"rendered":"<h1>Getting started with Ghost CMS on Ubuntu 18.04<\/h1>\n<p>Today we\u2019ll walk you through how to install Ghost on your VPS using Ubuntu 18.04 or Ubuntu 16.04.<\/p>\n<p>The Ghost CMS is simple, elegant, and responsive platform for blogging. Unlike <a href=\"https:\/\/www.ssdnodes.com\/blog\/how-to-install-wordpress-on-ubuntu-18-04-with-lamp-tutorial\/\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress<\/a>, the Ghost CMS is meant exclusively for blogging\u2013 so it\u2019s not set up to handle something more extensive, like an e-commerce website.<\/p>\n<h2>Why install Ghost CMS over other content management systems?<\/h2>\n<p>The Ghost CMS has a no-nonsense style that appeals to people who just want a simple blogging platform that looks great. There are minimal themes and an uncluttered design, so you can get right to writing instead of finding your way through a cluttered dashboard and thousands of plugins.<\/p>\n<p><a href=\"https:\/\/ghost.org\/\" target=\"_blank\" rel=\"noopener\">Ghost<\/a> is a modern, open source blogging platform written in NodeJS. The Ghost CMS come with a brand new Markdown editor, a refreshed UI, a new default theme design, and a lot more features that make for a nicer blogging experiencing.<\/p>\n<p>Installing Ghost CMS is pretty straightforward and Ghost officially recommends the following stack and server setup:<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>Ubuntu 18.04<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>MySQL<\/li>\n<li>NGINX<\/li>\n<li>Systemd<\/li>\n<li>NodeJS<\/li>\n<li>At least 1GB memory<\/li>\n<li>A non-root user for running ghost commands<\/li>\n<\/ul>\n<p><em>Source: <a href=\"https:\/\/ghost.org\/docs\/hosting\/\" target=\"_blank\" rel=\"noopener\">Ghost<\/a><\/em><\/p>\n<h2>Prerequisites for your Ghost CMS install<\/h2>\n<ul>\n<li>A VPS running Ubuntu 18.04 (or Ubuntu 16.04)<\/li>\n<li>A non-root, <code>sudo<span style=\"font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;\">-<\/span>enabled<\/code> user. If you only have a <code>root<\/code> user, see our <a href=\"https:\/\/www.ssdnodes.com\/blog\/tutorial-setting-up-and-securing-ssh-based-authentication\/#adding-a-new-user\">SSH tutorial<\/a> for details on creating new users.<\/li>\n<li>A registered domain name.<\/li>\n<li>A DNS A record that points to your server\u2019s IP address based on the FQDN you want to use. For example, an A record named <code>test<\/code> would point to <code>test.DOMAIN.TLD<\/code>.<\/li>\n<\/ul>\n<h2>Notes<\/h2>\n<ul>\n<li>This tutorial requires the use of domain names. Whenever you see either the <code>SUBDOMAIN<\/code>, <code>DOMAIN<\/code>, or <code>TLD<\/code> variables, replace them with the details of your domain name. In <code>example.ssdnodes.com<\/code>, <code>example<\/code> is the <code>SUBDOMAIN<\/code>, <code>ssdnodes<\/code> is the <code>DOMAIN<\/code>, and <code>.com<\/code> is the <code>TLD<\/code>.<\/li>\n<li>This tutorial requires the use of passwords. Whenever you see the <code>PASSWORD<\/code> variable, then replace it with your own.<\/li>\n<\/ul>\n<div class=\"cta-inline\"><\/div>\n<h2>Getting your server ready to install Ghost CMS<\/h2>\n<p>Ghost is built on NodeJS, and the latest release of Ghost supports NodeJS versions <strong>10.x<\/strong> and <strong>8.x<\/strong> only. You can pick either of the NodeJS versions, but for this tutorial, we will use NodeJS version 10. To install it, add the NodeSource APT repository to your server first.<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">$ curl -sL https:\/\/deb.nodesource.com\/setup_10.x | sudo -E bash\n<\/code><\/pre>\n<h2>Now install NodeJS with the following apt command:<\/h2>\n<pre><code class=\"language-shell\" lang=\"shell\">$ sudo apt install nodejs\n<\/code><\/pre>\n<p>Check the version of Node and NPM:<\/p>\n<p>$ node -v &amp;&amp; npm -v<br \/>\nv10.16.3<br \/>\n6.9.0<\/p>\n<p><a href=\"https:\/\/www.ssdnodes.com\/blog\/how-to-install-nodejs-on-ubuntu-18-04-tutorial\/\" target=\"_blank\" rel=\"noopener noreferrer\">Click here for a more detailed tutorial on how to install NodeJS on Ubuntu 18.04<\/a><\/p>\n<h2>Install MariaDB and create a database<\/h2>\n<p>Ghost supports either MySQL\/MariaDB or SQLite databases. However, for this tutorial, we will be using the MariaDB database. You can also opt for MySQL instead of MariaDB.<\/p>\n<p>Install the latest stable release of MariaDB server on your system by using following <code>apt<\/code> command:<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">$ sudo apt install mariadb-server\n<\/code><\/pre>\n<p>Next, run <code>mysql_secure_installation<\/code> to configure a few settings of MariaDB like updating the root password, removing the test database, and more, to make it secure.<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">$ sudo mysql_secure_installation\n<\/code><\/pre>\n<p>Once the MariaDB server is installed and configured in your server, create a user and a database especially for Ghost. To do that, log in to the MariaDB server using <code>mysql <span style=\"font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;\">-<\/span>u root <span style=\"font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;\">-<\/span>p<\/code> command and complete the steps as described below.<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">$ mysql -u root -p\nEnter password:\n\nMariaDB [mysql]&gt; CREATE DATABASE blog;\nQuery OK, 1 row affected (0.00 sec)\n\nMariaDB [mysql]&gt; CREATE USER 'ghostuser'@'localhost' IDENTIFIED BY 'PASSWORD';\nQuery OK, 0 rows affected (0.00 sec)\n\nMariaDB [mysql]&gt; GRANT ALL ON blog.* TO 'ghostuser'@'localhost' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;\nQuery OK, 0 rows affected (0.00 sec)\n\nMariaDB [mysql]&gt; FLUSH PRIVILEGES;\nQuery OK, 0 rows affected (0.00 sec)\n\nMariaDB [mysql]&gt; exit\n<\/code><\/pre>\n<h2>Install Nginx<\/h2>\n<p>Ghost runs on port <code>2368<\/code>, which is different from standard web server port <code>80<\/code> typically employed by either Apache or Nginx. To direct traffic to Ghost, you need to configure a proxy server that will act as a front end. Ghost officially recommends Nginx as a proxy server, although you can use Apache to do the same job. To install Nginx, issue the following command from the terminal:<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">$ sudo apt install nginx\n<\/code><\/pre>\n<h2>Install Ghost-CLI<\/h2>\n<p>Ghost-CLI is a command line interface (CLI) tool to install and update Ghost in the terminal. Ghost-CLI makes it easy to install Ghost CMS by selecting the database, configuring NGINX as a reverse proxy, setting up a Let\u2019s Encrypt SSL certificate, and creating a systemd service with a single command.<\/p>\n<blockquote><p>The objective of the Ghost CLI project is to make setting up and maintaining a Ghost site as straightforward as possible for people who do not want to use Ghost(Pro).<br \/>\nSource: <a href=\"https:\/\/github.com\/TryGhost\/Ghost-CLI\" target=\"_blank\" rel=\"noopener\">Ghost-CLI<\/a><\/p><\/blockquote>\n<p>Since Ghost-CLI is an NPM module, it can be installed using either <code>npm<\/code> or <code>yarn<\/code>. We will use <code>npm<\/code> to install it.<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">$ sudo npm install -g ghost-cli@latest\n<\/code><\/pre>\n<p>Check the version of Ghost-CLI using following command:<\/p>\n<pre><code>$ ghost -v\nGhost-CLI version: 1.11.0\n<\/code><\/pre>\n<h2>Install Ghost<\/h2>\n<p>To install Ghost, navigate to the <code>\/var\/www\/html<\/code> and create a folder for it.<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">$ cd \/var\/www\/html\n$ sudo mkdir -p \/var\/www\/html\/blog\n<\/code><\/pre>\n<p><strong>Note<\/strong>: <em>Installing Ghost in the \/root or \/home\/USER folder won\u2019t work and result in a broken setup! Please only use \/var\/www\/html because it has the right permissions.<\/em><\/p>\n<p>Once you\u2019re done with creating the installation folder for Ghost, change the ownership of the folder to a non-root, sudo-enabled user. The installation of Ghost will not proceed if the ownership of the newly created folder remains with <code>root<\/code> user. For this tutorial, we have created a non-root, sudo-enabled user by the name <code>bloguser<\/code>. Check <a href=\"https:\/\/www.ssdnodes.com\/blog\/tutorial-setting-up-and-securing-ssh-based-authentication\/#adding-a-new-user\">this tutorial<\/a> to create a non-root, sudo-enabled user.<\/p>\n<p>Note: Don\u2019t give this new user the name <code>ghost<\/code>! Ghost-CLI will create a <code>ghost<\/code> user for managing the blog during installation.<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">$ sudo chown bloguser:bloguser \/var\/www\/html\/blog\n<\/code><\/pre>\n<p>Next, assign correct <a href=\"https:\/\/www.ssdnodes.com\/blog\/linux-permissions\/\">permissions<\/a> to the installation folder.<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">$ sudo chmod 775 \/var\/www\/html\/blog\n<\/code><\/pre>\n<p>Change to the shell of the non-root user and subsequently navigate to the Ghost installation folder <code>\/var\/www\/html\/blog<\/code> to install it.<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">$ su - bloguser\n$ bloguser@localhost: cd \/var\/www\/html\/blog\/\n<\/code><\/pre>\n<p>Now install Ghost using Ghost-CLI.<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">ghost install\n<\/code><\/pre>\n<p>Answer the prompts as followed:<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">? Enter your blog URL: https:\/\/DOMAIN.TLD\n? Enter your MySQL hostname: localhost\n? Enter your MySQL username: ghostuser\n? Enter your MySQL password: PASSWORD\n? Enter your Ghost database name: blog\n? Do you wish to set up \"ghost\" mysql user? no\n? Do you wish to set up Nginx? yes\n? Do you wish to set up SSL? yes\n? Enter your email (used for Let's Encrypt notifications) EMAIL@DOMAIN.TLD\n? Do you wish to set up Systemd? yes\n? Do you want to start Ghost? yes\n<\/code><\/pre>\n<p>Your Ghost installation should be finished at this point! You can now access it via <code><a href=\"https:\/\/DOMAIN.TLD\" target=\"_blank\" rel=\"noopener\">https:\/\/DOMAIN.TLD<\/a><\/code> or <code><a href=\"https:\/\/SUBDOMAIN.DOMAIN.TLD\" target=\"_blank\" rel=\"noopener\">https:\/\/SUBDOMAIN.DOMAIN.TLD<\/a><\/code>, depending on your particular configuration.<\/p>\n<h2>Complete the Ghost CMS install &amp; setup<\/h2>\n<p>To complete the setup process, point your browser to the Ghost CMS configuration page at <code><a href=\"https:\/\/DOMAIN.TLD\/ghost\" target=\"_blank\" rel=\"noopener\">https:\/\/DOMAIN.TLD\/ghost<\/a><\/code>.<\/p>\n<p><strong>STEP 1<\/strong><\/p>\n<p>Click <code>Create your account<\/code>.<\/p>\n<p><strong>STEP 2<\/strong><\/p>\n<p>Fill up all the details, like the blog\u2019s title, your name, email address, and password. The email address and password will be used by Ghost to authenticate the <code>admin<\/code> user at later stages. Once done click <code>Invite your team<\/code> to add more members to your team.<\/p>\n<p>STEP 3<\/p>\n<p>Or, click the <code>I\u2019ll do this later, take me to my blog!<\/code> link to visit the admin section and change your site\u2019s theme or configure additional settings.<\/p>\n<p>Your installation of Ghost CMS is complete!<\/p>\n<p>You can now start blogging with this awesome platform. Consult the official <a href=\"https:\/\/ghost.org\/docs\/introduction\/\" target=\"_blank\" rel=\"noopener\">documentation<\/a> for theming instructions and other configurations.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Ghost CMS offers a more streamlined and modern blogging alternative to WordPress, and is a breeze to install on a VPS running Ubuntu 16.04<\/p>\n","protected":false},"author":20,"featured_media":2304,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[18,30],"tags":[231,185],"class_list":["post-2302","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-tutorials","tag-ghost","tag-ubuntu"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/2302","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/comments?post=2302"}],"version-history":[{"count":4,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/2302\/revisions"}],"predecessor-version":[{"id":13039,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/2302\/revisions\/13039"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/media\/2304"}],"wp:attachment":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/media?parent=2302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/categories?post=2302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/tags?post=2302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}