Help us understand the problem. What is going on with this article?

MongoDBインストール(CentOS、Amazon Linux)

More than 3 years have passed since last update.

yumアップデート

yum update -y

レポジトリ追加

vi /etc/yum.repos.d/mongodb-org-3.4.repo

■ CentOSの場合

[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc

■ Amazon Linuxの場合

[mongodb-org-3.4]
name=MongoDB Repository
baseurl=http://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.4/x86_64/
gpgcheck=0
enabled=1

インストール

yum install -y mongodb-org

SELinuxの無効化

※ Amazon Linuxは最初から無効のため必要なし

getenforce
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

起動

■ CentOSの場合

systemctl start mongod
systemctl enable mongod

■ Amazon Linuxの場合

/etc/init.d/mongod start
chkconfig mongod on

起動確認

cat /var/log/mongodb/mongod.log
2017-07-25T09:51:17.306+0000 I NETWORK  [thread1] waiting for connections on port 27017
tyanakaz
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away