Linux系统:第十二章:AWS服务器X86架构安装配置Mysql与MongoDB
sudo passwd root
root
su root
cd /usr/local/
chmod 777 /usr/local/
上传文件到/usr/local下
安装MongoDB
(安装文件:链接:https://pan.baidu.com/s/1eZuuUaqBW_eQ7k6DkhSIgg
提取码:fe0r )
chmod u+x /etc/rc.local
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled’ >> /etc/rc.local
echo ‘echo never > /sys/kernel/mm/transparent_hugepage/defrag’ >> /etc/rc.local
echo -e ‘mongod - fsize unlimited\nmongod - cpu
unlimited\nmongod - as unlimited\nmongod - memlock
unlimited\nmongod - nofile 64000\nmongod - rss
unlimited\nmongod - nproc 64000’ >> /etc/security/limits.conf
rpm -ivh ./mongodb-org-server-4.2.3-1.el7.x86_64.rpm
rpm -ivh ./mongodb-org-shell-4.2.3-1.el7.x86_64.rpm
rpm -ivh ./mongodb-org-mongos-4.2.3-1.el7.x86_64.rpm
rpm -ivh ./mongodb-org-tools-4.2.3-1.el7.x86_64.rpm
cp mongod.conf /etc/mongod.conf
mkdir -p /data/mongodb/{data,logs}
chown -R mongod:mongod /data/mongodb/
systemctl enable mongod
systemctl start mongod
数据目录: /data/mongodb/data 日志目录: /data/mongodb/logs
mongod --dbpath /data/mongodb/data --logpath /data/mongodb/logs/mongod.log
或者sudo service mongodb start启动
tail -10f /data/mongodb/logs/mongod.log
mongo localhost:27017
use admin
db.createUser({ user: “root”, pwd: “111111”, roles: [{ role: “userAdminAnyDatabase”, db: “admin” }] })
exit
mongo localhost:27017/admin -u root -p
111111
安装MySQL(参考的是这篇:Linux Centos7安装mysql5.7详细教程)
更多内容请见原文,原文转载自:https://blog.csdn.net/weixin_44519496/article/details/120632935