Install LAMP using TaskSel

An alternative way to install a LAMP server in Ubuntu is to use the Tasksel utility. Make sure Tasksel is installed by installing it first via apt-get. Once tasksel is installed, you can then install the lamp-server.

# install tasksel
sudo apt-get -y install tasksel
# install lamp server
sudo tasksel install lamp-server

Install LAMP on Ubuntu Desktop

My development server is old. You’ll get a chuckle when you see the specs. It runs on a 400Mhz Pentium II CPU with a 128MB RAM and a 40GB drive. This old relic still manages to run Apache, MySQL, PHP and a local DNS. The server has also gone through 4 Ubuntu upgrades from version 7.04 to 9.04. After each upgrade, pages that require MySQL and PHP have slowed down considerably.

You guessed it. It’s about time to move to another machine. So, I’ve decided to install AMP minus the L (Linux) since we are already installing it on the Ubuntu Desktop. The following tutorial will show you how to install Apache, MySQL, PHP as well as the MySQL admin tool called PhpMyAdmin. Let’s get started:

Install Apache

sudo apt-get install apache2

Install PHP. Restart Apache

sudo apt-get install php5
sudo /etc/init.d/apache2 restart

Install MySQL

sudo apt-get install mysql-server
sudo apt-get install libapache2-mod-auth-mysql
sudo apt-get install php5-mysql

Finally PhpMyAdmin
sudo apt-get install phpmyadmin

You’ll be asked to provide passwords on the MySQL and PhpMyAdmin installations. There are a couple of minor tweaks you have to do to make sure the applications are working properly. First, make sure the MySQL extension is set in PHP. Restart Apache again after you make your changes.

MySQL Extension. Restart Apache

sudo vi /etc/php5/apache2/php.ini
extension=mysql.so
sudo /etc/init.d/apache2 restart

Now, open your Firefox browser, and type `localhost` in the address bar. If you see “It Works!,” that means the installation was successful. One final thing before you go, I installed WordPress and the installation was a success, except for the mod_rewrite which wasn’t working if you try to use the permalinks feature. To make the permalinks feature work, first you’ll need to create a .htaccess file and make it writable. Next, turn on mod_rewrite module.

Mod Rewrite

cd /var/www/
touch .htaccess
chmod 777 .htaccess
sudo a2enmod rewrite

Lastly, make sure AllowOverride is set to All. Edit the file:

sudo vi /etc/apache2/sites-available/default

Allow Override

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

Restart Apache

sudo /etc/init.d/apache2 restart