středa 29. ledna 2014

CentOS based ownCloud

ownCloud seems to be a promising piece of sw, it allows to run your own cloud-like repository. 

Installation:
1. apache web server and some additional modules
yum install php-pear


2. ssl for apache - see the official guide. Remember to specify the  "Common Name" in the self-signed certificate.  Enter your official domain name here or, if you don't have one yet, your site's IP address. Incorrectly set up SSL certificate makes big troubles.

3. install the ownCloud server using repository and yum (using "packages"). It installs all dependencies, in opposite to the web install and tar install.
It is necessary to have the epel repository availabe and active.

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm

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

4. correct the paths in /etc/httpd/conf.d/owncloud.conf a /etc/httpd/conf.d/ssl.conf

Client: linux client requires https: connection and correct SSL certificate

Update:

Create database:
create database owncloud;
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
grant all privileges on owncloud.* to 'user'@'localhost' ;
FLUSH PRIVILEGES;


Update:

Move owncloud installation from the default place:
mount /dev/BIGdevice /srv
service httpd stop
cp -a --preserve=context owncloud /srv
chcon -Rv --type=httpd_sys_content_t /srv/owncloud



edit configs:
change DocumentRoot in /etc/httpd/conf.d/owncloud.conf
DocumentRoot "/srv/owncloud"

change 'datadirectory' in /srv/owncloud/config/config.php
'datadirectory' = '/srv/owncloud/data'

service httpd start

From the README.SELinux:
# semanage fcontext -a -t httpd_sys_rw_content_t '/srv/owncloud/data'
# restorecon '/srv/owncloud/data'
# semanage fcontext -a -t httpd_sys_rw_content_t '/srv/owncloud/config'
# restorecon '/srv/owncloud/config'



Update 2014-10-01:
If you see error: Your data directory and your files are probably accessible from the internet. The .htaccess file is not working. We strongly suggest that you configure your webserver in a way that the data directory is no longer accessible or you move the data directory outside the webserver document root. , add following to the httpd.conf
 
<Directory "/var/www/html/owncloud/">
      AllowOverride all
</Directory>