1.在终端上运行"sudo apt-get install mongo-org"后出现错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package mongodb-org //This is the error并且在运行"apt-get update"后依然是这个错误提示。2.结果按下面步骤设置后安装成功:
#Step 1: Import the MongoDB public key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
#Step 2: Generate a file with the MongoDB repository url
echo ‘deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen‘ | sudo tee /etc/apt/sources.list.d/mongodb.list
#Step 3: Refresh the local database with the packages
sudo apt-get update
#Step 4: Install the last stable MongoDB version and all the necessary packages on our system
sudo apt-get install mongodb-org
3.这时装好以后应该会自动运行mongod程序,通过"pgrep mongo -l "查看进程是否已经启动:
4.在终端输入"mongo",然后回车进入数据库
时间: 2024-10-19 08:02:07