How to Install Parse Server on CentOS 7
Parse Server stands as the open-source substitute for the Parse backend service, which has been discontinued. If you’re fond of the original platform, you can continue enjoying its features by hosting Parse Server on your own server.
This guide explains the steps required to set up Parse Server on a CentOS 7 system.
Prerequisites
- A CentOS 7 x64 server environment
- A user account with sudo privileges
Step 1: Update Your CentOS System
Start by accessing your server through SSH using a sudo user account. Then update the operating system using the following commands:
sudo yum install epel-release -y
sudo yum update -y
sudo shutdown -r now
Once the reboot completes, log in again with the same sudo account to continue.
Step 2: Install Node.js
Proceed to install Node.js version 6.x, specifically version 6.9.4 at the time of this writing:
cd
curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash -
sudo yum install -y nodejs
Step 3: Set Up MongoDB
Create the YUM repository for MongoDB 3.4 by running this block of code in your terminal:
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
Install and enable the MongoDB service with the commands below:
sudo yum install -y mongodb-org
sudo systemctl start mongod.service
sudo systemctl enable mongod.service
Step 4: Install Parse Server
Use the following commands to install Parse Server version 2.3.2, which was the current release when this guide was prepared:
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: Launch Parse Server
Before launching Parse Server, define the following credentials:
- appId: 462s45ze2vn6x2vrfyfenqmksngx5xbs
- masterKey: kcr454f9xgq3bpdbhwuy4umamekk3n7f
Then, start the Parse Server using the commands below:
mongodb-runner start
parse-server --appId 462s45ze2vn6x2vrfyfenqmksngx5xbs --masterKey kcr454f9xgq3bpdbhwuy4umamekk3n7f --databaseURI mongodb://localhost/test
The terminal output should look like this:
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
Congratulations! Parse Server is now running independently on your machine.
Step 6: Verify Parse Server Functionality
Open another SSH terminal window to run the following tests, while keeping the original Parse Server session active.
First, post some test data to your MongoDB instance:
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 receive a reply similar to:
{"objectId":"meNcfQ6JJJ","createdAt":"2017-01-20T02:19:57.436Z"}
To fetch the stored data, run the following:
curl -X GET \
-H "X-Parse-Application-Id: 462s45ze2vn6x2vrfyfenqmksngx5xbs" \
http://localhost:1337/parse/classes/Inventory/meNcfQ6JJJ
The expected response should include the submitted object data, as shown below:
{"objectId":"meNcfQ6JJJ","score":1337,"InventoryName":"Desktops","cheatMode":false,"createdAt":"2017-01-20T02:19:57.436Z","updatedAt":"2017-01-20T02:19:57.436Z"}
Conclusion
Installing Parse Server on a CentOS 7 system is a practical and efficient way to regain control over your app backend now that the official Parse service is no longer available. By following the steps above, you can fully replicate the Parse experience on your own infrastructure and begin developing or migrating your applications with confidence.