Introduction:
MongoDB
There are already enough materials and data, so I won’t explain them. For details, please refer toofficial website. Here to explain the installation under Ubuntu.
Install:
One: apt installation: Mongodb’s installation package has been integrated into Ubuntu’s apt, and can be installed directly with apt.
1, Check first: see if there is an installation package
2, If not, you need to add the source yourself (10.04), or you want to install the latest version:
No apt source, method one:
① Add in /etc/apt/sources.list:
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
② Execute again:
sudo apt-key adv –keyserver keyserver.ubuntu.com –recv 7F0CEB10
③ Finally, update the data source:
④ Installation:
sudo apt-get install mongodb
No apt source, method 2: (recommended)
Reference:【http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/】
① Configure the software package management system: import the public GPG key package:
sudo apt-key adv –keyserver keyserver.ubuntu.com –recv 7F0CEB10
② Create a 10gen.list file:
echo ‘deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen’ | sudo tee /etc/apt/sources.list.d/10gen.list
③ Reload:
④ Installation:
sudo apt-get install mongodb-10gen
Specified version: (latest version) <recommended>
apt-get install mongodb-10gen=2.4.
3, If there is a package (12.04), install it directly, and there is no need to operate in step 2.
4, test
Two: ubuntu binary installation and use
1, download, go to http://www.mongodb.org/downloads
Download your own version of Mongodb
For example, my system is 32-bit:
View version: lsb_release -a View digits: file /sbin/init
32-bit download:
wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.4.3.tgz
64-bit download:
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.3.tgz
2. Unzip: tar zxvf package
Make these files soft links to the /usr/bin directory:
ln -s /home/zhoujy/mongodb/mongodb-linux-i686-2.4./bin/mongo /usr/bin/mongo…………
3, Create a file directory and an account
useradd mongodbmkdir -p /var/lib/mongodbmkdir -p /var/log/mongodbchown -R mongodb:mongodb /var/lib/mongodb/chown -R mongodb:mongodb /var/log/mongodb/
4, Start mongodb (1): specify parameters
mongod –dbpath /var/lib/mongodb/ –logpath=/var/log/mongodb/mongodb.log &
5, Because the mongodb installed by the binary package does not have a configuration file, you need to manually compile one by yourself, and put it in /etc/mongodb.conf after writing the file
6, Start mongodb (2): specify the configuration file (-f)
mongod -f /etc/mongodb.conf
7, test
Complete the above