Tutorial

How To Setup ownCloud 5 On Ubuntu 12.10

Published on April 18, 2013
author

By Sági-Kazár Márk

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.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the author(s)

Category:
Tutorial

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
40 Comments
Leave a comment...

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!

I’ve had it running on Ubuntu for about six months or so & it works flawlessly. Also Gnome 3.8 now features ownCloud integration directly into the file system (it’s running OK on Fedora 19 Alpha RC4)…

There’s a syntax error in this article.

“Hit Ctrl + X and then Enter to save the changes.” This is not correct. It should say “Hit Ctrl + X, then y and then Enter to save the changes.”.

Perfect, thank you

Hi, new here… I’m a bit lost in this part… " 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." Can anybody help? Thanks

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
June 3, 2013

@emanon1978 that means you should type “quit” in the MySQL console to exit the console and browse to http://yourdomain.com to access ownCloud 5.

Hi, something has not worked for me. I’ve created a new droplet laghw01 with the application Wordpress on Ubuntu12.10 with a www.lagunaheadwaters.org. Then I’ve followed install instructions for Wordpress including editing nano /etc/apache2/sites-enabled/laghw01 Then installed postfix & phpmyadmin The wordpress installation comes up well Then I’ve installed ownCloud except for the apache_server^ which was already present So I think its being bypassed by wordpress defaulting to /home/wordpress/public_html . Any suggestions on how WordPress and ownCloud work together :) I was thinking of reading up on what I can do in /etc/apache2/sites-available or moving /var/ownCloud into /home/wordpress/public_html? Any suggestions greatly appreciated

Hi I got it working by creating nano /etc/apache2/sites-available/owncloud per http://www.nineproductions.com/owncloud-quick-setup-for-debian/

Automated updates can be obtain by using the package installation method as mentioned on the owncloud install page: http://owncloud.org/install/

openSUSE Build Service hosts the package repositories for all distributions: http://software.opensuse.org/download/package?project=isv:ownCloud:community&package=owncloud

The instructions above work great. Downloadable clients from owncloud.org work. As a cautionary tale, I went down the path of “aptget install owncloud”. Either a partial install or an older version was the result. Ended up deleting all of it out and just following the instructions above.

I did make one addition to the instructions above. I didn’t like user data piling up under /var/www/owncloud/data, so I switched the data directory to /var/lib/owncloud/data. Note that you have to change the /var/www/owncloud/config/config.php to correctly access this location and make sure UID and group are set to www-data.

I am also running davical just fine along side owncloud - both working fine (many comments in forums about webdav of one package interfering with another).

Instead of doing owncloud-5.0.4.tar.bz2 like the article shows, do owncloud-latest.tar.bz2 instead. As it speaks for itself, it will download the latest version of ownCloud. Would save the user time finding out the latest version.

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
August 9, 2013

Thanks TechKat! I’ve updated the article.

Owncloud now have packages.

Nothing is easier than apt-get install owncloud

http://software.opensuse.org/download/package?project=isv:ownCloud:community&package=owncloud

hi, i don’t have a domain name. but i do have a static ip… will that work or not ?

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
August 21, 2013

@Templ4r1995: Yes – it would work. Substitute all references of domain.com with your IP address and it should work fine.

sorry but i have another question when i run “wget http://download.owncloud.org/community/owncloud-latest.tar.bz2” the connection keeps timing out. so i decided to download the file on my windows pc and put it onto a flash. only to get slapped in the face by the challenge of copying something off a flash with no GUI. (i have almost no prior linux experience.) so is there a possible solution to my connection timing out when downloading the owncloud surce code ?

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
August 23, 2013

@Templ4r1995: Weird. Is this on a dedicated server? Take a look at this doc page:

https://help.ubuntu.com/community/Mount/USB#Manually_Mounting

I am running ubuntu server 12.0.4.2. But I am considering the possibility that the ISO I downloaded is corrupt. I looked at the guide of manually mounting but had no success. After trying wget about 20 times it finally downloaded. only to see after done with the whole guide, that my server isn’t running anything. I restarted my server and restarted apache and all that. and used “curl icanhazip.com” to find my external ip. There was nothing when I typed the ip into a web browser. The server couldn’t even ping itself so I am assuming something is very wrong. I guess this is what you get if your first dive into linux is trying to start up a server.

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
August 24, 2013

@Templ4r1995: Your server is most likely behind a router. Some routers drop ICMP packets (pings) so I doubt it’s an issue with your server.

Can you ping the server’s local IP from your computer?

Hi thanx Kamal for the great guide. i got the owncloud server running on a ubuntu 12 machine. So it would seem that something was wrong with my ubuntu server installation. I will re-attempt the process with ubuntu server at some point. Thanks alot.

How many memory does this program need? In 5 mins it ate all my 512 mb memory (only 1 user). What i made wrong?

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
October 25, 2013

