FreeBSD install script

Hi everyone !

I have Freenas with plenty of memory so I’m current working on a install script to install webodm in a jail.
It’s have really been a pain to iron out all the problems that I have encounter on this journey but now I find my self beaten.

My current script …


pkg update -f
pkg upgrade

pkg install -y nano						# Nano (text editor)	

pkg install -y postgresql11-server postgresql11-client  	# install postgres
sysrc postgresql_enable=yes  					# enable at boot in  /ect/rc.conf
/usr/local/etc/rc.d/postgresql initdb				# init the database

                                                # make postgresql listen to all addresses

echo "listen_addresses = '*'" >>  /var/db/postgres/data11/postgresql.conf  	

/usr/local/etc/rc.d/postgresql initdb				# Initialize the database
                  # make all  connection,user,databases available
echo "host  all  all  md5" >>     /var/db/postgres/data11/pg_hba.conf    

/usr/local/etc/rc.d/postgresql start 				# start postgresql

								# Setup of WebODM database

su - postgres -c "psql -c "\""CREATE USER postgres WITH PASSWORD 'postgres'"\"";  " 
su - postgres -c "psql -c "\""ALTER ROLE postgres WITH PASSWORD 'postgres'"\""; " 
su - postgres -c "psql -c "\""ALTER ROLE postgres WITH SUPERUSER"\""; " 
su - postgres -c "createdb -O postgres webodm_dev -E utf-8" 

su - postgres -c "psql -d webodm_dev -c "\""SET postgis.enable_outdb_rasters TO True;"\"" "
su - postgres -c "psql -d webodm_dev -c "\""SET postgis.gdal_enabled_drivers TO 'GTiff';"\"" " 

	# Install misc package

pkg install -y postgis30-3.0.1_2 	# Postgis
pkg install -y python3			# Python3 
pkg install -y gdal                     # Gdal       
pkg install -y py37-gdal-3.1.0   
pkg install -y node 			# Node.js
pkg install -y grass7-7.8.3		# Grass

pkg install -y nginx			# Ngnix

rehash  				# make tsch aware of the new application
sysrc nginx_enable="YES"		# enable nginx at boot
/usr/local/etc/rc.d/nginx start 	# start nginx

pkg install -y git			# Git
rehash                                  # Make system aware of installed git

                                        # Fetching WebODM
git clone --depth 1

					# Generate cfg file.
touch WebODM/webodm/
cat > ./WebODM/webodm/<<EOF
    'default': {
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'NAME': 'webodm_dev',
        'USER': 'postgres',
        'PASSWORD': 'postgres',
        'HOST': 'localhost',
        'PORT': '5432',


pkg install -y redis				# install redis
sysrc redis_enable="YES"			# enable redis at boot
/usr/local/etc/rc.d/redis start			# start redis

						#redis-server /usr/local/etc/redis.conf    	# start redis broker

pkg install -y py37-pip				# install pip
rehash						# make system aware of pip

echo "Installing numpy will take a while"
pip install numpy                               # numphy used by requirements.txt

pip install -r ./WebODM/requirements.txt	# install WebODM requirements

pkg install -y npm				# Node Package Manager
npm install -g webpack
npm install -g webpack-cli

# npm install --package--lock

webpack --mode production

tzsetup			# set local timezone

python3 ./WebODM/ collectstatic --noinput

chmod +x ./WebODM/ 			# Make executable


	# replacing python with python3 in ./WebODM/
	# fixing the shebang

if ! ( -f ./WebODM/ cp ./WebODM/ ./WebODM/    	# make a copy if runned first timne
cat ./WebODM/ | sed s:python:python3:g > ./WebODM/     	# using the copy and replace with python3
cat ./WebODM/ | sed 's:#\!\/bin\/bash:#\!\/bin\/sh:' > ./WebODM/	# finally replace the shebang (to #!/bin/sh ) and save to

 ./WebODM/ --no-gunicorn 

# greppa ip nummer nedan
# ifconfig | sed -En 's/;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'

# /var/db/postgres/data11/hb_pga.conf

echo *** end **

My first problem is missing “raster”.

Applying app.0001_initial…Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/django/db/backends/”, line 83, in _execute
return self.cursor.execute(sql)
psycopg2.errors.UndefinedObject: type “raster” does not exist
LINE 1: …d_control_points" varchar(100) NULL, “orthophoto” raster NUL…

This would also make the GRASS engine to fail and so on.

Anyone with some skills of Feebsd and this postgres raster problem ?

1 Like