mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/selfhosting-blogposts.git
synced 2025-05-16 12:16:59 +00:00
202 lines
5.7 KiB
Markdown
202 lines
5.7 KiB
Markdown
---
|
|
search:
|
|
exclude: true
|
|
---
|
|
# SearX
|
|
|
|
Before we start, you will need a Debian 10+ VPS (you can get one on digitalocean for example), if you prefer to use your own self hosted server, make sure that port 80 and 443 are correctly port forwarded so that the public ip points to the server and not the router. Once that's done, go and ssh into your debian 10 server.
|
|
|
|
You can use DuckDNS to get a free domain name:
|
|
|
|

|
|
|
|
|
|
[ 192.168.100.1/24 ] [ /dev/pts/13 ] [~/Nextcloud/blog/Conf]
|
|
→ ssh root@ech4.duckdns.org
|
|
The authenticity of host 'ech4.duckdns.org (178.128.46.38)' can't be established.
|
|
ECDSA key fingerprint is SHA256:z2HAncB99pfbAUfj9tJY7vlo8EGUzCIUxWBAnjAflcA.
|
|
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
|
|
Warning: Permanently added 'ech4.duckdns.org,178.128.46.38' (ECDSA) to the list of known hosts.
|
|
Linux debian-s-1vcpu-1gb-lon1-01 4.19.0-10-cloud-amd64 #1 SMP Debian 4.19.132-1 (2020-07-24) x86_64
|
|
|
|
The programs included with the Debian GNU/Linux system are free software;
|
|
the exact distribution terms for each program are described in the
|
|
individual files in /usr/share/doc/*/copyright.
|
|
|
|
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
|
|
permitted by applicable law.
|
|
root@debian-s-1vcpu-1gb-lon1-01:~#
|
|
|
|
|
|
|
|
## **1**
|
|
|
|
|
|
apt update -y && apt upgrade -y
|
|
useradd --shell /bin/bash --system \
|
|
--home-dir "/usr/local/searx" \
|
|
searx
|
|
|
|
mkdir /usr/local/searx
|
|
chown -R "searx:searx" "/usr/local/searx"
|
|
usermod -aG sudo searx
|
|
passwd searx
|
|
|
|
su searx
|
|
cd ~
|
|
|
|
git clone https://github.com/searx/searx.git searx
|
|
cd searx
|
|
|
|
sudo -H ./utils/searx.sh install all
|
|
sudo -H ./utils/filtron.sh nginx install
|
|
sudo -H ./utils/morty.sh nginx install
|
|
|
|
sudo apt install nginx -y
|
|
sudo -H ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx
|
|
|
|
|
|
|
|
|
|
# https://example.org/searx
|
|
|
|
location /searx {
|
|
proxy_pass http://127.0.0.1:4004/;
|
|
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header Connection $http_connection;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Scheme $scheme;
|
|
proxy_set_header X-Script-Name /searx;
|
|
}
|
|
|
|
location /searx/static {
|
|
alias /usr/local/searx/searx-src/searx/static;
|
|
}
|
|
|
|
Configure reverse proxy for morty, listening on localhost 3000:
|
|
|
|
# https://example.org/morty
|
|
|
|
location /morty {
|
|
proxy_pass http://127.0.0.1:3000/;
|
|
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header Connection $http_connection;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Scheme $scheme;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
apt update -y && apt upgrade -y
|
|
apt install git sudo curl -y
|
|
apt install -y \
|
|
virtualenv python3-dev python3-babel python3-venv \
|
|
uwsgi uwsgi-plugin-python3 \
|
|
git build-essential libxslt-dev zlib1g-dev libffi-dev libssl-dev \
|
|
shellcheck
|
|
|
|
useradd --shell /bin/bash --system \
|
|
--home-dir "/usr/local/searx" \
|
|
--comment 'Privacy-respecting metasearch engine' searx
|
|
|
|
mkdir "/usr/local/searx"
|
|
chown -R "searx:searx" "/usr/local/searx"
|
|
|
|
su searx
|
|
git clone "https://github.com/searx/searx.git" "/usr/local/searx/searx-src"
|
|
|
|
|
|
python3 -m venv "/usr/local/searx/searx-pyenv"
|
|
echo ". /usr/local/searx/searx-pyenv/bin/activate" >> "/usr/local/searx/.profile"
|
|
|
|
command -v python && python --version
|
|
pip install -U pip
|
|
pip install -U setuptools
|
|
pip install -U wheel
|
|
|
|
cd "/usr/local/searx/searx-src"
|
|
pip install -e .
|
|
|
|
sudo -H mkdir -p "/etc/searx"
|
|
sudo -H cp "/usr/local/searx/searx-src/searx/settings.yml" "/etc/searx/settings.yml"
|
|
sudo -H sed -i -e "s/ultrasecretkey/$(openssl rand -hex 16)/g" "/etc/searx/settings.yml"
|
|
sudo -H sed -i -e "s/{instance_name}/searx@$(uname -n)/g" "/etc/searx/settings.yml"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
su searx
|
|
|
|
mkdir ~/Downloads
|
|
cd ~/Downloads
|
|
git clone https://github.com/searx/searx searx
|
|
cd searx
|
|
|
|
./utils/searx.sh install all
|
|
./utils/filtron.sh install all
|
|
./utils/morty.sh install all
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
apt install nginx -y
|
|
ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx
|
|
|
|
|
|
wget https://raw.githubusercontent.com/searx/searx/master/utils/filtron.sh
|
|
chmod +x filtron.sh
|
|
./filtron.sh
|
|
|
|
useradd --shell /bin/bash --system \
|
|
--home-dir "/usr/local/filtron" \
|
|
--comment "Privacy-respecting metasearch engine" filtron
|
|
|
|
|
|
mkdir "/usr/local/filtron"
|
|
chown -R "filtron:filtron" "/usr/local/filtron"
|
|
|
|
cat > "/usr/local/filtron/.go_env" <> ~/.profile
|
|
(filtron) $ mkdir /usr/local/filtron/local
|
|
(filtron) $ wget --progress=bar -O "go1.13.5.linux-amd64.tar.gz" \
|
|
"https://dl.google.com/go/go1.13.5.linux-amd64.tar.gz"
|
|
(filtron) $ tar -C /usr/local/filtron/local -xzf "go1.13.5.linux-amd64.tar.gz"
|
|
(filtron) $ which go
|
|
/usr/local/filtron/local/go/bin/go
|
|
|
|
sudo -i -u "filtron"
|
|
(filtron) $ go get -v -u github.com/asciimoo/filtron
|
|
|
|
get the systemd service from here https://searx.github.io/searx/utils/filtron.sh.html#filtron-sh
|
|
|
|
filtron.sh --help
|
|
|
|
then nginx config
|
|
|
|
|
|
|