Installing Searx on FreeBSD

A simple guide to installing SearX on freeBSD

Installing dependencies

This blog post was written by a freeBSD noob. I just wrote how I did it, which might not be the most efficient way possible. Also this is my first blog, set your expectations low :)

A port of searx already exists for freeBSD, so why bother? this port uses a deprecated version of python (py27)

Installing packages

pkg install py37-virtualenv python py37-pip \
    py37-lxml /py37-babelfish/   git libxml2\
    hs-ShellCheck \
uwsgi #optional

Fetching ports

portsnap fetch

this might take a LONG time

Installing packages from ports

sudo pkg install py37-babel

creating user

Now we need to create a searx user

sudo adduser

with the following settings:

Username: searx
Full name: Searx Search Engine
Uid (Leave empty for default): *EMPTY*
Login group [searx]: *EMPTY*
Login group is searx. Invite searx into other groups? []: *EMPTY*
Login class [default]: *EMPTY*
Shell (sh csh tcsh bash rbash fish git-shell nologin) [sh]: *EMPTY*
Home directory [/home/searx]: /usr/home/searx
Home directory permissions (Leave empty for default): *EMPTY*
Use password-based authentication? [yes]: no
Lock out the account after creation? [no]: no

Install Searx and dependencies

Start an interactive shell from new created user and clone searx:

sudo -H -u searx -i
cd /usr/home/searx
git clone ./searx-src

In the same shell create a virtualenv

python3 -m venv /usr/home/searx/searx-pyenv
echo . /usr/home/searx/searx-pyenv/bin/activate >>  /usr/home/searx/.profile

To install searx's dependencies, exit the bash session open a new one (CTRL+D).

sudo -H -u searx -i
# update pip's boilerplate ..
pip install -U pip
pip install -U setuptools
pip install -U wheel


open a second terminal for configuring the tasks and leave '(searx)$' terminal open


In another terminal type:

sudo mkdir /usr/local/etc/searx

Then copy the settings config file to /usr/local/etc/searx

sudo -H cp /usr/home/searx/searx-src/searx//settings.yml  /usr/local/etc/searx/settings.yml

Now replace the secret key and instance name

 sudo -H sed -i -e s/{ultrasecretkey}/\367ed0f4f4f300bd1457e5c87d036ab2/g /usr/local/etc/searx/settings.yml
sudo -H sed -i -e s/{instance_name}/searx@\ryzen/g /etc/searx/settings.yml

This didn't work for me for some reason, so change it manually! (line #3 and #15)


To check searx , enable optional debugging and start the webapp. (line #2)

debug: False
#change it to
debug True

Then we can start the web app

sudo -H -u searx -i
cd /usr/home/searx/searx-src
export SEARX_SETTINGS_PATH=/usr/local/etc/searx/settings.yml
python searx/


if freeBSD is installed in your local machine then simply open localhost:8888 in a browser, if you are in a ssh session, then you need to bind address to your local machine.

#run in your local machine
ssh -L 8888:localhost:8888 username@server

now you should be able to open searx in localhost:8888 in your browser!

At this point searx is not demonized, this why we should use uwsgi or pm2. You should also change Debug to False in setting.yml (/usr/local/etc/searx/settings.yml)

debug: False
#change it to
debug True

Demonizing Searx with pm2

#+BEGIN_COMMENT Official docs use uwsgi, however I believe that pm2 is way easier

Install node if you dont have it already

sudo pkg install node www/npm

Install pm2 with

sudo npm i -g pm2

start pm2 on startup with the following

pm2 startup -u root

you will then be given a command to copy/paste (note that it doesn't work in fish shell, use sh)

Now start searx with pm2

   sudo pm2 start /usr/home/searx/searx-src/searx/ --interpreter=/usr/home/searx/searx-pyenv/bin/python3 --name=searx

Installing nginx

This guide is getting quit long and I think dividing it would be better :)

Setting Nginx guide here :)