How to setup ownCloud 5 on Ubuntu Server 12.04

Installing Prerequisites For ownCloud

We need to install additional libraries that will be used by ownCloud. Execute the following:

sudo apt-get install php5-gd php-xml-parser php5-intl smbclient curl libcurl3 php5-curl

Now we need to enable mod_rewrite and mod_headers Apache2 modules, that are needed for ownCloud to function normally.

To enable mod_rewrite and mod_headers, type the following:

sudo a2enmod rewrite
sudo a2enmod headers

Additionally, we have to change Apache2 config file in order for ownCloud rewrite rules to work properly. Run the following:

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

Find the “<Directory /var/www/>” section, and change the following:

AllowOverride None


AllowOverride All

Now we need to restart Apache2 for changes to take effect:

sudo service apache2 restart


Now we need to download the source files of ownCloud 5 and move them to the Apache web root directory.

To download ownCloud source files, execute the following (where x is the latest version number):


Now we need to extract the archive. Execute the following:

tar -xjf owncloud-5.0.x.tar.bz2

Now we need to move ownCloud source files in the appropriate directory. Execute the following:

mv owncloud /var/www

Having ownCloud source files in the right place is nice, but we have to change a few folder permissions for ownCloud to function normally. Execute the following:

cd /var/www
sudo chown -R www-data:www-data owncloud


Now we need to configure MySQL.  Log in to MySQL with the following command:

mysql -u root -p

It will prompt you for root password, enter the one you entered upon installing LAMP stack.

Next, create a new database with the following command:


Then assign a new user with proper privileges to the new database:

GRANT ALL ON owncloud.* TO 'owncloud'@'localhost' IDENTIFIED BY 'some_password';

Be sure to replace “some_password” with the actual password you desire for your MySQL database.

Browse to to access the ownCloud 5 installation.

Then, after the installation dialog opens, fill in the details for the admin account. Next, enter the MySQL database details as you set them up in the previous step and click Finish Setup.