Line 2: |
Line 2: |
| | | |
| This page lists all the steps necessary to install Product Opener on Debian, including a development environment. | | This page lists all the steps necessary to install Product Opener on Debian, including a development environment. |
| + | |
| + | = Installation on Jessie = |
| + | |
| + | We start from a clean Jessie install. |
| + | |
| + | == Get the code and configure it == |
| + | |
| + | <pre> |
| + | cd /srv/openfoodfacts/cgi |
| + | rm Blogs |
| + | ln -s . Blogs |
| + | ln -s SiteLang_off.pm SiteLang.pm |
| + | </pre> |
| + | |
| + | Edit a few variables in Config2.pm: |
| + | <pre> |
| + | $server_domain = "yourdomain.com"; |
| + | $www_root="/srv/openfoodfacts/html"; |
| + | $data_root="/srv/openfoodfacts"; |
| + | </pre> |
| + | |
| + | Also in Config_off.pm: |
| + | <pre> |
| + | $domain = 'yourdomain.com'; |
| + | $contact_email = 'webmaster@yourdomain.com'; |
| + | $admin_email = 'webmaster@yourdomain.com'; |
| + | </pre> |
| + | |
| + | And in startup.pl: |
| + | <pre> |
| + | use lib "/srv/openfoodfacts/cgi/"; |
| + | </pre> |
| + | |
| + | In /srv/openfoodfacts/cgi/Display.pm, swap lines 3750-3752 and |
| + | 3769-3771 (location of Javascript things) |
| + | |
| + | == Install packaged prerequisites == |
| + | |
| + | <pre> |
| + | cd /srv |
| + | git clone .../openfoodfacts/ |
| + | mkdir /srv/openfoodfacts/users |
| + | mkdir /srv/openfoodfacts/products |
| + | chown -R www-data:www-data /srv/openfoodfacts |
| + | |
| + | apt-get install mongodb memcached imagemagick tesseract-ocr tesseract-ocr-fra geoip-bin geoip-database libwww-perl libimage-magick-perl libxml-encoding-perl libtext-unaccent-perl libmime-lite-perl libcache-memcached-fast-perl libjson-perl libclone-perl libgraphviz-perl libmime-lite-perl libcrypt-passwdmd5-perl libencode-detect-perl libgraphics-color-perl libbarcode-zbar-perl libxml-feedpp-perl libmongodb-perl liburi-find-perl liburi-escape-xs-perl libtest-nowarnings-perl libhtml-defang-perl libgeo-ip-perl libdatetime-format-mail-perl libperl-dev zlib1g-dev apache2 build-essential |
| + | |
| + | cpan Net::IDN::Punycode |
| + | cpan Encode::Punycode |
| + | cpan GraphViz2 |
| + | cpan Image::OCR::Tesseract |
| + | </pre> |
| + | |
| + | == Rebuild Apache 2.2 and mod_perl == |
| + | |
| + | <pre> |
| + | cd /usr/local/src/ |
| + | wget http://apache.crihan.fr/dist//httpd/httpd-2.2.29.tar.gz |
| + | tar xvfz httpd-2.2.29.tar.gz |
| + | cd httpd-2.2.29 |
| + | ./configure --with-mpm=prefork --prefix=/usr/local --enable-rewrite --enable-proxy --enable-proxy_http --enable-deflate --disable-userdir --enable-headers |
| + | make |
| + | make install |
| + | |
| + | cd /usr/local/src/ |
| + | wget http://mir2.ovh.net/ftp.apache.org/dist/perl/mod_perl-2.0.8.tar.gz |
| + | tar xvfz mod_perl-2.0.8.tar.gz |
| + | cd mod_perl-2.0.8 |
| + | perl Makefile.PL MP_APXS=/usr/local/bin/apxs |
| + | make |
| + | make install |
| + | |
| + | cat >> /usr/local/conf/httpd.conf <<EOF |
| + | Listen 8001 |
| + | |
| + | LoadModule perl_module modules/mod_perl.so |
| + | |
| + | PerlWarn Off |
| + | PerlRequire /srv/openfoodfacts/cgi/startup.pl |
| + | |
| + | <VirtualHost *:8001> |
| + | DocumentRoot /srv/openfoodfacts/html |
| + | ServerName yourdomain.com |
| + | ErrorLog /var/log/apache2/error.log |
| + | CustomLog /var/log/apache2/access.log combined |
| + | ScriptAlias /cgi/ /srv/openfoodfacts/cgi/ |
| + | |
| + | <Location /cgi> |
| + | SetHandler perl-script |
| + | PerlResponseHandler ModPerl::Registry |
| + | PerlOptions +ParseHeaders |
| + | Options +ExecCGI |
| + | Order allow,deny |
| + | Allow from all |
| + | </Location> |
| + | </VirtualHost> |
| + | |
| + | PerlPostReadRequestHandler My::ProxyRemoteAddr |
| + | EOF |
| + | |
| + | sed -i -e 's/^Listen 80$/#Listen 80/' /usr/local/conf/httpd.conf |
| + | sed -i -e 's/^User.*/User www-data/' /usr/local/conf/httpd.conf |
| + | sed -i -e 's/^Group.*/Group www-data/' /usr/local/conf/httpd.conf |
| + | |
| + | /usr/local/bin/apachectl -k start |
| + | </pre> |
| + | |
| + | == Configure standard Apache 2 == |
| + | |
| + | <pre> |
| + | a2enmod proxy_http |
| + | a2enmod rewrite |
| + | |
| + | cat >> /etc/apache2/sites-available/product-opener-proxy.conf <<EOF |
| + | <VirtualHost *> |
| + | DocumentRoot /srv/openfoodfacts/html |
| + | ServerName yourdomain.com |
| + | ServerAlias *.yourdomain.com |
| + | |
| + | <Directory "/srv/openfoodfacts/html"> |
| + | Options Indexes FollowSymLinks |
| + | Require all granted |
| + | </Directory> |
| + | ProxyPreserveHost On |
| + | RewriteEngine on |
| + | RewriteCond %{REQUEST_URI} !/./ |
| + | RewriteRule ^(/cgi/.*)$ http://localhost:8001$1 [P,L] |
| + | RewriteMap escape int:escape |
| + | RewriteRule ^/favicon.ico$ /favicon.ico [L] |
| + | RewriteCond %{REQUEST_URI} !^/images/ |
| + | RewriteCond %{REQUEST_URI} !^/js/ |
| + | RewriteCond %{REQUEST_URI} !^/rss/ |
| + | RewriteCond %{REQUEST_URI} !^/robots |
| + | RewriteCond %{REQUEST_URI} !^/clicks/ |
| + | RewriteCond %{REQUEST_URI} !^/data/ |
| + | RewriteCond %{REQUEST_URI} !^/files/ |
| + | RewriteRule ^(.*)$ http://localhost:8001/cgi/display.pl?${escape:$1} [P,L,QSA] |
| + | </VirtualHost> |
| + | EOF |
| + | |
| + | a2ensite product-opener-proxy.conf |
| + | a2dissite 000-default.conf |
| + | service apache2 restart |
| + | </pre> |
| + | |
| + | You should now have a working Productopener instance running at http://yourdomain.com/. Enjoy! |
| + | |
| + | = Old notes = |
| | | |
| All instructions below are for user "stephane", please use your own name. :-) | | All instructions below are for user "stephane", please use your own name. :-) |