Get the App
SLTechnology News&Howtos  ›  Database  › 

Installation and self-startup method under Mongodb Ubuntu

Shulou Source: shulou.com Published: 2022-06-01 18:51:44 09月17日 Update

Today, I took some time to install the Mongodb database under Ubuntu 13.10. Now I write down the installation operation method and the automatic startup method:

1. apt-get update Update Library 2. apt-get install mongodb

3. After installation, you need to modify the relevant configuration file to modify the data storage path

vi /etc/mongodb.conf dbpath=/www/mongodbvi /etc/init.d/mongodb DATA=/www/mongodbmkdir /www/mongodb/ chown -R mongodb:nogroup /www/mongodb/

4. Start Mongodb

/etc/init.d/mongodb start,

It is started by default when it is installed at the beginning. This step is not required.

5. Confirm if startup is successful

netstat -antup cat /var/log/mongodb/mongodb.log

6. Testing the mongo client

mongo db.foo.save({a:1}) db.foo.findOne()

7. Operation Mongodb service background automatic start

Enter the following command under/usr/bin/

./ mongod --dbpath /var/lib/mongodb/ --logpath /var/log/mongodb/mongodb.log --logappend &

background running program

At this point, the Mongodb database is installed.

Additional information:

How to open Mongodb extensions in PHP?

1. Install php mongo

sudo pecl install mongo

2. enablement module

vi /etc/php5/cli/conf.d/mongodb.ini

extension=mongo.so

3. Confirm successful installation

php -m

4. restart Apache

Done!

Tags: Data method success background database command client client file time module program path software software library update service test input run Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Redmi Huawei Apple Xiaomi