Installing and Configuring ownCloud on CentOS Stream 8

Select distribution:
Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Create a Linode account to try this guide with a $ credit.
This credit will be applied to any valid services used during your first  days.

What is ownCloud?

With ownCloud you can host a private cloud for data synchronization, file storage, and file sharing. You can use ownCloud as an alternative to commercial services like DropBox or Box. This software is great for secure collaboration across your projects and teams.

ownCloud has plenty of compelling features:

  • Versioning: A file history permits you to roll back to a previous version.
  • Encryption: ownCloud protects user data in transit; when it’s transmitted between client and server.
  • Drag and drop upload: Drag files from your desktop file manager to your ownCloud instance.
  • Theming: Change the look of your ownCloud instance.
  • Viewing ODF files: You can view Open Document Format files such as .odt documents and .ods spreadsheets.
  • Expansion via installable applications: From within the ownCloud Marketplace , you can install a number of official and third party applications.
  • A mobile app for Android and iOS : Mobile apps allow you to interact with your ownCloud server, such as for syncing, uploading, downloading, and viewing files.

Why would you want to host your own cloud? Some common reasons are:

  • To save sensitive data, but not on a third-party, commercial option.
  • You work from home and you need a private cloud to be used only by those in your household.
  • You own a small business and want to keep everything in-house.
  • You need an expandable storage solution.

This tutorial walks you through the steps to install ownCloud on CentOS Stream 8 . There are only a few steps to install ownCloud on CentOS Stream 8. You install the LAMP (Linux Apache MySQL/MariaDB PHP) stack ; create a database and database user; configure Apache; and set up ownCloud using its graphical user interface.

Note
To automatically install ownCloud on a Compute Instance, consider deploying ownCloud Server through the Linode Marketplace .

Before You Begin

  1. If you have not already done so, create a Linode account and Compute Instance. See our Getting Started with Linode and Creating a Compute Instance guides.

  2. Follow our Setting Up and Securing a Compute Instance guide to update your system. You may also wish to set the timezone, configure your hostname, create a limited user account, and harden SSH access.

Note
If you have a registered domain name that you want to point to your ownCloud instance, then use the Linode DNS Manager to point the domain to the Linode server on which you plan to install ownCloud. If you do not have a registered domain name, then replace example.com with the IP address of the Linode server when following the steps in the Create an Apache Configuration File section.

Install ownCloud

Install the LAMP Stack

Install the Apache Web Server

ownCloud requires a full LAMP (Linux, Apache, MySQL, PHP) stack. In this section, you complete the steps to install a LAMP stack on your Linode. Although you don’t have to use Apache as the web server, the ownCloud developers highly recommend it over web servers like NGINX and lightHTTP.

  1. Install the Apache web server:

    sudo dnf install httpd httpd-tools -y
  2. When the installation is complete, enable and start Apache:

    sudo systemctl start httpd
    sudo systemctl enable httpd
  3. Configure FirewallD to Allow HTTP and HTTPS Connections

    sudo firewall-cmd --permanent --zone=public --add-service=http
    sudo firewall-cmd --permanent --zone=public --add-service=https
    sudo firewall-cmd --reload
  4. Ensure you can reach the Apache server. Open a web browser, and enter in your Linode’s IP address . For example, enter in http://192.0.2.0 and replace the IP address with your own. You should see the Apache welcome page.

Install MariaDB

  1. Install MariaDB:

    sudo dnf install mariadb-server mariadb -y
  2. Start and enable the database:

    sudo systemctl start mariadb
    sudo systemctl enable mariadb
  3. Set a MariaDB admin password and secure the installation. The command includes mysql even though we use MariaDB.

    sudo mysql_secure_installation

    You will be given the choice to change the MariaDB root password, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases. It is recommended that you answer yes to these options. You can read more about the script in the MariaDB Knowledge Base .

Install PHP

So far, you have installed the Apache web server, and MariaDB. Next up is the programming language, PHP 7.4.

  1. Add the EPEL repository to install the current version of PHP:

    sudo dnf install epel-release -y
  2. CentOS Stream installs PHP 7.2 by default, but PHP 7.4 (or higher) is required to use ownCloud. This requires a few steps. First, reset the PHP modules:

    sudo dnf module reset php
  3. Enable PHP 7.4:

    sudo dnf module enable php:7.4
  4. Install PHP and all the required PHP modules:

    sudo dnf install php php-opcache php-gd php-curl php-mysqlnd php-intl php-json php-ldap php-mbstring php-mysqlnd php-xml php-zip -y
  5. Restart and enable the PHP Fast Process Manager (PHP-FPM):

    sudo systemctl start php-fpm
    sudo systemctl enable php-fpm
  6. Enable SELinux to allow Apache to execute PHP code via PHP-FPM.:

    sudo setsebool -P httpd_execmem 1

