Installing mnoGoSearch on FreeBSD


My experience with FreeBSD is that most things work really well, but some things are a bit harder to get going than on Debian (my server OS of choice). mnoGoSearch seems to be in the latter group. I'm documenting it here, just in case I have to do something tricky (so these notes can be helpful to someone else in future). This is FreeBSD 4.7-RELEASE.

I've already got Apache, MySQL, Perl, Python and PHP installed. This document only covers the installation of the search engine.

cd /usr/ports/www/mnogosearch
make install WITH_MNOGO_MYSQL=yes

Now I need to do some DB stuff -- "Now, to use mnoGoSearch you need to create the appropriate *sql database manually: Please read INSTALL file located in ${PREFIX}/share/doc/mnogosearch."

less /usr/local/share/doc/mnogosearch/INSTALL

Create the database:

mysqladmin -p create mnoGoSearch

And add the tables:

cd /usr/local/share/mnogosearch/create/mysql/
mysql -p mnoGoSearch < create.txt

And some stopwords:

cd ../stopwords/
mysql -p mnoGoSearch < stop.en.txt

We don't have a user yet, so we have to do this now.

mysql -p
grant all privileges on mnoGoSearch.* to search_foo@localhost identified by 'password';
flush privileges

Now we need to run the indexer -- it needs a conf file.

cd /usr/local/etc/mnogosearch/
cp indexer.conf-dist

Change DBAddr to point to the mysql DB and the user we created earlier. The previous example would result in mysql://search_foo:password@localhost/mnoGoSearch/.

Search for 'AuthBasic' and add a 'Server' line. In my case I'm using authentication, so I put an AuthBasic line first:

AuthBasic foo:bar

Now we run the indexer and let it build the index; it should run fairly quickly if you are indexing a small local site:

indexer /usr/local/etc/mnogosearch/

Now we need to put a front-end in place. There is an example script included with mnoGoSearch; let's try that.

cp /usr/local/share/mnogosearch/search.cgi /usr/local/www/cgi-bin/

We also need to give it a template:

cd /usr/local/etc/mnogosearch/
cp search.htm-dist search.htm

... and tell the template about the database:

emacs search.htm

Now change the DBAddr parameter to be the same as what you put in

Next, make sure search.cgi is executable and that the web server is configured to run CGI scripts. You'll need something like the following in your Apache httpd.conf:

<Directory /path/to/search/cgi>
    AddHandler cgi-script .cgi
    Options +ExecCGI

(Put that in the relevant VirtualHost section).

Finally, you should be able to go to search.cgi in a web browser and search.

Did these notes work for you? If not, drop me a line with a correction and I'll put it in here ().

See also: Installing ht://Dig on FreeBSD.