How to Install ApostropheCMS on Ubuntu 18.04
ApostropheCMS is a modern content management system built on NodeJS with a focus on extensible in-context editing tools. In this tutorial, you will learn how to deploy ApostropheCMS for production on a clean Ubuntu 18.04 server.
Requirements
- New Vultr Ubuntu 18.04 instance with at least 2 CPU cores and 1 GB RAM
- Non-root user with sudo privileges.
- NodeJS version 10.x or greater.
- MongoDB version 4.x or greater.
- ImageMagick
Check the Ubuntu version.
lsb_release -ds
# Ubuntu 18.04 LTS
Create a new non-root user account with sudo
access and switch to it.
adduser johndoe --gecos "John Doe"
usermod -aG sudo johndoe
su - johndoe
NOTE: Replace johndoe
with your username.
Set up the timezone.
sudo dpkg-reconfigure tzdata
Ensure that your system is up to date.
sudo apt update && sudo apt upgrade -y
Step 1: Install NodeJS and NPM
Run the following commands to install NodeJS.
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt install -y nodejs
Check the Node and NPM versions.
node -v && npm -v
# v10.x.x
# 6.x.x
In order for some NPM packages to work, you will need to install the build-essential
package.
sudo apt-get install -y build-essential
Step 2: Install MongoDB
Import the MongoDB GPG key to your system.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
Once the key is imported, create a list file run.
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
Reload the packages list.
sudo apt-get update
Install MongoDB packages.
sudo apt install -y mongodb-org
Start the MongoDB daemon.
sudo service mongod start
Step 3: Install ImageMagick
Install ImageMagick.
sudo apt install -y imagemagick
Check the ImageMagick version.
convert --version
# Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
# Copyright: © 1999-2017 ImageMagick Studio LLC
# License: http://www.imagemagick.org/script/license.php
# Features: Cipher DPC Modules OpenMP
# Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
Step 4: Create a project
Install the apostrophe-cli module.
sudo npm install apostrophe-cli -g
Create a project.
sudo mkdir /var/www
cd /var/www
sudo apostrophe create-project my-project
Change ownership of /var/www/my-project
folder to user johndoe
.
sudo chown -R johndoe:johndoe /var/www/my-project
Install the dependencies, and start the server.
cd my-project
sudo npm install
sudo node app.js apostrophe-users:add admin admin
sudo node app.js
Next, open your browser and navigate to the IP address or domain at port 3000
: http://your_server_ip:3000
or http://example.com:3000
.
Your ApostropheCMS setup is now complete.