반응형
몽고디비 설치는 간단하다.
yum 설치를 위한 repo파일을 받아온다
[mongodb-org-6.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/6.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc
위 내용은 /etc/yum.repo.d/ 폴더안에
원하는 이름.repo파일로 해서 생성하자
그리고 아래 명령어로 설치한다
sudo yum install -y mongodb-org
Resolving Dependencies
--> Running transaction check
---> Package mongodb-org.x86_64 0:6.0.3-1.el7 will be installed
--> Processing Dependency: mongodb-org-database for package: mongodb-org-6.0.3-1.el7.x86_64
--> Processing Dependency: mongodb-org-tools for package: mongodb-org-6.0.3-1.el7.x86_64
--> Processing Dependency: mongodb-mongosh for package: mongodb-org-6.0.3-1.el7.x86_64
--> Running transaction check
---> Package mongodb-mongosh.x86_64 0:1.6.0-1.el8 will be installed
---> Package mongodb-org-database.x86_64 0:6.0.3-1.el7 will be installed
--> Processing Dependency: mongodb-org-mongos for package: mongodb-org-database-6.0.3-1.el7.x86_64
--> Processing Dependency: mongodb-org-server for package: mongodb-org-database-6.0.3-1.el7.x86_64
--> Processing Dependency: mongodb-org-database-tools-extra for package: mongodb-org-database-6.0.3-1.el7.x86_64
---> Package mongodb-org-tools.x86_64 0:6.0.3-1.el7 will be installed
--> Processing Dependency: mongodb-database-tools for package: mongodb-org-tools-6.0.3-1.el7.x86_64
--> Running transaction check
---> Package mongodb-database-tools.x86_64 0:100.6.1-1 will be installed
--> Processing Dependency: cyrus-sasl for package: mongodb-database-tools-100.6.1-1.x86_64
--> Processing Dependency: cyrus-sasl-gssapi for package: mongodb-database-tools-100.6.1-1.x86_64
--> Processing Dependency: cyrus-sasl-plain for package: mongodb-database-tools-100.6.1-1.x86_64
---> Package mongodb-org-database-tools-extra.x86_64 0:6.0.3-1.el7 will be installed
---> Package mongodb-org-mongos.x86_64 0:6.0.3-1.el7 will be installed
---> Package mongodb-org-server.x86_64 0:6.0.3-1.el7 will be installed
--> Running transaction check
---> Package cyrus-sasl.x86_64 0:2.1.26-24.el7_9 will be installed
---> Package cyrus-sasl-gssapi.x86_64 0:2.1.26-24.el7_9 will be installed
---> Package cyrus-sasl-plain.x86_64 0:2.1.26-24.el7_9 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================
Installing:
mongodb-org x86_64 6.0.3-1.el7 mongodb-org-6.0 6.1 k
Installing for dependencies:
cyrus-sasl x86_64 2.1.26-24.el7_9 updates 88 k
cyrus-sasl-gssapi x86_64 2.1.26-24.el7_9 updates 41 k
cyrus-sasl-plain x86_64 2.1.26-24.el7_9 updates 39 k
mongodb-database-tools x86_64 100.6.1-1 mongodb-org-6.0 48 M
mongodb-mongosh x86_64 1.6.0-1.el8 mongodb-org-6.0 41 M
mongodb-org-database x86_64 6.0.3-1.el7 mongodb-org-6.0 6.2 k
mongodb-org-database-tools-extra x86_64 6.0.3-1.el7 mongodb-org-6.0 11 k
mongodb-org-mongos x86_64 6.0.3-1.el7 mongodb-org-6.0 21 M
mongodb-org-server x86_64 6.0.3-1.el7 mongodb-org-6.0 31 M
mongodb-org-tools x86_64 6.0.3-1.el7 mongodb-org-6.0 6.1 k
Transaction Summary
=================================================================================================================================================
Install 1 Package (+10 Dependent packages)
Total download size: 142 M
Installed size: 562 M
Is this ok [y/d/N]: y
Downloading packages:
(1/11): cyrus-sasl-2.1.26-24.el7_9.x86_64.rpm | 88 kB 00:00:00
(2/11): cyrus-sasl-gssapi-2.1.26-24.el7_9.x86_64.rpm | 41 kB 00:00:00
(3/11): cyrus-sasl-plain-2.1.26-24.el7_9.x86_64.rpm | 39 kB 00:00:00
warning: /var/cache/yum/x86_64/7/mongodb-org-6.0/packages/mongodb-database-tools-100.6.1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 64c3c388: NOKEY
Public key for mongodb-database-tools-100.6.1.x86_64.rpm is not installed
(4/11): mongodb-database-tools-100.6.1.x86_64.rpm | 48 MB 00:00:03
(5/11): mongodb-mongosh-1.6.0.x86_64.rpm | 41 MB 00:00:04
(6/11): mongodb-org-database-6.0.3-1.el7.x86_64.rpm | 6.2 kB 00:00:00
(7/11): mongodb-org-6.0.3-1.el7.x86_64.rpm | 6.1 kB 00:00:00
(8/11): mongodb-org-database-tools-extra-6.0.3-1.el7.x86_64.rpm | 11 kB 00:00:00
(9/11): mongodb-org-mongos-6.0.3-1.el7.x86_64.rpm | 21 MB 00:00:00
(10/11): mongodb-org-server-6.0.3-1.el7.x86_64.rpm | 31 MB 00:00:00
(11/11): mongodb-org-tools-6.0.3-1.el7.x86_64.rpm | 6.1 kB 00:00:00
-------------------------------------------------------------------------------------------------------------------------------------------------
Total 26 MB/s | 142 MB 00:00:05
Retrieving key from https://www.mongodb.org/static/pgp/server-6.0.asc
Importing GPG key 0x64C3C388:
Userid : "MongoDB 6.0 Release Signing Key <packaging@mongodb.com>"
Fingerprint: 39bd 841e 4be5 fb19 5a65 400e 6a26 b1ae 64c3 c388
From : https://www.mongodb.org/static/pgp/server-6.0.asc
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mongodb-org-database-tools-extra-6.0.3-1.el7.x86_64 1/11
Installing : mongodb-mongosh-1.6.0-1.el8.x86_64 2/11
Installing : cyrus-sasl-plain-2.1.26-24.el7_9.x86_64 3/11
Installing : cyrus-sasl-2.1.26-24.el7_9.x86_64 4/11
Installing : mongodb-org-server-6.0.3-1.el7.x86_64 5/11
Created symlink from /etc/systemd/system/multi-user.target.wants/mongod.service to /usr/lib/systemd/system/mongod.service.
Installing : mongodb-org-mongos-6.0.3-1.el7.x86_64 6/11
Installing : mongodb-org-database-6.0.3-1.el7.x86_64 7/11
Installing : cyrus-sasl-gssapi-2.1.26-24.el7_9.x86_64 8/11
Installing : mongodb-database-tools-100.6.1-1.x86_64 9/11
Installing : mongodb-org-tools-6.0.3-1.el7.x86_64 10/11
Installing : mongodb-org-6.0.3-1.el7.x86_64 11/11
Verifying : mongodb-database-tools-100.6.1-1.x86_64 1/11
Verifying : cyrus-sasl-gssapi-2.1.26-24.el7_9.x86_64 2/11
Verifying : mongodb-org-database-tools-extra-6.0.3-1.el7.x86_64 3/11
Verifying : mongodb-org-mongos-6.0.3-1.el7.x86_64 4/11
Verifying : mongodb-org-tools-6.0.3-1.el7.x86_64 5/11
Verifying : mongodb-org-6.0.3-1.el7.x86_64 6/11
Verifying : mongodb-org-server-6.0.3-1.el7.x86_64 7/11
Verifying : cyrus-sasl-2.1.26-24.el7_9.x86_64 8/11
Verifying : cyrus-sasl-plain-2.1.26-24.el7_9.x86_64 9/11
Verifying : mongodb-org-database-6.0.3-1.el7.x86_64 10/11
Verifying : mongodb-mongosh-1.6.0-1.el8.x86_64 11/11
Installed:
mongodb-org.x86_64 0:6.0.3-1.el7
Dependency Installed:
cyrus-sasl.x86_64 0:2.1.26-24.el7_9 cyrus-sasl-gssapi.x86_64 0:2.1.26-24.el7_9 cyrus-sasl-plain.x86_64 0:2.1.26-24.el7_9
mongodb-database-tools.x86_64 0:100.6.1-1 mongodb-mongosh.x86_64 0:1.6.0-1.el8 mongodb-org-database.x86_64 0:6.0.3-1.el7
mongodb-org-database-tools-extra.x86_64 0:6.0.3-1.el7 mongodb-org-mongos.x86_64 0:6.0.3-1.el7 mongodb-org-server.x86_64 0:6.0.3-1.el7
mongodb-org-tools.x86_64 0:6.0.3-1.el7
Complete!
몽고디비를 실행한다
systemctl start mongod
몽고디비에 디비를 생성한다.
$ mongsh
Current Mongosh Log ID: 63731e04aeb5c8a33c7c46c8
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.0
Using MongoDB: 6.0.3
Using Mongosh: 1.6.0
For mongosh info see: https://docs.mongodb.com/mongodb-shell/
To help improve our products, anonymous usage data is collected and sent to MongoDB periodically (https://www.mongodb.com/legal/privacy-policy).
You can opt-out by running the disableTelemetry() command.
------
The server generated these startup warnings when booting
2022-11-15T14:03:26.280+09:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
2022-11-15T14:03:26.280+09:00: vm.max_map_count is too low
------
------
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()
------
test> db
test
test> use 디비명
그런데 실제 디비가 생성된건 아니다..
그래서 아래와 같이 작업한다
디비명> show dbs
admin 40.00 KiB
config 12.00 KiB
local 40.00 KiB
디비명> db.book.insert({"name":"디비명","author":"만든놈"});
DeprecationWarning: Collection.insert() is deprecated. Use insertOne, insertMany, or bulkWrite.
{
acknowledged: true,
insertedIds: { '0': ObjectId("63731e828ebdf3bd31bde646") }
}
디비명> show dbs
admin 40.00 KiB
config 12.00 KiB
local 40.00 KiB
디비명 8.00 KiB
이제 디비를 사용할수 있게 되었다.
출처 : https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-red-hat/
728x90
반응형
'기타' 카테고리의 다른 글
[Google SEO] 스크립트 document.write() 대체하기 (0) | 2023.02.23 |
---|---|
[아웃룩] olm파일 윈도우 아웃룩으로 옮기기 (0) | 2023.01.18 |
자바 class 파일 디컴파일 온라인 사이트 (0) | 2022.10.21 |
지메일로 메일이 차단된 경우 (시즌 2) (0) | 2022.10.07 |
YouTube 차단하기 (0) | 2022.09.22 |