sudo apt purge nodejs npm mongodb; sudo apt autoremove;
Install Node (original source: https://github.com/nodejs/help/wiki/Installation):
Download NodeJs from website: https://nodejs.org/dist/v20.12.2/node-v20.12.2-linux-x64.tar.xz
Edit version number below and keep it same as your downloaded file name. The snippet also exports path:
VERSION=v20.12.2
DISTRO=linux-x64
sudo mkdir -p /usr/local/lib/nodejs
sudo tar -xJvf node-$VERSION-$DISTRO.tar.xz -C /usr/local/lib/nodejs
export PATH=/usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin:$PATH
. ~/.profile
Above snippet modifies also PATH. Those who wish to create a symlink instead can follow this:
VERSION=v20.12.2
DISTRO=linux-x64
sudo ln -s /usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin/node /usr/bin/node
sudo ln -s /usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin/npm /usr/bin/npm
sudo ln -s /usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin/npx /usr/bin/npx
Check if installed components output normally:
node -v
npm
npx -v
npm install express cors dotenv mongoose
- Express:
- cors:
- dotenv:
- mongoose:
text
(original source: https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/):
Import the MongoDB public GPG key
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 a List file for your version of Ubuntu. You can run neofetch
to find which version of ubuntu you are currently running:
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 Repository:
sudo apt update
Install MongoDB:
sudo apt install -y mongodb-org
Run MongoDB:
sudo systemctl daemon-reload
sudo systemctl start mongod
sudo systemctl status mongod
sudo systemctl enable mongod
You can connect to mongoDB port using command mongosh
. Default port and url is localhost and 27017 respectively.
Download .deb file from here: https://www.mongodb.com/try/download/compass Go to downloads folder, open terminal there and type:
sudo apt install ./mongodb-compass*.deb