How to Install OwnCloud on CentOS 7

Try it in our public cloud & Get $5 Credit
CLAIM NOW

Owncloud is like a self-hosted Dropbox and Google Apps clone. It can synchronize files, contacts and calendars between computers and mobile devices. Addons allow for real-time, collaborative document editing. If you’re looking for a security-conscious, private alternative to Dropbox, give Owncloud a shot and see if it meets your needs.

Getting Started

To complete this guide, you will need the following:
• 1 Node (Cloud Server or Dedicated Server) with a clean CentOS 7 installed.

If you don't want to go through the whole installation of OwnCloud on your CentOS 7 server, you can always try our One-Click Apps and get a new OwnCloud instance in seconds.

Tutorial

We’ll start by applying all CentOS 7 updates, pulling in security patches and other bugfixes before continuing with the installation. This step should be performed regularly to keep your Owncloud installation secure and up-to-date.

yum -y update && shutdown -r now

We need to disable SELinux before continuing. SELinux enhances system security, but is difficult to work with and requires indepth knowledge to use effectively.

setenforce 0
sed -i 's/enforcing/disabled/' /etc/sysconfig/selinux

Owncloud works with a variety of databases. For this installation we’ll use MariaDB, the community MySQL fork. Let’s install and secure MariaDB.

yum -y install wget nano mariadb-server php-mysql
systemctl start mariadb.service
mysql_secure_installation

To install Owncloud itself, we need to enable its package repository.

cd /etc/yum.repos.d/
wget http://download.opensuse.org/repositories/isv:ownCloud:community/CentOS_7/isv:ownCloud:community.repo
yum -y update

Now we install the package. This process should also be done regularly as it will install future updates.

yum -y install owncloud

Apache needs read and write access to Owncloud’s root directory so it can synchronize files and other data. We’ll now grant that, then start the Apache server.

chown -R apache.apache /var/www/html/owncloud/
systemctl start httpd.service

Apache and MariaDB must be set up to launch at boot. Without this, your Owncloud server must be started manually every time your server starts up, which is undesirable for a file synchronization service.

systemctl enable mariadb.service
systemctl enable httpd.service

Owncloud needs a database to run. We’ll create that now, along with a user having all database access privileges.

mysql -u root -p
MariaDB> CREATE DATABASE owncloud;
MariaDB> CREATE USER 'cloud'@'localhost' IDENTIFIED BY 'cloudpassword';
MariaDB> GRANT ALL PRIVILEGES ON owncloud.* TO 'cloud'@'localhost';
MariaDB> FLUSH PRIVILEGES;
MariaDB> exit

The final step is done on the web, the installer. Visit http://your_ip/owncloud to perform this task.

First, set your username and password. These credentials are what you will use to synchronize files, contacts and calendars. This user is also an administrator, meaning it can change settings and create extra users.

For the database server, choose MySQL/MariaDB.

Now you’ll enter your database credentials, along with the database name.

Once complete, you’ll see your main page, with links to the clients and apps you’ll need to continue.

Conclusion

You now have a system that can synchronize all your files and contacts. With client apps available for most operating systems and mobile platforms, it is easy to synchronize everything on your own private, secure infrastructure. If this guide was helpful to you, kindly share it with others who may also be interested.