Ghost one and linux

How to install Ghost on Ubuntu

This the official guide for self-hosting Ghost using our recommended stack of Ubuntu 16.04, 18.04, 20.04 or 22.04. If you’re comfortable installing, maintaining and updating your own software, this is the place for you. By the end of this guide you’ll have a fully configured Ghost install running in production using MySQL.

This install is not suitable for local use or contributing to core.

Prerequisites

The officially recommended production installation requires the following stack:

  • Ubuntu 16.04, Ubuntu 18.04, Ubuntu 20.04 or Ubuntu 22.04
  • NGINX (minimum of 1.9.5 for SSL)
  • A supported version of Node.js
  • MySQL 8
  • Systemd
  • A server with at least 1GB memory
  • A registered domain name

Before getting started you should set up a working DNS A-Record from you domain, pointing to the server’s IP address. This must be done in advance so that SSL can be configured during setup.

Server Setup

This part of the guide will ensure all prerequisites are met for installing the Ghost-CLI.

Create a new user

Open up your terminal and login to your new server as the root user:

Note: Using the user name ghost causes conflicts with the Ghost-CLI, so it’s important to use an alternative name.

Update packages

Ensure package lists and installed packages are up to date.

Follow any prompts to enter the password you just created in the previous step.

Install NGINX

Ghost uses an NGINX server and the SSL configuration requires NGINX 1.9.5 or higher.

If ufw was activated, the firewall allows HTTP and HTTPS connections. Open Firewall:

Install MySQL

Next, you’ll need to install MySQL to be used as the production database.

Install Node.js

You will need to have a supported version of Node installed system-wide in the manner described below. If you have a different setup, you may encounter problems.

Читайте также:  Автоматическое подключение сетевых дисков linux

Install Ghost-CLI

Ghost-CLI is a commandline tool to help you get Ghost installed and configured for use, quickly and easily. The npm module can be installed with npm or yarn .

Once installed, you can always run ghost help to see a list of available commands.

Install Ghost

Once your server is correctly setup and ghost-cli is installed, you can install Ghost itself. The following steps are the recommended setup. If you need more fine-grained control, the CLI has flags and options that allow you to break down and customise the install steps.

Create a directory

Ghost must be installed in its own directory, with a proper owner and permissions.

         

Run the install process

Now we install Ghost with one final command.

Install questions

During install, the CLI will ask a number of questions to configure your site.

Blog URL

Enter the exact URL your publication will be available at and include the protocol for HTTP or HTTPS. For example, https://example.com . If you use HTTPS, Ghost-CLI will offer to set up SSL for you. Using IP addresses will cause errors.

MySQL hostname

This determines where your MySQL database can be accessed from. When MySQL is installed on the same server, use localhost (press Enter to use the default value). If MySQL is installed on another server, enter the name manually.

MySQL username / password

If you already have an existing MySQL database, enter the the username. Otherwise, enter root . Then supply the password for your user.

Ghost database name

Enter the name of your database. It will be automatically set up for you, unless you’re using a non-root MySQL user/pass. In that case the database must already exist and have the correct permissions.

If you provided your root MySQL user, Ghost-CLI can create a custom MySQL user that can only access/edit your new Ghost database and nothing else.

Sets NGINX up automatically enabling your site to be viewed by the outside world. Setting up NGINX manually is possible, but why would you choose a hard life?

Читайте также:  Linux create random files

If you used an https Blog URL and have already pointed your domain to the right place, Ghost-CLI can automatically set up SSL for you using Let’s Encrypt. Alternatively you do this later by running ghost setup ssl at any time.

SSL certification setup requires an email address so that you can be kept informed if there is any issue with your certificate, including during renewal.

systemd is the recommended process manager tool to keep Ghost running smoothly. We recommend choosing yes but it’s possible to set up your own process management.

Start Ghost?

Choosing yes runs Ghost, and makes your site work.

Future maintenance

Once Ghost is properly set up it’s important to keep it properly maintained and up to date. Fortunately, this is relatively easy to do using Ghost-CLI. Run ghost help for a list of available commands, or explore the full Ghost-CLI documentation.

What to do if the install fails

If an install goes horribly wrong, use ghost uninstall to remove it and try again. This is preferable to deleting the folder to ensure no artifacts are left behind.

If an install is interrupted or the connection lost, use ghost setup to restart the configuration process.

For troubleshooting and errors, use the site search and FAQ section to find information about common error messages.

What’s next?

You’re all set! Now you can start customising your site. Check out our range of tutorials or the Ghost API documentation depending on which page of this choose-your-own-adventure experience you’d like to subject yourself to next.

Источник

How to install Ghost locally

Running Ghost locally is the easiest way to get your own copy of the software running and be able to do some local development with it. By the end of this guide you will have completed a local Ghost install that runs in development mode using SQLite3.

This install is not suitable for production use or contributing to core.

Prerequisites

To install Ghost locally you will need the following:

  • A computer running MacOS, Windows or Linux
  • A supported version of Node.js
  • Either yarn or npm to manage packages
  • A clean, empty directory on your machine

Install Ghost-CLI

Ghost-CLI is a commandline tool to help you get Ghost installed and configured for use, quickly and easily. The npm module can be installed with npm or yarn on a local machine, depending on your preference.

Читайте также:  What is my ipv6 linux

Once installed, you can always run ghost help to see a list of available commands.

Install Ghost

In your terminal, cd into an empty directory and run the install command:

Once the install is finished you’ll be able to access your new site on http://localhost:2368 and http://localhost:2368/ghost to access Ghost Admin ✨

That’s it! You’re done.

  • Your publication is setup in development mode with less caching
  • The SQLite3 database is auto-setup and located in /content/data/
  • Logs only go to stdout

Starting & Stopping

Ghost runs in a separate background process and remains running until you stop it or restart your computer. So you may find these commands useful for taming it:

  • ghost stop to stop Ghost
  • ghost start to start Ghost
  • ghost log views logs
  • ghost ls to list all running Ghost blogs

Run ghost help for a list of available commands, or explore the full Ghost-CLI documentation.

Troubleshooting

For troubleshooting and errors, try searching this documentation and FAQ section to find information about common error messages.

Developing Themes

To work on a Ghost Handlebars Theme locally, your custom theme should always be placed in the top-level /content/themes/ directory.

Live reloading

All edits made to Ghost theme files will automatically reload. If you add any new files to your theme during development, you’ll need to restart Ghost to see the changes take effect.

Validating with GScan

GScan is a tool that validates Ghost themes for compatibility with the latest versions of Ghost. Ghost automatically runs this tool when a theme is uploaded or activated. For development purposes, your can also run these checks yourself by locally installing it.

GScan can also be accessed at gscan.ghost.org, where you can sign up for the latest updates as a Ghost theme developer.

What’s next

You’ve completed a local Ghost install — congrats! You can now put Ghost through its paces and see what it’s all about, or jump right into developing a custom Ghost theme.

When you’re ready ship your site to production, follow one of these guides.

For more information about theme development read the Handlebars theme documentation and check out the tutorials.

Источник

Оцените статью
Adblock
detector