Linux

How to Install and Configure ownCloud on Ubuntu 20.04

How to Install and Configure ownCloud on Ubuntu 20.04

ownCloud is a powerful open-source software suite that provides file synchronization, sharing, and collaboration features, similar to services like Dropbox or Google Drive. In this guide, you will learn how to install and configure ownCloud on Ubuntu 20.04, enabling you to manage your files securely and efficiently.

Prerequisites
Before you begin the installation, ensure you have the following:

A server running Ubuntu 20.04.
Root or sudo access to the server.
A LAMP stack (Linux, Apache, MySQL/MariaDB, PHP) installed. If you don’t have this set up, you can follow the steps below to install it.
Step 1: Install the LAMP Stack
1.1. Update Your System
First, ensure that your system is up to date:

sudo apt update
sudo apt upgrade -y

1.2. Install Apache
Install the Apache web server:

sudo apt install apache2 -y

1.3. Install MySQL/MariaDB
For database management, you can choose either MySQL or MariaDB. Here, we will install MariaDB:

sudo apt install mariadb-server -y

Secure your MariaDB installation:

sudo mysql_secure_installation

Follow the prompts to set a root password and secure your installation.

1.4. Install PHP and Required Extensions
ownCloud requires PHP along with some specific extensions. Install PHP and the necessary extensions:

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

Step 2: Download and Install ownCloud
2.1. Download ownCloud
Change to the /var/www directory and download the latest version of ownCloud:

cd /var/www
wget https://download.owncloud.org/community/owncloud-complete-latest.zip

2.2. Extract the Zip File
Extract the downloaded file:

sudo apt install unzip -y
sudo unzip owncloud-complete-latest.zip

2.3. Set Permissions
Set the ownership and permissions for the ownCloud directory:

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

Step 3: Configure Apache for ownCloud
3.1. Create a New Virtual Host
Create a new configuration file for ownCloud:

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

Add the following configuration, replacing example.com with your domain or server IP:

ServerAdmin [email protected]
DocumentRoot /var/www/owncloud
ServerName example.com

Options Indexes MultiViews
AllowOverride All
Require all granted

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

3.2. Enable the Virtual Host
Enable the new virtual host and rewrite module:

sudo a2ensite owncloud.conf
sudo a2enmod rewrite

3.3. Restart Apache
Restart the Apache server to apply the changes:

sudo systemctl restart apache2

Step 4: Create a Database for ownCloud
4.1. Log into MariaDB
Log into your MariaDB server:

sudo mysql -u root -p

4.2. Create the Database and User
Run the following commands in the MariaDB shell:

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 of your choice.

Step 5: Complete the Installation Through the Web Interface
Open your web browser and navigate to http://your-domain-or-ip. You should see the ownCloud setup page.

Enter the following information:

Admin Account: Create an admin username and password.
Database user: Enter the database user and password created earlier.
Database name: Enter owncloud.
Database host: Leave as localhost.
Click on the “Finish setup” button.

Step 6: Secure ownCloud with HTTPS (Optional)
To secure your ownCloud instance, it’s recommended to use HTTPS. You can use Certbot to obtain a free SSL certificate:

6.1. Install Certbot

sudo apt install certbot python3-certbot-apache -y

6.2. Obtain a Certificate
Run the following command to obtain an SSL certificate:

sudo certbot –apache -d example.com

Follow the prompts to complete the SSL configuration.

Conclusion

You have successfully installed and configured ownCloud on Ubuntu 20.04. You can now access your ownCloud server from any device with an internet connection, allowing you to store, share, and collaborate on files securely. For additional features, such as calendar and contact management, explore the various ownCloud apps available.

For further reading and detailed documentation, visit the official ownCloud documentation.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button