ubuntu 22.04安装mongodb7

1、环境更新

bash 复制代码
sudo apt update
sudo apt upgrade

要执行curl命令,需先安装此包

bash 复制代码
sudo apt-get install curl

2、生成MongoDB的gpg秘钥和向APT导入MongoDB7.0版软件包的资源链接

bash 复制代码
curl -fsSL https://pgp.mongodb.com/server-7.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor

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

sudo apt update

3、下载MongoDB并安装

安装MongoDB前需要安装libssl1.1

bash 复制代码
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb

sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb

安装mongodb

bash 复制代码
sudo apt-get install -y mongodb-org

4、启动MongoDB服务并设置开机启动和查询运行状态

bash 复制代码
sudo systemctl start mongod

sudo systemctl enable mongod

sudo systemctl status mongod
相关推荐
高山有多高29 分钟前
【Linux笔记】Linux自定义Shell
linux·c++
姜鱼问生36 分钟前
HTTPS 部署实战:未备案域名 + 非标端口的完整方案
linux·https
jackletter1 小时前
linux:安装 ubuntu 26.04.1
linux·ubuntu·ubuntu26.04.1
打工仔折腾 AI1 小时前
飞牛OS上用Docker Compose部署ExerciseDiary运动记录并配置远程访问
运维·人工智能·后端·python·docker·容器·ai agent 实战
2401_869769591 小时前
make 进度条
linux
天远数科1 小时前
零信任架构实战:基于天远运营商三要素简版V即时版查询构建自动化买手实名核验网关
运维·人工智能·架构·自动化
天衍四九-2 小时前
Docker Compose企业实战系列(八·终章):多环境隔离实战,开发/测试/生产一键切换
运维·docker·容器
IT大白鼠2 小时前
搜索系列 · 第 04 篇——部署实操:内网集群落地
运维·elasticsearch·nosql
Elastic 中国社区官方博客2 小时前
使用 Jev 作为 search reranker:基准测试与实现方法
大数据·运维·elasticsearch·全文检索
YYRAN_ZZU3 小时前
如何编一个gcc的交叉工具链
linux·c++