RHEL BasedRocky Linux

How To Install Parse Server on Rocky Linux 9

Install Parse Server on Rocky Linux 9

Parse Server is a popular open-source backend platform that allows developers to build, test, and deploy web or mobile applications quickly. Originally created by Facebook, its open-source version provides a flexible and scalable environment ideal for modern development practices. Running Parse Server on Rocky Linux 9 offers a stable, security-focused operating system with an active community and enterprise-grade features. This tutorial walks through the entire process of installing and configuring Parse Server on Rocky Linux 9, covering key steps such as installing dependencies, configuring Node.js, integrating MongoDB, and setting up Parse Dashboard for convenient administration. Useful tips on troubleshooting, security best practices, and testing are also covered to ensure a smooth experience.

This guide assumes some familiarity with Linux systems and basic administrative tasks, such as using the command line, editing configuration files, and managing services. However, users of all skill levels can benefit from the detailed, step-by-step instructions covered here. By adhering to these steps and best practices, you will be equipped to install a robust and reliable backend solution. Parse Server’s flexibility allows developers to create a wide range of applications, from small prototypes to large-scale production deployments. Whether you are building a new app from scratch or migrating an existing project, successfully deploying Parse Server on Rocky Linux 9 can greatly streamline your development workflow.

System Requirements

Before starting, ensure your Rocky Linux 9 system meets the recommended resource requirements for smooth performance:

  • CPU: A modern multi-core processor (e.g., 2+ cores) to handle multiple concurrent operations
  • RAM: At least 2 GB, though 4 GB or more is preferred for moderate workloads
  • Disk Space: A minimum of 20 GB, which accommodates the base system, MongoDB data, logs, and Parse Server files
  • Network: Reliable internet connection for downloads, updates, and remote client connections
  • Software Requirements: Current system packages, Node.js 14+ (or 16+), and MongoDB

A well-provisioned environment ensures steady performance and lowers the risk of service disruptions. Adjust memory and processing power based on the size of your user base, the complexity of your application logic, and the volume of data stored in MongoDB.

Preparing the Environment

This section focuses on the essential steps to get your Rocky Linux 9 system ready for Parse Server installation. Proper preparation is crucial to avoid conflicts, ensure security, and streamline the rest of the setup process. Below is a breakdown of tasks, including configuration of repositories, system updates, and network settings.

Enable Required Repositories

Rocky Linux 9 comes with several built-in repositories. However, certain packages may only be available in Extra Packages for Enterprise Linux (EPEL) or the CodeReady Linux Builder (CRB) repository. Enabling these repositories makes it easier to install dependencies like Node.js and MongoDB:

sudo dnf install epel-release -y
sudo dnf config-manager --set-enabled crb

After enabling these, refresh the package index to ensure the system recognizes the newly added repositories:

sudo dnf update -y

By completing these steps, your Rocky Linux 9 environment will have broader access to the packages needed for Parse Server and its various components.

System Updates and Basic Tools

Keeping your system up-to-date is a foundational security practice. Run a system-wide update to apply the latest patches and features:

sudo dnf upgrade -y

It is also advisable to install some commonly used tools that may be required throughout the setup process, such as:

sudo dnf install git wget curl nano -y

By performing these updates and installing basic tools, you guarantee a clean working environment and reduce potential conflicts during Parse Server installation.

Network Configuration

Configuring your firewall and network settings is vital for secure remote connections. Parse Server needs specific ports to be open, particularly port 1337 by default when hosting your API. If you plan on running Parse Dashboard, you’ll typically use port 4040 unless changed:

sudo firewall-cmd --permanent --add-port=1337/tcp
sudo firewall-cmd --permanent --add-port=4040/tcp
sudo firewall-cmd --reload

These commands add the necessary firewall rules permanently and reload the firewall configuration so that any inbound traffic on the designated ports can reach Parse Server and Parse Dashboard. Verify the network settings by checking that your firewall rules are active.

With your environment prepared, you are now ready to install the dependencies needed to run Parse Server effectively on Rocky Linux 9.

Installing Dependencies

Successful Parse Server deployment heavily depends on having the right software components installed and properly configured. The two main dependencies are Node.js (along with npm) and MongoDB. While PostgreSQL is also supported by Parse Server, MongoDB is the most widely used default database backend.

Node.js Setup

