Installing Ghost in WSL
Shame on Tuj for installing Ghost on public server before installing locally.
Tuj: Time flows in the opposite direction on Earth? (pretending to be a galactic hitchhiker)
Locally we plan to install things in the Windows Subsystem for Linux rather than struggling with quirks of Windows. Well, it turns out there are still some minor struggles.
How-to
Follow exactly the same steps as in Installing Ghost up to just before the point of ghost install
. For development purposes, probably ghost install --development
is more appropriate. BTW the Linux flavour in current WSL defaults to Ubuntu 16.04 which ghost-cli
supports. After our powerful Surface groaned under the load for 10 minutes, ghost
was installed and the setup failed. Due to a bug in WSL, sudo -u
does not work. This was what ruined the setup process. At that point, all that was missing was the migration of the database, so we just ran it manually using the sudo sudo
workaround provided in the link above.
sudo sudo -E -u ghost $HOME/.nvm/versions/node/v6.5.0/lib/node_modules/ghost-cli/node_modules/.bin/knex-migrator-migrate --init --mgpath /var/www/ghost/current
During the setup, we used url http://localhost:2368 so that we will visit ghost directly.
Remember to start mysqld
if it is not running already. Since we are in WSL, services do not run automatically.
Running Ghost
First try
ghost start --development
failed, because of sudo -u
again. What works is the following.
sudo node current/index.js
Then launch a browser and visit http://localhost:2368.
Some Random Thoughts
The VPS is so much powerful than our local machine. The building and linking processes were so much faster. We thought that it would be quite limited by its tiny size of memory. We did have to add swap for the VPS to accommodate the memory eater npm
. We are also super envious of the download speed! Downloading the dependencies for ghost actually failed many times on our local machine. (╯°□°)╯︵ ┻━┻