How To Install Parse Server on Ubuntu


Parse server is an open source and is like mobile back-end. It is owned by Facebook since 2013. This server may be deployed to any infrastructure that may run Node.Js and MongoDB. This article explains about – How To Install Parse Server on Ubuntu.

Prerequisites

  • python-software-properties package
  • Node.js
  • MongoDB

To add python-software-properties package, use the following command-

$ sudo apt-get install build-essential git python-software-properties

The sample output should be like this –

Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
build-essential set to manually installed.
The following packages were automatically installed and are no longer required:
   linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic
   linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic
   linux-signed-image-4.4.0-31-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
   git-man liberror-perl python-apt python-pycurl
Suggested packages:
   git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk
   gitweb git-arch git-cvs git-mediawiki git-svn python-apt-dbg python-apt-doc
   libcurl4-gnutls-dev python-pycurl-dbg python-pycurl-doc
............................................................................

To install node script, use the following command –

$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -

The sample output should be like this –

## Installing the NodeSource Node.js v6.x repo...

## Populating apt-get cache...

+ apt-get update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://dl.google.com/linux/chrome/deb stable Release
Hit:3 http://in.archive.ubuntu.com/ubuntu xenial InRelease
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:5 http://ppa.launchpad.net/linuxgndu/sqlitebrowser-testing/ubuntu xenial InRelease [17.6 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Hit:8 http://archive.canonical.com/ubuntu xenial InRelease
Hit:9 http://ppa.launchpad.net/webupd8team/sublime-text-2/ubuntu xenial InRelease
Hit:10 http://archive.canonical.com xenial InRelease
Hit:11 http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu xenial InRelease
Get:12 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata [68.3 kB]
Get:13 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:14 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons [39.2 kB]
Get:15 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata [19.4 kB]
Get:16 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Icons [25.6 kB]
.............................................................................................

To install Node.js, use the following command –

$ sudo apt-get install nodejs

The sample output should be like this –

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
   linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic
   linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic
   linux-signed-image-4.4.0-31-generic
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
   nodejs
0 upgraded, 1 newly installed, 0 to remove and 19 not upgraded.
Need to get 10.1 MB of archives.
After this operation, 50.8 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_6.x xenial/main amd64 nodejs amd64 6.9.2-1nodesource1~xenial1 [10.1 MB]
Fetched 10.1 MB in 7s (1,412 kB/s)
Selecting previously unselected package nodejs.
(Reading database ... 242052 files and directories currently installed.)
Preparing to unpack .../nodejs_6.9.2-1nodesource1~xenial1_amd64.deb ...
Unpacking nodejs (6.9.2-1nodesource1~xenial1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up nodejs (6.9.2-1nodesource1~xenial1) ...

To add key server, use the following command –

$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927

The sample output should be like this –

Executing: /tmp/tmp.IagxypDbAy/gpg.1.sh --keyserver
hkp://keyserver.ubuntu.com:80
--recv
EA312927
gpg: requesting key EA312927 from hkp server keyserver.ubuntu.com
gpg: key EA312927: public key "MongoDB 3.2 Release Signing Key " imported
gpg: Total number processed: 1
gpg:                imported: 1 (RSA: 1)

To add mongoDB PPA, use the following command –

$ echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb.list

Now update the adding packages, use the following command –

$ sudo apt-get update

To install MongoDB, use the following command –

$ sudo apt-get install mongodb-org

The sample output should be like this –

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
   linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic
   linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic
   linux-signed-image-4.4.0-31-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
   mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
The following NEW packages will be installed:
   mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell
   mongodb-org-tools
0 upgraded, 5 newly installed, 0 to remove and 19 not upgraded.
.........................................................................................

Downloading and setting up Parse Server

To download Parse server files, use the following command-

$ sudo git clone https://github.com/ParsePlatform/parse-server-example.git

The sample output should be like this –

Cloning into 'parse-server-example'...
remote: Counting objects: 312, done.
remote: Total 312 (delta 0), reused 0 (delta 0), pack-reused 312
Receiving objects: 100% (312/312), 77.77 KiB | 0 bytes/s, done.
Resolving deltas: 100% (144/144), done.
Checking connectivity... done.

To enter into parse-server-example directory, use the following command –

$ cd parse-server-example

use npm, to install parse-server as shown below –

/parse-server-example$ sudo npm install

The sample output should be like this –

parse-server-example@1.4.0 /opt/parse-server-example
   +-- express@4.11.2
   | +-- accepts@1.2.13
   | | +-- mime-types@2.1.13
   | | | `-- mime-db@1.25.0
   | | `-- negotiator@0.5.3
   | +-- content-disposition@0.5.0
   | +-- cookie@0.1.2
   | +-- cookie-signature@1.0.5
   | +-- debug@2.1.3
   | | `-- ms@0.7.0
   | +-- depd@1.0.1
   | +-- escape-html@1.0.1
   | +-- etag@1.5.1
   | | `-- crc@3.2.1
   | +-- finalhandler@0.3.3
   | +-- fresh@0.2.4
   | +-- media-typer@0.3.0
   | +-- merge-descriptors@0.0.2
   | +-- methods@1.1.2
   | +-- on-finished@2.2.1
   | | `-- ee-first@1.1.0
   | +-- parseurl@1.3.1
   | +-- path-to-regexp@0.1.3
..............................................................................

Now open index.js file to add APP_ID and MASTER_KEY shown below –

$ sudo nano index.js

Use any random string for APP_ID and MASTER_KEY as shown below-

var api = new ParseServer({
   databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
   cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
   appId: process.env.APP_ID || 'tutorialspointsample',
   masterKey: process.env.MASTER_KEY || 'samplecreatedbysairam', //Add your mast$
   serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse', // Don't$
   liveQuery: {
      classNames: ["Posts", "Comments"] // List of classes to support for query s$
   }
});

Now save and close the file.To start parse server, use the following command –

$ sudo npm start

The sample output should be like this –

> parse-server-example@1.4.0 start /opt/parse-server-example
> node index.js

DATABASE_URI not specified, falling back to localhost.
parse-server-example running on port 1337.
info: Parse LiveQuery Server starts running
....................................................................

In the above article, we have learnt – How To Install Parse Server on Ubuntu. In our next articles, we will come up with more Linux based tricks and tips. Keep reading!.

Sharon Christine
Sharon Christine

An investment in knowledge pays the best interest

Updated on: 23-Jan-2020

253 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements