knaka Tech-Blog

AI, IoT, DIYエレクトロニクス, データサイエンスについて投稿予定です。

mongoDB 4を、Ubuntuにインストールする

index:

概要:

mongodb 4.2を、Ubuntu16 にインストールして使用メモとなります

環境

mongo DB 4.2
Ubuntu16

追加の手順

上記ページの、手順と同じですが。

wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -

echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list

sudo apt-get update

sudo apt-get install -y mongodb-org

echo "mongodb-org hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-selections
echo "mongodb-org-shell hold" | sudo dpkg --set-selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
echo "mongodb-org-tools hold" | sudo dpkg --set-selections

起動

sudo service mongod start

停止するときは
sudo service mongod stop

mongo のログ

v4.2 で、起動してますね。

app4$ mongo
MongoDB shell version v4.2.0
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("e0cc8937-6984-47a1-9661-81a6e05f7320") }
MongoDB server version: 4.2.0
Server has startup warnings:
2019-09-14T11:10:13.216+0900 I  STORAGE  [initandlisten]
2019-09-14T11:10:13.216+0900 I  STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-09-14T11:10:13.216+0900 I  STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-09-14T11:10:14.426+0900 I  CONTROL  [initandlisten]
2019-09-14T11:10:14.426+0900 I  CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-09-14T11:10:14.426+0900 I  CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-09-14T11:10:14.426+0900 I  CONTROL  [initandlisten]
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).

The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.

To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---

>