4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

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

Last updated at Posted at 2018-01-17

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
4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?