ownCloud installed on Centos 6 with Apache and PHP

Home » Computer Articles » Linux » ownCloud installed on Centos 6 with Apache and PHP
March 2, 2013 Linux 2 Comments

Would you like to have your own Cloud? Or your own local storage that has clients etc, then maybe ownCloud is something you may want use. I like it for all the devices etc it supports.


Do a basic installation of Centos 6, I like to use the minimal install iso image.

Make sure that everything is up to date.

# yum update


Enable Additional Repositories

# rpm --import https://fedoraproject.org/static/0608B895.txt 
# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

If above doesn't work then go to the website above and check the epel-release number and change it to match.


Install yum priorities package

# yum install yum-priorities


Edit epel.repo file and add priorities entry.

# vi /etc/yum.repos.d/epel.repo and add priorities=10 just above gpgcheck=1.


Programs you will need for the ownCloud installation.

# yum install wget policycoreutils-python


Installation of 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 (Version installed was 4.5.7)

UPDATE, I just updated to Version 5 and they have changed the web interface and I noticed performance enhancements.

To update, run the # yum update command. This will update the system and ownCloud.


Edit /etc/httpd/conf/httpd.conf and change AllowOverride None and change to AllowOverride All


Start the web server and you can connect to ownCloud, put your ip address and then the owncloud directory.

# /etc/init.d/httpd start

Example: Load a web browser and connect to http://ip-address or domainname/owncloud then add an admin user and password. Now you have the ownCloud installed.

Download and setup a client on your workstation and test out. If the client asked you for location then put ip-address/owncloud and add your admin user and password. This would be just for testing. I would add some normal users and use them in production.


Some configuration options.

Edit the php.ini and change the upload parameters. If you try and upload some big files you could have some problems.

# vi /etc/php.ini and look for upload_max_filesize and post_max_size, put 1025M size for both of these.


Now you can edit another file so the ownCloud web interface reflects the update upload file size.

Where every you install ownCloud, look for .htaccess file and change php_value memory_limit 1024M. Now the web browser will show you that you can upload a bigger file size.


Do you want a redirect page instead of typing in the full URL.

Create this file in /var/www/html/index.php and add <?PHP header("Location: http://ip-address or domainname/owncloud"); exit ?>


Did you want to use a MySQL database. Then you will need to install the MySQL-Server and other applications. This is what I did to change to a   MySQL database.

# yum install mysql-server

# /etc/init.d/mysql start

# /usr/bin/mysql_secure_installation ( This will allow you to setup a password etc. More secure.)

Now you will need to login to the MySQL database and create a user, set a password and create a database.

# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.1.67 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE DATABASE owncloud;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON owncloud.* TO "mycloud"@"localhost";
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON owncloud.* TO "mycloud"@"localhost" IDENTIFIED BY "password";
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

mysql> exit

You should now have the database setup.

MySQL Performance Adjusts: There could be a lot more of course.



This is for systems around 2G of memory. Double for 4G of memory.


If you have already did I the installation and now want to change to the MySQL database.

# cd /var/www/html/owncloud/config

# mv config.php config.old

Go to the website site again and now choose to setup ownCloud with a MySQL database.


Performance Adjustments.

Install PHP cache.

# yum install php-pecl-apc

# vi /etc/php.d/apc.ini





Right away I noticed a good performance change with ownCloud. I really noticed the performance change with the photo gallery.Up the memory to whatever you environment needs. If you read about apc, there are more options etc.

Create a phpinfo.php to check that your php is setup the way you want. I setup one to make sure apc was working.

# /etc/init.d/httpd start

LDAP authentication to a Windows Active Directory Server.

In the ownCloud Admin area, click on Apps and enable LDAP user and group backend. I setup this way because I wanted to control the users I would allow access to ownCloud. So I created a ownCloud group and then put the users I wanted to give access.

Make sure you have the LDAP software installed.

# yum install php-ldap openldap-clients (Install client if you need to test from the command line.)

There is some other information that you may need. I already have my LDAP server setup for SSL etc. Which I will need to put more information here.

LDAP Page 1

Host: ldaps://hostname.domainname.com

Base: DC=domainname,DC=com

Name: ldapuser (Username with the permissions to query LDAP database)

Password: Password for user above.

User Login Filter: (&(sAMAccountName=%uid)(objectClass=person)(memberOf=CN=ownCloud,OU=ACL,DC=ad,DC=domainname,DC=com))

User List Filter: memberOf=CN=ownCloud_Access,OU=ACL,DC=ad,DC=domainname,DC=com

Group Filter: objectClass=Group

LDAP Page 2 - Advanced

Port: 636 (Since I setup with LDAPS earlier.)

Base User Tree: DC=ad,DC=domainname,DC=com

Base Group Tree: DC=ad,DC=domainname,DC=com

Group-Member assiciation: uniqueMember

Use TLS: null

Case Insensitive LDAP Server (Windows): Checked

Display Name Field: sAMAccountName

Group Display Name Field: cn

Quota Attribute: null

Quota Default: null or whatever you want.

Email Attribute: mail

Testing from the Linux command line.

# ldapsearch -D "cn=ldapuser,cn=users,dc=domainname.com" -b "ou=staff,dc=domainname.com" -H ldaps://servername.domainname.com -Z -w "password" objectclass=person

Of course there is a lot more you can do with this command. That would be another post.


ownCloud website, owncloud.org

Troubleshooting ownCloud, http://forum.owncloud.org/viewtopic.php?f=17&t=6526

Linuxaria website, http://linuxaria.com/recensioni/how-to-install-owncloud-on-your-linux-box?lang=en

PHP Cache, http://www.server-world.info/en/note?os=CentOS_6&p=httpd&f=8

Performance Improvements, http://support.atmail.com/display/DOCS/Performance+Improvements


On my Mac OS X computer, I received an error, owncloud csync failed to create a lock file. Searching on Google I found that I had to shutdown ownCloud application and delete the lock file under /Users/username/Library/Application Support/ownCloud, Started the ownCloud app. Everything should be back to normal.

On my Linux computer, I received a error, owncloud csync failed to create a lock file. Run command below to fix. Shutdown Owncloud and run this command, rm ~/.local/share/data/ownCloud/lock and restart owncloud client.

Share This:

2 Replies to “ownCloud installed on Centos 6 with Apache and PHP”

  1. Hello, I have been trying to get this to work for weeks now. I got owncloud installed as you said. And I got to this point:
    Edit /etc/httpd/conf/httpd.conf and change AllowOverride None and change to AllowOverride All

    Start the web server and you can connect to ownCloud, put your ip address and then the owncloud directory.

    # /etc/init.d/httpd start

    And when I put or into a browser it says problem loading page.

    Like always it says that. I can get debian to work, but my friend needs centos for it's extra drivers that it installs.

    I did a minimal install of centos 6.4

    Any idea on what I need to do to get this to work?

    Thank You

    1. Hello, Question for you? is the iptables firewall running? at a prompt type iptables -nL. Do you see some rules(See below). If so, type /etc/init.d/iptables stop or service iptables stop. Then try to connect to your web server again.

      # iptables -nL
      Chain INPUT (policy ACCEPT)
      target prot opt source destination

      Chain FORWARD (policy ACCEPT)
      target prot opt source destination

      Chain OUTPUT (policy ACCEPT)
      target prot opt source destination

      This means the firewall isn't blocking anything.

Leave a Reply

Your email address will not be published. Required fields are marked *