On Sep 23, 5:37 pm, Wouter <
wiegm...@gmail.com> wrote:
> Thanks! Initially it didn't work, but after I made some modifications,
> it did.
>
> I installed MongoDB in /usr/local/mongodb-1.0. The DB is stored at /
> data/db.
>
> I did the following to get it to work
>
> In Ubuntu:
>
> 1) Create file to store PID
> sudo touch /var/run/MongoDB.pid
>
> 2) Create init.d
> sudo nano /etc/init.d/mongo
>
> 3) Paste the init.d (+ modifications, see below) & Save
>
> 4) Make executable
> sudo chmod +x /etc/init.d/mongo
>
> Updates to init.d:
> 1) set DAEMON to /usr/local/mongodb-1.0/bin/mongod
>
> 2) set DATA to /data/db
>
> 3) set DAEMON_OPTS to "--dbpath $DATA" (I removed --logpath, that
> doesn't seem to be supported?? How am I logging now?)
>
To enable logging, you'll need to
mkdir /var/log/mongodb
and make that path read/writable by the user that mongod is running
as.
then add --logpath /var/log/mongodb/MongoDB.log to the init script
again.
> 4) comment DAEMONUSER as I did not have a mongodb user. Is it
> important or smart to have a separate MongoDB user?
>
It's generally considered good security practice to run daemons with
their own user, so it's a good idea to do so if this is a production
environment.
> 5) Save & exit
>
> Now
>
> sudo /etc/init.d/mongo start/stop etc.
>
> To make it run on a reboot
>
> sudo /usr/sbin/update-rc.d -f mongo defaults
>
> Please let me know if I made any errors. I'm not too experienced with
> all this system administration :-)
>
Those changes seem fine, obviously I'd personally recommend building
a .deb package so that you don't have to make all those changes and it
just works 'out of the box'.