My system is Ubuntu 12.10
First, add the key:
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
An error occurs as soon as it comes up:
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.PJ6JkuPTDR --trustdb-name /etc/apt//trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv 7F0CEB10gpg: requesting key 7F0CEB10 from hkp server keyserver.ubuntu.comgpg: keyserver timed outgpg: keyserver receive failed: keyserver error
The keyserver.ubuntu.com server uses port 11371, which is restricted in the company network.
So we need to use SSH tunnel:
ssh -fNL 11371:keyserver.ubuntu.com:11371 root@non-blocked-server -p 443 sudo apt-key adv --keyserver 127.0.0.1 --recv 7F0CEB10
Assume that there is an Ubuntu server outside the company with a public IP address. The non-blocked-server is used to indicate its IP address, and the SSH service is installed. Set the port to HTTPS port: 443. because the company firewall allows access to port 443 outside.
After the preceding command is run, a tunnel is established and the Local Machine listens to port 11371.
Then add the key:
apt-key adv --keyserver 127.0.0.1 --recv 7F0CEB10
Note that keyserver.ubuntu.com is replaced with 127.0.0.1.
Now added successfully:
--primary-keyring /etc/apt/trusted.gpg --keyserver 127.0.0.1 --recv 7F0CEB10gpg: requesting key 7F0CEB10 from hkp server 127.0.0.1gpg: key 7F0CEB10: public key "Richard Kreuter <richard@10gen.com>" importedgpg: no ultimately trusted keys foundgpg: Total number processed: 1gpg: imported: 1 (RSA: 1)
Create a file:/etc/APT/sources. List. d/10gen. List
The content is:
echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" >> /etc/apt/sources.list.d/10gen.list
Update it now:
apt-get update
The following command can install the latest MongoDB version.
apt-get install mongodb-10gen
After the installation is complete, the configuration file is:
/Etc/MongoDB. conf
The path of the database file is/var/lib/MongoDB.
Log File Path:/var/log/MongoDB/mongdb. Log
The service script has been installed:
/Etc/init. d/MongoDB
MongoDB has been started automatically.
Service MongoDB START | stop | restart.
Official documentation in: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
Take a look from time to prevent changes.