CentOS is a powerful Linux distribution and its perfect for server. This tutorial I will show you how I create my Owncloud Server using CentOS 7.3 Server. Installing Owncloud on CentOS needs few command line execution but don’t worry, I will try to explain every steps I took here with example. I hope at the end of this post, you will be able to power up your own Owncloud server on your local network or in the real cloud environment.
Steps to install Owncloud on CentOS 7.3
Step 1. Install LAMP Server
I have created a special tutorial to install LAMP Stack on CentOS 7.3 Server. You may also watch the following video to install LAMP Server on CentOS 7.3
Step 2. Prepare installation for Owncloud
If you follow my tutorial above to install LAMP Stack on CentOS 7.3, we still need to install some additional packages to our system prior to Owncloud installation.
Install additional PHP modules
yum install php-gd php-intl php-mbstring php-process php-xml
Install Owncloud
rpm --import https://download.owncloud.org/download/repositories/stable/CentOS_7/repodata/repomd.xml.key wget http://download.owncloud.org/download/repositories/stable/CentOS_7/ce:stable.repo -O /etc/yum.repos.d/ce:stable.repo yum clean expire-cache yum install owncloud
Step 3. Create Owncloud Database
We need to create a new database for Owncloud.
[root@localhost ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 68 Server version: 5.5.52-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> CREATE DATABASE owncloud_db; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> CREATE USER 'dhani'@'localhost' IDENTIFIED BY '12345678'; Query OK, 0 rows affected (0.02 sec) MariaDB [(none)]> GRANT ALL ON owncloud_db.* TO 'dhani'@'localhost' IDENTIFIED BY '12345678'; Query OK, 0 rows affected (0.02 sec) MariaDB [(none)]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> EXIT; Bye
Step 4. Configure SELINUX on CentOS
By default, SELINUX is enabled on CentOS 7.3. We need to do some tweak to the owncloud installation to work with SELINUX. If not, you will get the following permission error when opening Owncloud web interface.
To fix this, run the following commands as root
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/data(/.*)?' semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/config(/.*)?' semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps(/.*)?' semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/assets(/.*)?' semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/.htaccess' semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/.user.ini' restorecon -Rv '/var/www/html/owncloud/'
Don’t forget to change the owncloud directory if you installed it on different location. For more information about this permission and SELINUX on Owncloud, please visit this page.
Now we can start configure Owncloud via web browser.
http://ip-address/owncloud
Follow on screen installation wizard. You will be asked to enter the MySQL database, user and password we created earlier.