It is becoming more and more common to read and hear about security breaches from companies that handle vital user information on the Internet, and this makes many people wonder whether it is so necessary to trust these giant companies.
Another important issue is that these large companies do not take the issue of privacy seriously and their handling of user files and information is at least questionable.
Therefore, many users and small businesses prefer to invest in infrastructure that allows them to have their private cloud. At the software level, owncloud is emerging as the most important solution in this matter.
OwnCloud is a software that allows us to create a private cloud with which you can synchronize files, calendar, contacts, notes and more using extensions. It’s free, open source and has an application for Android, iOS and desktop client for Linux, Windows and Mac OS X.
Installing OwnCloud on our CentOS 7 server
1.-Upgrading the system
Normally when starting an installation process for this type of application, we need to update the system. For that:
           sudo -i
Enter your password and you will be a root user
           yum update
Once this is done, we can continue with the installation with the certainty of having all the security updates available.
2.-Installing Apache
In order to run it, a web server is required, in this case we will install apache.
               yum install httpd
Now we must start the service and enable it to run when the system starts.
           systemctl start httpd
and:
          systemctl enable httpd
For all this to work, we have to open the http ports in the firewall:
            firewall-cmd –permanent –zone=public –add-service=http
and:
           firewall-cmd –permanent –zone=public –add-service=https
Finally:
          firewall-cmd –reload
When accessing from our favorite web browser, to the server ip, we should see the apache test page, indicating that the process has been done correctly.
             http://IP_SERVER
3.-It is now up to MariaDB
Owncloud requires a DBMS and the one chosen in this case is MariaDB. We proceed to install it:
             yum install mariadb-server mariadb
As with apache, you need to activate and enable the service.
            systemctl start mariadb
and:
           systemctl enable mariadb
Next we’ll use the configuration script to set root password and more.
              mysql_secure_installation
To the questions we will answer: Y,n,y,y,y
The next thing is to create the database that will use owncloud, for this we access the MariaDB console.
           mysql -u root -p
And once inside, we execute the sentence:
            CREATE DATABASE owncloud;
Then we’ll create the user that will have permissions on that database.
             GRANT ALL PRIVILEGES ON owncloud.* TO ‘ownclouduser’@’localhost’ IDENTIFIED BY ‘owncloudpss’;
Don’t forget to change your username and password. Now we refresh the permissions and exit the mariadb console.
             FLUSH PRIVILEGES;
             exit;
4.-Adding owncloud repository
Before adding the owncloud repository, we must activate the EPEL repository and install some dependencies:
            yum install wget
Next:
            wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
And we proceed to install the downloaded package:
            rpm -Uvh epel-release-latest-7.noarch.rpm
Now, we checked that the repository was added correctly.
           yum repolist
As we can see it has been added correctly.
With EPEL added we can install some OwnCloud dependencies:
           yum –enablerepo=epel -y install php php-pear-MDB2-Driver-mysqli php-pear-Net-Curl
As we can see, these dependencies include php.
Now we proceed to add the Owncloud repository:
wget http://download.owncloud.org/download/repositories/stable/CentOS_7/ce:stable.repo -P /etc/yum.repos.d
And we proceed to install it:
      yum -y install owncloud         Â
Finally, we restart Apache.
           systemctl restart httpd
If we have SELINUX Enabler we must run these commands to give owncloud permissions.
            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/config
            restorecon /var/www/html/owncloud/apps
            restorecon /var/www/html/owncloud/config
At this point, if we try to access the web interface, we will encounter this error:
It tells us the bug that we need to upgrade php to a higher version but not 7.3.
5.-Upgrading php
As it was said, we need to update the version of php that comes in CentOS. First we add the REMI repository:
             yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
We must also install the package yum-utils
              yum install yum-utils
Now we enable the repository and update the system:
           yum-config-manager –enable remi-php72
and:
           yum update
We install the necessary php modules for owncloud:
             yum install php-gd php-zip php-mbstring php-intl
As we can see, php is updated with the command. Then, we restart Apache.
             systemctl restart httpd
6.-Completing the installation through the web interface
At this point we can complete the configuration from the web browser:
            http://IP_SERVER/owncloud
And we introduce the parameters of mariadb that we have done before. In addition to creating the administrator account.
Once the process is complete, you will be asked for your password to enter the application.
We enter the username and password and the application is displayed as such.
And owncloud is already installed and we can start to take advantage of it.
Owncloud is important for many small and medium businesses that do not want to have their files entrusted to third parties with the advantage of being the full owner of the privacy of the server that contains them.
Don’t forget to share this article through social networks.