AWSにRocketChatをインストールする手順

  •  
 
ホス2018年9月6日 - 12:31 に投稿

タグ

概要

  • AWSのEC2インスタンス上にRocketChatをインストールし、ブラウザからRocketChatにアクセスできるようにするまでの手順をまとめました。

前提

  • 本稿で使用するインスタンスタイプ、ソフトウェアバージョン、その他設定は以下の通りです。
    • OS
      • CentOS 7 (x86_64) - with Updates HVM
    • インスタンスタイプ
      • t2.micro
    • セキュリティグループ
      • 次の通りであること。
  タイプ プロトコル ポート範囲 ソース
SSHでのアクセス用 SSH TCP 22 ※SSHアクセスする際のIPアドレス
ブラウザからのアクセス用 カスタムTCPルール TCP 3000 ※ブラウザでアクセスする際のIPアドレス
(アクセス元を制限しない場合は 0.0.0.0/0)
  • RocketChatのバージョン
    • 最新バージョン (本稿執筆時は Rocket.Chat.0.65)

インストール手順

  1. 事前に必要なものをインストールします。

    $ sudo yum -y install epel-release nano
    $ sudo yum -y update
  2. nanoエディタを立ち上げます。

    $ sudo nano /etc/yum.repos.d/mongodb.repo
    
    • 以下の内容をファイルに記載します。
      [mongodb]
      name=MongoDB Repository
      baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
      gpgcheck=0
      enabled=1
    • 保存する前に、余計な空白が入っていないことを確認します。
    • Ctrl+Xキーを押します。
    • Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
      にY(Yes)と答えます。
    • File Name to Write: /etc/yum.repos.d/mongodb.repo
      はそのままEnterキーを押して保存します。
  3. 念のため、保存されたことを確認します。
    • $ less /etc/yum.repos.d/mongodb.repo
  4. 必要なものをインストールします。
    • $ sudo yum install -y nodejs curl GraphicsMagick npm mongodb-org-server mongodb-org gcc-c++
    • $ sudo npm install -g inherits n
      • 実行すると以下のようになります。
        
        [centos@ip-172-xx-xx-xxx ~]$ sudo npm install -g inherits n
        /usr/bin/n -> /usr/lib/node_modules/n/bin/n
        /usr/lib
        ├── inherits@2.0.3
        └── n@2.1.11
  5. Node-JSのバージョンを設定します。
    • $ sudo n 8.9.3
      • 実行すると以下のようになります。
        
        [centos@ip-172-xx-xx-xxx ~]$ sudo n 8.9.3
        install : node-v8.9.3
         mkdir : /usr/local/n/versions/node/8.9.3
         fetch : https://nodejs.org/dist/v8.9.3/node-v8.9.3-linux-x64.tar.gz
        ######################################################################## 100.0%
        installed : v6.14.2
  6. RocketChatをダウンロードして展開します。
    • $ cd /opt
    • $ sudo curl -L https://releases.rocket.chat/latest/download -o rocket.chat.tgz
    • $ sudo tar zxvf rocket.chat.tgz
      • 実行すると以下のようになります。
        
        [centos@ip-172-xx-xx-xxx ~]$ cd /opt
        [centos@ip-172-xx-xx-xxx opt]$ curl -L https://releases.rocket.chat/latest/download -o rocket.chat.tgz
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
        100   225  100   225    0     0    243      0 --:--:-- --:--:-- --:--:--   242
        Warning: Failed to create the file rocket.chat.tgz: 許可がありません
        0  141M    0 15928    0     0  10854      0  3:48:00  0:00:01  3:47:59 10854
        curl: (23) Failed writing body (0 != 15928)
        [centos@ip-172-xx-xx-xxx opt]$
        [centos@ip-172-xx-xx-xxx opt]$
        [centos@ip-172-xx-xx-xxx opt]$
        [centos@ip-172-xx-xx-xxx opt]$ sudo curl -L https://releases.rocket.chat/latest/download -o rocket.chat.tgz
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
        100   225  100   225    0     0    292      0 --:--:-- --:--:-- --:--:--   292
        100  141M  100  141M    0     0  47.6M      0  0:00:02  0:00:02 --:--:-- 66.5M
        
        [centos@ip-172-xx-xx-xxx opt]$ ls -la
        合計 145016
        drwxr-xr-x.  5 root   root          91  5月 28 06:32 .
        dr-xr-xr-x. 17 root   root         224  5月 16 20:50 ..
        drwxr-xr-x.  4   3434   3434       107  5月 28 01:55 bundle
        drwxr-x---. 10 centos centos       217  1月  4 09:00 keycloak-3.4.3.Final
        drwxr-xr-x.  8 apache apache       136  5月 28 03:15 phpldapadmin
        -rw-r--r--.  1 root   root   148493456  5月 28 06:30 rocket.chat.tgz
  7. フォルダ名を変更します。
    • sudo mv bundle Rocket.Chat
      • 実行したあとに「Rocket.Chat」フォルダがあることを確認します。
        
        [centos@ip-172-xx-xx-xxx opt]$ ls -la
        合計 145016
        drwxr-xr-x.  5 root   root          96  5月 28 06:33 .
        dr-xr-xr-x. 17 root   root         224  5月 16 20:50 ..
        drwxr-xr-x.  4   3434   3434       107  5月 28 01:55 Rocket.Chat
        drwxr-x---. 10 centos centos       217  1月  4 09:00 keycloak-3.4.3.Final
        drwxr-xr-x.  8 apache apache       136  5月 28 03:15 phpldapadmin
        -rw-r--r--.  1 root   root   148493456  5月 28 06:30 rocket.chat.tgz
  8. RocketChatのインストールを実行します。
    • $ cd Rocket.Chat/programs/server
    • $ sudo npm install
  9. $ cd ../..
  10. $ sudo vi rocketchat.env
    • 記載する中身
      
      PORT=3000
      ROOT_URL=http://:3000/
      MONGO_URL=mongodb://localhost:27017/rocketchatのパブリックipアドレス>
    • 2行目はAWSのパブリックIPアドレス(ブラウザからアクセスするときに指定する予定のアドレス)を指定します。
  11. MongoDBの設定を変更します。
    • 
      $ vim /etc/mongod.conf
      bind_ip=0.0.0.0
  12. MongoDBを起動
    • $ sudo systemctl start mongod
      • 起動後のstatusを確認します。
        
        [centos@ip-172-xx-xx-xxx Rocket.Chat]$ systemctl status mongod
        ● mongod.service - SYSV: Mongo is a scalable, document-oriented database.
        Loaded: loaded (/etc/rc.d/init.d/mongod; bad; vendor preset: disabled)
        Active: active (running) since 月 2018-05-28 06:46:56 UTC; 13s ago
        Docs: man:systemd-sysv-generator(8)
        Process: 5711 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=0/SUCCESS)
        Main PID: 5728 (mongod)
        CGroup: /system.slice/mongod.service
             └─5728 /usr/bin/mongod -f /etc/mongod.conf  
          
        5月 28 06:46:55 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database....
        5月 28 06:46:55 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal runuser[5724]: pam_unix(runuser:session): session opened for user mongod by (uid=0)
        5月 28 06:46:55 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal mongod[5711]: Starting mongod: [  OK  ]
        5月 28 06:46:56 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal systemd[1]: Started SYSV: Mongo is a scalable, document-oriented database..
  13. MongoDBを自動で起動するように設定します。
    
    [centos@ip-172-31-30-190 Rocket.Chat]$ sudo systemctl enable mongod
    mongod.service is not a native service, redirecting to /sbin/chkconfig.
    Executing /sbin/chkconfig mongod on
  14. RocketChatのサービスファイルを作成します。
    • $ sudo vi /usr/lib/systemd/system/rocketchat.service
      • 以下の内容をサービスファイルに記載します。
        
        [Unit]
        Description=The Rocket.Chat server
        After=network.target remote-fs.target nss-lookup.target nginx.target mongod.target
        [Service]
        ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js
        EnvironmentFile=/opt/Rocket.Chat/rocketchat.env
        StandardOutput=syslog
        StandardError=syslog
        SyslogIdentifier=rocketchat
        User=root
        [Install]
        WantedBy=multi-user.target
  15. サーバを立ち上げた際にRocketChatのサービスを自動で起動するように設定します。
    • $ sudo systemctl enable rocketchat.service
      • 実行すると以下のようになります。
        
        [centos@ip-172-xx-xx-xxx Rocket.Chat]$ sudo systemctl enable rocketchat.service
        Created symlink from /etc/systemd/system/multi-user.target.wants/rocketchat.service to /usr/lib/systemd/system/rocketchat.service.
  16. RocketChatのサービスを起動します。
    • $ sudo systemctl start rocketchat.service
      • 実行した様子(起動に失敗しています)
        
        [centos@ip-172-xx-xx-xxx Rocket.Chat]$ systemctl status rocketchat.service
        ● rocketchat.service - The Rocket.Chat server
        Loaded: loaded (/usr/lib/systemd/system/rocketchat.service; enabled; vendor preset: disabled)
        Active: failed (Result: exit-code) since 月 2018-05-28 06:49:46 UTC; 11s ago
        Process: 5774 ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js (code=exited, status=1/FAILURE)
        Main PID: 5774 (code=exited, status=1/FAILURE)  
        
        5月 28 06:49:46 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[5774]: at Function.Module._load (module.js:489:3)
        5月 28 06:49:46 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[5774]: at Module.require (module.js:579:17)
        5月 28 06:49:46 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[5774]: at require (internal/module.js:11:18)
        5月 28 06:49:46 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[5774]: at Object.<anonymous> (/opt/Rocket.Chat/programs/server/node_modules/fibers/fibers.js:24:38)
        5月 28 06:49:46 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[5774]: at Module._compile (module.js:635:30)
        5月 28 06:49:46 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[5774]: at Object.Module._extensions..js (module.js:646:10)
        5月 28 06:49:46 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[5774]: at Module.load (module.js:554:32)
        5月 28 06:49:46 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal systemd[1]: rocketchat.service: main process exited, code=exited, status=1/FAILURE
        5月 28 06:49:46 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal systemd[1]: Unit rocketchat.service entered failed state.
        5月 28 06:49:46 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal systemd[1]: rocketchat.service failed.

