xxxxxxxxxx
sudo systemctl start mongodb
# it will starts mongodb server
xxxxxxxxxx
If you want it to work only once you can run this command in your terminal
$ export PATH="$HOME/.composer/vendor/bin:$PATH"
But if you want it to be stored and work whenever you open a new terminal you need to do the following steps:
1) open the ~/.zshrc file by running the following command $ nano ~/.zshrc
2) at the bottom of that file add this export PATH="$HOME/.composer/vendor/bin:$PATH"
then to save hit (ctrl + x) then (Y) then finally hit enter(or return).
xxxxxxxxxx
echo "PATH=\"$HOME/.config/composer/vendor/bin:$PATH\"" >> ~/.zshrc
source ~/.zshrc
xxxxxxxxxx
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/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
xxxxxxxxxx
> sudo apt-get install gnupg curl
// ------------------------------------
// ------------------------------------
> curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \
--dearmor
// ------------------------------------
// ------------------------------------
// for Ubuntu 24.04 (Noble)
> echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
// ------------------------------------
// for Ubuntu 22.04 (Jammy)
> echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
// ------------------------------------
// for Ubuntu 20.04 (Focal)
> echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
// ------------------------------------
// ------------------------------------
> sudo apt-get update
// ------------------------------------
// ------------------------------------
// for installing the latest release of mongodb
> sudo apt-get install -y mongodb-org
// ------------------------------------
// for installing a specific version of mongodb
> sudo apt-get install -y mongodb-org=8.0.4 mongodb-org-database=8.0.4 mongodb-org-server=8.0.4 mongodb-mongosh mongodb-org-mongos=8.0.4 mongodb-org-tools=8.0.4
xxxxxxxxxx
# https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/
sudo apt-get install gnupg
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
# for Ubuntu 20.04
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
# if you get "mongodb-org-mongos : Depends: libssl1.1 (>= 1.1.1) but 1.1.0l-1~deb9u6 is to be installed" error
# https://stackoverflow.com/questions/50375979/getting-error-while-installing-mongodb-in-linux
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1\~18.04.20_amd64.deb
sudo dpkg -i libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
sudo apt-get install -y mongodb-org