Skip to content

Installing SearchTLD

Avitld edited this page Jun 12, 2023 · 4 revisions

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

Using the install script

Prerequisites

You will need:

  1. NGINX installed.
  2. Access to root user.

The currently supported operating systems are:

Fedora GNU/Linux (Any supported release)
Debian GNU/Linux (12 required, 11 can be used if php8.2 is replaced with 7.4 in the website configuration)
Ubuntu GNU/Linux (22.04.2 LTS, same as debian)
Rocky  GNU/Linux (Any supported release)

Installation

Clone the git repository and enter it:

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

Now run the setup script with root permissions:

sudo bash setup/setup-nginx.sh

The script will ask you for your desired domain, enter it in and make sure it is correct or else the next steps will not work:

Please enter your desired domain: search.example.com
Is search.example.com the correct domain? (Y/n) y

If you have a sites-available directory in the nginx folder (usually only on Debian and Ubuntu) then that is where the nginx configuration will be placed, else it will be placed in conf.d

Then it will install the dependencies required for your distribution:

Installing dependencies for Debian GNU/Linux

Afterwards, it will start the PHP service and set up the nginx config.

Lastly it will ask for the directory where SearchTLD is located:

Is /home/user/SearchTLD/main the correct location of SearchTLD? y
Continuing...

If for some reason the location is incorrect then it will ask again:

Enter the correct path of SearchTLD: 

Now it will set up the directory for SearchTLD (located in /var/www) and start nginx.

And finally it will generate a certificate.

If everything went well you should be able to type in your domain in the address bar of your browser and see 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" />

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.

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)

Clone this wiki locally