DEV Community

Ersin KOÇ
Ersin KOÇ

Posted on

How to Install and Configure ownCloud on CentOS 9 Stream

Prerequisites

Before starting the installation, make sure you have:

  • A KVM-based NVMe VPS from EcoStack Cloud running CentOS 9 Stream.
  • A user account with sudo privileges.

Step 1: Update the System

Start by updating your system to ensure all packages are current.

sudo dnf update -y
Enter fullscreen mode Exit fullscreen mode

Step 2: Install Required Packages

Install the necessary packages for running ownCloud. These include Apache, MariaDB, PHP, and additional modules.

sudo dnf install httpd mariadb-server mariadb php php-mysqlnd php-xml php-json php-mbstring php-gd php-curl php-intl php-zip wget unzip -y
Enter fullscreen mode Exit fullscreen mode

Step 3: Start and Enable Apache and MariaDB

Enable and start the Apache and MariaDB services.

sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl start mariadb
sudo systemctl enable mariadb
Enter fullscreen mode Exit fullscreen mode

Step 4: Secure MariaDB Installation

Run the security script to set up a root password and secure your MariaDB installation.

sudo mysql_secure_installation
Enter fullscreen mode Exit fullscreen mode

Follow the prompts to set the root password and remove anonymous users, disallow root login remotely, and remove the test database.

Step 5: Create a Database for ownCloud

Log in to MariaDB and create a database and user for ownCloud.

sudo mysql -u root -p
Enter fullscreen mode Exit fullscreen mode

In the MariaDB shell, execute the following commands:

CREATE DATABASE owncloud;
CREATE USER 'ownclouduser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON owncloud.* TO 'ownclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Enter fullscreen mode Exit fullscreen mode

Replace your_password with a strong password.

Step 6: Download and Install ownCloud

Download the latest version of ownCloud from its official website.

wget https://download.owncloud.org/community/owncloud-complete-latest.zip
Enter fullscreen mode Exit fullscreen mode

Extract the downloaded archive and move it to the Apache web root directory.

unzip owncloud-complete-latest.zip
sudo mv owncloud /var/www/html/
Enter fullscreen mode Exit fullscreen mode

Step 7: Set Permissions

Set the appropriate permissions to ensure ownCloud can read and write to its files and directories.

sudo chown -R apache:apache /var/www/html/owncloud/
sudo chmod -R 755 /var/www/html/owncloud/
Enter fullscreen mode Exit fullscreen mode

Step 8: Configure Apache for ownCloud

Create a new Apache configuration file for ownCloud.

sudo nano /etc/httpd/conf.d/owncloud.conf
Enter fullscreen mode Exit fullscreen mode

Add the following configuration:

<VirtualHost *:80>
    DocumentRoot "/var/www/html/owncloud"
    ServerName your_server_ip_or_domain

    <Directory "/var/www/html/owncloud">
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog /var/log/httpd/owncloud-error_log
    CustomLog /var/log/httpd/owncloud-access_log combined
</VirtualHost>
Enter fullscreen mode Exit fullscreen mode

Replace your_server_ip_or_domain with your server’s IP address or domain name. Save and close the file.

Step 9: Adjust Firewall Settings

Allow HTTP traffic through the firewall.

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload
Enter fullscreen mode Exit fullscreen mode

Step 10: Restart Apache

Restart Apache to apply the changes.

sudo systemctl restart httpd
Enter fullscreen mode Exit fullscreen mode

Step 11: Complete the Installation via Web Browser

Open your web browser and navigate to http://your_server_ip_or_domain/owncloud. You will see the ownCloud setup page.

  • Create an admin account by filling in the required details.
  • Enter the database details:
    • Database user: ownclouduser
    • Database password: The password you set earlier
    • Database name: owncloud
    • Database host: localhost

Click "Finish Setup" to complete the installation.


Conclusion

You have successfully installed and configured ownCloud on CentOS 9 Stream with EcoStack Cloud. You can now use your own cloud storage solution to manage and share your files securely.

For more details and advanced configurations, check out the official ownCloud documentation.

Top comments (0)