Install ownCloud on CentOS 6.4 x86_64

As you may know ownCloud is a wonderful FREE online storage platform that can be install in any kind of environment without those annoying restrictions of max file size, total storage and bandwidth constraints. It can be deployed on almost any box you may have laying around for a quick online storage system. Being free and early in stage it has its minor/major issues when trying to get out its full potential, along the way I’ve done multiple installations trying to make this work as flawless as possible and here is a complete guide on how to install it on CentOS 6.4.

Lets start by assuming you already have a web server running on Centos 6.4 with PHP 5.5 (Important that you have this version), if not then refer to these online guides on how to do so.

CentOS 6.4 Install Guide

PHP 5.5 Install Guide

Webserver Guide

Once you have your webserver up and running we can continue with our installation of ownCloud.

To install ownCloud

cd /etc/yum.repos.d/
wget http://download.opensuse.org/repositories/isv:ownCloud:community/CentOS_CentOS-6/isv:ownCloud:community.repo
yum install owncloud


Great it won’t install (missing dependency)

Error: Package: owncloud-5.0.7-4.1.noarch (isv_ownCloud_community)
           Requires: php-pear-Net-Curl
Error: Package: owncloud-5.0.7-4.1.noarch (isv_ownCloud_community)
           Requires: php-pear-MDB2-Driver-mysqli
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Install missing repo

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install owncloud

Awesome ownCloud was installed successfully now to do a post-install

Now point your browser to your server’s IP (if you don’t know it run ifconfig)

https://your_ip/owncloud

If for some reason your server doesn’t resolve you might have an iptables problem, follow this guide on how to work iptables magic
iptables Guide

Once your server resolves and can see the ownCloud login page follow these instructions.

In the case you get an error when loading ownCloud like this one

PHP module mb multibyte not installed

It’s saying that PHP has a missing module called php5-mbstring it can be fixed by simply restarting the apache server

service httpd restart

Reload the ownCloud page and you should now see the initial installation (ignore any PHP version warnings).

Proceed to create a username and password for admin account. Before submitting check under the “Advanced” dropdown for additional settings such as where is your data going to be stored? and if you would like to use SQLite or MySQL

For this tutorial I will leave the data folder to default, however, I will choose MySQL to complicate things a bit more.

For a faster deployment you may want to use SQLite.

If you decide to use MySQL you will first need to create a database for ownCloud, to do so you can do it two ways, bash OR phpMyAdmin To install phpMyAdmin follow these instructions:

yum install phpMyAdmin

Then edit the file /etc/httpd/conf.d/phpMyAdmin.conf
And edit the lines after

<IfModule !mod_authz_core.c>

To look like this

<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Allow from All
</IfModule>

Then restart apache server

service httpd restart

Go to

http://your_ip/phpMyAdmin

And create a database, for this tutorial I’ve created a db named “owncloud”

Once you’ve created the db go ahead enter the info to the owncloud initial installation settings and click “Finish setup”

Finally we have a working ownCloud instance!

But wait, there’s more…

As of right now you can use it and it will work fine, the hard part begins now if you would like to get an important feature to work correctly.
Lets say you upload a 2MB file, it goes through right? Try it.

Ok great it went through, but lets say now you want to upload a 10GB video file(or any other format). Try it.

Something wrong? It didn’t go through right? For two reasons:

1. Our current configuration only allows for max file size of 513MB files
2. We’ll get to this one later.

To increase our maximum file size we must configure an .htaccess file located in the owncloud installation folder.
Navigate to

cd /var/www/html/owncloud
vi .htaccess

And change the values for

php_value upload_max_filesize 513M
php_value post_max_size 513M
php_value memory_limit 512M

To your desired/limitation values
1G,2G,10G,… you get the point

Save the file and restart apache server

On the upload file button the label should have changed to your now updated values.

The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form

Lets try that 10G file upload again.

Problem?

At this point you probably got a warning saying

MAX_FILE_SIZE_err

To fix this you will actually be modifying some php code from owncloud. Go ahead and navigate to this dir

cd /var/www/html/owncloud/apps/files/templates
vi index.php

Now html-comment out this line

<!--<input type="hidden" name="MAX_FILE_SIZE" id="max_upload"
           value="<?php p($_['uploadMaxFilesize']) ?>">-->

Save file and reload

Try uploading the 10GB file again.

Now we don’t get this error but the file never finishes uploading (spinning thing going on forever). So what is the issue now you ask?
The issue is the MySQL timesout on these huge files which is the reason they don’t go through.

To fix this add this after the php_value memory_limit line in the .htaccess file in the ownCloud installation folder again.

php_value max_input_time -1
php_value max_execution_time 60000
php_value default_socket_timeout 60000
php_value mysql.connect_timeout -1

Save and reload apache server.
Try re-uploading the 10G file and watch as it magically works

success

  • Sam

    Great post Francisco,

    I installed owncloud in Fedora but when I go to the site is showing me “Can’t write into config directory config” I googled it and they said set user apache as owner for /owncloud folder, I did that but nothing, I also gave 777 permissions to the whole folder but nothing is working so far… any suggestion??

  • steve

    Would you be interested in doing a quick install for me?

  • After installing I am getting: https:///owncloud/index.php how do I make mod_rewrite work with centos? I am new to this OS, and the normal ways (/etc/apache/sites-enabled) doesn’t exist.

    Any assistance would be great

  • lenny

    I like your tutorial but you’re missing one part: ssl installation.
    How you get to come to https://your_ip/owncloud without installation/configuration of ssl and virtual host for the site?

  • Pingback: Roll your ownCloud on CentOS 6.5 w/ SSL | The Deer Press()

  • Victor Alfredo C├írabez Barajas

    this works on CentOS 5.10 too?