Skip to main content

Ubuntu 12.04 aufsetzen mit Solr

Add Data partition to /etc/fstab - use NTFS for compatibility with Windows in Vhost
# Daten Partition für Windows und Ubuntu
UUID=1990E089111DCC37 /media/ana/Daten ntfs-3g defaults,permissions,acl 0 0

Do not use NTFS if your're working with vagrant! Use ext instead!

NEVER, EVER install nvidia proprietary drivers!

apt-get remove gnome-screensaver
apt-get install xscreensaver xscreensaver-data-extra xscreensaver-gl-extra
apt-get install libwww-perl

In /etc/inputrc, uncomment:
# alternate mappings for "page up" and "page down" to search the history
"\e[5~": history-search-backward
"\e[6~": history-search-forward

apt-get install dpkg
apt-get install apache2 php5 mysql-server php5-mysql libapache2-mod-auth-mysql libapache2-mod-php5
apt-get install php5-cgi php5-cli php5-common php5-curl php5-mysql php5-odbc php5-snmp php5-tidy php5-xmlrpc php5-xsl php5-enchant php5-ffmpeg php5-geoip php5-imagick php5-mcrypt php5-xcache php5-xdebug
apt-get install vlc keepass2
apt-get install git
apt-get install gdebi
apt-get install virtualbox
apt-get install mc vim curl
apt-get install openjdk-6-jdk
apt-get install dnsmasq phpmyadmin
apt-get install libsaxonb-java

After installing apache, mysql, php etc. don't forget to install dnsmasq to redirect all domains with ending .dev to local 127.0.0.1

In file /etc/dnsmasq.conf insert
address=/.dev/127.0.0.1
listen-address=127.0.0.1

Do not forget, apt-get phpmyadmin is not working with php 5.3 and mysql 5.5 .... install with apt-get but then replace dir in /usr/share with working copy

cp phpmyadmin.conf into /etc/apache2/conf.de/phpmyadmin.conf

Create /etc/apache2/conf.d/virtual.conf
Content: NameVirtualHost *

Set user to own user in /etc/apache2/envvars
a2enmod rewrite
service apache2 restart

Change apache defaults in /etc/apache2/sites-available/default:

DocumentRoot

Download opera
dpkg --install opera_12.16.1860_amd64.deb

Download eclipse (kepler) as tar.gz
Unpack to /opt and create desktop icon

Install printer with system settings and by typing IP in host ...

sudo apt-get install libqt4-dbus:i386 libqt4-network:i386 libqt4-xml:i386 libqtcore4:i386 libqtgui4:i386 libqtwebkit4:i386 sni-qt:i386
Download skype from skype site
sudo dpkg -i skypeXXXXX.deb

add-apt-repository -y ppa:skype-wrapper/ppa && sudo apt-get -qq update
apt-get install skype-wrapper

###############
Installing php 5.2.17 in parallel
http://zgadzaj.com/how-to-install-php-53-and-52-together-on-ubuntu-1204
######################

Download php from http://php.net/releases/
Untar and cd into php dir

apt-get install libxml2-dev libpcre3-dev libbz2-dev libcurl4-openssl-dev libdb4.8-dev libjpeg-dev libpng12-dev libxpm-dev libfreetype6-dev libmysqlclient-dev postgresql-server-dev-9.1 libt1-dev libgd2-xpm-dev libgmp-dev libsasl2-dev libmhash-dev unixodbc-dev freetds-dev libpspell-dev libsnmp-dev libtidy-dev libxslt1-dev libmcrypt-dev

