# Mongodb32 installed withouth mongodb.conf



## dnrn (May 6, 2017)

I've just installed mongodb32 from the port collection:

```
make install clean
```

After the installation I would like to setup some configurations, but can find mongod.conf?

It's not located under /usr/local/etc/mongod.conf or in /etc

Am I doing something wrong? I am new to FreeBSD, so this might be the case.

I am using FreeBSD 11.0.

Thanks


----------



## Phishfry (May 6, 2017)

I would suggest you search your whole hard drive. Usually there is a 'port.conf.sample'  file included.

Baring that you might have to make your own.
https://github.com/mongodb/mongo/blob/master/rpm/mongod.conf

The instructions here seem to indicate that it is installed:
https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-freebsd-10-1
https://www.freebsdnews.com/2016/04/01/how-to-mongodb-on-freebsd-10-x/


----------



## dnrn (May 6, 2017)

Thank you! 
I've got the file now


----------



## talsamon (May 6, 2017)

`/usr/ports/databases/mongodb32 % cat pkg-plist|grep conf
@sample etc/mongodb.conf.sample`
I guess it should be   /usr/local/etc/mongodb.conf.sample..


----------



## Phishfry (May 6, 2017)

So the gist of a sample conf is to copy it -to retain an original template file.
`cp /etc/mongodb.conf.sample /usr/local/etc/monogodb.conf`

Then edit it:
`ee /usr/local/etc/monogodb.conf`


----------



## dnrn (May 6, 2017)

Thank again for the help!
I've got the file and setup my rc.conf with the following:

```
mongod_enable="YES"
mongod_config="/usr/local/etc/mongodb.conf"
mongod_dbpath="/var/db/mongodb"
```

But now I get the following error (/var/db/mongodb/mongod.log):

```
I CONTROL  [main] ERROR: Cannot write pid file to /var/run/mongodb/pid: No such file or directory
```

I've tried the naive approach (I am new to FreeBSD) and created the folder, but then ran into a permission issue. I am installing MongoDB as root. 

I've followed the guide also mention Phishfry
https://newbiedba.wordpress.com/2016/03/14/installing-mongodb-on-freebsd-10-x/

Thanks


----------



## dnrn (May 6, 2017)

I've solved the permission issue with setting the /var/run/mongodb to 777. 
I'm not sure this is the best permission to use though?

Thanks again!


----------



## SirDice (May 11, 2017)

dnrn said:


> I've solved the permission issue with setting the /var/run/mongodb to 777.
> I'm not sure this is the best permission to use though?


Bad. Really bad. You just gave everything and everyone write access. Please note that 777 permissions are rarely, if ever, the correct solution.


```
chown mongodb:mongodb /var/run/mongodb
chmod 755 /var/run/mongodb
```


----------



## fnoyanisi (Sep 7, 2017)

Yesterday, I tried to install databases/mongodb32 and hit this very same wall. 
I fixed the issue by downloading the sample mongodb.conf file, creating some extra directories, changing the permission of these new directories and modifying the paths in the mongodb.conf.

Should this be reported back to the port maintainer?


----------

