Introduction
The MEAN stack is a powerful collection of JavaScript technologies used for building dynamic web applications. It consists of MongoDB, Express.js, Angular, and Node.js. In this guide, you will learn how to install the MEAN stack on Ubuntu 22.04, which can be efficiently hosted on a Windows VPS UK for optimal performance.
Prerequisites
- An Ubuntu 22.04 server with root access
- Basic knowledge of Linux commands
- An active internet connection
Step 1: Update Your System
Start by updating your package index and upgrading existing packages:
sudo apt update && sudo apt upgrade -y
Step 2: Install Node.js
Install Node.js using the NodeSource repository:
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install -y nodejs
Verify the installation:
node -v
npm -v
Step 3: Install MongoDB
Add the MongoDB repository:
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/multiverse amd64 packages" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
Update the package index and install MongoDB:
sudo apt update
sudo apt install -y mongodb-org
Start and enable the MongoDB service:
sudo systemctl start mongod
sudo systemctl enable mongod
Step 4: Install Angular CLI
Install the Angular Command Line Interface (CLI) globally:
sudo npm install -g @angular/cli
Step 5: Install Express Generator
Install the Express.js application generator globally:
sudo npm install -g express-generator
Step 6: Create a New Express Application
Create a new Express application:
express myapp
Navigate into the application directory:
cd myapp
Install the required packages:
npm install
Step 7: Set Up the Angular Application
Create a new Angular application inside your project directory:
ng new frontend
Navigate into the Angular directory:
cd frontend
Start the Angular development server:
ng serve --open
Step 8: Conclusion
You have successfully installed the MEAN stack (MongoDB, Express.js, Angular, and Node.js) on Ubuntu 22.04. This powerful web development stack can significantly benefit from being hosted on a Windows VPS. For additional options, explore various VPS UK Windows solutions, including Windows Virtual Private Server Hosting and Windows VPS Hosting UK for optimal performance and security.