Jul 30, 2024 5 min read

How to Install and Configure ownCloud with Apache on Ubuntu 22.04

Install and Configure ownCloud on Ubuntu 22.04 with our step-by-step tutorial. The ownCloud is an advanced file sync and share platform.

Install and Configure ownCloud with Apache on Ubuntu 22.04
Install and Configure ownCloud with Apache on Ubuntu 22.04
Table of Contents

Choose a different version or distribution

Introduction

Before we begin talking about how to install and configure ownCloud on Ubuntu 22.04, let’s briefly understand- What is ownCloud?

The ownCloud is a cutting-edge file synchronization and sharing platform. It is a secure, open-source cloud storage solution that enables users to store and access their files from anywhere in the world. With ownCloud, you can effortlessly collaborate with colleagues, share large files easily, and safeguard your data. Experience the convenience and flexibility of a self-hosted, privacy-focused cloud storage system with ownCloud.

In this tutorial, you will install and configure ownCloud on Ubuntu 22.04. We will also address a few FAQs on how to install and configure ownCloud on Ubuntu 22.04.

Advantages of ownCloud

  1. Secure File Storage: Have peace of mind with ownCloud's robust security measures, encrypting your data at rest and in transit.
  2. Easy Collaboration: Seamlessly collaborate with others, share files and folders, and work on projects in real-time.
  3. Flexibility and Control: Own and manage your own cloud storage system, giving you full control over your data and privacy.
  4. Accessibility: Access your files anytime, anywhere, on any device, ensuring productivity whether you're in the office or on the go.
  5. Integration: Connect ownCloud with popular tools like Microsoft Office, Google Drive, and more, simplifying your workflow and enhancing efficiency.

Prerequisites

  • You should log in as a sudo user to complete this tutorial.

Step 1 - Creating MySQL Database

ownCloud supports SQLite, Oracle 11g, PostgreSQL, and MySQL databases to store its configurations.

We'll be using MySQL as a database back-end.

1) Install the MariaDB server:

sudo apt install mariadb-server -y

2) Log in to the MySQL shell using the following command:

sudo mysql

3) After that, create a database from within the MySQL shell with the help of this SQL statement:

CREATE DATABASE owncloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

4) Then, create a user account and grant access to the database.

GRANT ALL ON owncloud.* TO 'ownclouduser'@'localhost' IDENTIFIED BY 'change-with-strong-password';

5) Now, exit the console with the following command:

EXIT;

Step 2 - Installing PHP and Apache

Since ownCloud is a PHP application, it works with PHP 7.4. Ubuntu 22.04 does not have PHP 7.4 by default hence, we need to install it using ppa:

sudo apt update
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update

Install required PHP extensions:

sudo apt install php7.4 openssl unzip php-imagick php7.4-common php7.4-curl php7.4-gd php7.4-imap php7.4-intl php7.4-json php7.4-ldap php7.4-mbstring php7.4-mysql php7.4-pgsql php-smbclient php-ssh2 php7.4-sqlite3 php7.4-xml php7.4-zip libapache2-mod-php7.4 -y

Set the default PHP version to 7.4 :

sudo update-alternatives --config php
Output

There are 2 choices for the alternative php (providing /usr/bin/php).

  Selection    Path             Priority   Status
------------------------------------------------------------
  0            /usr/bin/php8.2   82        auto mode
* 1            /usr/bin/php7.4   74        manual mode
  2            /usr/bin/php8.2   82        manual mode

Press <enter> to keep the current choice[*], or type selection number: 1

Now, you need to install Apache and its PHP extensions with the help of the following command:

sudo apt install apache2 libapache2-mod-php7.4

Step 3 - Configuring Firewall

1) In case you are using UFW to manage your firewall, open HTTP (80) and HTTPS (443) ports. This can be done by enabling 'Apache Full'.

sudo ufw allow 'Apache Full'

Step 4 - Downloading ownCloud

1) You can obtain the most recent version by visiting the ownCloud download page.

2) After that, use the following wget command to download the ownCloud zip archive:

wget https://download.owncloud.com/server/stable/owncloud-complete-latest.zip -P /tmp

3) Now, extract the files to the /var/www directory.

sudo unzip /tmp/owncloud-complete-latest.zip -d /var/www

4) Then, set the correct ownership to allow Apache web server access to ownCloud's files and directories.

sudo chown -R www-data: /var/www/owncloud

Step 5 - Configuring Apache

1) Create the following Apache configuration file:

sudo nano /etc/apache2/conf-available/owncloud.conf
Alias /owncloud "/var/www/owncloud/"

<Directory /var/www/owncloud/>
  Options +FollowSymlinks
  AllowOverride All

 <IfModule mod_dav.c>
  Dav off
 </IfModule>

 SetEnv HOME /var/www/owncloud
 SetEnv HTTP_HOME /var/www/owncloud

</Directory>

2) After that, enable this configuration and all the required Apache modules with it.

sudo a2enconf owncloud
sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod env
sudo a2enmod dir
sudo a2enmod mime

3) Restart the Apache service to activate the changes.

sudo systemctl reload apache2

Step 6 - Installing ownCloud

1) Now, you need to run your ownCloud installation by opening your browser and entering your domain name or IP address followed by /owncloud.

http://domain_name_or_ip_address/owncloud

2) You will then see the following page:

ownCloud on Ubuntu

3) Fill in a username and password of your choice, along with the MySQL user and database created earlier.

4) After that, click on the Finish setup button. On completion, the installer will redirect you to the ownCloud Dashboard, logged in as an admin.

ownCloud Dashboard

FAQs to Install and Configure ownCloud on Ubuntu 22.04

Can I install ownCloud with a different web server instead of Apache on Ubuntu 22.04?

While Apache is commonly used, ownCloud supports other web servers like Nginx and Lighttpd. The specific installation and configuration steps may differ.

How can I backup my ownCloud data on Ubuntu 22.04?

Backing up ownCloud includes creating regular database backups, as well as backing up the ownCloud data directory specified during installation. You can utilize various backup methods and tools, such as cron jobs or automated scripts.

Can I use SQLite as the database backend for ownCloud on Ubuntu 22.04? 

ownCloud officially supports MySQL/MariaDB and PostgreSQL as the database backends. Although SQLite support is available, it is not recommended for production environments.

How can I enable SSL/TLS encryption for secure access to ownCloud on Ubuntu 22.04? 

To enable SSL/TLS encryption, you need to obtain an SSL certificate and configure Apache to use HTTPS. You can either obtain a free certificate from Let's Encrypt or use a certificate from a trusted third-party provider.

Can I use LDAP or Active Directory for user authentication in ownCloud on Ubuntu 22.04? 

Yes, ownCloud supports LDAP and Active Directory integration. You can configure ownCloud to authenticate users against an LDAP or Active Directory server for centralized user management.

How can I install and configure additional apps for ownCloud on Ubuntu 22.04?

ownCloud provides an extensive marketplace where you can find and install additional apps to extend its functionality. You can access and install apps from the ownCloud administration interface.

Are there any specific system requirements for running ownCloud on Ubuntu 22.04?

ownCloud has minimum requirements that include PHP, a web server (like Apache or Nginx), and a supported database (MySQL/MariaDB or PostgreSQL). Ensure that your server meets the specified requirements.

Conclusion

We hope this detailed tutorial helped you understand how to install and configure ownCloud on Ubuntu 22.04. To learn more about ownCloud installation on Ubuntu 22.04 server, check out the official ownCloud installation document.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them for sure.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.