温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

ahjesus中怎么安装mongodb

发布时间:2021-07-19 11:21:45 来源:亿速云 阅读:126 作者:Leah 栏目:系统运维

这篇文章将为大家详细讲解有关ahjesus中怎么安装mongodb,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

导入共匙

代码如下:


sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

创建源列表

代码如下:


echo 'deb https://repo.mongodb.com/apt/ubuntu precise/mongodb-enterprise/stable multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list

刷新包

代码如下:


sudo apt-get update

安装企业版

代码如下:


sudo apt-get install mongodb-enterprise

防止意外升级到最新版,可以运行如下命令

代码如下:


echo "mongodb-enterprise hold" | sudo dpkg --set-selections
echo "mongodb-enterprise-server hold" | sudo dpkg --set-selections
echo "mongodb-enterprise-shell hold" | sudo dpkg --set-selections
echo "mongodb-enterprise-mongos hold" | sudo dpkg --set-selections
echo "mongodb-enterprise-tools hold" | sudo dpkg --set-selections


启动运行

代码如下:


sudo /etc/init.d/mongod start

验证启动成功

验证是否启动成功可以到日志文件查看,具体位置在 /var/log/mongodb/mongod.log.

停止

代码如下:


sudo /etc/init.d/mongod stop

重启

代码如下:


sudo /etc/init.d/mongod restart

附:update失败 提示有一个旧项的解决办法

更新源至国内
我用的是阿里云的源
具体的操作是 vi /etc/apt/sources.list  在文件最前面添加以下条目(!!!操作前请做好相应备份!!!)

代码如下:


deb http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse

关于ahjesus中怎么安装mongodb就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

向AI问一下细节
推荐阅读:
  1. mongodb 安装
  2. 安装MongoDB

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI