====== Installation mnogosearch 3.3.15 ====== Vous pouvez consulter la [[http://mnogosearch.free.fr/compil-install-mnogosearch.html|doc d'installation en français]] mais elle est sur la 3.2. Sinon nous allons décrire ci-dessous l'installation de la 3.3.15 à partir de la doc en anglais qui est [[http://www.mnogosearch.org/doc33/msearch-install.html|ici]] Installation du 24 février 2014 : ===== Téléchargement ===== [[http://www.mnogosearch.org/download.html|Télécharger]] la version suivante : Download sources - current development branch Le produit : mnoGoSearch-3.3.15 - Latest release (includes PHP extension module) Le fichier **mnogosearch-3.3.15.tar.gz** contient les sources. Copier le dans /home/hodei/ Décompresser avec la commande suivante : tar -zxf mnogosearch-3.3.15.tar.gz cd mnogosearch-3.3.15 ===== Lancer l'installation ===== Deux méthodes : * 1 : par le script install.pl : il génére aprés validation des choix la commande ./configure ci-dessous * 2 : par la commande ./configure (cf ci-dessous) **J'ai choisi la méthode 2** ./install.pl Please set installation path [/usr/local/mnogosearch]: Layout settings --------------- Configured layout: Installation path: /usr/local/mnogosearch User executables DIR: /usr/local/mnogosearch/bin System executables DIR: /usr/local/mnogosearch/sbin Configuration data DIR: /usr/local/mnogosearch/etc Modifiable data DIR: /usr/local/mnogosearch/var Object code libraries DIR: /usr/local/mnogosearch/lib C header files DIR: /usr/local/mnogosearch/include Man documentation DIR: /usr/local/mnogosearch/man Database settings ----------------- Try to autodetect databases at known locations? (yes/no) [yes]: Sorry, no SQL servers at known locations was found Which ODBC-style database support to include? Note, that you may choose only one from the following. 1 - Include iODBC support. 2 - Include unixODBC support. 3 - Include OpenLink ODBC support. 4 - Include EasySoft ODBC support. 5 - Include IBM DB2 support. 6 - None of these. Choose one from the mentioned (6): Which database support to include? Note, that you can choose only one from these. 1 - Include Solid support. 2 - Include SAPDB support. 3 - None of these. Choose one from the mentioned (3): Include MySQL support [no] ? Include PostgreSQL support [no] ? Include mSQL support [no] ? Include InterBase support [no] ? Include Oracle7 support [no] ? Include Oracle8 support [no] ? Include Oracle8i support [no] ? Include Ct-Lib support [no] ? Include FreeTDS Ct-Lib support [no] ? Compilation settings -------------------- Build shared libraries? (yes/no) [no]: build static libraries? (yes/no) [yes]: Logging settings ---------------- Use syslog (yes) or stdout/stderr (no)? (yes/no) [yes]: Syslog facility (valid name from /usr/include/sys/syslog.h) [default]: URL parser settings ------------------- Enable file:/ URL scheme support? (yes/no) [yes]: Enable http:// URL scheme support? (yes/no) [yes]: Enable ftp:// URL scheme support? (yes/no) [yes]: Enable htdb:/ virtual URL scheme support? (yes/no) [yes]: Enable news:// URL schema support? (yes/no) [yes]: Additional features ------------------- Build documentation (docbook required)? (yes/no) [no]: Enable Posix pthreads? (yes/no) [yes]: Enable external parsers support? (yes/no) [yes]: Enable MP3 tags support? (yes/no) [yes]: Enable HTTP Content-Encoding (zlib) support? (yes/no) [yes]: Enable DMALLOC support ? (yes/no) [no]: Enable OpenSSL support ? (yes/no) [no]: **Commande configure** ./configure --prefix=/usr/local/mnogosearch --bindir=/usr/local/mnogosearch/bin --sbindir=/usr/local/mnogosearch/sbin --sysconfdir=/usr/local/mnogosearch/etc --localstatedir=/usr/local/mnogosearch/var --libdir=/usr/local/mnogosearch/lib --includedir=/usr/local/mnogosearch/include --mandir=/usr/local/mnogosearch/man --disable-shared --enable-static --enable-syslog --without-docs --enable-pthreads --disable-dmalloc --enable-parser --disable-mp3 --disable-xml --disable-rss --disable-css --disable-js --with-extra-charsets=all --enable-file --enable-http --enable-ftp --enable-htdb --enable-news --with-mysql --with-zlib avec le debug ajouter --with-debug __**Version run**__ ./configure --prefix=/usr/local/mnogosearch --bindir=/usr/local/mnogosearch/bin --sbindir=/usr/local/mnogosearch/sbin --sysconfdir=/usr/local/mnogosearch/etc --localstatedir=/usr/local/mnogosearch/var --libdir=/usr/local/mnogosearch/lib --includedir=/usr/local/mnogosearch/include --mandir=/usr/local/mnogosearch/man --disable-shared --enable-static --enable-syslog --without-docs --enable-pthreads --disable-dmalloc --enable-parser --disable-mp3 --disable-xml --disable-rss --disable-css --disable-js --with-extra-charsets=all --enable-file --enable-http --enable-ftp --enable-htdb --enable-news --with-mysql --with-zlib ==== Probleme 1 : zlib : gcc et option -lz ==== Le fichier d'installation install.pl plante : configure: error: Unable to find working zlib library configure failed: 256 at ./install.pl line 175, line 30. **Solution :** apt-get update apt-get upgrade apt-get install zlib1g-dev ==== Probleme 2 : mysql.h ==== checking for MySQL support... no configure: error: Unknown MySQL directory - unable to find mysql.h **Solution :** Installer le package développement de mariadb apt-get install libmariadbclient-dev updatedb Relancer ./configure .... /bin/rm: cannot remove `libtoolT': No such file or directory configure: WARNING: unrecognized options: --disable-dmalloc, --disable-xml, --disable-rss, --disable-css, --disable-js, --enable-htdb *********************************************************** * * * Now run make && make install * * If it fails, try to use GNU make, * * often installed as gmake. * * * * * * Thank you for using mnoGoSearch! * *********************************************************** ==== Building and installing the package ==== make make install Supprimer tous les fichiers mnogosearch dans /home/hodei ==== Fin Installation ==== Les binaires et fichier de conf sont ici : /usr/local/mnogosearch Les sources et le plugin PHP sont ici : /var/www/www.hodei.net/mnogosearch ====== Installation de la base de données : mnogosearch ====== mysql -u root -pDolimysql! ===== Création de la base de données ===== Ces deux tables ne sont crées que sur l'instance www.bilatu.lan pas sur bot.bilatu.lan mysql>create database mnogosearch; Essayer aussi de créer avec utf-8 CREATE DATABASE mnogosearch DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; Rajout de 2 tables : CREATE TABLE IF NOT EXISTS `hdi_communes` ( `id` int(11) NOT NULL AUTO_INCREMENT, `numinsee` int(11) NOT NULL, `nom` varchar(50) NOT NULL, `cp` int(5) NOT NULL, `lat` double NOT NULL, `lon` double NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; La table ci-dessous stocke les urls saisies lors de la soumission; CREATE TABLE IF NOT EXISTS `hdi_posturl` ( `code` int(11) NOT NULL AUTO_INCREMENT, `url` varchar(255) NOT NULL, `post` tinyint(1) NOT NULL, `email` varchar(255) NOT NULL, `nom` varchar(50) NOT NULL, `prenom` varchar(50) NOT NULL, `datecreated` datetime NOT NULL, `dateupdated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=34 Le fichier de requete d'INSERT est {{:systeme_informatique:bilatu:mnogosearch:indexer.conf.xlsx|ici}} Pour exécuter l'ajout copier la 3eme colonne du fichier Exceldans phpmyadmin ou exécuter la commande suivante mysql -u root -pDolimysql! mnogosearch < requete.sql requete.sql contient un copier/coller de la 3eme colonne du fichier Excel ===== Création du fichier indexer.conf ===== cd /usr/local/mnogosearch/etc/ cp indexer.conf-dist indexer.conf #Se connecter root su #changer les droits sur indexer.conf chmod ugo+w indexer.conf ===== Creation du fichier search.htm ===== cp search.htm-dist search.htm ===== Création des tables pour la base de données ===== sudo ./sbin/indexer -Ecreate -d /usr/local/mnogosearch/etc/indexer.conf **Suppression des tables pour la base 'web' mnogosearch** ./sbin/indexer -Edrop -d /usr/local/mnogosearch/etc/indexer.conf Création de link pour visionner les logs : cd /var/www/www.hodei.net/fr ln -s /usr/local/mnogosearch/sbin/logmngc2 ln -s /usr/local/mnogosearch/sbin/logmngi2 ====== Installation du plugin Php ====== [[http://www.mnogosearch.org/doc33/msearch-install-php-module.html|Installing mnoGoSearch PHP module]] ou consulter le README dans /home/hodei/mnogosearch-3.3.15/php su #installer le packet php5-dev qui contient la commande phpize. apt-get install php5-dev phpize cd mnogosearch-3.3.x/php ./configure --with-mnogosearch=/usr/local/mnogosearch make # une erreur apparait sur le make : /usr/bin/ld: /usr/lib/mnogosearch/libmnogosearch.a(spell.o): relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC /usr/lib/mnogosearch/libmnogosearch.a: could not read symbols: Bad value collect2: error: ld returned 1 exit status make: *** [mnogosearch.la] Error 1 **__Solution :__** Recompiler mnogosearch avec la commande suivante ./configure --with-mnogosearch=/usr/local/mnogosearch make make install Puis relancer la compilation de l'extension de php ./configure --with-mnogosearch=/usr/local/mnogosearch make make install Le fichier **mnogosearch.so** se trouve ici : **/usr/lib/php5/20100525** ===== Mettre à jour php.ini ===== Laisser **mnogosearch.so** dans /usr/lib/php5/20100525/ Editer /etc/php5/apache2/php.ini # se connecter root su nano /etc/php5/apache2/php.ini #rajouter extension=mnogosearch.so ===== Vérification et tests ===== Vérifier ensuite avec phpinfo que mnogosearch apparaît dans la liste des extensions Puis tester une fonction de l'API php: mnogotest.php [[http://192.168.150.112/mnogotest.php|http://192.168.150.112/mnogotest.php]] ====== Configuration de bot.bilatu.lan ====== Pour utiliser les commandes php ci-dessous il faut installer php5pour apache2 (cf [[http://www.php.net/manual/fr/install.unix.debian.php|ici]] apt-get install php5-common libapache2-mod-php5 php5-cli L'extension pdo pour mysql est ici : **/usr/lib/php5/20100525/pdo.so** Installer aussi : apt-get install php5-mysql Rajouter dans /etc/php5/apache2/php.ini la ligne extension=pdo.so extension=pdo_mysql.so ===== Indexation mnogosearch ===== # -------------------------------------------------------------------------------------------- # CRAWLING : explore et telecharge les documents avec les nouveaux contenus tous les jours a 1h # N=10 threads # -------------------------------------------------------------------------------------------- 0 1 * * * /usr/local/mnogosearch/sbin/indexer -N 10 -d /usr/local/mnogosearch/etc/indexer.conf > /usr/local/mnogosearch/sbin/indexer_craw.log 2> /usr/local/mnogosearch/sbin/indexer_craw.err # ------------------------------------------------------------------------------------------- # INDEXING : met a jour l'index dans les tables tous les jours a 4h # ------------------------------------------------------------------------------------------- 0 4 * * * /usr/local/mnogosearch/sbin/indexer -Eblob /usr/local/mnogosearch/etc/indexer.conf > /usr/local/mnogosearch/sbin/indexer_ind.log 2> /usr/local/mnogosearch/sbin/indexer_ind.err __** Logs**__ cd /var/www ln -s /usr/local/mnogosearch/sbin/indexer_craw.err ln -s /usr/local/mnogosearch/sbin/indexer_craw.log ln -s /usr/local/mnogosearch/sbin/indexer_ind.err ln -s /usr/local/mnogosearch/sbin/indexer_ind.log **Consulter les logs :** Sur la console bot tail -f /var/log/syslog [[http://192.168.150.111/indexer_craw.err|Crawling erreurs]] [[http://192.168.150.111/indexer_craw.err|Crawling logs]] [[http://192.168.150.111/indexer_ind.err|Indexing erreurs]] [[http://192.168.150.111/indexer_ind.err|Indexing logs]] ===== Mise a jour de indexer.conf ===== Il faut autoriser bot.bilatu.lan à se connecter sur www.bilatu.lan. Pour cela sur www.bilatu.lan je me suis connecté à Mysql et tapé les commandes suivantes : MariaDB [(none)]> CREATE USER 'bot'@'bot.bilatu.lan' IDENTIFIED BY 'Hodei2013!'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'bot'@'bot.bilatu.lan' WITH GRANT OPTION; MariaDB [(none)]> CREATE USER 'bot'@'%' IDENTIFIED BY 'Hodei2013!'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'bot'@'%' WITH GRANT OPTION; Un document de conception est décrit [[http://hodei.hodei.net/wiki/lib/exe/detail.php?id=wordpress_hodei&media=process_indexerupd.php.jpg|ici]]. Le programme ci-dessous est décrit dans un flux. __Remarque : __ Afin de repérer dans indexer.conf le début de la liste des adresses web les lignes ci-dessous ont été rajoutées Elles ne doivent pas être modifiées car le programme indexerupd.php ne fonctionnerait plus. # -------------------- # Hodei parameter server # HDISRV05062014 # -------------------- **Dans la crontab on trouve ceci :** On met php à la place de php -f ou php-cli # ============================================================================================================== # indexer.conf # Met a jour le fichier indexer.conf de bot a partir de la bd wwwhodei de www # toutes les minutes : 1 # toutes les 5 minutes : */5 # ============================================================================================================== #1 * * * * php /usr/local/mnogosearch/php/indexerupd.php > /usr/local/mnogosearch/php/indexerupd.log 2>&1 */5 * * * * php /usr/local/mnogosearch/php/indexerupd.php >> /usr/local/mnogosearch/php/indexerupd.log 2>&1 **__Logs__** cd /var/www ln -s /usr/local/mnogosearch/php/indexerupd.log **Consulter les logs :** [[http://192.168.150.111/indexerupd.log|Indexerupd.php Logs]] tail -f /usr/local/mnogosearch/etc/indexer.conf ===== Copie de indexer.conf de bot vers www ===== On a mis une clé ssh de bot vers www scp /usr/local/mnogosearch/etc/indexer.conf root@www.bilatu.lan:/usr/local/mnogosearch/etc/ ====== Configuration de www.bilatu.lan ====== ===== indexer.conf ===== Le fichier indexer.conf de www.bilatu.lan contient la meme configuration que celui de bit.bilatu.lan à part la liste d'url : comme ce serveur n'est pas 'crawlé' la liste des urls est inutile sur www.bilatu.lan. La seule commande importante est DBAddr : DBAddr mysql://root:Dolimysql!@localhost/mnogosearch/?dbmode=blob ===== php ===== [[http://www.hodei.net/phpinfo.php|phpinfo]] ===== Autocompletion : wrdstat ===== On rajoute une commande pour extraire tous les mots indexes (table wrdstat) # ------------------------------------------------------ # Wordstat : indexer mnogosearch # Alimente la table wordstat des mots indexes # tous les 1er et 15 du mois a 01h00 # ------------------------------------------------------- 00 1 1 * * /usr/local/mnogosearch/sbin/indexer --wordstat 00 1 15 * * /usr/local/mnogosearch/sbin/indexer --wordstat # --------------------------------------------------- # Wordstat : programme php wordstat # -------------------------------------------------- # Alimente le fichier wordstatdata.php a partir de la # table wordstat.php tous les 2 et 16 du mois a 03h00 # ancienne commande : php-cli -f # ----------------------------------------------------- 00 3 2 * * php /var/www/www.bilatu.lan/wp-content/plugins/hdibilatu/wordstat.php 00 3 16 * * php /var/www/www.bilatu.lan/wp-content/plugins/hdibilatu/wordstat.php > /var/www/www.bilatu.lan/wp-content/plugins/hdibilatu/resources/data/wordstat.log 2>/var/www/www.bilatu.lan/wp-co$ Ce fichier est généré par le script php [[http://www.hodei.net/wp-content/plugins/hdibilatu/wordstat.php|wordstat.php]] Un link a été crée avec la commande suivante : cd /var/www/www.bilatu.lan ln -s /var/www/www.bilatu.lan/wp-content/plugins/hdibilatu/resources/data lnkbilatudata On accède ainsi à tout le répertoire avec : http://www.hodei.net/lnkbilatudata/ [[http://www.hodei.net/lnkbilatudata/wordstat.err|Fichier erreur]] [[http://www.hodei.net/lnkbilatudata/wordstat.log|Fichier Log]] [[http://www.hodei.net/lnkbilatudata/wordstatdata.php|Fichier data autocompletion]] ou [[http://www.hodei.net/wp-content/plugins/hdibilatu/resources/data/wordstatdata.php|worstatdata]] ===== Actualités : flux rss ===== # ------------------------------------------------------------------------------------------------------------ # Flux RSS : programme php rssmake # Genere un fichier http://www.hodei.net/wp-content/plugins/hdirss/rsscache/hodeifeed.xml # de tous nos flux RSS (listes dans http://www.hodei.net/wp-content/plugins/hdirss/data/feeds.txt) # Frequence : toutes les heures # ------------------------------------------------------------------------------------------------------------ 0 * * * * php /var/www/www.bilatu.lan/wp-content/plugins/hdirss/rssmake.php >/var/www/www.bilatu.lan/wp-content/plugins/hdirss/data/rssmake.log 2>/var/www/www.bilatu.lan/wp-content/plugins/hdirss/data/rssmake.err **__Le programme :__** * Données en entrée : [[http://www.hodei.net/wp-content/plugins/hdirss/data/feeds.txt|Liste des flux sélectionnés par hodei]] * Programme générant le fichier feed.xml : [[http://www.hodei.net/wp-content/plugins/hdirss/rssmake.php|rssmake.php dans crontab]] * Données en sortie : [[http://www.hodei.net/wp-content/plugins/hdirss/rsscache/hodeifeed.xml|Flux RSS hodei : concaténé et unique]] **__Les Logs :__** * [[http://www.hodei.net/wp-content/plugins/hdirss/data/rssmake.log|Logs]] * [[http://www.hodei.net/wp-content/plugins/hdirss/data/rssmake.err|Erreurs]] Le programme http://www.hodei.net/wp-content/plugins/hdirss/rssparser.php analyse les informations et les affichent dans le moteur de recherche bilatu.