CentOS7服务器系统安装MongoDB数据库详细过程记录
环境准备
1、操作系统:CentOS 7
2、MongoDB版本:4.4.6
3、下载MongoDB安装包
安装依赖
1、安装wget工具
sudo yum install wget y
2、安装gcc工具
sudo yum install gcc y
3、安装openssldevel工具
sudo yum install openssldevel y
4、安装readlinedevel工具
sudo yum install readlinedevel y
5、安装zlibdevel工具
sudo yum install zlibdevel y
6、安装libaiodevel工具
sudo yum install libaiodevel y
7、安装sqlitedevel工具
sudo yum install sqlitedevel y
8、安装ncursesdevel工具
sudo yum install ncursesdevel y
9、安装python工具
sudo yum install python y
10、安装pip工具
sudo yum install pythonpip y
11、升级pip工具到最新版本
sudo pip install upgrade pip
12、安装pymongo工具
sudo pip install pymongo
下载并解压MongoDB安装包
1、使用wget命令下载MongoDB安装包
wget https://fastdl.mongodb.org/linux/mongodblinuxx86_644.4.6.tgz
2、解压MongoDB安装包到指定目录
tar zxvf mongodblinuxx86_644.4.6.tgz C /usr/local/mongodb
创建数据和日志目录
1、创建数据目录
sudo mkdir p /data/db1/{log,data}
2、创建日志目录
sudo chown R mongodb:mongodb /data/db1/log /data/db1/data
配置环境变量
1、编辑MongoDB配置文件/etc/profile
,添加以下内容:
export MONGO_HOME=/usr/local/mongodb/bin/mongod; export PATH=$PATH:$MONGO_HOME; export DBPATH=/data/db1; export LOGDIR=/data/db1/log; export LANG=en_US.UTF8; export COLLATION=utf8_general_ci; export LC_ALL=en_US.UTF8; export TZ=Asia/Shanghai; export NODE_ENV=production; export SERVER_IP=0.0.0.0; export SERVER_PORT=27017; export REPLICA_SET=rs0; export ARCHIVE_OPTIONS=archive; export FORK=true; export STORAGE_ENGINE=wiredTiger; export STORAGE_ENGINE_COLLECTION_WIRETIGERAW=true; export STORAGE_ENGINE_STORE_WIRETIGERAW=true; export STORAGE_ENGINE_ARCHIVE_WIRETIGERAW=true; export STORAGE_ENGINE_BSON=bson; export STORAGE_ENGINE_DEFAULT_COMMAND=wiredTiger; export STORAGE_ENGINE_DIRECTORY=/data/db1/data; export STORAGE_ENGINE_MIGRATE=false; export STORAGE_ENGINE_AUTHENTICATION=disabled; export STORAGE_ENGINE_OPLOG=[]; export STORAGE_ENGINE_TLS=false; export STORAGE_ENGINE_READONLY=false; export STORAGE_ENGINE_SNAPSHOT=false; export STORAGE_ENGINE_SYNCABLE=false; export STORAGE_ENGINE_HA=false; export STORAGE_ENGINE_REPLICASET=rs0; export STORAGE_ENGINE_REPLICASET_ARGS={}; export JOURNALING=true; export JOURNALING_MODE=MEMORY; export JOURNALING_SIZE_LIMIT=1GB; export JOURNALING_OPTS={}; export MMAPV1=false; export FASTCGI=false; export HTTPD=false; export PROXY=false; export IPCSHAREDDIRECTORY=false; export IPCHOST=false; export IPCWRITE=false; export IPCREAD=false; export IPCAPIKEY=false; export X509USERNAMEFILE=false; export X509PRIVATEKEYFILE=false; export X509CERTIFICATEFILE=false; export X509CAFILE=false; export X509CLIENTAUTHREQUIRED=false; export X509CLIENTAUTHSECRET=false; export X509SERVERAUTHREQUIRED=false; export X509SERVERAUTHSECRET=false; export X509VERIFYHOSTNAME=false; export X509VERIFYPEERNAME=false; export X509VERIFYCLIENTCERTIFICATE=false; export X509VERIFYSERVERCERTIFICATE=false; export X509VERIFYCRLFILES=false; export X509VERIFYCRLURLS=false; export X509VERIFYCRLTIMEOUT=false; export X509VERIFYCRLDAYS=1; export X509VERIFYREVOCATIONCHECKENDDATE=1; export X509VERIFYREVOCATIONCHECKSTARTDATE=1; export X509VERIFYREVOCATIONCHECKINTERVAL=1; export X509VERIFYREVOCATIONCHECKCAFILES=false; export X509VERIFYREVOCATIONCHECKOCSPURLS=false; export X509VERIFYREVOCATIONCHECKOCSPTIMEOUT=1; export X509VERIFYREVOCATIONCHECKOCSPDAYS=1; export X509VERIFYREVOCATIONCHECKOCSPNOCERTS=1; export X509VERIFYREVOCATIONCHECKOCSPSIGNERS=1; export X509VERIFYREVOCATIONCHECKOCSPISSUERS=1; export X509VERIFYREVOCATIONCHECKOCSPLOCALHOSTNAMES=1; export X509VERIFYREVOCATIONCHECKOCSPSUBJECTALTNAMES=1; export X509VERIFYREVOCATIONCHECKOCSPDNSNAMES=1; export X509VERIFYREVOCATIONCHECKOCSPEMAILADDRS=1; export X509VERIFYREVOCATIONCHECKOCSPURIS=1; export X509VERIFYREVOCATIONCHECKOCSPIPADDRS=1; export X509VERIFYREVOCATIONCHECKOCSPEXTENSIONS=1; nohup mongod config /etc/mongod.conf > /dev/null & # nohup mongod config /etc/mongod.conf > /dev/null & # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /etc/mongod.conf # mongod config /
原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/509551.html