起動できない場合

エラー内容(抜粋)

$ less /var/log/messages

May 28 06:53:30 ip-172-xx-xx-xxx rocketchat: module.js:664
May 28 06:53:30 ip-172-xx-xx-xxx rocketchat: return process.dlopen(module, path._makeLong(filename));
May 28 06:53:30 ip-172-xx-xx-xxx rocketchat: ^
May 28 06:53:30 ip-172-xx-xx-xxx rocketchat: Error: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /opt/Rocket.Chat/programs/server/node_modules/fibers/bin/linux-x64-57/fibers.node)
May 28 06:53:30 ip-172-xx-xx-xxx rocketchat: at Object.Module._extensions..node (module.js:664:18)
May 28 06:53:30 ip-172-xx-xx-xxx rocketchat: at Module.load (module.js:554:32)
May 28 06:53:30 ip-172-xx-xx-xxx rocketchat: at tryModuleLoad (module.js:497:12)
May 28 06:53:30 ip-172-xx-xx-xxx rocketchat: at Function.Module._load (module.js:489:3)
May 28 06:53:30 ip-172-xx-xx-xxx rocketchat: at Module.require (module.js:579:17)
May 28 06:53:30 ip-172-xx-xx-xxx rocketchat: at require (internal/module.js:11:18)
May 28 06:53:30 ip-172-xx-xx-xxx rocketchat: at Object.<anonymous> (/opt/Rocket.Chat/programs/server/node_modules/fibers/fibers.js:24:38)
May 28 06:53:30 ip-172-xx-xx-xxx rocketchat: at Module._compile (module.js:635:30)
May 28 06:53:30 ip-172-xx-xx-xxx rocketchat: at Object.Module._extensions..js (module.js:646:10)
May 28 06:53:30 ip-172-xx-xx-xxx rocketchat: at Module.load (module.js:554:32)
May 28 06:53:30 ip-172-xx-xx-xxx systemd: rocketchat.service: main process exited, code=exited, status=1/FAILURE
May 28 06:53:30 ip-172-xx-xx-xxx systemd: Unit rocketchat.service entered failed state.
May 28 06:53:30 ip-172-xx-xx-xxx systemd: rocketchat.service faile