Parse Server is built on JavaScript, running on the Node.js runtime. Installing a stable Node.js version ensures reliable performance:

  1. Add Node.js Repository
    To access recent releases, add the NodeSource or an official distribution repository:

    curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -
  2. Install Node.js and npm
    sudo dnf install nodejs -y

    This installs both Node.js and the bundled npm (Node Package Manager).

  3. Verify Installation
    node -v
    npm -v

    Confirm you see the correct version numbers.

With Node.js and npm configured, your system is primed to run JavaScript applications, including Parse Server, effectively.

MongoDB Installation

MongoDB is a NoSQL database that stores data in a flexible JSON-like format, making it ideal for modern, dynamic applications. Follow these steps to install MongoDB on Rocky Linux 9:

  1. Configure the MongoDB Repository
    Create or update the /etc/yum.repos.d/mongodb.repo file:

    [mongodb-org-6.0]
    name=MongoDB Repository
    baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/6.0/x86_64/
    gpgcheck=1
    enabled=1
    gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc
  2. Install MongoDB
    sudo dnf install mongodb-org -y
  3. Start and Enable MongoDB
    sudo systemctl start mongod
    sudo systemctl enable mongod

    Enabling ensures MongoDB automatically starts on reboot.

  4. Check MongoDB Version
    mongod --version

    Confirm the installed version is the one you intend to use.

At this point, your system has the crucial dependencies. Node.js will serve as the runtime environment for Parse Server, while MongoDB will manage all database operations.

Parse Server Installation

Installing Parse Server involves creating a dedicated project directory, installing the necessary npm packages, and configuring critical settings, such as database connection details and security tokens. Follow these steps to successfully install and configure Parse Server on Rocky Linux 9.

Core Installation

1. Create a Project Directory
Choose a directory to store Parse Server files:

mkdir ~/parse-server-project
cd ~/parse-server-project

2. Initialize a Node.js Project
This step creates a package.json file:

npm init -y

3. Install Parse Server via npm
Download and install Parse Server modules:

npm install parse-server --save

These commands generate a basic Node.js project structure, along with essential Parse Server files.

Server Configuration

Configuring Parse Server is critical for establishing secure connections, customizing your app’s behavior, and ensuring proper database alignment. Below is a minimal example of a Parse Server configuration file named index.js that you can place in the same directory:

const ParseServer = require('parse-server').ParseServer;
const http = require('http');

const api = new ParseServer({
  databaseURI: 'mongodb://localhost:27017/parse',
  cloud: './cloud/main.js', 
  appId: 'MY_APP_ID',
  masterKey: 'MY_MASTER_KEY',
  serverURL: 'http://localhost:1337/parse',
});

const port = 1337;
const httpServer = http.createServer(api.app);
httpServer.listen(port, function() {
  console.log('Parse Server running on port ' + port);
});

In the databaseURI field, specify your MongoDB address and port. Use unique values for appId and masterKey, as they secure application data. The field cloud references a file where you can store custom JavaScript functions (optional, but beneficial for advanced logic).

Once your file is configured, launch Parse Server:

node index.js

If everything is set up correctly, you will see output indicating that Parse Server is running on localhost:1337. Keep this terminal open or run the process in the background using process management tools such as pm2 or systemd.

For a persistent setup, consider creating a systemd service file (e.g., /etc/systemd/system/parse-server.service):

[Unit]
Description=Parse Server
After=network.target

[Service]
Type=simple
User=rocky
ExecStart=/usr/bin/node /home/rocky/parse-server-project/index.js
Restart=on-failure

[Install]
WantedBy=multi-user.target

Enable and start the service:

sudo systemctl enable parse-server
sudo systemctl start parse-server

With this configuration, your Parse Server instance will automatically start at boot under systemd supervision, boosting your application’s reliability on Rocky Linux 9.

Parse Dashboard Setup

Parse Dashboard provides a user-friendly, web-based interface for managing your app data, classes, users, and other resources. It simplifies everyday tasks like viewing logs, editing records, and monitoring server performance. Below are the steps to install and configure Parse Dashboard.

1. Install Parse Dashboard
Use npm to install the Parse Dashboard package:

cd ~/parse-server-project
npm install parse-dashboard --save

2. Create a Dashboard Configuration File
Within the project directory, make a file called parse-dashboard-config.json:

{
  "apps": [
    {
      "serverURL": "http://localhost:1337/parse",
      "appId": "MY_APP_ID",
      "masterKey": "MY_MASTER_KEY",
      "appName": "MyParseServerApp"
    }
  ],
  "users": [
    {
      "user": "admin",
      "pass": "adminPassword",
      "readOnly": false
    }
  ]
}

