OwnCloud

How To Install and Configure OwnCloud on Ubuntu 24.04 Or Newer

Welcome to the Greenhost.cloud blog! Today, we’re diving into the world of self-hosted cloud storage solutions with a comprehensive guide on installing and configuring OwnCloud on Ubuntu 24.04 or newer. OwnCloud is a powerful platform that allows you to store, sync, and share files securely online, giving you complete control over your data. Let’s get started!

What is OwnCloud?

OwnCloud is an open-source software suite that provides file storage, sharing, and collaboration features similar to popular cloud services like Dropbox or Google Drive. One of its biggest advantages is that it can be hosted on your own servers, ensuring that you maintain full control over your files and privacy.

Prerequisites

Before we begin, ensure you have:

  • A server running Ubuntu 24.04 or newer.
  • A non-root user with sudo privileges.
  • A LAMP stack (Linux, Apache, MySQL/MariaDB, PHP) installed on your server.
  • Basic knowledge of using the command line.

Step 1: Update Your System

First, it’s a good practice to update your package lists and upgrade any outdated packages:

sudo apt update
sudo apt upgrade -y

Step 2: Install Required Packages

Next, install the necessary PHP extensions and other dependencies for OwnCloud:

sudo apt install apache2 libapache2-mod-php php php-mysql php-curl php-xml php-zip php-gd php-mbstring php-intl php-bcmath php-json unzip -y

Step 3: Download OwnCloud

Now, let’s download the latest version of OwnCloud. Visit the OwnCloud Download Page to get the most recent version URL. For this guide, we will use the command line to download it directly.

cd /var/www/
sudo wget https://download.owncloud.org/community/owncloud-x.y.z.zip

Make sure to replace x.y.z with the latest version number.

Step 4: Unzip OwnCloud

Once the download is complete, unzip the OwnCloud package:

sudo unzip owncloud-x.y.z.zip

After unzipping, move the contents to the web directory:

sudo mv owncloud /var/www/html/

Step 5: Set Permissions

Set the correct permissions for the OwnCloud directory to ensure the web server can read and write files:

sudo chown -R www-data:www-data /var/www/html/owncloud
sudo chmod -R 755 /var/www/html/owncloud

Step 6: Create a Database for OwnCloud

Next, we need to create a database for OwnCloud. Log in to MySQL or MariaDB:

sudo mysql -u root -p

Once you are logged in, run the following commands:

CREATE DATABASE owncloud;
CREATE USER 'ownclouduser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON owncloud.* TO 'ownclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Make sure to replace yourpassword with a strong password for the database user.

Step 7: Configure Apache

Create a new Apache configuration file for OwnCloud:

sudo nano /etc/apache2/sites-available/owncloud.conf

Add the following configuration:

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/html/owncloud
    ServerName your_domain_or_ip

    <Directory /var/www/html/owncloud>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/owncloud_error.log
    CustomLog ${APACHE_LOG_DIR}/owncloud_access.log combined
</VirtualHost>

Make sure to replace your_domain_or_ip with your server’s domain name or IP address.

Step 8: Enable the Configuration

Enable the new site and the required Apache modules:

sudo a2ensite owncloud.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

Step 9: Complete the Installation via Web Interface

Open your web browser and navigate to http://your_domain_or_ip. You will be greeted with the OwnCloud setup page.

  1. Create an admin account by filling in the username and password.
  2. Enter the database details you created earlier:
  • Database user: ownclouduser
  • Database password: yourpassword
  • Database name: owncloud
  1. Click “Finish setup.”

Step 10: Secure Your OwnCloud Installation

For enhanced security, it’s recommended to enable HTTPS by installing a TLS certificate. You can use Let’s Encrypt for a free SSL certificate:

sudo apt install certbot python3-certbot-apache
sudo certbot --apache -d your_domain_or_ip

Follow the prompts to complete the installation.

Conclusion

Congratulations! You have successfully installed and configured OwnCloud on Ubuntu 24.04 or newer. You can now enjoy the benefits of your own cloud storage solution. From here, you can extend the functionality of OwnCloud by adding apps, managing users, and customizing settings.