Share this:

Like this:

The development server caters for the hosting of schema-free document-oriented databases during the development of web-based applications.

Installing MongoDB

The official packages are generally more up to date than the packages distributed with Debian. To enable the installation of the official packages, we need to import the public GPG key of the MongoDB package store. To import the public GPG key to the system key ring, we execute the following command in a “root” shell.

apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10

Once the key is imported, we need to create an APT source list file for MongoDB. To create the file, we execute the following command in a “root” shell.

Once the source list file is created, we need to reload the local package database. To reload the local package database, we execute the following command in a “root” shell.

apt-get update

Once the package database is updated, we can install the latest stable version of MongoDB. To install the MongoDB package, we execute the following command in a “root” shell.

apt-get install mongodb-org

Configuring MongoDB

The configuration of MongoDB is defined in the /etc/mongod.conf file. It is recommended to stop the daemon before making any configuration changes.

To stop the daemon, we stop the mongod service by executing the following command in a “root” shell.

service mongod stop

dbpath

dbpath = /var/lib/mongodb

By default, MongoDB stores its databases under /var/lib/mongodb. To store the databases under /home/mongodb, we would move the current databases by executing the following command in a “root” shell.

mv /var/lib/mongodb /home

To update the location, we set the value of dbpath to /home/mongodb in the /etc/mongodb.conf file.

dbpath = /home/mongodb

port

port = 27017

By default, MongoDB listens on port 27017 for connections. By setting the value of port, MongoDB can listen on a different port for connections. The default ports used by MongoDB, is listed in the reference documentation.

bind_ip

bind_ip = 127.0.0.1

By default, MongoDB binds to the localhost IP address. By specifying an IP address for bind_ip, MongoDB will bind to that specific address.

bind_ip = 192.168.100.14

From the example above, MongoDB will only bind to the IP address specified, namely 192.168.100.14.

To start the daemon, we start the mongod service by executing the following command in a “root” shell.

service mongod start

Share this:

Like this:

In this series of articles, we will be setting up a new development environment under Debian 7.5. This will include a base server operating system, GUI Desktop Environment, Network Time Server, DNS server, Mail server, Database server and Web server. We will also be hosting our own Version Control System with integration into a Project Management and Issue and Time Tracking solution. We will also require our own Certificate Authority to request and sign digital certificates to use on our internal network and web server.

Operating System and Desktop Environment

As stated above, we will be making use of Debian 7.5 for our server operating system and either log in remotely to a shell over SSH or directly via a Desktop Environment.

Our Desktop Environment will be LXDE, due to the fact that it is designed to work well with computers on the lower end of the performance spectrum – in my case, I am running my Debian server on a Pentium IV 1.7GHz with 512MB of RAM and 2 drives of 40GB and 160GB each – the latter being used as my data drive and the former to host the operating system. We’ll also be installing Gnome and KDE as well, which are both very common Desktop Environments.

Network Time

For us to be able to broadcast Coordinated Universal Time on our internal network, we will be using NTP.

DNS Server

For us to be able to host domains on our internal network, we will be using Bind.

At the end of this series, we will have a comprehensive development server for internal use. A note on this, we are setting up the server behind an existing firewall making use of the 192.168.100.x range of IP addresses.