时间:2021-07-01 10:21:17 帮助过:12人阅读
The Ubuntu package management tools (i.e. dpkg
and apt
) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys. Issue the following command to import the MongoDB public GPG Key:
2 Create a list file for MongoDB.
- sudo apt-key adv <span style="color: #008000">--</span><span style="color: #008000">keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6</span>
Create the /etc/apt/sources.list.d/mongodb-org-3.4.list
list file using the command appropriate for your version of Ubuntu:
3 Reload local package database. Issue the following command to reload the local package database:
- echo <span style="color: #800000">"</span><span style="color: #800000">deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse</span><span style="color: #800000">"</span> | sudo tee /etc/apt/sources.list.d/mongodb-org-<span style="color: #800080">3.4</span>.list
4 Install the MongoDB packages.
- sudo apt-get update
Issue the following command:
- sudo apt-get install -y mongodb-org
Most Unix-like operating systems limit the system resources that a session may use. These limits may negatively impact MongoDB operation. See UNIX ulimit Settings for more information.
The MongoDB instance stores its data files in /var/lib/mongodb
and its log files in /var/log/mongodb
by default, and runs using the mongodb
user account. You can specify alternate log and data file directories in /etc/mongod.conf
. See systemLog.path
and storage.dbPath
for additional information.
If you change the user that runs the MongoDB process, you must modify the access control rights to the /var/lib/mongodb
and /var/log/mongodb
directories to give this user access to these directories.
Issue the following command to start mongod
:
2 Verify that MongoDB has started successfully
- sudo service mongod start
Verify that the mongod
process has started successfully by checking the contents of the log file at/var/log/mongodb/mongod.log
for a line reading
- [initandlisten] waiting <span style="color: #0000ff">for</span> connections on port <port>
Verify that the mongod
process has started successfully by checking the contents of the log file at/var/log/mongodb/mongod.log
for a line reading
- [initandlisten] waiting <span style="color: #0000ff">for</span> connections on port <port>
where <port>
is the port configured in /etc/mongod.conf
, 27017
by default.
As needed, you can stop the mongod
process by issuing the following command:
4 Restart MongoDB.
- sudo service mongod stop
Issue the following command to restart mongod
:
5 Begin using MongoDB.
- sudo service mongod restart
To help you start using MongoDB, MongoDB provides Getting Started Guides in various driver editions. See Getting Started for the available editions.
Before deploying MongoDB in a production environment, consider the Production Notes document.
Later, to stop MongoDB, press Control+C
in the terminal where the mongod
instance is running.
To completely remove MongoDB from a system, you must remove the MongoDB applications themselves, the configuration files, and any directories containing data and logs. The following section guides you through the necessary steps.
1 Stop MongoDB. Stop the mongod
process by issuing the following command:
2 Remove Packages.
- sudo service mongod stop
Remove any MongoDB packages that you had previously installed.
3 Remove Data Directories.
- sudo apt-get purge mongodb-org*
Remove MongoDB databases and log files.
- sudo rm -r /var/log/<span style="color: #000000">mongodb
- sudo rm </span>-r /var/lib/mongodb
啦啦啦
mongodb 在 Ubuntu系统上的安装及卸载
标签:iat contain arm ensure deb more 官网 tee document