Skip to content

Installing SearchTLD

Avitld edited this page Dec 13, 2023 · 4 revisions

There are two ways you can install SearchTLD, manually and using the install script. This guide will cover both methods.

Using Docker

Prerequisites

You will need:

  1. Docker and Docker-Compose installed

Installation

Clone the git repository and enter it:

git clone https://github.com/avitld/SearchTLD.git
cd SearchTLD

Updating opensearch descriptor

To make your SearchTLD instance recognizable as a search engine by your browser, you need to use an opensearch descriptor. By default, one is already provided but links to the official SearchTLD website.

Using your preferred text editor, open up opensearch.xml (located in the main SearchTLD directory)

All you need to do is replace search.example.com with your own domain on these lines:

<moz:SearchForm>https://search.example.com</moz:SearchForm>
<Image width="16" height="16" type="image-x/icon">https://search.example.com/static/img/favicon.ico</Image>
<Url type="text/html" template="https://search.example.com/search.php?q={searchTerms}&amp;ph=0&amp;tp=0" />

Now you can also take your time to check and make any changes you'd like to the config file config.json

Starting up the docker container

Run

docker-compose up -d

to start the container in the background, this may require root permissions. Now, SearchTLD should be running on port 8080, using nginx or apache you can attach a domain.

To see how to update files such as the config and opensearch descriptor in docker look at the guide: Updating SearchTLD Config Files

NGINX With Docker

The docker container runs on port 8080, but most people would want to link a domain like search.example.org with it. This is the NGINX configuration you will need for this:

server {
    listen 80;
    listen [::]80;

    server_name search.example.org;

    location / {
        proxy_pass http://localhost:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Manually installing

Prerequisites

You will need:

  1. Access to root user.

Installation

First, you clone the git repository:

git clone https://github.com/avitld/SearchTLD.git

Then you move the main directory of SearchTLD to preferably /var/www:

mv SearchTLD/main /var/www

Then install the required dependencies:

Debian based:

sudo apt install php php-fpm php-curl php-xml nginx certbot python3-certbot-nginx

RPM based:

sudo dnf install php php-fpm php-xml php-common nginx certbot python3-certbot-nginx

Then start the php-fpm service:

systemctl start php-fpm

Then copy over the sampleconfig from SearchTLD/setup If you are using a Debian based distro use the Debian config, The Fedora config works on every other distro as well.

-- As of 13/12/2023 this is not working anymore as /setup doesn't exist. Wiki will be updated soon.

Debian:

cp SearchTLD/setup/sampleconfig-debian /etc/nginx/sites-available/search

Other Distros:

cp SearchTLD/setup/sampleconfig-fedora /etc/nginx/conf.d/search.conf

Then edit the configuration and make the appropriate changes (e.g server name)

Finally, restart nginx and generate certificates for your website

systemctl restart nginx
certbot --nginx -d search.example.com

Now, when you open your domain in your browser you should see SearchTLD.

The only thing that is left to do now is to update the opensearch descriptor (Listed above)