Atlantic.Net Blog

How to Install MEAN Stack on Oracle Linux 8

Hitesh Jethva
by Atlantic.Net (468 posts) under Tutorials, VPS Hosting
0 Comments

A MEAN stack is one of the most popular JavaScript technology stacks. It is a free and open-source framework that helps you build fast, robust, and maintainable production-ready web applications using MongoDB, Express, Angular, and Node.js. A MEAN stack supports the same language for both the front-end and back-end, which will increase efficiency and reduces the confusion of developers.

In this guide, we will show you how to install MEAN.JS on Oracle Linux 8.

Prerequisites

  • A fresh Oracle Linux 8 server on the Atlantic.Net Cloud Platform
  • A root password configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Oracle Linux 8 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your Oracle Linux 8 server, run the following command to update your base system with the latest available packages.

apt-get update -y

Step 2 – Install MongoDB

MongoDB is the first component of the MEAN stack. By default, MongoDB is not included in the Oracle Linux 8 default repository, so you will need to add the MongoDB repository to your server.

nano /etc/yum.repos.d/mongodb-org-4.4.repo

Add the following lines:

[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc

Next, install the MongoDB server with the following command:

dnf install mongodb-org

After installing MongoDB, start the MongoDB service and enable it to start at system reboot:

systemctl start mongod.service
systemctl enable mongod.service

You can now verify the MongoDB version using the following command:

mongod --version

You should see the following output:

db version v4.4.16
Build Info: {
    "version": "4.4.16",
    "gitVersion": "a7bceadbac919a2c035f2874c61d138fd75d6a6f",
    "openSSLVersion": "OpenSSL 1.1.1k  FIPS 25 Mar 2021",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distmod": "rhel80",
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}

Step 3 – Install Node.js

Next, you will need to install Node.js on your system. First, install all required dependencies using the following command:

dnf install curl git gcc-c++ make -y

Next, add the Node source repo using the following command:

curl -fsSL https://rpm.nodesource.com/setup_16.x | bash -

Next, install the Node.js by running the following command:

dnf install nodejs -y

Once Node.js is installed, you can verify the Node.js version using the following command:

node --version

You will get the following output:

v16.17.0

Step 4 – Install Express

Express is a Node.js framework that supports MVC and helps to build more scalable, structured, and dynamic websites. You can install the Express using the NPM command:

npm install -g express-generator

Once Express is installed, create a directory for the Express project with the following command:

mkdir app

Next, navigate to the app directory and create an Express project with the following command:

cd app
express

You will get the following output:

   create : public/
   create : public/javascripts/
   create : public/images/
   create : public/stylesheets/
   create : public/stylesheets/style.css
   create : routes/
   create : routes/index.js
   create : routes/users.js
   create : views/
   create : views/error.jade
   create : views/index.jade
   create : views/layout.jade
   create : app.js
   create : package.json
   create : bin/
   create : bin/www

   install dependencies:
     $ npm install

   run the app:
     $ DEBUG=app:* npm start

Next, run the following command to install additional dependencies:

npm install

Next, run the Express app using the following command:

DEBUG=app:* npm start

You will get the following output:

> [email protected] start
> node ./bin/www

  app:server Listening on port 3000 +0ms

Now, open your web browser and access the Express app using the URL http://your-server-ip:3000. You should see the following screen:
Express dashboard page
Press the CTRL+C on your command line interface to stop the Express app.

Step 5 – Install Angular

Angular is an MVC framework used for both the client end and the front end. It allows you to create an interactive web or mobile application.

You can install the Angular CLI by running the following command:

npm install -g @angular/cli

Once installed, create a new Angular app using the following command:

ng new angular-app

You should see the following output:

? Would you like to add Angular routing? No
? Which stylesheet format would you like to use? CSS

Next, navigate to the angular-app directory and run your application using the following command:

cd angular-app
ng serve --host your-server-ip --port 8088

You should get the following output:

✔ Browser application bundle generation complete.

Initial Chunk Files   | Names         |  Raw Size
vendor.js             | vendor        |   1.73 MB | 
polyfills.js          | polyfills     | 315.30 kB | 
styles.css, styles.js | styles        | 207.37 kB | 
main.js               | main          |  47.74 kB | 
runtime.js            | runtime       |   6.52 kB | 

                      | Initial Total |   2.29 MB

Build at: 2022-08-23T10:25:26.405Z - Hash: 50e206289757a698 - Time: 23713ms

** Angular Live Development Server is listening on 208.117.81.16:8088, open your browser on http://208.117.81.16:8088/ **


✔ Compiled successfully.

You can now access the Angular app using the URL http://your-server-ip:8088. You should see your Angular app on the following screen:
Angular dashboard page

Conclusion

Congratulations! You have successfully installed the MEAN stack on Oracle Linux 8. You can now use the MEAN stack in your production environment to develop fast, secure, and scalable dynamic web applications. Get started with a MEAN stack on VPS Hosting from Atlantic.Net!

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

Best Cloud Consultancy or MSP in 2022
BAA Red Flags: What Should Your HIPAA-Compliant Hosting Company Be Willing to Accommodate?
HIPAA Compliance for Remote Workers: How to Maintain HIPAA Compliance with a Remote Team
How to Make the Best Use of the Cloud in the Internet of Things (IoT)
How to Make the Best Use of Artificial Intelligence in Cloud Computing

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2008 Lookout Dr,

Garland, Texas 75044

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources