windows11 scoopでmongoDBをインストールする

windows11 scoopでmongoDBをインストールする

windows11でscoopを使ってmongoDBをインストールするまでの手順を記述してます。

環境

  • OS windows10 pro 64bit

scoopインストール

管理者権限でpowershell起動して、下記のコマンド実行します。

powershell上で下記のコマンドを実行します。

Set-ExecutionPolicy RemoteSigned -scope CurrentUser
iex (new-object net.webclient).downloadstring('https://get.scoop.sh') 

インストールが成功すると「Scoop was installed successfully!」となるので、これで利用可能になります。

mongoDBインストール

scoopがインストールが終わったので、mongoDBをインストールします。

まずは、アップデートして利用できるmongoDBのバージョンを確認します。

> scoop update

> scoop search mongodb

'extras' bucket:
    mongodb-compass-community (1.21.2)

'main' bucket:
    mongodb-database-tools (100.5.1)
    mongodb (5.2.0-rc2)

「5.2.0-rc2」となっており、RC版ですが、最新を使用したいのでインストールしてみます。

> scoop install mongodb

'mongodb' (5.2.0-rc2) was installed successfully!

インストールが完了すれば、別のコマンドプロンプトを立ち上げれば「mongo」が実行できます。

> mongo

MongoDB shell version v5.2.0-rc2
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("3677df6c-2b53-4a2a-b82e-724223439686") }
MongoDB server version: 5.2.0-rc2
================
Warning: the "mongo" shell has been superseded by "mongosh",
which delivers improved usability and compatibility.The "mongo" shell has been deprecated and will be removed in
an upcoming release.
For installation instructions, see
https://docs.mongodb.com/mongodb-shell/install/
================
---
The server generated these startup warnings when booting:
        2021-12-24T17:07:17.175+09:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
---
---
        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()
---
>

起動は以下のコマンドで可能です。

> mongod

設定ファイル場所

設定ファイルである「mongod.cfg」は、以下の場所に存在します。

C:\Users\ユーザー名\scoop\apps\mongodb\5.2.0-rc2\bin