以下の手順で、リビルドを行います。

  1. $ sudo npm install -g node-gyp
  2. $ cd /opt/Rocket.Chat/programs/server/node_modules/fibers/
  3. $ sudo node-gyp rebuild --target=v8.9.3
  4. $ sudo cp -f build/Release/fibers.node bin/linux-x64-57/fibers.node
    • 実行した様子
      
      [centos@ip-172-xx-xx-xxx Rocket.Chat]$ sudo npm install -g node-gyp
      /usr/bin/node-gyp -> /usr/lib/node_modules/node-gyp/bin/node-gyp.js
      /usr/lib
      └─┬ node-gyp@3.6.2
      ├─┬ fstream@1.0.11
      │ └── inherits@2.0.3
      ├─┬ glob@7.1.2
      │ ├── fs.realpath@1.0.0
      │ ├─┬ inflight@1.0.6
      │ │ └── wrappy@1.0.2
      │ ├── once@1.4.0
      │ └── path-is-absolute@1.0.1
      ├── graceful-fs@4.1.11
      ├─┬ minimatch@3.0.4
      │ └─┬ brace-expansion@1.1.11
      │   ├── balanced-match@1.0.0
      │   └── concat-map@0.0.1
      ├─┬ mkdirp@0.5.1
      │ └── minimist@0.0.8
      ├─┬ nopt@3.0.6
      │ └── abbrev@1.1.1
      ├─┬ npmlog@4.1.2
      │ ├─┬ are-we-there-yet@1.1.5
      │ │ ├── delegates@1.0.0
      │ │ └─┬ readable-stream@2.3.6
      │ │   ├── core-util-is@1.0.2
      │ │   ├── isarray@1.0.0
      │ │   ├── process-nextick-args@2.0.0
      │ │   ├── string_decoder@1.1.1
      │ │   └── util-deprecate@1.0.2
      │ ├── console-control-strings@1.1.0
      │ ├─┬ gauge@2.7.4
      │ │ ├── aproba@1.2.0
      │ │ ├── has-unicode@2.0.1
      │ │ ├── object-assign@4.1.1
      │ │ ├── signal-exit@3.0.2
      │ │ ├─┬ string-width@1.0.2
      │ │ │ ├── code-point-at@1.1.0
      │ │ │ └─┬ is-fullwidth-code-point@1.0.0
      │ │ │   └── number-is-nan@1.0.1
      │ │ ├─┬ strip-ansi@3.0.1
      │ │ │ └── ansi-regex@2.1.1
      │ │ └── wide-align@1.1.3
      │ └── set-blocking@2.0.0
      ├─┬ osenv@0.1.5
      │ ├── os-homedir@1.0.2
      │ └── os-tmpdir@1.0.2
      ├─┬ request@2.87.0
      │ ├── aws-sign2@0.7.0
      │ ├── aws4@1.7.0
      │ ├── caseless@0.12.0
      │ ├─┬ combined-stream@1.0.6
      │ │ └── delayed-stream@1.0.0
      │ ├── extend@3.0.1
      │ ├── forever-agent@0.6.1
      │ ├─┬ form-data@2.3.2
      │ │ └── asynckit@0.4.0
      │ ├─┬ har-validator@5.0.3
      │ │ ├─┬ ajv@5.5.2
      │ │ │ ├── co@4.6.0
      │ │ │ ├── fast-deep-equal@1.1.0
      │ │ │ ├── fast-json-stable-stringify@2.0.0
      │ │ │ └── json-schema-traverse@0.3.1
      │ │ └── har-schema@2.0.0
      │ ├─┬ http-signature@1.2.0
      │ │ ├── assert-plus@1.0.0
      │ │ ├─┬ jsprim@1.4.1
      │ │ │ ├── extsprintf@1.3.0
      │ │ │ ├── json-schema@0.2.3
      │ │ │ └── verror@1.10.0
      │ │ └─┬ sshpk@1.14.1
      │ │   ├── asn1@0.2.3
      │ │   ├── bcrypt-pbkdf@1.0.1
      │ │   ├── dashdash@1.14.1
      │ │   ├── ecc-jsbn@0.1.1
      │ │   ├── getpass@0.1.7
      │ │   ├── jsbn@0.1.1
      │ │   └── tweetnacl@0.14.5
      │ ├── is-typedarray@1.0.0
      │ ├── isstream@0.1.2
      │ ├── json-stringify-safe@5.0.1
      │ ├─┬ mime-types@2.1.18
      │ │ └── mime-db@1.33.0
      │ ├── oauth-sign@0.8.2
      │ ├── performance-now@2.1.0
      │ ├── qs@6.5.2
      │ ├── safe-buffer@5.1.2
      │ ├─┬ tough-cookie@2.3.4
      │ │ └── punycode@1.4.1
      │ ├── tunnel-agent@0.6.0
      │ └── uuid@3.2.1
      ├── rimraf@2.6.2
      ├── semver@5.3.0
      ├─┬ tar@2.2.1
      │ └── block-stream@0.0.9
      └─┬ which@1.3.1
      └── isexe@2.0.0
      
      [centos@ip-172-xx-xx-xxx Rocket.Chat]$ cd /opt/Rocket.Chat/programs/server/node_modules/fibers/
      [centos@ip-172-xx-xx-xxx fibers]$ sudo node-gyp rebuild --target=v8.9.3
      gyp info it worked if it ends with ok
      gyp info using node-gyp@3.6.2
      gyp info using node@6.14.2 | linux | x64
      gyp http GET https://nodejs.org/dist/v8.9.3/node-v8.9.3-headers.tar.gz
      gyp http 200 https://nodejs.org/dist/v8.9.3/node-v8.9.3-headers.tar.gz
      gyp http GET https://nodejs.org/dist/v8.9.3/SHASUMS256.txt
      gyp http 200 https://nodejs.org/dist/v8.9.3/SHASUMS256.txt
      gyp info spawn /bin/python2
      gyp info spawn args [ '/usr/lib/node_modules/node-gyp/gyp/gyp_main.py',
      gyp info spawn args   'binding.gyp',
      gyp info spawn args   '-f',
      gyp info spawn args   'make',
      gyp info spawn args   '-I',
      gyp info spawn args   '/opt/Rocket.Chat/programs/server/node_modules/fibers/build/config.gypi',
      gyp info spawn args   '-I',
      gyp info spawn args   '/usr/lib/node_modules/node-gyp/addon.gypi',
      gyp info spawn args   '-I',
      gyp info spawn args   '/root/.node-gyp/8.9.3/include/node/common.gypi',
      gyp info spawn args   '-Dlibrary=shared_library',
      gyp info spawn args   '-Dvisibility=default',
      gyp info spawn args   '-Dnode_root_dir=/root/.node-gyp/8.9.3',
      gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/node-gyp',
      gyp info spawn args   '-Dnode_lib_file=/root/.node-gyp/8.9.3/<(target_arch)/node.lib',
      gyp info spawn args   '-Dmodule_root_dir=/opt/Rocket.Chat/programs/server/node_modules/fibers',
      gyp info spawn args   '-Dnode_engine=v8',
      gyp info spawn args   '--depth=.',
      gyp info spawn args   '--no-parallel',
      gyp info spawn args   '--generator-output',
      gyp info spawn args   'build',
      gyp info spawn args   '-Goutput_dir=.' ]
      gyp info spawn make
      gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
      make: ディレクトリ `/opt/Rocket.Chat/programs/server/node_modules/fibers/build' に入ります
      CXX(target) Release/obj.target/fibers/src/fibers.o
      CXX(target) Release/obj.target/fibers/src/coroutine.o
      CC(target) Release/obj.target/fibers/src/libcoro/coro.o
      SOLINK_MODULE(target) Release/obj.target/fibers.node
      COPY Release/fibers.node
      make: ディレクトリ `/opt/Rocket.Chat/programs/server/node_modules/fibers/build' から出ます
      gyp info ok
  5. RocketChatを再度起動してみます。
    
    [centos@ip-172-xx-xx-xxx fibers]$ sudo systemctl start rocketchat
    [centos@ip-172-xx-xx-xxx fibers]$ systemctl status rocketchat
    ● rocketchat.service - The Rocket.Chat server
     Loaded: loaded (/usr/lib/systemd/system/rocketchat.service; enabled; vendor preset: disabled)
     Active: active (running) since 月 2018-05-28 07:24:34 UTC; 7s ago
    Main PID: 6109 (node)
     CGroup: /system.slice/rocketchat.service
             └─6109 /usr/local/bin/node /opt/Rocket.Chat/main.js  
    
    5月 28 07:24:39 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[6109]: Will load cache for users
    5月 28 07:24:39 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[6109]: 0 records load from users
    5月 28 07:24:39 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[6109]: Will load cache for rocketchat_room
    5月 28 07:24:39 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[6109]: 0 records load from rocketchat_room
    5月 28 07:24:39 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[6109]: Will load cache for rocketchat_subscription
    5月 28 07:24:39 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[6109]: 0 records load from rocketchat_subscription
    5月 28 07:24:39 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[6109]: Will load cache for rocketchat_settings
    5月 28 07:24:39 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[6109]: 0 records load from rocketchat_settings
    5月 28 07:24:41 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[6109]: Updating process.env.MAIL_URL
    5月 28 07:24:41 ip-172-xx-xx-xxx.ap-northeast-1.compute.internal rocketchat[6109]: Starting Email Inter
  6. RocketChatを起動することができました。
    ブラウザでRocketChatにアクセスできることを確認します。

 

