How to Install and Configure ownCloud on Ubuntu 20.04

ownCloud is an open source project that can be installed on your server to securely store and access files.

Introduction

Let us now go through the steps to install ownCloud on Ubuntu 20.04.

For this, you will require a Ubuntu 20.04 server with root access.

Ensure that all the installed packages are up to date by running the below command :

apt update
apt upgrade

After updating your system, kindly reboot if necessary.

Install the LAMP stack

To begin with, run the commands below to install Apache on the Ubuntu server.

apt install apache2

Once the installation is completed, start and enable Apache service,

systemctl start apache2
systemctl enable apache2

Now your Apache web server should be working. Check your browser by entering http:// in the url bar. You should get a similar page as below :

Install PHP

Install PHP and the required package with the following command :

apt-get 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

MySQL

Install MariaDB by running the below command:

apt install mariadb-server

We strongly recommand to improve the security of the MySQL database with the following command :

mysql_secure_installation

When prompt for the following, we recommend the following answers :

Connecting to MySQL using a blank password.

Securing the MySQL server deployment.

The 'validate_password' component is installed on the server.

The subsequent steps will run with the existing configuration
of the component.

Please set the password for root here.

New password:

Re-enter new password:

...

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y

...

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.

...

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

...

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y

...

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

Success.

All done!

We now need to create the ownCloud database from the MySQL console :

mysql --user=root -p

Create the database for ownCloud :

CREATE DATABASE ownclouddb;

Create a new user and use a strong password :

CREATE USER ownclouduser@localhost IDENTIFIED BY 'password';

Grant the new user with the all privileges :

GRANT ALL PRIVILEGES ON ownclouddb.* TO ownclouduser@localhost;

Enable changes by flushing the privileges :

FLUSH PRIVILEGES;

After flushing the privileges, you can exit from the MySQL console :

EXIT

Download latest ownCloud

Use the command line given below :

wget https://download.owncloud.org/community/owncloud-latest.zip

Before unzip the file install unzip :

 apt install unzip

Unzip the downloaded file :

unzip owncloud-latest.zip

The new directory has been created of owncloud after unziping the file. Now move the directory into the Apache default directory :

mv owncloud /var/www/

Change the permission of the directory for the user www-data :

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

Configure Apache

Open your text editor and create the following Apache configuration file.

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

Fill the text file with the following and adapt it to your needs :

  • default port for http is 80 (change it if needed)
  • replace localhost by your domain or IP address.
<VirtualHost \*:80>
     ServerAdmin admin@example.com
     DocumentRoot /var/www/html/owncloud
     ServerName example.com
    <Directory /var/www/html/owncloud>
         Options FollowSymlinks
         AllowOverride All
         Require all granted
     </Directory>

ErrorLog ${APACHE_LOG_DIR}/example.com_error.log

CustomLog ${APACHE_LOG_DIR}/your-domain.com_access.log combined

</VirtualHost>

Save and exit from your editor

Enable the rewrite, mime, and unique_id Apache modules :

a2enmod rewrite mime unique_id

Restart the Apache server:

systemctl restart apache2

The command line portion of the installation is complete.

Finalize ownCloud Configuration

Open your browser and navigate to http://<server-IP>.

This will load the ownCloud Configuration page and prompts you to configure some of the things like below,

  • Creating Admin user account with password, Configure the DataBase with the information that was used earlier during the setup.

  • Click on the Finish button to complete the configuration.

    Next, login with the Admin user created moments ago and you will enter the ownCloud Dashboard.

    When configuration completes, you will get to a login page.

    Enter your admin user login details to login to ownCloud dashboard.

    This concludes our guide on installing ownCloud on Ubuntu 20.04 system.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS