Or copy link
Copy link
A strong web development environment is key to making dynamic and scalable apps. The MEAN stack is great for making modern web apps. It combines MongoDB, Express, Angular, and Node.js. Together, they make web apps strong, scalable, dynamic, and efficient. Overall, this setup is particularly suited for real-time applications and single-page applications.
In this tutorial, we will teach the step-by-step instructions for MEAN stack installation on Ubuntu 24.04.
Before installing the MEAN on Ubuntu, you need Node.js and MongoDB installed on the system. These are the core parts of the MEAN stack. Let’s start the installation:
First, you need to install Node.js. It is a JavaScript environment that lets you run JavaScript outside of a browser. Here’s how to do it on Ubuntu 24.04:
System Update
Start by updating the system’s package list with the following command:
sudo apt update
Install Node.js
Node.js is a well-known runtime environment for compiling and executing JS code. You can install Node.js on Ubuntu via the below command:
sudo apt install nodejs npm
This command installs the required dependencies as well:
Verification
To check the successful installation of Node.js, use the —version or -v option as below:
node -v
The output displays the version of Node.js installed on the system.
Install MEAN Stack on Our Ubuntu VPS!
Install the MEAN Stack on our Ubuntu VPS for efficient web development with MongoDB, Express, Angular, and Node.js for smooth performance.
Next, you need to install MongoDB on Ubuntu. As MongoDB is not available in the default Ubuntu repository, you will need to add the MongoDB repository to your server. Here’s how to install it on your Ubuntu 24.04 system:
Install Dependencies
Before proceeding, install the necessary dependencies:
sudo apt install gnupg curl
Import the MongoDB GPG Key
After installing dependencies, import the MongoDB GPG key by using the curl command:
curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor
Create the MongoDB Repository
Now, create the MongoDB repository by adding the following line to your system’s sources.list file:
echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
Install MongoDB
After that, update the package index and install MongoDB:
Next, you need to install MongoDB. Let’s install it on the system through the apt command:
sudo apt install mongodb-org
Start and Enable the MongoDB Service
After installation, start the services of MongoDB that is automatically configured on the system boot:
sudo systemctl start mongod
Now run the following command to enable the MongoDB services:
sudo systemctl enable mongod
Verify the MongoDB Services
Finally, verify the MongoDB installation through the systemctl command. It displays the status of MongoDB services that are installed on the system:
sudo systemctl status mongod
To set up the MEAN stack environment on Ubuntu, you’ll also need to install Angular CLI, which is the command-line interface for Angular. For this purpose, you can use npm, as follows:
sudo npm install -g @angular/cli
To verify the successful installation of Angular, check its version. It displays the information of MongoDB installed on your system:
ng version
Note: To create the first MEAN stack application, you can specify the application name by utilizing the command “ng new [application_name]”.
Read also How to Install Webmin on Ubuntu
Express.js is a web application framework for Node.js. Install it using npm:
sudo npm install express
To authenticate the above installation, check the “node_modules” directory:
ls
After setting up the MEAN stack environment, it’s time to create and test the application. Testing the MEAN stack application is a crucial step in ensuring the proper functioning of your web development project.
Create a Directory
For instance, create a directory “mean-app” for the MEAN stack project using the following command:
mkdir mean-app
Now move to this newly created directory using the cd command:
cd mean-app
Note: You can also start the application by running the npm start command in the project directory.
Customize the MEAN Stack Application
Now, you can create the customized MEAN stack application by specifying its name such as server.js with the nano editor:
sudo nano server.js
Copy the below content and paste the above-created server.js file:
const express = require('express'); const app = express(); const port = 3000; app.get('/', (req, res) => { res.send('Install MEAN on Ubuntu 24.04'); }); app.listen(port, () => { console.log(`Server running on port ${port}`); });
After pasting content, save and exit the editor.
Testing the MEAN Stack Application
Now, start the services of Mongo with the help of the systemctl command:
After this, run the server.js file using the following command:
node server.js
Once the application is running, you can test the MEAN app on Ubuntu. Open a web browser and go to http://localhost:3000. It sees your MEAN stack application up and running:
By following these steps, you have learned how to install and set up the MEAN stack on Ubuntu 24.04.
To install the MEAN stack on Ubuntu 24.04, you need to follow a series of steps, starting with the installation of MongoDB, then, you can proceed to install Node.js. Once these are set up, you can install Angular and Express. Finally, create and test the MEAN stack application on Ubuntu 24.04. With the MEAN stack, you can get JavaScript’s full-stack capabilities to build efficient and scalable web applications.
We hope this guide has helped you install the MEAN stack on Ubuntu 24.04. Setting up the MEAN stack on a Linux system is simple with the right hosting platform. Specifically, Ultahost’s Linux VPS hosting is an ideal choice, offering fast performance and the flexibility to scale resources as your project grows.
The MEAN stack is a combination of different tools for making modern web apps. It combines MongoDB, Express.js, Angular, and Node.js smoothly. These technologies work together to build dynamic web apps.
The MEAN stack offers a consistent JavaScript environment, efficient data handling with MongoDB, a scalable backend with Express and Node.js, and a robust front-end with Angular.
To install the MEAN stack on Ubuntu 24.04, you need a compatible system. It should have enough resources and necessary dependencies.
Installing Node.js on Ubuntu 24.04 requires a few steps. You might need to add a repository, update your system, and install Node.js.
Setting up MongoDB on Ubuntu 24.04 involves adding a repository and updating your system. Then, install MongoDB. You might also need to configure the MongoDB service.
To create a new MEAN stack project on Ubuntu 24.04, you’ll need to set up the project structure by creating directories for both the client-side and server-side, followed by configuring the necessary settings.
To test the MEAN stack application on Ubuntu 24.04, start the server-side components and the client-side Angular application. Then, check if the application works as expected.
The .deb packages are the standard format for installin...
Swift is a powerful, modern programming language develo...
Sublime Text is a popular, feature-rich text editor des...
The Oracle Database is a powerful relational database m...
Managing logs in Docker Compose is essential for develo...
Python is a powerful and versatile programming language...
Save my name, email, and website in this browser for the next time I comment.
Δ