Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
| serveur_hebergement:installer_une_instance_searx [2022/10/02 17:46] – [Préparation] fate | serveur_hebergement:installer_une_instance_searx [2025/08/11 13:40] (Version actuelle) – [Installation de Searxng] fate | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | ====== | + | ====== |
| - | ===== Présentation de Searx ===== | + | ===== Présentation de Searxng |
| + | |||
| + | [[https:// | ||
| ===== Préparation ===== | ===== Préparation ===== | ||
| - | Installez les dépendances : <code bash> | + | Installez les dépendances : <code bash> |
| - | Créez un utilisateur | + | Créez un utilisateur |
| - | <code bash> | + | <code bash> |
| - | Créez le répertoire home : | + | Créez le répertoire home ainsi que le sous répertoire pour le socket uWSGI : |
| - | <code bash> | + | <code bash> |
| Modifiez le propriétaire du répertoire home : | Modifiez le propriétaire du répertoire home : | ||
| - | <code bash> | + | <code bash> |
| - | ===== Installation de Searx ===== | + | ===== Installation de Searxng |
| - | Connectez-vous avec l' | + | Connectez-vous avec l' |
| - | <code bash> | + | <code bash> |
| - | Récupérez les sources de Searx : | + | Récupérez les sources de Searxng |
| - | <code bash>git clone " | + | <code bash>git clone " |
| Créez l' | Créez l' | ||
| - | <code bash> | + | <code bash> |
| Activez-le à chaque connexion : | Activez-le à chaque connexion : | ||
| - | <code bash> | + | <code bash> |
| - | Déconnectez vous avec la commande <code bash> | + | Déconnectez-vous avec la commande <code bash> |
| - | Connectez-vous de nouveau avec l' | + | Connectez-vous de nouveau avec l' |
| - | <code bash> | + | <code bash> |
| Mettre à jour les modules nécessaires : | Mettre à jour les modules nécessaires : | ||
| Ligne 40: | Ligne 42: | ||
| pip install -U wheel | pip install -U wheel | ||
| pip install -U pyyaml | pip install -U pyyaml | ||
| + | pip install -U dateutils | ||
| + | pip install -U isodate | ||
| + | pip install -U typer | ||
| + | pip install -U msgspec | ||
| + | pip install -U uvloop | ||
| + | pip install -U httpx_socks | ||
| + | pip install -U httpx | ||
| + | pip install -U lxml | ||
| + | pip install -U redis | ||
| + | pip install -U markdown-it-py | ||
| + | pip install -U flask_babel | ||
| + | pip install -U flask | ||
| + | pip install -U pygments | ||
| + | |||
| </ | </ | ||
| Lancez l' | Lancez l' | ||
| <code bash> | <code bash> | ||
| - | cd "/ | + | cd "/ |
| pip install -e . | pip install -e . | ||
| </ | </ | ||
| Ligne 50: | Ligne 66: | ||
| ===== Configuration ===== | ===== Configuration ===== | ||
| - | Dans un autre terminal, | + | Dans un autre terminal, |
| <code bash> | <code bash> | ||
| - | sudo mkdir -p "/etc/searx" | + | sudo mkdir -p "/etc/searxng" |
| - | sudo | + | sudo |
| </ | </ | ||
| - | Ouvrez le fichier / | + | Copiez-y les lignes suivantes (modifiez |
| + | < | ||
| + | # SearXNG settings | ||
| - | Pour vérifiez que Searx se lance sans problème, activez le debug : | + | use_default_settings: true |
| - | <code bash> | + | |
| - | Connectez-vous de nouveau | + | general: |
| - | <code bash> | + | debug: false |
| + | instance_name: | ||
| + | contact_url: | ||
| + | |||
| + | search: | ||
| + | safe_search: | ||
| + | autocomplete: | ||
| + | formats: | ||
| + | | ||
| + | |||
| + | server: | ||
| + | secret_key: " | ||
| + | limiter: true | ||
| + | image_proxy: | ||
| + | |||
| + | redis: | ||
| + | url: unix:/// | ||
| + | |||
| + | ui: | ||
| + | # Custom static path - leave it blank if you didn't change | ||
| + | static_path: "" | ||
| + | | ||
| + | # Custom templates path - leave it blank if you didn't change | ||
| + | templates_path: | ||
| + | # query_in_title: | ||
| + | # it decreases the privacy, since the browser can records the page titles. | ||
| + | query_in_title: | ||
| + | # infinite_scroll: | ||
| + | infinite_scroll: | ||
| + | # ui theme | ||
| + | default_theme: | ||
| + | # center the results ? | ||
| + | center_alignment: | ||
| + | # URL prefix of the internet archive, don't forgett trailing slash (if needed). | ||
| + | # cache_url: " | ||
| + | # Default interface locale | ||
| + | # use codes from the ' | ||
| + | default_locale: | ||
| + | # Open result links in a new tab by default | ||
| + | results_on_new_tab: | ||
| + | theme_args: | ||
| + | # style of simple theme: auto, light, dark | ||
| + | simple_style: | ||
| + | |||
| + | # preferences: | ||
| + | # | ||
| + | # - autocomplete | ||
| + | # - method | ||
| + | |||
| + | enabled_plugins: | ||
| + | - 'Hash plugin' | ||
| + | - ' | ||
| + | - 'Self Informations' | ||
| + | - ' | ||
| + | - 'Ahmia blacklist' | ||
| + | # - ' | ||
| + | # - ' | ||
| + | # - 'Open Access DOI rewrite' | ||
| + | # - ' | ||
| + | |||
| + | # plugins: | ||
| + | # - only_show_green_results | ||
| + | |||
| + | engines: | ||
| + | - name: google | ||
| + | engine: google | ||
| + | shortcut: go | ||
| + | # see https:// | ||
| + | use_mobile_ui: | ||
| + | # additional_tests: | ||
| + | # | ||
| - | Puis lancez searx : | ||
| - | <code bash> | ||
| - | cd / | ||
| - | export SEARX_SETTINGS_PATH="/ | ||
| - | python searx/ | ||
| </ | </ | ||
| - | Désactivez le mode debug : | + | Voici les principales options par défaut activées dans ce fichier configuration |
| - | <code bash>sudo sed -i -e "s/debug : True/ | + | * safe_search: |
| + | * autocomplete: | ||
| + | * formats: | ||
| + | * limiter: true -> active le filtre anti-bot | ||
| + | * results_on_new_tab: true -> ouvre les résultats dans un nouvel onglet | ||
| + | * use_mobile_ui: | ||
| + | ===== Redis ===== | ||
| + | |||
| + | Redis va stocker la base de donnée du plugin " | ||
| + | |||
| + | On va utiliser le script d' | ||
| + | <code bash> | ||
| + | sudo -s | ||
| + | sudo / | ||
| + | </ | ||
| + | |||
| + | Choisissez les réponses par défaut à chaque question. | ||
| ===== uWSGI ===== | ===== uWSGI ===== | ||
| Ligne 79: | Ligne 177: | ||
| Créez le fichier de configuration pour uWSGI : | Créez le fichier de configuration pour uWSGI : | ||
| - | <code bash> | + | <code bash> |
| Collez-y les lignes suivantes : | Collez-y les lignes suivantes : | ||
| <code bash> | <code bash> | ||
| + | # -*- mode: conf; coding: utf-8 -*- | ||
| [uwsgi] | [uwsgi] | ||
| Ligne 90: | Ligne 189: | ||
| # https:// | # https:// | ||
| - | # Who will run the code | + | # Who will run the code / Hint: in emperor-tyrant mode uid & gid setting will be |
| - | uid = searx | + | # ignored [1]. Mode emperor-tyrant is the default on fedora (/ |
| - | gid = searx | + | # |
| + | # [1] https:// | ||
| + | # | ||
| + | uid = searxng | ||
| + | gid = searxng | ||
| # set (python) default encoding UTF-8 | # set (python) default encoding UTF-8 | ||
| Ligne 100: | Ligne 203: | ||
| # chdir to specified directory before apps loading | # chdir to specified directory before apps loading | ||
| - | chdir = /usr/local/searx/searx-src/searx | + | chdir = /usr/local/searxng/searxng-src/searx |
| - | # searx configuration (settings.yml) | + | # SearXNG |
| - | env = SEARX_SETTINGS_PATH=/etc/searx/ | + | env = SEARXNG_SETTINGS_PATH=/etc/searxng/ |
| # disable logging for privacy | # disable logging for privacy | ||
| Ligne 140: | Ligne 243: | ||
| # set PYTHONHOME/ | # set PYTHONHOME/ | ||
| - | virtualenv = /usr/local/searx/ | + | virtualenv = /usr/local/searxng/ |
| # add directory (or glob) to pythonpath | # add directory (or glob) to pythonpath | ||
| - | pythonpath = /usr/local/searx/searx-src | + | pythonpath = /usr/local/searxng/searxng-src |
| # speak to upstream | # speak to upstream | ||
| # ----------------- | # ----------------- | ||
| - | # | ||
| - | # Activate the ' | ||
| - | # configuration if you setup your HTTP server to use uWSGI protocol via sockets. | ||
| - | # using IP: | + | socket = /usr/local/searxng/run/socket |
| - | # | + | buffer-size = 8192 |
| - | # https://uwsgi-docs.readthedocs.io/en/latest/Options.html# | + | |
| - | # Native HTTP support: https:// | + | |
| - | http = 127.0.0.1: | + | # uWSGI serves |
| - | + | ||
| - | # using unix-sockets: | + | |
| - | # | + | |
| - | # On some distributions you need to create | + | |
| # | # | ||
| - | # mkdir -p / | + | # ui: |
| - | # chown -R searx:searx / | + | # static_use_hash: true |
| # | # | ||
| - | # socket | + | static-map |
| + | # expires set to one year since there are hashes | ||
| + | static-expires = /* 31557600 | ||
| + | static-gzip-all = True | ||
| + | offload-threads = %k | ||
| # Cache | # Cache | ||
| - | cache2 = name=searxcache, | + | cache2 = name=searxngcache, |
| </ | </ | ||
| Activez le lancement au démarrage de Searx : | Activez le lancement au démarrage de Searx : | ||
| - | <code bash> | + | <code bash> |
| Démarrez Searx : | Démarrez Searx : | ||
| - | <code bash> | + | <code bash> |
| ===== Configuration d' | ===== Configuration d' | ||
| - | On va configurer Apache2 pour pour voir accéder à notre instance Searx via un sous domaine style searx.domaine.fr (je ne traiterai pas la gestion du nom de domaine) | + | On va configurer Apache2 pour pouvoir |
| Activez les modules Apache2 nécessaires : | Activez les modules Apache2 nécessaires : | ||
| - | <code bash> | + | <code bash> |
| Créez le fichier de config Apache2 : | Créez le fichier de config Apache2 : | ||
| <code bash> | <code bash> | ||
| - | Copiez-y les lignes suivantes (remplacez le noom de domaine par le votre ainsi que l' | + | Copiez-y les lignes suivantes (remplacez le noom de domaine par le vôtre |
| <code apache> | <code apache> | ||
| < | < | ||
| ServerName searx.nomdedomaine.fr | ServerName searx.nomdedomaine.fr | ||
| - | ServerAdmin fate@nomdedomaine.fr | ||
| Redirect / https:// | Redirect / https:// | ||
| </ | </ | ||
| + | |||
| + | < | ||
| + | ServerName searx.rasp.fr | ||
| LogLevel warn | LogLevel warn | ||
| - | | + | ErrorLog ${APACHE_LOG_DIR}/ |
| - | | + | |
| - | < | ||
| - | SSLEngine on | ||
| - | SSLProxyEngine On | ||
| - | ProxyRequests Off | ||
| - | ProxyPreserveHost On | ||
| - | SSLCertificateFile / | ||
| - | SSLCertificateKeyFile / | ||
| - | AddDefaultCharset utf-8 | ||
| - | HostnameLookups off | ||
| - | UseCanonicalName off | ||
| - | ProxyBadHeader Ignore | ||
| - | KeepAlive off | ||
| - | Header set Content-Security-Policy " | ||
| - | </ | ||
| - | # < | + | SSLEngine on |
| - | # | + | SSLProxyEngine On |
| - | # </FilesMatch> | + | ProxyRequests Off |
| + | ProxyPreserveHost On | ||
| + | SSLCertificateFile / | ||
| + | | ||
| + | AddDefaultCharset utf-8 | ||
| + | | ||
| + | UseCanonicalName off | ||
| + | ProxyBadHeader Ignore | ||
| + | KeepAlive off | ||
| + | Header set Content-Security-Policy " | ||
| + | |||
| + | ProxyPreserveHost On | ||
| + | ProxyPass / unix:/ | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | ProxyPass / http:// | ||
| - | # | ||
| - | |||
| - | < | ||
| - | SSLOptions +StdEnvVars | ||
| - | </ | ||
| - | |||
| - | BrowserMatch "MSIE [2-6]" \ | ||
| - | nokeepalive ssl-unclean-shutdown \ | ||
| - | downgrade-1.0 force-response-1.0 | ||
| - | BrowserMatch "MSIE [17-9]" | ||
| </ | </ | ||
| - | # modern configuration, | ||
| - | SSLProtocol | ||
| - | SSLCipherSuite | ||
| - | SSLHonorCipherOrder | ||
| - | SSLCompression | ||
| - | SSLSessionTickets | ||
| - | |||
| - | # OCSP Stapling, only in httpd 2.3.3 and later | ||
| - | SSLUseStapling | ||
| - | SSLStaplingResponderTimeout 5 | ||
| - | SSLStaplingReturnResponderErrors off | ||
| - | SSLStaplingCache | ||
| </ | </ | ||
| Activez le fichier de configuration : | Activez le fichier de configuration : | ||
| <code bash> | <code bash> | ||
| + | |||
| + | Votre instance SearXNG est maintenant accessible à l' | ||
| + | |||
| + | ===== Mise à jour de SearXNG ===== | ||
| + | |||
| + | Pour mettre à jour votre instance, il vous suffit de lancer la commande suivante : | ||
| + | <code bash> | ||
| + | |||
| + | |||
| + | |||
| + | |||