Adjust the serverURL, appId, masterKey, username, and password to match your previous Parse Server config. The appName field is a friendly name that appears in the dashboard UI.

3. Launch Parse Dashboard
Invoke the parse-dashboard command with the config file:

npx parse-dashboard --config parse-dashboard-config.json --port 4040

By default, the dashboard listens on port 4040, so access it at http://SERVER_IP:4040. Enter the credentials set in your configuration file to log in.

Install Parse Server on Rocky Linux 9

To run Parse Dashboard continuously, you can create another systemd service file or use pm2, similar to how you configured Parse Server. This ensures your dashboard is always available for quick database checks or administrative tasks.

Testing and Verification

After installation, it is wise to conduct thorough tests to confirm Parse Server is functioning properly. This not only identifies potential misconfigurations but also assures you that your server can handle real-world scenarios. Below are recommended checks.

Verify Server Status

Check if Parse Server is active via systemd:

sudo systemctl status parse-server

If the status is running without errors, it’s a strong indication that your configuration is correct. If it’s not running, inspect the logs for clues on potential issues.

Test API Endpoints

You can test the server’s readiness by sending a simple request to the Parse Health Check endpoint. For instance, from the same machine:

curl http://localhost:1337/parse/health

You should see a JSON response like {"status":"ok"}. This indicates that Parse Server is up and responding to requests.

Access the Dashboard

Open a web browser and navigate to http://YOUR_SERVER_IP:4040 (or the domain name, if you have configured DNS). Enter the username and password defined in the Parse Dashboard configuration. Successfully logging in verifies connectivity between the dashboard and Parse Server.

Perform Basic CRUD Operations

Within Parse Dashboard, create a new class and add some fields. This quick test ensures the database is being updated as intended:

  1. Click “Create a class” in the dashboard.
  2. Add a few custom fields, such as name or age.
  3. Create a new record and see if the data is stored.
  4. Update or delete the record to verify all CRUD operations work.

Completing these steps confirms the end-to-end functionality of Parse Server and the associated dashboard, providing reassurance that your installation was successful.

Security Considerations

Securing your Parse Server and its data is of paramount importance. This includes restricting access, safeguarding network ports, and implementing encryption. Below are several recommendations.

Firewall Practices

Only open ports necessary for your application. If you have no use for the Parse Dashboard in a production environment, consider limiting access to your organization’s IP range or using a secure VPN.

Enable SSL/TLS

For production deployments, configure HTTPS to prevent data from traversing the network in plain text. You can set up a reverse proxy (for example, using NGINX or Apache) to handle TLS termination. This ensures requests between remote clients and Parse Server are encrypted.

Access Control

Keep appId and masterKey private. In a multi-application environment, use different master keys for each app. Also, implement robust role-based access controls and class-level permissions in your Parse Server to block unauthorized data changes.

Security Hardening Steps

Regularly update all dependencies, including Node.js, MongoDB, and system packages. Activate intrusion detection or prevention systems (IDS/IPS) to monitor unusual behavior. Additionally, use log management tools like Graylog, ELK Stack, or Datadog to monitor application logs for anomalies.

Troubleshooting Guide

Even with thorough preparation, issues may sporadically arise during or after Parse Server installation. Below is a list of common scenarios and potential solutions.

  1. Node.js Version Conflicts
    If you experience module compatibility errors, verify your Node.js version. Upgrading or downgrading might resolve issues.
  2. Port Conflicts
    If Parse Server fails to start, check if another service is already listening on port 1337. Use lsof -i :1337 or netstat -tulpn | grep 1337 to identify conflicts.
  3. MongoDB Connection Errors
    Confirm MongoDB is running: sudo systemctl status mongod. Ensure databaseURI in your config exactly matches your MongoDB address.
  4. Permission Denied Errors
    Make sure your user has appropriate permissions to read and write the project folder. Sometimes using sudo incorrectly can change file ownership.
  5. Parse Dashboard Not Accessible
    Verify the firewall or SELinux policies aren’t blocking port 4040. Confirm that the user credentials in your parse-dashboard-config.json file are valid.

By methodically troubleshooting these common points of failure, most installation and configuration issues can be swiftly resolved, ensuring a stable Parse Server environment.

Congratulations! You have successfully installed Parse. Thanks for using this tutorial for installing the Parse Server on Rocky Linux 9 system. For additional help or useful information, we recommend you check the official Parse Server website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button