Or copy link
Copy link
The MEAN stack is a combination of MongoDB, Express.js, Angular, and Node.js. The purpose of installing it on Debian 12 is to establish a robust development environment for building dynamic and modern web applications. By using the combined power of MongoDB, Express.js, Angular, and Node.js, developers can efficiently create feature-rich applications with a unified JavaScript ecosystem. This streamlined approach enhances development speed, improves code maintainability, and facilitates seamless data flow between the client-side and server-side components.
In this tutorial, we will discuss the detailed steps to install the MEAN stack on a Debian 12 system.
Installing the MEAN stack on Debian 12 is essential for developers who want to create dynamic, full-stack web applications using a unified JavaScript framework.
Install MEAN Stack on our Best Debian VPS!
Deploy the MEAN Stack on Ultahost Linux VPS to create scalable and dynamic web applications. Ultahost handles all server management to ensure optimal performance!
To install MEAN on Debian 12, first, check the Linux version to avoid compatibility issues and then follow the below steps:
First, update your system’s package index to ensure you have the latest package information:
sudo apt update
Node.js and npm are essential for running and managing JavaScript applications. Let’s install them:
Add Node.js Repository
After updating packages, add Node.js repository in the system via the below command:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
Install Node.js and npm
Once the repository is added to the system, users can install the Node.js package:
sudo apt install -y nodejs
Read also How to Install the MEAN Stack on Ubuntu 24.04
Verify Installation
Users can check the installed version of Node.js via the -v option below:
node -v
To confirm the installation of the npm package manager, utilize the -v option:
npm -v
The purpose of installing MongoDB for a MEAN stack on Debian 12 is to provide a robust and flexible database solution for your web application. Let’s install it:
Import the MongoDB GPG Key
Now, download the MongoDB repository key (version 7.0) securely, then add it to your system’s trusted keyrings for package verification:
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 MongoDB Source List
In this step, add the MongoDB repository for Debian 12 to download the source list and specify the package version 7.0 and Ubuntu’s compatible codename jammy. Then, saving the list to a dedicated file for MongoDB packages:
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
Update Package Index
Once the MongoDB repository is added, update the packages list:
Install MongoDB
In this step, users need to install the MongoDB packages from the Debian repositories:
sudo apt install mongodb-org
Start and Enable MongoDB Service
Now, instruct the system’s service manager (systemd) to start the service named mongod:
sudo systemctl start mongod
After starting services, users can enable services via the below command:
sudo systemctl enable --now mongod
Finally, verify the running status of the MongoDB service via the systemctl command. It displays information like service state, active connections, and any errors:
sudo systemctl status mongod
In this step, users need to install Express.js which is a web-based application framework for Node.js. Let’s install it:
Create a Directory for Your Project
Now, create a new directory named myapp in the current directory. Then, navigate (changes directory) into the newly created myapp directory:
mkdir myapp && cd myapp
Initialize a New Node.js Project
In this step, initialize a new Node.js project with default settings and create a package.json file for managing dependencies:
npm init -y
Install Express.js
Now, install the Express.js framework, a minimal and flexible Node.js web application framework, into your current project’s directory. This allows you to use Express.js features like routing, middleware, and HTTP servers within your application:
npm install express
In this step, users need to set up Angular, which is a JavaScript framework for building client-side applications. Let’s set it:
Install Angular CLI
Now, install the Angular CLI globally on your system. This allows you to create new Angular projects and perform various development tasks from the command line:
sudo npm install -g @angular/cli
Create a New Angular Project
In this step, create a new Angular project named client. It initializes the project with the necessary files and dependencies:
ng new client
Navigate to the Angular Project Directory
In this step, navigate the current directory to the subdirectory named client. This is commonly used to access files and folders related to the front end of a web application:
cd client
Start the Angular Development Server
The Angular CLI starts a local development server, compiles an Angular application, and serves it in the browser for live development and testing:
ng serve
After some time, it configures some files and outputs the URL with a specific port number, such as http://localhost:4200/:
This setup allows you to create powerful and scalable applications with a unified JavaScript stack. In the last step, launch the web browser and navigate to http://localhost:4200 to see the Angular application running:
By following these steps, you have successfully installed the MEAN stack on Debian 12.
Installing the MEAN stack on Debian 12 helps developers streamline their development process and ensures seamless integration between the front-end and back-end components. This setup not only enhances productivity but also allows for efficient testing and deployment, making it an invaluable tool for modern web development. In this article, we explained how to create a fully functional development environment for building modern web applications using MongoDB, Express.js, Angular, and Node.js.
We hope this guide has helped you install the MEAN stack on Debian 12. Consider Ultahost’s managed VPS hosting to unlock your website’s true potential. Ultahost offers maximum flexibility, unlimited bandwidth, and unmatched performance. Buy VPS now and take your online presence to the next level!
The MEAN stack is a collection of JavaScript technologies: MongoDB (database), Express.js (server framework), Angular (front-end), and Node.js (runtime).
Yes, MongoDB is supported on Debian 12 and can be installed from the official repositories.
To install Node.js, add the NodeSource repository and run sudo apt install nodejs to get the latest version.
Express.js is a web framework for Node.js that simplifies building server-side applications and APIs for MEAN on Debian 12.
Create an app.js file, install Express using npm, and use the app.get() to set up routes and app.listen() to start the server.
The Angular CLI is a command-line tool for creating and managing Angular applications, simplifying tasks like project setup and development.
Install Angular CLI globally with the command sudo npm install -g @angular/cli to manage Angular projects.
A strong web development environment is key to making d...
Kali Linux is a powerful and versatile operating system...
The .deb packages are the standard format for installin...
Encountering the error add-apt-repository command not f...
Kali Linux is a popular operating system used for secur...
Python is a high-level programming language known for i...
Save my name, email, and website in this browser for the next time I comment.
Δ