# How to install Ghost with Ghost-CLI

Tutorial · Norbert · Updated 12 Nov 2026 · 3 min read

Source: https://brightthemes.com/blog/ghost-install

Install Ghost on your computer for theme development, or on an Ubuntu server for production, with Ghost's command-line tool.

Ghost-CLI is Ghost's command-line tool. It installs, configures and updates Ghost for you, on your own computer or on a server. This guide covers both: a local install for building or changing a theme, and a production install on Ubuntu, the stack Ghost recommends.

> [!NOTE]
> A Ghost-CLI install can't run Ghost's built-in web analytics, and it uses Ghost's hosted service for the social web. To self-host both, use Ghost's [Docker setup](https://docs.ghost.org/install/docker) (in preview) instead. Or skip the server work with [Ghost(Pro)](https://brightthemes.com/ghost/pro). See [Ghost hosting options](https://brightthemes.com/blog/ghost-hosting-options) to compare.

## What you need

**For a local install:**

- macOS, Windows or Linux.
- A [supported Node.js version](https://docs.ghost.org/faq/node-versions): Ghost 6 runs on Node.js 22 or 24, the two LTS versions Ghost supports. Use the latest release of either.
- Python 3 and setuptools, to build SQLite3, the database used locally.
- An empty folder.

**For a server:**

- Ubuntu 22.04, 24.04 or 26.04, with at least 1 GB of memory. On DigitalOcean, the Ghost 1-Click App does most of this for you: see [Self-hosting Ghost on DigitalOcean](https://brightthemes.com/blog/ghost-self-hosted).
- NGINX, MySQL 8.0 or 8.4, and Node.js 22 or 24 (step 3 installs them).
- A domain name, with a DNS **A record** pointing to the server's IP address. Set it up before you install, so SSL can be configured.

## 1. Install Ghost-CLI

Install it globally with npm:

```bash
npm install ghost-cli@latest -g
```

On a server, run it with `sudo`. Then `ghost --help` lists every command. The ones you'll use most:

- `ghost start`, `ghost stop` and `ghost restart`
- `ghost update` to update Ghost
- `ghost config` to change settings such as the URL
- `ghost log` to read the logs
- `ghost ls` to list every Ghost install on the machine, and whether it's running

## 2. Install Ghost locally

In your terminal, go to an empty folder and run:

```bash
ghost install local
```

When it's done, your site runs at `http://localhost:2368`, and Ghost Admin at `http://localhost:2368/ghost`.

A local install runs in development mode, with less caching, which suits theme work. The SQLite3 database is in `content/data/`, and themes go in `content/themes/`. Ghost keeps running in the background until you run `ghost stop` or restart your computer.

That's all for a local install. The next steps are for a server.

## 3. Prepare your server

Log in to your server as `root` and create a user to run Ghost with. Don't call it `ghost`: that name conflicts with Ghost-CLI.

```bash
adduser <user>
usermod -aG sudo <user>
su - <user>
```

Update the system, then install NGINX and open the firewall for it:

```bash
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install nginx
sudo ufw allow 'Nginx Full'
```

Install MySQL:

```bash
sudo apt-get install mysql-server
```

On Ubuntu, MySQL's `root` user logs in through the system socket, which Ghost doesn't support. Give it a password:

```bash
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH 'caching_sha2_password' BY '<your-new-root-password>';
FLUSH PRIVILEGES;
exit
```

Install Node.js 22 or 24 from NodeSource, system-wide, with the commands in [How to upgrade Node.js for self-hosted Ghost](https://brightthemes.com/blog/ghost-upgrade-node-18) (steps 1 and 2). Then install Ghost-CLI as in step 1.

## 4. Install Ghost on your server

Ghost needs its own folder, owned by your user. Replace `sitename` and `<user>`:

```bash
sudo mkdir -p /var/www/sitename
sudo chown <user>:<user> /var/www/sitename
sudo chmod 775 /var/www/sitename
cd /var/www/sitename
```

Then run the install:

```bash
ghost install
```

Ghost-CLI checks your system, downloads Ghost and asks a few questions.

## 5. Answer the install questions

- **Blog URL:** the full address of your site, with `https://`, for example `https://example.com`. Don't use an IP address.
- **MySQL hostname:** `localhost` when MySQL runs on the same server. Press Enter for the default.
- **MySQL username and password:** `root` and the password you set in step 3.
- **Ghost database name:** Ghost creates it for you.
- **Set up a ghost MySQL user?** Yes. Ghost-CLI creates a MySQL user that can only reach the Ghost database.
- **Set up NGINX?** Yes.
- **Set up SSL?** Yes. Ghost-CLI gets a free Let's Encrypt certificate and renews it. It asks for an email address for certificate notices.
- **Set up systemd?** Yes. It keeps Ghost running and starts it again after a reboot.
- **Start Ghost?** Yes.

If the install stops halfway, run `ghost setup` to pick up the configuration again. If it goes badly wrong, run `ghost uninstall` and start over, rather than deleting the folder.

## 6. Create your account and set up email

Go to `https://example.com/ghost` and create the owner account.

Then set up email. Ghost needs it for staff invites, password resets and member sign-in links, and it sends newsletters through Mailgun. Follow [How to set up Mailgun email in Ghost](https://brightthemes.com/blog/ghost-mailgun-config).

## The result

Ghost runs on your server behind NGINX, with HTTPS and a MySQL database, and systemd keeps it running. Keep it up to date with `ghost update`: the [Ghost version history](https://brightthemes.com/ghost/version-history) lists what each release changes. Check Ghost's supported Node.js versions before a major update. Next, pick a look for your site: browse our [Ghost themes](https://brightthemes.com/themes).
