I've been using Ghost for my websites for a long time now. Ghost is based on Markdown, which I use all day long. Markdown is a simple way to just write and forget about formatting. Perfect for sharing information as painlessly as possible.

I've decided to consolidate all of services, so I need to transfer my website to a new server. Transfering a site using Ghost is pretty easy. Here goes.

Export Existing Site

Login as administrator on your current site: http://yoursite.com/ghost, click on labs. Export the contents:

export

Setup Ghost on the New Server

I'm using a AWS Lightsail instance for my new server. I have very little traffic, so the $3.99/month plan works just fine. Assuming you have an AWS account, just open https://lightsail.aws.amazon.com/ to get started.

Create the Instance

Click on Create Instance, select Ghost under Apps + OS . You will see this screen:

Select Ghost Apps + OS

Scroll down. Fill in the name and whatever options you choose. Then click on Create Instance.

You will be returned to the console. AWS will chug along for a minute or two. Just wait until the instance is running:

running instance

Although the server is running, Ghost is not. You need to login to the server and start it. The simplest method is to use SSH in the browser.

ssh with browser

You will be logged into the shell:

You will find a bitnami ghost app setup. Ghost is already configured to run, but you'll need the adminstrator credentials. Enter the command below to get the login information for the administrator:

$ cat bitnami_credentials

Start ghost:

$ cd stack
$ ./ctlscript.sh start ghost

You'll now be able to login for the first time on your fresh website. You'll need to login as adminstrator, which is the /ghost folder. Enter http://34.227.30.47/ghost/ into your browser. (Your IP address will be different of course). This will bring you to the admin screen for your site.

login

Login with the username and password from the bitnami_credentials file.

You will be presented with the default site. It is important to change your profile to match the admin user from your existing site. Click on yourself, then open Your Profile

Change all of the information on this page, including email and password. Save. Your profile name and picture should change.

Click on labs, then delete all content:

Import content:

Your site is now fully populated, except the images are not on the new site.

You need to copy the images from your old site to the images directory on the new site. The images directory may be different on your install.  You can do a ps ax to see where the log is being stored... it probably best to look for the config.production.json file:

$ find / -name config.production.json

When you find it, grep for contentPath:

$ grep contentPath /bitnami/ghost/config.production.json
    "contentPath": "/opt/bitnami/ghost/content"

Copy all of the files from your old webserver to the images folder, in this case:/opt/bitnami/ghost/content/images.

Hopefully you know how to copy files from your old webserver. You can use the Lightsail console and ssh to copy the files for instance. Here's an example:

$ scp -r user@oldsite.com:/opt/bitnami/apps/ghost/htdocs/content/images /opt/bitnami/ghost/htdocs/content/

Depending on your old server setup, you might need to include '-i file.pem'  on the scp command line.

Visit a page on your site with a picture, refresh the page. You should see the images.

Lightsail Login

It is necessary to use a .pem file to login to a Lightsail instance. You can obtain this file from your account page:

account page

The downloaded .pem needs to be protected, otherwise ssh or scp will refuse to use it. It is best to keep it under ~/.ssh, for instance:

$ chmod 600 file.pem
$ mv file.pem ~/.ssh