How to Install Cezerin on CentOS 7

 

Cezerin is a Node.js based eCommerce platform with React serving as its frontend framework. It is an open-source eCommerce platform that makes it super easy to develop, personalize, and host your online store. Thanks to this platform, you can make a commercial site in only a few minutes. Let’s get started.

Prerequisites:

Make sure that your server meets the following minimum requirements:

  • A VPS with CentOS 7 running on it
  • A user account with root access, or access to the “root” user

Step 1: Install Updates and Fix Dependencies

Log in to your server via SSH:

$ ssh username@server_ip -p port_number

Remember to replace “username” with the username which you wish to use on the server (e.g. “root” for the root account), as well as replacing “server_ip” and “port_number” with your server’s respective IP address and SSH port number.

Before starting with the Cezerin installation, it is a good idea to update the system packages to their latest versions, if any are available:

$ yum -y update

Install software package dependencies needed by Cezerin by running the following command:

$ yum install wget git

Step 2: Install Node.js

We will install Node.js V10 LTS from the NodeSource repository which depends on the EPEL repository being enabled.

To enable the EPEL repository on your CentOS 7 VPS, issue the following command:

$ yum install epel-release curl

Once the EPEL repository is enabled run the following command to add the Node.js V10 LTS repository:

$ curl --silent --location https://rpm.nodesource.com/setup_10.x | sudo bash -

Once the NodeSource repository is enabled, install Node.js with the following command:

$ yum install nodejs

To check the Node.js version you have just installed after these initial steps, type:

$ node -v

You should see an output similar to this. Your version may be newer than the one shown here.

v10.17.0

Step 3: Install MongoDB Server

You need to add the MongoDB repo using your preferred text editor. We will be using nano:

$ nano /etc/yum.repos.d/mongodb.repo
[MongoDB]
name=MongoDB Repository
baseurl=http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/x86_64/
gpgcheck=0
enabled=1

Save and exit the file.

Now, install MongoDB:

$ yum install mongodb-org

Start the MongoDB service:

$ systemctl start mongod.service
$ systemctl enable mongod.service

Verify the installation of MongoDB. You should have version 4.2 or newer:

$ mongod --version
db version v4.2.1
git version: edf6d45851c0b9ee15548f0f847df141764a317e
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
allocator: tcmalloc
modules: none
build environment:
    distmod: rhel70
    distarch: x86_64
    target_arch: x86_64

Step 4: Install Cezerin

In this step, we will download and install Cezerin from their GitHub repository.

We are going to put installation under the /opt/ directory – let’s go to the directory and download Cezerin:

$ cd /opt
$ git clone https://github.com/cezerin/cezerin.git cezerin

Now that Cezerin has been downloaded to /opt/cezerin, now let’s go to the directory and proceed with the installation:

$ cd cezerin
$ npm i [email protected]
$ npm install
$ npm run build

Next, run this command to add the default data and create the indices:

$ npm run setup

You should see an output similar to this.

> [email protected] setup /opt/cezerin
> node -r esm src/api/server/setup.js

info: Successfully connected to mongodb://127.0.0.1:27017/shop

Finally, we can start the project:

$ npm start

You should see an output similar to this.

> [email protected] start /opt/cezerin
> concurrently npm:start-*

[start-store]
[start-store] > [email protected] start-store /opt/cezerin
[start-store] > node -r esm dist/store/server/index.js
[start-store]
[start-api]
[start-api] > [email protected] start-api /opt/cezerin
[start-api] > node -r esm src/api/server/index.js
[start-api]
[start-store] info: Store running at http://localhost:3000
[start-api] info: API running at http://localhost:3001
[start-api] info: MongoDB connected successfully

You can use Ctrl + C to stop the service if needed. Now, let’s proceed with the next step.

Step 5: Create a systemd File

To manage the Cezerin service easier, we can create a systemd file. This allows us to have it start up on boot, as well as run the process independently of our terminal session. Open a new file using your preferred text editor:

$ nano /etc/systemd/system/cezerin.service

Add the following to the file:

[Unit]
Description=Cezerin

[Service]
ExecStart=/usr/bin/npm start
WorkingDirectory=/opt/cezerin
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=nodejs-example

[Install]
WantedBy=multi-user.target

When finished with editing the file, save and exit it.

Every time you create or edit a systemd file, you need to reload the daemon so that the system can take the new unit that we created for systemd.

$ systemctl daemon-reload

Now let’s enable it to start automatically on boot as well as manually start the service now.

$ systemctl enable cezerin
$ systemctl start cezerin

The Cezerin installation is now completed and you can access it at http://IP_Address:3000.

How to Install Cezerin on CentOS 7