Create the ownCloud Database

Now that you have installed the prerequisites, it’s time to create the ownCloud database and user. The commands in this section are issued from within the MariaDB console.

  1. Access the MariaDB console:

    sudo mysql -u root -p
  2. Create your ownCloud database:

    CREATE DATABASE ownclouddb;
  3. Create a new user with the necessary privileges, including a strong and unique password. Be sure to substitute PASSWORD with your own password:

    GRANT ALL ON ownclouddb.* TO 'ownclouduser'@'localhost' IDENTIFIED BY 'PASSWORD';
  4. Flush your database’s privileges:

    FLUSH PRIVILEGES;
  5. Finally, exit the database console:

    exit

Download ownCloud

At this point, the system is ready for ownCloud. Before you actually download the software, check the ownCloud downloads page to confirm the most recent version.

  1. Install the wget utility:

    sudo yum install wget
  2. Download the latest version of ownCloud. As of writing this guide, the latest version is 10.11.

    wget https://download.owncloud.com/server/stable/owncloud-complete-latest.tar.bz2
  3. Extract the downloaded file:

    tar -xjf owncloud-complete-latest.tar.bz2
  4. When you extract the file, a new directory named owncloud is created. Move the new directory to the Apache document root. This example uses the default directory for Apache site files:

    sudo mv owncloud /var/www/html/
  5. Change the ownership of the owncloud directory:

    sudo chown -R apache: /var/www/html/owncloud

Create an Apache Configuration File

Apache requires a virtual host configuration file in order to server your ownCloud instance to the web.

  1. Create an Apache configuration file using the Nano text editor:

    sudo nano /etc/httpd/conf.d/owncloud.conf
  2. Paste the following text into the new file. Replace mentions of example.com with your own domain name or your Linode’s IP Address :

    File: etc/httpd/conf.d/owncloud.conf
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    
    Alias /owncloud "/var/www/html/owncloud/"
    <Directory /var/www/html/owncloud/>
      Options +FollowSymlinks
      AllowOverride All
    
    <IfModule mod_dav.c>
      Dav off
    </IfModule>
    
    SetEnv HOME /var/www/html/owncloud
    SetEnv HTTP_HOME /var/www/html/owncloud
    
    </Directory>
  3. Save and close the file by typing Ctrl + O and then Ctrl + X.

  4. Restart the Apache server:

    sudo systemctl restart httpd
  5. Make sure that the Apache web server can write to the ownCloud directory:

    sudo setsebool -P httpd_unified 1

Configure ownCloud

This section covers the web-based portion of the installation.

  1. Open a web browser and navigate to your site’s domain, if it has been configured to use a domain name like, http://example.com/owncloud. If you configured Apache to point to your server’s IP address, navigate to http://192.0.2.0/owncloud and replace the example IP address with your own. You should see the ownCloud web-based installer.

    Troubleshooting SELinux

    If you encounter permissions errors when navigating to your ownCloud instance in the web browser, it means you need to configure the SELinux. You can do so with the following commands:

    su
    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/apps-external(/.*)?'
    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/'
    exit

    If you continue to experience issues, you can temporarily disable SELinux.

    sudo setenforce 0

    Refer to the A Beginner’s Guide to SELinux on CentOS 8 guide to learn more about SELinux.

  2. Once you access the web-based installer, type a username and password for the admin user; click the Storage & Database drop-down; and then click MySQL/MariaDB.

  3. The database information section is now available. Enter the following information:

    • Database User: ownclouduser
    • Database password: the password you set for the ownCloud database user
    • Database: ownclouddb
    • Localhost: leave as the default

    The database details section for the ownCloud installation

  4. Click Finish setup. When the install completes, the ownCloud login page appears. Login with the newly-created admin credentials. Once logged in, you are taken to the main ownCloud page.

You now have a working instance of ownCloud, running on CentOS 8 Stream.

This page was originally published on


Your Feedback Is Important

Let us know if this guide was helpful to you.


Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.
The Disqus commenting system for Linode Docs requires the acceptance of Functional Cookies, which allow us to analyze site usage so we can measure and improve performance. To view and create comments for this article, please update your Cookie Preferences on this website and refresh this web page. Please note: You must have JavaScript enabled in your browser.