# 1.4. Installation on FreeBSD

## 1.4.1. Installation

Use the pre-built binary packages to install CouchDB:

    pkg install couchdb3

Alternatively, it is possible installing CouchDB from the Ports Collection:

    cd /usr/ports/databases/couchdb3
    make install clean

Note

Be sure to create an admin user before starting CouchDB for the first time!

## 1.4.2. Service Configuration

The port is shipped with a script that integrates CouchDB with FreeBSD’s rc.d service framework. The following options for `/etc/rc.conf` or `/etc/rc.conf.local` are supported (defaults shown):

    couchdb3_enable="NO"
    couchdb3_user="couchdb"
    couchdb3_erl_flags="-couch_ini /usr/local/libexec/couchdb3/etc/default.ini /usr/local/etc/couchdb3/local.ini"
    couchdb3_chdir="/var/db/couchdb3"

After enabling the `couchdb3` service (by setting `couchdb3_enable` to `"YES"`), use the following command to start CouchDB:

    service couchdb3 start

This script responds to the arguments `start`, `stop`, `status`, `rcvar` etc. If the service is not yet enabled in `rc.conf`, use `onestart` to start it up ad-hoc.

The service will also use settings from the following config files:

- `/usr/local/libexec/couchdb3/etc/default.ini`

- `/usr/local/etc/couchdb3/local.ini`

The `default.ini` should be left read-only, and will be replaced on upgrades and re-installs without warning. Therefore administrators should use `default.ini` as a reference and only modify the `local.ini` file.

## 1.4.3. Post Install

The installation is not complete. Be sure to complete the Setup steps for a single node or clustered installation.

Also note that the port will probably show some messages after the installation happened. Make note of these instructions, although they can be found in the ports tree for later reference.