Skip to content

Instantly share code, notes, and snippets.

Last active July 9, 2024 07:25
Show Gist options
  • Save Zamana/e9281d736f9e9ce5882c6f4b140a590e to your computer and use it in GitHub Desktop.
Save Zamana/e9281d736f9e9ce5882c6f4b140a590e to your computer and use it in GitHub Desktop.

Installing NocoDB on FreeBSD/FreeNAS/TrueNAS jail

First of all, make sure to refer and understand the general instructions in the official NocoDB site:

What you'll find here are the specific instructions to setup NocoDB in a FreeBSD system, or in a FreeNAS/TrueNAS CORE jail.

This was originally done in a TrueNAS CORE 12.0-U5.1, which uses FreeBSD 12.4-RELEASE-p6 as base system.

So, after creating a regular jail...

0. Adjust your date/time (if necessary).

In my specific case it is.

rm /etc/localtime
ln -s /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime

1. Update your packages:

pkg update
pkg upgrade

2. Create the user 'nocodb'

and set its home folder to '/usr/local/share/nocodb', that's where the application will be saved:

pw add user nocodb -d /usr/local/share/nocodb

3. Install the packages

'git' and 'npm', and optionaly the database(s) you intend to use. By default NocoDB uses sqlite3:

pkg install git npm postgresql14-server postgresql14-client

4. Clone the repository:

Go to the 'nocodb' home folder, clone the repository, and grant the access:

cd /usr/local/share/nocodb
git clone
chown -R nocodb:nocodb nocodb-seed

5. Install the whole shebang

Enter in the folder just created and run the 'install' command:

cd nocodb-seed
npm install

If everything ran fine, you are ready to run the app, but hold on, because you'll need to make the FreeBSD setup.

6. Folder for the PID

Create a folder to save the PID file for the process, and grant the access:

mkdir /var/run/nocodb/
chown -R nocodb:nocodb /var/run/nocodb

7. Init script

Save this file with the name nocodb at '/usr/local/etc/rc.d':


# Author: C. R. Zamana (czamana at gmail dot com)
# PROVIDE: nocodb
# REQUIRE: networking

. /etc/rc.subr

load_rc_config ${name}

: ${nocodb_enable:="NO"}
: ${nocodb_user:="nocodb"}




nocodb_precmd() {
        cd $(getent passwd ${nocodb_user} | cut -d\: -f6)
        cd nocodb-seed

command_args="-P ${pidfile} /usr/local/bin/npm start > /dev/null"

run_rc_command "$1"

and grant the execution permissions:

chmod +x /usr/local/etc/rc.d/nocodb

8. Run at boot

Configure the service to run automagically at system/jail boot:

sysrc nocodb_enable=YES

From now on you can control the service with:

service nocodb start | stop | status

but first is necessary to change the IP where NocoDB listens. That's because it came by default listening at localhost only, which is not pratical if you need to access the app from outside the server, what's generally true.

For this, edit the file .env and add a definition for the variable HOST pointing to your IP or more generally to, so NocoDB will listen on every interface available. For example:

vi /usr/local/share/nocodb/nocodb-seed/.env

and set HOST to your desired IP:


9. Change 'index.js'

Now edit the file 'usr/local/share/nocodb/nocodb-seed/index.js', and change the line with localhost to ${process.env.HOST}. At the end you want your index.js file to looks like this:

(async () => {
    const app = require('express')();
    const {Noco} = require("nocodb");
    app.use(await Noco.init({}));
    console.log(`Visit : ${process.env.HOST}:${process.env.PORT}/dashboard`)

10. Start the service:

service start nocodb

and make sure that it is running and listening at port 8080:

service status nocodb
nocodb is running as pid 60058. <<-- your PID will be different...

netstat -an | grep -iw listen
tcp46      0      0 *.8080                 *.*                    LISTEN <<<---- here it is
tcp46      0      0 *.8083                 *.*                    LISTEN
tcp4       0      0         *.*                    LISTEN
tcp6       0      0 ::1.5432               *.*                    LISTEN

Now the service should be accessible through your browser:

http://<jail|freebsd IP>:8080


11. Update/Upgrade

In order to update/upgrade the app, execute:

service nocodb stop
cd /usr/local/share/nocodb/nocodb-seed
git pull
npm uninstall nocodb
npm install --save nocodb
service nocodb start

Feel free to point out any mistakes I made, including misspellings, typos and grammar errors.

Copy link

TtuxX commented Oct 24, 2022

Hi there @Zamana ! :)

Thank you very much for this great guide, which allowed me to have NodoDB up and running on my server!

I am experiencing an issue however (fully reported here: nocodb/nocodb#4148 (comment)): I cannot delete some columns after some time.

Unfortunately, I haven't been able to track down the issue as I cannot find any relevant log file in the jail.

Would you have a clue about the source of this issue and where I could possibly have a look ?

Thank you very much for your help.

Copy link

adRn-s commented Nov 9, 2022

Came into this by chance... so I will answer without much knowledge, hope it helps.

Check that there's a > /dev/null as part of command_args variable in the script /usr/local/etc/rc.d/nocodb. You would need to switch output to another path, say > /tmp/log.txt instead of > /dev/null... then you'd have a place to look at. Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment