Instalación Mongodb
Instalación
GNU/Linux
Debian
Debian 11 Bulleye
MongoDB 6.x
echo "deb http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list curl -sSL https://www.mongodb.org/static/pgp/server-6.0.asc -o mongoserver.asc gpg --no-default-keyring --keyring ./mongo_key_temp.gpg --import ./mongoserver.asc gpg --no-default-keyring --keyring ./mongo_key_temp.gpg --export > ./mongoserver_key.gpg sudo mv mongoserver_key.gpg /etc/apt/trusted.gpg.d/ sudo apt-get update sudo apt install mongodb-org
La versión de mongodb:
mongod --version
Sale por pantalla:
db version v6.0.4 Build Info: { "version": "6.0.4", "gitVersion": "44ff59461c1353638a71e710f385a566bcd2f547", "openSSLVersion": "OpenSSL 1.1.1n 15 Mar 2022", "modules": [], "allocator": "tcmalloc", "environment": { "distmod": "debian11", "distarch": "x86_64", "target_arch": "x86_64" } }
Hacer correr servicio:
sudo systemctl enable --now mongod sudo systemctl status mongod --no-pager -l
Docker
Bajando imagen
docker run -dp 27017:27017 -v local-mongo:/data/db --name local-mongo --restart=always mongo
Run container
docker exec -it local-mongo bash
Iniciar container
docker start 657efbbd9f6c
Parar container
docker stop 657efbbd9f6c