Knowledgebase

How to Install Parse Server on CentOS Print

  • 0

Parse Server is the open source alternative for the Parse backend service which is being shut down. If you are a fan of this service, you can still enjoy the same experience by deploying Parse Server on your own server.

This article will guide you through the process of installing Parse Server on a CentOS 7 machine.

Prerequisites

  • A CentOS 7 x64 server instance.
  • A sudo user.

Step 1: Update the system

Open an SSH terminal, log into your server as a sudo user, and then use the below commands to update the system to the latest stable status:

sudo yum install epel-release -y
sudo yum update -y
sudo shutdown -r now

After the system starts up again, log in back as the same sudo user to move on.

Step 2: Install Node.js

Install the latest Node.js 6.x as follows, which is 6.9.4 at the time of writing:

cd
curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash -
sudo yum install -y nodejs

Step 3: Install MongoDB Server

Create the MongoDB 3.4 YUM repo by copying the entire code segment below into your SSH terminal, and then pressing Enter:

cat <<EOF | sudo tee -a /etc/yum.repos.d/mongodb-org-3.4.repo
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
EOF

Use the following commands to install and start the latest stable release of MongoDB Server, which is 3.4.1 at the time of writing:

sudo yum install -y mongodb-org
sudo systemctl start mongod.service
sudo systemctl enable mongod.service

Step 4: Install Parse Server

Install the latest Parse Server, which is 2.3.2 at the time this article was written, as follows:

sudo yum install git -y
cd /opt
sudo git clone https://github.com/ParsePlatform/parse-server.git
cd parse-server
sudo npm install -g parse-server mongodb-runner

Step 5: Start Parse Server

Before you can use Parse Server, you need to setup two parameters (appId and masterKey) for authentication.

Assuming that:

  • appId = 462s45ze2vn6x2vrfyfenqmksngx5xbs
  • masterKey = kcr454f9xgq3bpdbhwuy4umamekk3n7f

Start Parse Server as follows:

mongodb-runner start
parse-server --appId 462s45ze2vn6x2vrfyfenqmksngx5xbs --masterKey kcr454f9xgq3bpdbhwuy4umamekk3n7f --databaseURI mongodb://localhost/test

The output should resemble:

appId: 462s45ze2vn6x2vrfyfenqmksngx5xbs
masterKey: ***REDACTED***
port: 1337
host: 0.0.0.0
databaseURI: mongodb://localhost/test
mountPath: /parse
maxUploadSize: 20mb
userSensitiveFields: email
serverURL: http://localhost:1337/parse

[13831] parse-server running on http://localhost:1337/parse

That's it. A stand-along version of Parse Server has been successfully deployed on your machine.

Step 6: Test Parse Server

Before you can move on, you need to open a new SSH terminal console window in order to keep Parse Server running in the current one.

In the new SSH teminal console window, send data to the MongoDB database as below:

curl -X POST \
-H "X-Parse-Application-Id: 462s45ze2vn6x2vrfyfenqmksngx5xbs" \
-H "Content-Type: application/json" \
-d '{"score":1337,"InventoryName":"Desktops","cheatMode":false}' \
http://localhost:1337/parse/classes/Inventory

You should get a response which is similar to:

{"objectId":"meNcfQ6JJJ","createdAt":"2017-01-20T02:19:57.436Z"}

Then you can retrieve the data using the following command:

curl -X GET \
-H "X-Parse-Application-Id: 462s45ze2vn6x2vrfyfenqmksngx5xbs" \
http://localhost:1337/parse/classes/Inventory/meNcfQ6JJJ

This time, you should get a response which is similar to:

{"objectId":"meNcfQ6JJJ","score":1337,"InventoryName":"Desktops","cheatMode":false,"createdAt":"2017-01-20T02:19:57.436Z","updatedAt":"2017-01-20T02:19:57.436Z"}

That concludes our tutorial. Thanks for reading.

Parse Server is the open source alternative for the Parse backend service which is being shut down. If you are a fan of this service, you can still enjoy the same experience by deploying Parse Server on your own server. This article will guide you through the process of installing Parse Server on a CentOS 7 machine. Prerequisites A CentOS 7 x64 server instance. A sudo user. Step 1: Update the system Open an SSH terminal, log into your server as a sudo user, and then use the below commands to update the system to the latest stable status: sudo yum install epel-release -y sudo yum update -y sudo shutdown -r now After the system starts up again, log in back as the same sudo user to move on. Step 2: Install Node.js Install the latest Node.js 6.x as follows, which is 6.9.4 at the time of writing: cd curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash - sudo yum install -y nodejs Step 3: Install MongoDB Server Create the MongoDB 3.4 YUM repo by copying the entire code segment below into your SSH terminal, and then pressing Enter: cat <
Was this answer helpful?
Back

Powered by WHMCompleteSolution