今回の説明は以上になります。
最後まで読んでいただき、ありがとうございました。

AWS&CentOS初心者です。

上記手順に従いRocketChat構築を進めていたところ、
ソフトウェアのインストールの部分でエラーが発生し進めなくなってしまいました。
考えられる原因や対応策についてご教授願いませんでしょうか。

前提条件は全て本ページの冒頭部分と同じです。

以下、出力ログ
--------------------------------------------
[centos@ip-172-31-10-113 ~]$ sudo yum install -y nodejs curl GraphicsMagick npm mongodb-org-server mongodb-org gcc-c++
Loaded plugins: fastestmirror

File contains no section headers.
file: file:///etc/yum.repos.d/mongodb.repo, line: 1
'name=MongoDB Repository\n'
[centos@ip-172-31-10-113 ~]$ sudo npm install -g inherits n
sudo: npm: command not found
[centos@ip-172-31-10-113 ~]$

/etc/yum.repos.d/mongodb.repoの中身は以下の通りです。
余分なスペースや改行はありません。
--------------------------------------------
[centos@ip-172-31-10-113 ~]$ sudo more /etc/yum.repos.d/mongodb.repo
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
--------------------------------------------

お忙しいところ恐れ入ります。
ごご教授頂けると幸いです。

yukiさま

コメントいただき、ありがとうございます。

いただきました情報を確認いたしましたところ、/etc/yum.repos.d/mongodb.repo の記載内容に問題があると考えられます。

現在の /etc/yum.repos.d/mongodb.repo の1行目の上に、下記の1行を追加してください。
--------------------------------------------
[mongodb]
--------------------------------------------

最終的には、moreコマンドを実行した際に下記のような結果になるようにしてください。
--------------------------------------------
[centos@localhost ~]$ sudo more /etc/yum.repos.d/mongodb.repo
[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
--------------------------------------------

その後、再度インストールのコマンドを実行していただけますと、問題が解消されるかと思います。

以上、よろしくお願いいたします。

コメントを追加

プレーンテキスト

  • HTMLタグは利用できません。
  • 行と段落は自動的に折り返されます。
  • ウェブページのアドレスとメールアドレスは自動的にリンクに変換されます。
CAPTCHA
この質問はあなたが人間の訪問者であるかどうかをテストし、自動化されたスパム送信を防ぐためのものです。