@spy1991: You did nothing wrong. Apache + MySQL use up a lot of RAM so it will appear that all of the 512 megabytes of available memory are used. See <a href=“http://linuxatemyram.com”>linuxatemyram.com</a>.

Hi, when i go to this url http://fqdn-of-your-droplet.tld/owncloud on my browser it downloads a file instead?

the file includes this inside

<?php

/**

  • ownCloud
  • @author Frank Karlitschek
  • @copyright 2010 Frank Karlitschek karlitschek@kde.org
  • This library is free software; you can redistribute it and/or
  • modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  • License as published by the Free Software Foundation; either
  • version 3 of the License, or any later version.
  • This library is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  • You should have received a copy of the GNU Affero General Public
  • License along with this library. If not, see http://www.gnu.org/licenses/.

*/

$RUNTIME_NOAPPS = true; //no apps, yet

require_once ‘lib/base.php’;

OC::handleRequest();

no clue what that means

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
October 30, 2013

@jono1408: Is php installed?

<pre>sudo apt-get install php5</pre>

I can get to the OC page via the web, but I can’t get a Mac client to access it.

The server is running on Ubuntu 12.04. I’ve pored over the manuals, but I’m not a linux geek, so it’s not sinking in very well. Still, if the web page comes up, why can’t I get a Mac client to see it on the same subnet?

Ah, never mind. I didn’t follow the instructions properly. Gonna start over. ::-\

Having a little trouble and I think it is with the virtual host file. I can get to the default web page [IP] but when I try to go to IP/owncloud it keeps reforming the address to https://[name].local/owncloud and gives me an error of “Firefox can’t establish a connection to the server at [name].local”. When I try to access the page from another computer it say the requested URL was not on the server… Do I need to set up an .htaccess file? … I see there is already one in /var/www/owncloud…?

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
December 12, 2013

@jared: Add the following line to <strong>/etc/hosts</strong>: <pre>127.0.0.1 fqdn-of-your-droplet.tld</pre> (e.g. owncloud.yourdomain.com) <blockquote>Be sure to replace “fqdn-of-your-droplet.tld” with the actual FQDN of your droplet.</blockquote>

Then add the DNS record for owncloud.yourdomain.com.

I set up ownCloud 5 just fine on my droplet running Ubuntu Server 12.04. Is there an easy way to upgrade to version 6 without breaking anything? EB

I followed this tutorial -at least I think I did so- but cannot access the installation. When I go to MYIP/owncloud, I get this error: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName

I tried adding localhost to the various config files, and the error apparently went away. However, I still do not gain access to the owncloud directory. I restarted apache2, but that did nothing.

Note that I am not using a FQDN but the IP address.

Any ideas or advice?

Thanks for a straight forward tutorial. However, afterwards when I logged on to configure owncloud through the browser it won’t accept my username and password. “MySQL username and/or password not valid You need to enter either an existing account or the administrator.” Do you know what could be wrong?

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
December 27, 2013

@adam.svensson1: Well, did you double check that you’re entering the correct mysql credentials?

I’ve followed this awesome tutorial to the end and everything seemed to work. But when I tried to access owncloud on my browser (through my-IP-addr/owncloud) I got the following permissions error.

Forbidden

You don’t have permission to access /owncloud/ on this server. Apache/2.2.22 (Ubuntu) Server at 192.168.0.77 Port 80

I new at all this so this error has completely halted me. Can anyone help?

@Kamal It worked when I used root. I thought I could create a new MySql user and use those credentials. Thanks for pointing me in the right direction. Now I just have to figure out how to access Owncloud from outside the office router. Do you know what the port forwarding settings should be for Owncloud?

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
January 9, 2014

If I recall correctly you only need to forward ports 80 and 443.

Thanks for this great guide and helpful support! I’m up and running with Owncloud on Ubuntu Server 12.4 and successfully connected iPhone, iPad and my mac to it.

I got it working. Yay for me. When I go to the admin panel, it suggests setting it up as https. Is this tough to do? Any guides to help us less than proficient ones?

Arggh!!! Excellent walkthrough until the bit; 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.

I am guessing that 90% of people going through this have a home network without a fixed ip and without a domain. Droplets and FQDN are jargon people starting out like me do not understand (googled it, still fuzzy on droplets).

I have 3 servers at my workshop with 1.5TB of disk space sat on the end of a fibre line (70mb down 20mb up) I wanted to try this at home and get to grips with it first. How do I connect to the owncloud service running on the machine from another PC on my home network? Like I said, fantastic up until the thats it bit! If you could extend the walkthrough for other options at the end that would be a big help to lots of people as they start out on the cloud adventure. Like the poster above, they got it to work and can use as a valuable tool, a bit more detail and it will help a LOT more people. Thanks.

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.