./configure \
--prefix=/usr/share/php52 \
--datadir=/usr/share/php52 \
--mandir=/usr/share/man \
--bindir=/usr/bin/php52 \
--with-libdir=lib64 \
--includedir=/usr/include \
--sysconfdir=/etc/php52/apache2 \
--with-config-file-path=/etc/php52/cli \
--with-config-file-scan-dir=/etc/php52/conf.d \
--localstatedir=/var \
--disable-debug \
--with-regex=php \
--disable-rpath \
--disable-static \
--disable-posix \
--with-pic \
--with-layout=GNU \
--with-pear=/usr/share/php \
--enable-calendar \
--enable-sysvsem \
--enable-sysvshm \
--enable-sysvmsg \
--enable-bcmath \
--with-bz2 \
--enable-ctype \
--with-db4 \
--without-gdbm \
--with-iconv \
--enable-exif \
--enable-ftp \
--enable-cli \
--with-gettext \
--enable-mbstring \
--with-pcre-regex=/usr \
--enable-shmop \
--enable-sockets \
--enable-wddx \
--with-libxml-dir=/usr \
--with-zlib \
--with-kerberos=/usr \
--with-openssl=/usr \
--enable-soap \
--enable-zip \
--with-mhash \
--with-exec-dir=/usr/lib/php5/libexec \
--without-mm \
--with-curl=shared,/usr \
--with-zlib-dir=/usr \
--with-gd=shared,/usr \
--enable-gd-native-ttf \
--with-gmp=shared,/usr \
--with-jpeg-dir=shared,/usr \
--with-xpm-dir=shared,/usr/X11R6 \
--with-png-dir=shared,/usr \
--with-freetype-dir=shared,/usr \
--with-ttf=shared,/usr \
--with-t1lib=shared,/usr \
--with-ldap=shared,/usr \
--with-mysql=shared,/usr \
--with-mysqli=shared,/usr/bin/mysql_config \
--with-pgsql=shared,/usr \
--with-pspell=shared,/usr \
--with-unixODBC=shared,/usr \
--with-xsl=shared,/usr \
--with-snmp=shared,/usr \
--with-sqlite=shared,/usr \
--with-tidy=shared,/usr \
--with-xmlrpc=shared \
--enable-pdo=shared \
--without-pdo-dblib \
--with-pdo-mysql=shared,/usr \
--with-pdo-pgsql=shared,/usr \
--with-pdo-odbc=shared,unixODBC,/usr \
--with-pdo-dblib=shared,/usr \
--enable-force-cgi-redirect --enable-fastcgi \
--with-libdir=/lib/x86_64-linux-gnu \
--with-pdo-sqlite=shared \
--with-sqlite=shared \
--enable-ipv6 \
--with-mcrypt \
--with-imap-ssl

make

Openssl error during make
#############################
Download patch openssl into php dir in Downloads:
https://bugs.php.net/patch-display.php?bug_id=54736&patch=debian_patches...

cd into php dir in Downloads
patch -p1 < debian_patches_disable_SSLv2_for_openssl_1_0_0.patch.patch

GMP* Error during make
#############################
You have to edit file ext/gmp/gmp.c and replace one occurence of __GMP_BITS_PER_MP_LIMB with GMP_LIMB_BITS, in my case it was in line 1399.

Memset Error during make
############################
edit file ext/zip/lib/zip_dirent.c and in line 478 replace:
memset(&tm, sizeof(tm), 0);
with
memset(&tm, 0, sizeof(tm));

make
make test
make install

Creating Apache conf
#########################

ln -s /etc/php5/conf.d /etc/php52
ln -s /etc/php5/cli /etc/php52
cp php.ini-recommended /etc/php52/apache2/php.ini
apt-get install libapache2-mod-fastcgi
service apache2 restart

Create a wrapper script called php52-cgi to run the fastcgi enabled version of PHP and place it under /usr/lib/cgi-bin/, with the following content:
#!/bin/sh
PHPRC="/etc/php52/apache2/"
export PHPRC
PHP_FCGI_CHILDREN=4
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
exec /usr/bin/php52/php-cgi

chmod +x /usr/lib/cgi-bin/php52-cgi

Finally create new include file /etc/apache2/php52.conf, which will be used by those virtual hosts that need to run off PHP 5.2. Add the following content to it:
# Include file for virtual hosts that need to run PHP 5.2


SetHandler application/x-httpd-php5

ScriptAlias /php52-cgi /usr/lib/cgi-bin/php52-cgi
Action application/x-httpd-php5 /php52-cgi
AddHandler application/x-httpd-php5 .php

cd /var/lib/apache2/
chown -R ana:ana fastcgi

SOLR
#############################

apt-get install openjdk-6-jdk tomcat6
service tomcat6 status
mkdir /opt/solr
mkdir /opt/solr/bin
mkdir /opt/solr/source
mv ~/Downloads/solr-4.1.0 /opt/solr/source/
ln -s /opt/solr/source/solr-4.1.0/example/webapps/solr.war /opt/solr/bin/solr-4.1.war
mkdir /opt/solr/instances
mkdir /opt/solr/instances/sprachenshop
cd /opt/solr/instances/sprachenshop/
cp -r /opt/solr/source/solr-4.1.0/example/solr/* .
cd /opt/solr/instances/sprachenshop
vim sprachenshop.xml

****************************
cd collection1/conf/
cp -r /media/ana/Daten/http/spotlight/sprachenshop/sites/all/modules/apachesolr/solr-conf/solr-4.x/* .

+++++++++++++++++++++++++++
cd /opt/solr/instances/sprachenshop
find -type d -exec chgrp tomcat6 {} \;
find -type f -exec chgrp tomcat6 {} \;
find -type d -exec chmod 0775 {} \;
find -type f -exec chmod 0664 {} \;
ln -s /opt/solr/instances/sprachenshop/sprachenshop.xml /etc/tomcat6/Catalina/localhost/sprachenshop.xml
service tomcat6 restart

SHOULD BE DONE