Reference: Install MongoDB Community Edition on Red Hat or CentOS — MongoDB Manual
Configure the package management system (yum
).
Create a /etc/yum.repos.d/mongodb-org-5.0.repo
file so that you can install MongoDB directly using yum
:
[root@unicaapdemo yum.repos.d]# yum install -y mongodb-org
MongoDB Repository 14 kB/s | 14 kB 00:00
Dependencies resolved.
======================================================================================================================================================================
Package Architecture Version Repository Size
======================================================================================================================================================================
Installing:
mongodb-org x86_64 5.0.4-1.el8 mongodb-org-5.0 11 k
Installing dependencies:
mongodb-database-tools x86_64 100.5.1-1 mongodb-org-5.0 47 M
mongodb-mongosh x86_64 1.1.4-1.el7 mongodb-org-5.0 43 M
mongodb-org-database x86_64 5.0.4-1.el8 mongodb-org-5.0 11 k
mongodb-org-database-tools-extra x86_64 5.0.4-1.el8 mongodb-org-5.0 16 k
mongodb-org-mongos x86_64 5.0.4-1.el8 mongodb-org-5.0 19 M
mongodb-org-server x86_64 5.0.4-1.el8 mongodb-org-5.0 28 M
mongodb-org-shell x86_64 5.0.4-1.el8 mongodb-org-5.0 15 M
mongodb-org-tools x86_64 5.0.4-1.el8 mongodb-org-5.0 11 k
Transaction Summary
======================================================================================================================================================================
Install 9 Packages
Total download size: 153 M
Installed size: 559 M
Downloading Packages:
(1/9): mongodb-org-5.0.4-1.el8.x86_64.rpm 39 kB/s | 11 kB 00:00
(2/9): mongodb-org-database-5.0.4-1.el8.x86_64.rpm 39 kB/s | 11 kB 00:00
(3/9): mongodb-org-database-tools-extra-5.0.4-1.el8.x86_64.rpm 66 kB/s | 16 kB 00:00
(4/9): mongodb-org-mongos-5.0.4-1.el8.x86_64.rpm 4.7 MB/s | 19 MB 00:04
(5/9): mongodb-mongosh-1.1.4.el8.x86_64.rpm 4.0 MB/s | 43 MB 00:10
(6/9): mongodb-org-server-5.0.4-1.el8.x86_64.rpm 4.5 MB/s | 28 MB 00:06
(7/9): mongodb-org-tools-5.0.4-1.el8.x86_64.rpm 41 kB/s | 11 kB 00:00
(8/9): mongodb-org-shell-5.0.4-1.el8.x86_64.rpm 4.6 MB/s | 15 MB 00:03
(9/9): mongodb-database-tools-100.5.1.x86_64.rpm 3.3 MB/s | 47 MB 00:14
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 11 MB/s | 153 MB 00:14
warning: /var/cache/dnf/mongodb-org-5.0-85529b2afce6c228/packages/mongodb-database-tools-100.5.1.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID e2c63c11: NOKEY
MongoDB Repository 1.6 kB/s | 1.6 kB 00:00
Importing GPG key 0xE2C63C11:
Userid : "MongoDB 5.0 Release Signing Key <packaging@mongodb.com>"
Fingerprint: F567 9A22 2C64 7C87 527C 2F8C B00A 0BD1 E2C6 3C11
From : https://www.mongodb.org/static/pgp/server-5.0.asc
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : mongodb-org-database-tools-extra-5.0.4-1.el8.x86_64 1/9
Installing : mongodb-org-shell-5.0.4-1.el8.x86_64 2/9
Running scriptlet: mongodb-org-server-5.0.4-1.el8.x86_64 3/9
Installing : mongodb-org-server-5.0.4-1.el8.x86_64 3/9
Running scriptlet: mongodb-org-server-5.0.4-1.el8.x86_64 3/9
Created symlink /etc/systemd/system/multi-user.target.wants/mongod.service → /usr/lib/systemd/system/mongod.service.
Installing : mongodb-org-mongos-5.0.4-1.el8.x86_64 4/9
Installing : mongodb-org-database-5.0.4-1.el8.x86_64 5/9
Installing : mongodb-mongosh-1.1.4-1.el7.x86_64 6/9
Running scriptlet: mongodb-database-tools-100.5.1-1.x86_64 7/9
Installing : mongodb-database-tools-100.5.1-1.x86_64 7/9
Running scriptlet: mongodb-database-tools-100.5.1-1.x86_64 7/9
Installing : mongodb-org-tools-5.0.4-1.el8.x86_64 8/9
Installing : mongodb-org-5.0.4-1.el8.x86_64 9/9
Running scriptlet: mongodb-org-5.0.4-1.el8.x86_64 9/9
Verifying : mongodb-database-tools-100.5.1-1.x86_64 1/9
Verifying : mongodb-mongosh-1.1.4-1.el7.x86_64 2/9
Verifying : mongodb-org-5.0.4-1.el8.x86_64 3/9
Verifying : mongodb-org-database-5.0.4-1.el8.x86_64 4/9
Verifying : mongodb-org-database-tools-extra-5.0.4-1.el8.x86_64 5/9
Verifying : mongodb-org-mongos-5.0.4-1.el8.x86_64 6/9
Verifying : mongodb-org-server-5.0.4-1.el8.x86_64 7/9
Verifying : mongodb-org-shell-5.0.4-1.el8.x86_64 8/9
Verifying : mongodb-org-tools-5.0.4-1.el8.x86_64 9/9
Installed products updated.
Installed:
mongodb-database-tools-100.5.1-1.x86_64 mongodb-mongosh-1.1.4-1.el7.x86_64 mongodb-org-5.0.4-1.el8.x86_64
mongodb-org-database-5.0.4-1.el8.x86_64 mongodb-org-database-tools-extra-5.0.4-1.el8.x86_64 mongodb-org-mongos-5.0.4-1.el8.x86_64
mongodb-org-server-5.0.4-1.el8.x86_64 mongodb-org-shell-5.0.4-1.el8.x86_64 mongodb-org-tools-5.0.4-1.el8.x86_64
Complete!
[root@unicaapdemo yum.repos.d]# vi /etc/mongod.conf
[root@unicaapdemo mongodb]# sudo semanage fcontext -a -t mongod_var_lib_t '/apps/mongodb/data'
[root@unicaapdemo mongodb]# sudo chcon -Rv -u system_u -t mongod_var_lib_t '/apps/mongodb/data'
changing security context of '/apps/mongodb/data'
[root@unicaapdemo mongodb]# sudo restorecon -R -v '/apps/mongodb/data'
[root@unicaapdemo mongodb]#
[root@unicaapdemo mongodb]# sudo semanage fcontext -a -t mongod_log_t '/apps/mongodb/logs'
[root@unicaapdemo mongodb]# sudo chcon -Rv -u system_u -t mongod_log_t '/apps/mongodb/logs'
changing security context of '/apps/mongodb/logs'
[root@unicaapdemo mongodb]# sudo restorecon -R -v '/apps/mongodb/logs'
[root@unicaapdemo mongodb]# ls -ld /apps/mongodb/logs
drwxr-xr-x. 2 mongod mongod 6 Dec 1 14:11 /apps/mongodb/logs
[root@unicaapdemo mongodb]# ls -ld /apps/mongodb/data
another good site : https://www.sqliz.com/posts/install-mongodb-on-red-hat-9/
ReplyDelete