So I been getting rather annoyed with CentOs recently, mainly due to the lack of PHP support above 5.1.6, especially with all the cool features of 5.3. Also I always seem to have massive trouble installing anything like Mcypt or Memcache.
So I thought I’d give Ubuntu a go and I’m now a convert! Everything went smoothly, not one issue or problem. The support forums are brilliant and almost all questions have already been answered. I dont know whether I’ve just got lucky (I guess only time will tell) but Ubuntu is now my first port of call when setting up a new server.
Below is a line by line tutorial on how I got setup with Ubuntu 10.04 Lucid. I don’t go into too much details on how to edit the files using nano or vi but you can have a look on my previous posts or online, otherwise you can sftp in using root and change the files that way, (my preferred method).
Install Lamp on Ubuntu
sudo tasksel install lamp-server
You will need to enter a root mysql password for mysql
Change Apache Default Web Location on Ubuntu
If you need to change the default root location from /var/www to something else you can do so in the following file location. This is useful for using frameworks such as Zend Framework.
/etc/apache2/sites-available/default
Create file and add Fully Qualified Domain Name to Apache config (auto adds all in conf.d)
Create a new file call fqdn in:
/etc/apache2/conf.d/
In the top of the file write the following where mydomain.com is the domain name pointing to this server.
servername mydomain.com
Enable mod_rewrite on Ubuntu
a2enmod rewrite
Edit “AllowOverride None” for default site (usually the first 2 found on line 4 and line 10). Change to the following
AllowOverride All
Found in:
/etc/apache2/sites-available/default
Disable Directory Listing on Ubuntu
Inside: /etc/apache2/sites-available/default
Add "-" before the word Indexes
<Directory "/var/www">
Options -Indexes
</Directory>
Restart Apache on Ubuntu
sudo /etc/init.d/apache2 restart
Install Memcached on Ubuntu
apt-get install memcached
apt-get install php5-memcache
Install Mcrypt on Ubuntu
sudo apt-get install php5-mcrypt
Install APC on Ubuntu
apt-get install php-apc
/etc/init.d/apache2 restart
When you get erros you need to type
apt-get install re2c
apt-get install gawk
Restart Apache
sudo /etc/init.d/apache2 restart
Other Useful Info on Ubuntu
PHP.ini Location in Ubuntu
/etc/php5/apache2/php.ini