You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
3.9 KiB
ReStructuredText

MongoDB
=======
If you're afraid of running out of memory by using Redis, or want your forum to be more easily scalable, you can install NodeBB with MongoDB. This tutorial assumes you know how to SSH into your server and have root access.
**These instructions are for Ubuntu. Adjust them accordingly for your distro.**
11 years ago
**Note:** If you have to add ``sudo`` to any command, do so. No one is going to hold it against you ;)
11 years ago
Step 1: Install MongoDB
-------------------------
11 years ago
The latest and greatest MongoDB is required (or at least greater than the package manager). The instructions to install it can be found on the `MongoDB manual <http://docs.mongodb.org/manual/administration/install-on-linux/>`_).
11 years ago
Step 2: Install node.js
-------------------------
11 years ago
Like MongoDB, the latest and greatest node.js is required (or at least greater than the package manager), so I'm leaving this to the official wiki. The instructions to install can be found on `Joyent <https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager>`_.
11 years ago
**Note: NPM is installed along with node.js, so there is no need to install it separately**
11 years ago
Step 3: Install the Base Software Stack
-------------------------
Enter the following into the terminal to install the base software required to run NodeBB:
11 years ago
.. code:: bash
# apt-get install git build-essential imagemagick
11 years ago
Step 4: Clone the Repository
-------------------------
Enter the following into the terminal, replacing `/path/to/nodebb/install/location` to where you would like NodeBB to be installed.
11 years ago
.. code:: bash
$ cd /path/to/nodebb/install/location
$ git clone git://github.com/designcreateplay/NodeBB.git nodebb
11 years ago
Step 5: Install The Required NodeBB Dependencies
-------------------------
Go into the newly created `nodebb` directory and install the required dependencies by entering the following.
11 years ago
.. code:: bash
$ cd nodebb
$ npm install
11 years ago
Step 6: Adding a New Database With Users
-------------------------
To go into the MongoDB command line, type:
11 years ago
.. code:: bash
$ mongo
To add a new database called `nodebb`, type:
11 years ago
.. code::
> use nodebb
To add a user to access the `nodebb` database, type:
11 years ago
.. code::
> db.addUser( { user: "nodebb",
... pwd: "<Enter in a secure password>",
... roles: [ "userAdmin" ] } )
11 years ago
**Note:** The role ``userAdmin`` gives all permissions to the user for that specific database.
11 years ago
Step 7: Configure MongoDB
-------------------------
11 years ago
MongoDB needs text search enabled. Modify ``/etc/mongodb.conf``.
.. code::
# nano /etc/mongodb.conf
11 years ago
Add ``setParameter=textSearchEnabled=true`` to the end. Also, to enable authentication, uncomment ``auth = true``. Restart MongoDB.
.. code::
# service mongodb restart
11 years ago
Step 8: Configuring NodeBB
-------------------------
Make sure you are in your NodeBB root folder. If not, just type:
11 years ago
.. code::
$ cd /path/to/nodebb
To setup the app, type:
11 years ago
.. code::
$ node app --setup
* Change the hostname to your domain name.
11 years ago
* Accept the defaults by pressing enter until it asks you what database you want to use. Type ``mongo`` in that field.
* Accept the default port, unless you changed it in the previous steps.
11 years ago
* Change your username to ``nodebb``, unless you set it to another username.
* Enter in the password you made in step 5.
11 years ago
* Change the database to ``nodebb``, unless you named it something else.
Continue with the installation, following the instructions the installer provides you.
11 years ago
Step 9: Starting the App
-------------------------
To start the app, run:
11 years ago
.. code::
$ node app
11 years ago
Now visit ``yourdomainorip.com:4567`` and your NodeBB installation should be running.
11 years ago
NodeBB can also be started with helper programs, such as [``supervisor`` and ``forever``](https://github.com/designcreateplay/NodeBB/wiki/How-to-run-NodeBB). You can also use `nginx` as a [reverse proxy](https://github.com/designcreateplay/NodeBB/wiki/Configuring-nginx-as-a-proxy-to-NodeBB).