Basic instalation of LAMMP: LAMP+MongoDB

This quick tutorial shows how to install Apache + MySQL + MongoDB + PHP on Linux, with a little but very eficient tunning.

MongoDB

Importing repository keys

apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10

Old Debian and Ubuntus (not using upstart)

echo "deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen" >> /etc/apt/sources.list.d/10gen.list

Recent Ubuntu (using upstart, 10.04,. 10.10, 11.04)

echo "deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen" >> /etc/apt/sources.list.d/10gen.list

MongoDB Drivers

apt-get -y install python-software-properties
add-apt-repository ppa:chris-lea/mongodb-drivers

Instaling LAMP+MongoDB

apt-get update
apt-get install apache2 libapache2-mod-php5 php-apc php-pear php5 php5-cli \
                php5-curl php5-dev php5-gd php5-imap php5-ldap php5-mcrypt php5-mysql \
                php5-sqlite php5-suhosin php5-xsl phpmyadmin mysql-server-5.1 mongodb-stable php5-mongo

Instaling unforgivable MCEDIT editor (optional)

apt-get install mc

Activating basic Apache modules

a2enmod expires headers expires

Increasing Apache security

mcedit /etc/apache2/conf.d/security

and changing:

ServerTokens Prod
ServerSignature Off

Configuring APC

mcedit /etc/php5/conf.d/apc.ini

and changing

apc.shm_size = 128
apc.enabled = 1
apc.stat = on

Restarting apache

/etc/init.d/apache2 restart