SearXNG/Installation
There are multiple ways to install SearXNG.
Docker
[edit | edit source]This is the recommended method, as it is the easiest.
First, create a directory for the instance and enter it:
mkdir my-instance
cd my-instance/
Next, specify a port for the container to run on. 8080 is used for this example:
export PORT=8080
Then, pull the container from the repository:
docker pull searxng/searxng
Now, run the container. Replace "my-instance" with whatever you want to call your instance:
docker run --rm \
-d -p ${PORT}:8080 \
-v "${PWD}/searxng:/etc/searxng" \
-e "BASE_URL=http://localhost:$PORT/" \
-e "INSTANCE_NAME=my-instance" \
searxng/searxng
If your web browser is running on the same computer that you installed SearXNG on, go to "localhost:8080" in your web browser. If not, enter the IP address of the computer SearXNG was installed on, and specify port 8080 (or whichever port you chose). If you installed it correctly, you should get the SearXNG homepage.
Installation script
[edit | edit source]The installation script is also fairly easy to do, though depending on your server it may have more issues than Docker.
First, clone the repository and enter its directory:
git clone https://github.com/searxng/searxng.git searxng
cd searxng
Then, run the script as root. Replace "sudo" with whichever privilege elevation program you use:
sudo -H ./utils/searxng.sh install all
Manual step-by-step installation
[edit | edit source]This method is intended for advanced users and is not necessary in most cases.
First, install the necessary packages:
On Debian-based systems:
sudo apt install python3-dev python3-babel python3-venv uwsgi uwsgi-plugin-python3 git build-essential libxslt-dev zlib1g-dev libffi-dev libssl-dev
On Arch-based systems:
sudo pacman -S python python-pip python-lxml python-babel uwsgi uwsgi-plugin-python git base-devel libxml2
On Fedora/RHEL systems:
sudo dnf install python python-pip python-lxml python-babel python3-devel uwsgi uwsgi-plugin-python3 git @development-tools libxml2 openssl
Next, create the searxng user:
sudo useradd --shell /bin/bash --system --home-dir "/usr/local/searxng" --comment 'Privacy-respecting metasearch engine' searxng
Create the searxng user's home directory, and give the directory the correct permissions:
sudo mkdir /usr/local/searxng
sudo chown -R searxng:searxng /usr/local/searxng
Next, change to the searxng user:
su - searxng
Alternatively, use the interactive mode of sudo:
sudo -u searxng -i
As the searxng user, create virtualenv:
python3 -m venv "/usr/local/searxng/searx-pyenv"
echo ". /usr/local/searxng/searx-pyenv/bin/activate" >> "/usr/local/searxng/.profile"
Exit the session and start a new one. Then, use pip to install the necessary dependencies:
command -v python && python --version
pip install -U pip
pip install -U setuptools
pip install -U wheel
pip install -U pyyaml
cd /usr/local/searxng/searxng-src
pip install -e .
Next, create a file called "settings.yml" and copy this configuration into it. Modify it to your preferences. After that, copy the configuration file to the correct directory:
sudo mkdir -p /etc/searxng
sudo cp /usr/local/searxng/searxng-src/utils/templates/etc/searxng/settings.yml /etc/searxng/settings.yml
Enable debugging and start the web app:
sudo sed -i -e "s/debug : False/debug : True/g" /etc/searxng/settings.yml
sudo -u searxng -i
cd /usr/local/searxng/searxng-src
export SEARXNG_SETTINGS_PATH="/etc/searxng/settings.yml"
python searx/webapp.py
If you ever want to disable debugging, use the following command:
sudo sed -i -e "s/debug : True/debug : False/g" /etc/searxng/settings.yml
If you did this correctly, SearXNG should be running on port 8888.