How to install Contao on an Ubuntu 14.04 VPS
Contao is a popular web-based open source content management system which allows you to develop search engine friendly web sites.
To install Contao on an Ubuntu VPS follow the very easy steps described below.
This install guide assumes that Apache, MySQL and PHP are already installed and configured on your Linux VPS. At the time of writing this tutorial, the latest stable version of Contao is 3.4.0 and it requires:
- PHP >= 5.2 with GD graphics library, SOAP, mbstring and mcrypt PHP extensions enabled.
- Apache Web Server >= 2.x+ compiled with mod_rewrite module in order to use search engine friendly URLs.
- MySQL >= 5.x installed on your Linux virtual server.
Download the latest version of Contao available at https://contao.org/en/download.html to the server and extract it using the following commands:
cd /root/ wget https://download.contao.org/3.4.0/zip -O contao.zip unzip contao.zip unzip contao.zip -d contao
Contao requires a database to work as this is where data is saved, so create a new MySQL database on your server:
mysql -u root -p mysql> CREATE DATABASE contaodb; mysql> CREATE USER contaouser@localhost; mysql> SET PASSWORD FOR 'contaouser'@'localhost' = PASSWORD("your-password"); mysql> GRANT ALL PRIVILEGES ON contaodb.* TO 'contaouser'@'localhost' IDENTIFIED BY 'your-password' WITH GRANT OPTION; mysql> FLUSH PRIVILEGES; mysql> quit
Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘contao.conf’:
touch /etc/apache2/sites-available/contao.conf ln -s /etc/apache2/sites-available/contao.conf /etc/apache2/sites-enabled/contao.conf vi /etc/apache2/sites-available/contao.conf
then, add the following lines:
<VirtualHost *:80> ServerAdmin email@example.com DocumentRoot /var/www/html/contao/ ServerName yourdomain.com ServerAlias www.yourdomain.com <Directory /var/www/html/contao/> Options FollowSymLinks AllowOverride All </Directory> ErrorLog /var/log/apache2/yourdomain.com-error_log CustomLog /var/log/apache2/yourdomain.com-access_log common </VirtualHost>
Move the Contao installation files to the document root directory defined in the virtual host directive above:
cd /root/ mv contao-3.4.0 /var/www/html/contao
Edit the ‘/etc/php5/apache2/php.ini’ configuration file and add/modify the following settings:
safe_mode = Off max_execution_time = 60 memory_limit = 128M register_globals = Off file_uploads = On upload_max_filesize=64M display_errors = Off html_errors = Off display_startup_errors = Off log_errors = On
Restart the Apache web server for the changes to take effect:
service apache2 restart
The web server user (www-data) needs to be able to write to files and directories inside the ‘/var/www/contao’ directory, so it can easily be accomplished by executing the following command:
chown www-data:www-data -R /var/www/html/contao/
Rename or copy ‘.htaccess.default’ file to ‘.htaccess’:
cd /var/www/html/contao/ cp .htaccess.default .htaccess
Open http://your-domain.com/contao/install.php in your popular web browser and follow the easy instructions.
Remove the the ‘contao/install.php’ file from your server using the the following command-line command:
rm -rf /var/www/html/contao/contao/install.php
That is it. The Contao installation is now complete.
You can now log in to the Contao administrator back-end using the link in the lower right corner (http://your-domain.com/contao/) and start developing your web site.
Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install Contao for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.