標籤:系統內容 idf 變數 bash rhel std 程式包 $path \n
1、下載MongoDB程式包(RHEL 7 Linux 64-bit x64)
[[email protected] /]# wget -P/usr/local/src/ https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.0.1.tgz
2、解壓程式包:
[[email protected] /]# tar -xzvf mongodb-linux-x86_64-rhel70-4.0.1.tgz -C /usr/local/src/[[email protected] /]# mv /usr/local/src/mongodb-linux-x86_64-rhel70-4.0.1 /usr/local/mongodb
3、建立程式運行所需的目錄:
[[email protected] /]# mkdir /usr/local/mongodb/etc /usr/local/mongodb/data /usr/local/mongodb/log
4、建立MongoDB設定檔:
[[email protected] /]# vim /usr/local/mongodb/etc/mongod.confdbpath = /usr/local/mongodb/data/logpath = /usr/local/mongodb/log/mongodb.logpidfilepath = /usr/local/mongodb/log/mongodb.pidbind_ip = 127.0.0.1port = 27017fork = true
5、啟動MongoDB程式:
[[email protected] /]# /usr/local/mongodb/bin/mongod -f /usr/local/mongodb/etc/mongod.conf
6、MongoDB添加到系統內容變數:
[[email protected] /]# sed -i ‘$a export MONGODB_HOME=/usr/local/mongodb\nexport PATH=$MONGODB_HOME/bin:$PATH‘ /etc/profile
[[email protected] /]# source /etc/profile
7、MongoDB用戶端登入:
[[email protected] /]# mongoMongoDB shell version v4.0.1connecting to: mongodb://127.0.0.1:27017MongoDB server version: 4.0.1
[THE END]
MongoDB配置簡明文檔