本次安裝mongodb使用yum.repo方式。詳細過程請參考,也列出一些安裝過程中的錯誤,歡迎指正。
mongodb版本:3.0
先在linux下cd 到 /etc/yum.repos.d/
:wq儲存後,清理yum資源
yum clean all然後搜尋下源
yum search mongodb以搜尋出來的名稱為準。
上圖search後出來的結果是mongodb-org.x86_64,然後mongo安裝即可
yum注:在安裝過程中,如果遇到下面的錯誤:install mongodb-org.x86_64
[root@localhost yum.repos.d]# yum解決方法如下:install
mongodb
loaded plugins: fastestmirror
setting up install process
loading mirror speeds from cached hostfile
*base: mirror.bit.edu.cn
*epel: mirrors.aliyun.com
*extras: mirror.neu.edu.cn
*updates: mirrors.btte.net
resolving dependencies
-->running transaction check
---> package mongodb.x86_64 0:2.4.13-1
.el6 will be installed
--> processing conflict: mongodb-org-3.0.2-1
.el6.x86_64 conflicts mongodb
--> processing conflict: mongodb-org-mongos-3.0.2-1
.el6.x86_64 conflicts mongodb
--> processing conflict: mongodb-org-server-3.0.2-1
.el6.x86_64 conflicts mongodb
--> processing conflict: mongodb-org-shell-3.0.2-1
.el6.x86_64 conflicts mongodb
--> processing conflict: mongodb-org-tools-3.0.2-1
.el6.x86_64 conflicts mongodb
-->finished dependency resolution
error: mongodb-org-mongos conflicts with mongodb-2.4.13-1
.el6.x86_64
error: mongodb-org-server conflicts with mongodb-2.4.13-1
.el6.x86_64
error: mongodb-org-tools conflicts with mongodb-2.4.13-1
.el6.x86_64
error: mongodb-org-shell conflicts with mongodb-2.4.13-1
.el6.x86_64
error: mongodb-org conflicts with mongodb-2.4.13-1
.el6.x86_64
you could try using --skip-broken to work around the problem
you could try running: rpm -va --nofiles --nodigest
yum跳過依賴關係就可以安裝了。install mongodb-org.x86_64 --skip-broken
mongod啟動:
service mongod start關閉(查詢到程序然後kill掉):
ps -ef|grep如果存在類似下面的一些警告:mongod
kill xx pid
i control [initandlisten] ** warning: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
i control [initandlisten] ** we suggest setting it to '
never
'i control [initandlisten]
i control [initandlisten] ** warning: /sys/kernel/mm/transparent_hugepage/defrag is '
always'.
i control [initandlisten] ** we suggest setting it to '
never
'
echo如果有遇到這種錯誤:"never
" > /sys/kernel/mm/transparent_hugepage/enabled
echo
"never
" > /sys/kernel/mm/transparent_hugepage/defrag
2015-05-08t11:33:14.789+0800 i control [initandlisten] ** warning: soft rlimits too low. rlimits set to 1024 processes, 64000 files. number of processes should be at least 32000 : 0.5 times number of files.可以嘗試:
cd /etc/security/limits.d* soft nproc 32000vim
90-nproc.conf
root soft nproc unlimited
將第一行改成提示的值(此處的值:number of processes should be at least 32000)
關閉mongodb:
mongod -f /etc/mongod.conf --shutdown檢視mongo狀態:
service mongod status啟動mongo:
mongod -f /etc/mongod.conf檢視執行狀態:
ps aux|grep mongodnetstat -aux|grep mongod
linux下安裝mongodb服務
4 tar zxvf mongodb linux x86 64 rhel70 4.0.9.tgz 解壓 5 mv mongodb linux x86 64 rhel70 4.0.9 usr local mongodb 遷移和重新命名目錄 6 cd usr local mongodb mkdir da...
Linux下MongoDB的安裝
1.自動安裝 sudo apt get install mongodb 預設安裝位置 var lib mongdb 配置檔案位置 etc mongodb.conf 命令集 usr bin usr local bin 檢視安裝位置 whereis mongodb 2.手動安裝 www.mongodb....
Linux環境下MongoDB 安裝
tar zxvf mongodb linux x86 64 4.0.1.tgz 解壓後子檔案放入 usr local mongodb 二 配置系統環境變數 vim etc profile export path path usr local mongodb bin wq 儲存退出,source et...