安装依赖
1
| sudo yum install -y libcurl openssl xz-libs wget vim
|
安装
1 2 3 4 5
| mkdir ~/tools && cd ~/tools wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-6.0.3.tgz tar -zxf mongodb-linux-x86_64-rhel70-6.0.3.tgz -C ~/ cd ~/ mv mongodb-linux-x86_64-rhel70-6.0.3 mongodb
|
复制命令
1 2 3 4
| sudo cp ~/mongodb/bin/* /usr/local/bin/ sudo ln -s ~/mongodb/bin/* /usr/local/bin/ sudo mkdir -p /var/lib/mongo sudo mkdir -p /var/log/mongodb
|
See UNIX ulimit
Settings
创建用户
1 2 3
| sudo useradd mongod sudo chown -R mongod:mongod /var/lib/mongo sudo chown -R mongod:mongod /var/log/mongodb
|
编辑配置文件
1
| sudo vim /etc/mongod.conf
|
写入
1 2 3 4 5 6 7
| storage: dbPath: /var/lib/mongo systemLog: path: /var/log/mongodb net: bindIp: 127.0.0.1 port: 27017
|
启动
1
| mongod --dbpath /var/lib/mongo --logpath /var/log/mongodb/mongod.log --fork
|
本文地址: https://github.com/maxzhao-it/blog/post/6b8ed0b3/