32位 Ubuntu16.04安装mongodb的一些记录

Ubuntu16.04安装mongodb记录

参考博客及网址:

https://blog.csdn.net/m_buddy/article/details/79780633

http://corpus.hubwiz.com/2/node.js/28945921.html

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

按网上的教程安装(error)

先去官网https://www.mongodb.com/try/download/community找对应的版本,然后复制下载链接

root@hadoop:/home/hadoop-m/Downloads# wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-4.4.6.tgz
--2021-06-17 00:11:48--  https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-4.4.6.tgz
Resolving fastdl.mongodb.org (fastdl.mongodb.org)... 13.227.49.2, 13.227.49.77, 13.227.49.72, ...
Connecting to fastdl.mongodb.org (fastdl.mongodb.org)|13.227.49.2|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 72077288 (69M) [application/gzip]
Saving to: ‘mongodb-linux-x86_64-ubuntu1604-4.4.6.tgz’
​
mongodb-linux-x 100%[=====>]  68.74M  1.42MB/s    in 48s     
​
2021-06-17 00:12:38 (1.42 MB/s) - ‘mongodb-linux-x86_64-ubuntu1604-4.4.6.tgz’ saved [72077288/72077288]
​
root@hadoop:/home/hadoop-m/Downloads# tar -zxvf mongodb-linux-x86_64-ubuntu1604-4.4.6.tgz 
#解压
root@hadoop:/home/hadoop-m/Downloads# mv mongodb-linux-x86_64-ubuntu1604-4.4.6 /usr/local/mongo
#复制到local目录

设置MongoDB数据文件存放的目录以及log文件的目录

root@hadoop:/home/hadoop-m/Downloads# cd /usr/local/mongo/
root@hadoop:/usr/local/mongo# mkdir -p /data/db
root@hadoop:/usr/local/mongo# ls
bin                    MPL-2   THIRD-PARTY-NOTICES
LICENSE-Community.txt  README
root@hadoop:/usr/local/mongo# mkdir -p /usr/local/mongo/logs
root@hadoop:/usr/local/mongo# cd logs/
root@hadoop:/usr/local/mongo/logs# touch mongodb.log
root@hadoop:/usr/local/mongo/logs# cd ..
root@hadoop:/usr/local/mongo# ./bin/mongod --dbpath=/data/db -logpath=/usr/local/mongo/logs/mongodb.log
bash: ./bin/mongod: cannot execute binary file: Exec format error
root@hadoop:/usr/local/mongo# /usr/local/mongo/bin/mongod --dbpath=/data/db -logpath=/usr/local/mongo/logs/mongodb.log
bash: /usr/local/mongo/bin/mongod: cannot execute binary file: Exec format error
root@hadoop:/usr/local/mongo# 
​

然后出问题了,暂未解决(后面得知是32位的锅)

apt安装(ok但版本太旧)

发现apt-get直接安装就行了,命令如下:

hadoop-m@hadoop:~$ sudo apt update && sudo apt upgrade -y
hadoop-m@hadoop:~$ sudo apt install mongodb
hadoop-m@hadoop:~$ sudo systemctl status mongodb#查看服务状态
● mongodb.service - An object/document-oriented database
   Loaded: loaded (/lib/systemd/system/mongodb.service; enable
   Active: active (running) since Thu 2021-06-17 11:05:23 CST;
     Docs: man:mongod(1)
 Main PID: 7614 (mongod)
   CGroup: /system.slice/mongodb.service
           └─7614 /usr/bin/mongod --config /etc/mongodb.conf
​
Jun 17 11:05:23 hadoop systemd[1]: Started An object/document-
​
​
mongo
MongoDB shell version: 2.6.10
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
    http://docs.mongodb.org/
Questions? Try the support group
    http://groups.google.com/group/mongodb-user
Server has startup warnings: 
2021-06-17T11:05:23.515+0800 [initandlisten] 
2021-06-17T11:05:23.515+0800 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
2021-06-17T11:05:23.516+0800 [initandlisten] **       32 bit builds are limited to less than 2GB of data (or less with --journal).
2021-06-17T11:05:23.516+0800 [initandlisten] **       See http://dochub.mongodb.org/core/32bit
2021-06-17T11:05:23.516+0800 [initandlisten] 
> db.version()
2.6.10
​

用阿里云或者官网的源apt安装失败(32位不被支持)

wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org

破案了:

The true problem here may be if you have a 32-bit system. MongoDB 3.X was never made to be used on a 32-bit system, so the repostories for 32-bit is empty (hence why it is not found). Installing the default 2.X Ubuntu package might be your best bet with:

sudo apt-get install -y mongodb 

鉴于虚拟机是32位的那就先不折腾了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值