August 30, 2013

ownCloud with Apache, SSL, and MariaDB on CentOS 6.4 X64

 Here is the procedure for installing ownCloud on CentOS 6.4 x64

1. Install CentOS 6.4 x64 from media.
2. Add repositories: rpm -Uvh | rpm –Uvh 
3. Create a repository for MariaDB: vi /etc/yum.repos.d/MariaDB.repo
# MariaDB 5.5 CentOS repository list - created 2013-08-30 14:03 UTC
name = MariaDB
baseurl =

4. Let’s get some packages: yum update –y | yum install –y httpd php MariaDB-server MariaDB-client php-mysql apr-util-ldap mailcap ntp ntpdate php-cli php-gd php-mbstring php-pear php-pear-MDB2 php-pear-MDB2-Driver-mysqli php-pear-Net-Curl php-process php-xml samba-client mod_ssl

5. Start services set to start on boot: chkconfig httpd on | service httpd start | chkconfig mysql on | service mysql start

6. Secure MariaDB: mysql_secure_installation

7. Create a database and user for ownCloud: mysql –u root –p

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON owncloud.* TO 'username'@'localhost' IDENTIFIED BY 'password';
8. Download the ownCloud repository and install ownCloud:
cd /etc/yum.repos.d
yum install owncloud
9. Configure ownCloud to use MariaDB: vi /var/www/html/owncloud/config/config.php
 "dbtype"        => "mysql",
  "dbname"        => "owncloud",
  "dbuser"        => "username",
  "dbpassword"    => "password",
  "dbhost"        => "localhost",
  "dbtableprefix" => "",
10. Create a self-signed SSL certificate for the site: mkdir /etc/ssl/Apache | cd /etc/ssl/apache  | openssl genrsa –out 2048 | openssl req –new –key –out | openssl x509 –req –days 365 –in –signkey –out
11. Create a virtual host on Apache for our SSL certificate: vi /etc/httpd/conf.d/owncloud-ssl.conf

LoadModule ssl_module modules/
Listen 443

<VirtualHost *:80>
      Redirect /
<VirtualHost *:443>
      SSLEngine on
      SSLCertificateFile /etc/ssl/Apache/
      SSLCertificateKeyFile /etc/ssl/Apache/
      DocumentRoot /var/www/html/owncloud
12. Move an unused Apache config files:
cd /etc/httpd/conf.d
mv ssl.conf ssl.conf.bak
mv welcome.conf welcome.conf.bak
13. Restart Apache and log into ownCloud:
service httpd restart

No comments:

Post a Comment