// Tutorial //

How To Setup ownCloud 5 On Ubuntu 12.10

Published on April 18, 2013
Default avatar
By Sági-Kazár Márk
Developer and author at DigitalOcean.
How To Setup ownCloud 5 On Ubuntu 12.10

What the Red Means

The lines that the user needs to enter or customize will be in red in this tutorial! The rest should mostly be copy-and-pastable.

About ownCloud

ownCloud is an open source Data Storage solution similar to Dropbox or Google Drive. One can grab its source code and install it anywhere he/she wants and thus gain much more control over his/her data.

The latest version of ownCloud as of this writing is 5.0.4 and that version will be installed in this tutorial.

LAMP Stack Setup on a VPS

First off, we need a LAMP (Linux, Apache, MySQL and PHP) stack in order to run ownCloud 5. Before installing it, we should perform a few system updates and upgrades.

sudo apt-get update
sudo apt-get upgrade

Next, we install the actual LAMP stack with the following command:

sudo apt-get install lamp-server^

Note the "^" character at the end of the package name, it is important to type it for the LAMP stack to be installed properly. The setup will prompt you for the MySQL root password, be sure to enter something sensible and easy to remember.

That's it, now we have a fully working LAMP stack on our VPS.

Setting Up MySQL and MySQL Database

Although ownCloud can use SQLite to store its data, in this tutorial, we will use MySQL database for ownCloud's internal data as MySQL is way faster than SQLite.

Type the following to run MySQL secure installation:

sudo mysql_secure_installation

It will prompt you for your MySQL root password. Enter the password you entered upon installation of LAMP stack.

It will ask you to change root password, type "n" for no.

It will ask you to remove anonymous users, type "y" for yes.

It will ask you to disallow remote root logins, type "y" for yes.

It will ask you to remove test database and access to it, type "y" for yes.

It will ask you to reload privilege tables, type "y" for yes.

Now we have a secure MySQL installation in place.

Installing Prerequisites For ownCloud

Before we can fully utilize 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

Ubuntu will install additional libraries, and now we have fulfilled all system requirements for ownCloud to function.

ownCloud uses Apache's .htaccess files (you can find more information on .htaccess here) for security purposes. However, in order to use them, we need to enable two apache modules and edit the apache configuration to allow for the .htaccess file.

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

The mentioned two modules are used for URL rewrite rules, that is, they help Apache2 rewrite URLs of a certain web site in a proper way. mod_headers module is used for controlling HTTP request and response headers.

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. Execute the following:

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

There, find "<Directory /var/www/>" section and change the following:

AllowOverride None

to

AllowOverride All

Hit Ctrl + X, then Y, and then Enter to save the changes.

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

sudo service apache2 restart

That’s it, proceed to the next step.

Downloading ownCloud Source Files and Installing ownCloud 5

Now we need to download the source files of ownCloud 5 and place them in the corresponding directory in order for a web server to be able to serve requests properly.

To download ownCloud 5.0.4 source files, execute the following:

wget http://download.owncloud.org/community/owncloud-latest.tar.bz2

It will download the latest version of ownCloud 5. Now we need to extract the archive. Execute the following:

tar -xjf owncloud-latest.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

Setting Up a MySQL Database

We're almost done, there's only one thing left to do before we begin installation - setting up a proper MySQL database.

First, 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:

CREATE DATABASE owncloud;

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.

Believe it or not, we're done! Type "quit" to exit MySQL interface and point your browser to http://fqdn-of-your-droplet.tld/owncloud to access ownCloud 5 installation.

Be sure to replace "fqdn-of-your-droplet.tld" with the actual FQDN of your droplet.

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.

You've reached the end of the tutorial! Enjoy your new ownCloud 5 installation.


Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.

Sign up
About the authors
Default avatar
Developer and author at DigitalOcean.

Still looking for an answer?

Was this helpful?
10 Comments

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

@Andrew SB

That did it! I appreciate the help!

@rrhino: Oh, sorry! I forgot that specific block was move out of that file into the main configuration file: /etc/apache2/apache2.conf:

<pre> <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> </pre>

And in /etc/apache2/sites-available/000-default.conf you’ll probably need to change

<pre> DocumentRoot /var/www/html </pre>

to

<pre> DocumentRoot /var/www </pre>

since that’s where you installed ownCloud to if you followed this tutorial.

@Andrew SB Thanks! It looks like that string worked. However, I do not see the AllowOverride after the /var/www/.

It’s laid out as, DocumentRoot /var/www/html

#Available loglevels" trace8, …, trace1, debug, info, notice ,warn, #error, crit,alert, emerg.

It is also possible to configure the loglevel for particular

#modules, e.g. #Loglevel info ssl:warn

etc…

@rrhino: Right, than the correct name of the conf file is what I posted above. So, edit it with:

<pre> sudo nano /etc/apache2/sites-available/000-default.conf </pre>

and change “AllowOverride None” to “AllowOverride All”

I’m using the latest ubuntu-14.04-server-amd64 build.

@rrhino: What version of Ubuntu are you running? On more recent version that file is named:

<pre> /etc/apache2/sites-available/000-default.conf </pre>

What am I doing wrong?

I’m at the part where I’m supposed to find “<Directory /var/www/>” section and change the following, AllowOverride None to AllowOverride All. But, I cannot find this location. When I launch the sudo nano /etc/apache2/sites-available/default I just see a blank screen.

i couldn’t find this bit in the default config files for apache2:

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

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

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

AllowOverride None

to

AllowOverride All

Hit Ctrl + X, then Y, and then Enter to save the changes.

-update i was able to create a 300gig partition on the other drive and mount it under the /var/www and install owncloud on that drive so now i limit myself to 300gigs ( i need a limit). The next thing i’m working on is setting up vsftpd to allow me access to /var/www directory to add/edit new website files along with owncloud data. right now i can only access user home folder through ftp client. is it possible to adjust permissions of the /var/www to allow ftp use as well as www-data… and maybe my user? is it possible to do this by creating and allowing a group with www-data, ftp and user1? is it necessary to adjust anything within vsftpd to gain access to /var/www? note: this is all for just my local/lan. i’m not worried about other users.