1.添加MongoDB安裝源
1
<code>vim </code><code>/etc/yum</code><code>.repos.d</code><code>/mongodb-enterprise</code><code>.repo</code>
将下列配置項寫入檔案
2
3
4
5
<code>[mongodb-enterprise]</code>
<code>name=MongoDB Enterprise Repository</code>
<code>baseurl=https:</code><code>//repo</code><code>.mongodb.com</code><code>/yum/redhat/</code><code>$releasever</code><code>/mongodb-enterprise/stable/</code><code>$basearch/</code>
<code>gpgcheck=0</code>
<code>enabled=1</code>
<code>yum </code><code>install</code> <code>mongodb-enterprise</code>
3.設定MongoDB程序開機啟動
<code>chkconfig mongod on </code><code>#不建議使用這種方式</code>
或者
<code>echo</code> <code>"mongod -f /etc/mongod.conf --rest"</code> <code>>></code><code>/etc/rc</code><code>.</code><code>local</code> <code>#建議使用這種開機啟動方式</code>
詳細資訊介紹:
1.安裝mongodb-enterprise,會安裝以下幾個包
mongodb-enterprise-server,包括Mongod程序,配置檔案和初始化腳本;
mongodb-enterprise-mongos,包括mongos程序;
mongodb-enterprise-shell,包括mongo shell程序;
mongodb-enterprise-tools,包括mongoimport bsondump, mongodump,mongoexport, mongofiles, mongoimport, mongooplog, mongoperf, mongorestore, mongostat, 和mongotop工具;
2.yun MongoDB後配置檔案為/etc/mongodb,初始化腳本為/etc/rc.d/init.d/mongod;
3.安裝其他版本的MongoDB,例如安裝2.6.1版本
<code>yum </code><code>install</code> <code>mongodb-enterprise-2.6.1</code>
本文轉自 bannerpei 51CTO部落格,原文連結:http://blog.51cto.com/281816327/1598270,如需轉載請自行聯系原作者