How to Install Cody CMS on Ubuntu 16.04 | 18.04 | 18.10 with MariaDB

Cody CMS is an open source, light, fast content management system (CMS) that runs on top of Node.js. It uses a database to store its content. It allows users and webmasters to create websites without the need to be a developer or designer.

Cody CMS offers features that may not be available to other PHP based CMS, like WordPress Joomla or Drupal.

Cody is written from ground up in JavaScript and runs on top of Node.js, a platform. It comes with features that you need like SEO friendly design, flexible CSS framework and more.

For more about Cody CMS, please check it homepage.

This brief tutorial shows students and new users how to install Cody CMS on Ubuntu 16.04, 18.04 and 18.10.To get started with installing Cody CMS, please continue below:

Step 1: Install Node.Js

Cody CMS runs on Node.js, a java script runtime and framework. To install Node.js on Ubuntu from its LTS repository, run the commands below to install:

sudo apt update
sudo apt install curl
curl -sL  | sudo -E bash -
sudo apt install -y nodejs

After that, Node.js should be installed and ready to use as well.

Step 2: Install PM2 Process Manager

Another requirement for Cody CMS is PM2 process manager. To install PM2 package on Ubuntu, run the commands below:

sudo npm install pm2 -g

After that, your system should be ready for Cody CMS.

Step 3: Install MariaDB Database Server

MariaDB database server is a great place to start when looking at open source database servers to use with Cody CMS. To install MariaDB run the commands below.

sudo apt-get install mariadb-server mariadb-client

After installing MariaDB, the commands below can be used to stop, start and enable MariaDB service to always start up when the server boots.

Run these on Ubuntu 16.04 LTS

sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service

Run these on Ubuntu 18.04 and 18.10 LTS

sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

After that, run the commands below to secure MariaDB server by creating a root password and disallowing remote root access.

sudo mysql_secure_installation

When prompted, answer the questions below by following the guide.

  • Enter current password for root (enter for none): Just press the Enter
  • Set root password? [Y/n]: Y
  • New password: Enter password
  • Re-enter new password: Repeat password
  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: Y
  • Remove test database and access to it? [Y/n]:  Y
  • Reload privilege tables now? [Y/n]:  Y

Next, run the commands below to logon to MariaDB server. When prompted for password, use the one created above.

sudo mysql -u root -p

In Ubuntu systems running MySQL 5.7 (and later) or MariaDB 10 and up, the root user is set to use the auth_socket authentication method by default.

The auth_socket plugin authenticates users that connect from the localhost through the Unix socket file. This means that you can’t authenticate as a root by providing a password.

Run commands below to enable MariaDB root user to use password authentication.

use mysql;
update user set plugin='' where User="root";
flush privileges;
exit

Restart and run the commands below to set a new password.

sudo systemctl restart mariadb.service

Step 4: Install Cody CMS

To get Cody CMS, you’ll want to clone it from Github to your home directory.To do that run the commands below

cd ~/
mkdir codycms

After that, change into Raneto folder by running the commands below.

cd codycms

Next, install NPM from the folder by running the commands below.

npm install cody

You may get an error message like the one below. just do what was mentioned in the error message:

┌───────────────────────────────────────────────────────────┐
│                  npm update check failed                  │
│            Try running with sudo or get access            │
│           to the local update config store via            │
│ sudo chown -R $USER:$(id -gn $USER) /home/richard/.config │
└───────────────────────────────────────────────────────────┘

After running the commands above, you may also get a message to resolve some vulnerabilities. If not, then you’re ready to use Cody CMS.

Next, run the commands below to create Cody CMS database for MariaDB.

nodejs ./node_modules/cody/bin/create_site.js

When you run the commands above, you should use the guide below to configure your new site.

Creating project in  /home/richard/codycms/

1) Enter projectname: CodyCMS
Note: also using CodyCmS as database name.
Note: by default the mysql root user has no password so you can just hit enter, if you forgot the root password 

2) Enter root password for mysql so we can create a new database and user: wisdom24

3) Enter site database user: codycmsuser

4) Enter site database password: create_user_password_here

5) Enter hostname for site: example.com

6) Enter a location for storing documents: codydata

mkdir /home/richard/codycms/CodyCmS/controllers
mkdir /home/richard/codycms/CodyCmS/locales
mkdir /home/richard/codycms/CodyCmS/static
mkdir /home/richard/codycms/CodyCmS/static/css
mkdir /home/richard/codycms/CodyCmS/static/images
mkdir /home/richard/codycms/CodyCmS/static/js
mkdir /home/richard/codycms/CodyCmS/views
created codydata/CodyCmS/
created codydata/CodyCmS/images
created codydata/CodyCmS/files
---
Site 'CodyCmS' has been prepared.

Please create DNS entries, or add to /etc/hosts:
127.0.0.1     example.com
Also check index.js and config.json to fine-tune extra parameters, encryption key, .
---
Start your site using:
$ forever start CodyCmS.js
    or
$ node CodyCmS.js
-
surf to 
    or manage your site at
/en/dashboard

You can start Cody CMS by running the commands below:

$ forever start CodyCmS.js
or
$ node CodyCmS.js

You will now be able to access your new Cody CMS installation by navigating to http://example.com:3001.

Open your browser and browse to the server hostname or IP address followed by port # 3001

Cody CMS Ubuntu install

To logon to the backend, use the URL below:

Cody CMS Ubuntu Install

The default users are: ‘super’, ‘admin’, ‘test’ and ‘user’ which all have password ‘empty‘ you can ofcourse use.

Username: super
Password: empty

You may also like the post below: