How to Install ownCloud on Ubuntu 18.04

In this article, we will show you how to install ownCloud on an Ubuntu 18.04 VPS.

ownCloud is a popular open-source enterprise web application written in PHP that’s used for data synchronization and file sharing. It allows users to easily manage their files, contacts, calendars, to-do lists, and more, making it a great alternative to to the popular cloud platforms such as Google Drive, Dropbox, iCloud, and so on. OwnCloud is a cross-platform application and can be installed on all popular operating systems.

Requirements

ownCloud requires the following dependencies:

  • PHP >= 5.6 (PHP 7.2 is recommended), with the following PHP extensions enabled: XML (Expat), curl, PDO, Phar, GD Graphics Library version 2.0.x+, DOM, ctype, JSON, iconv, intl, mcrypt, openssl, bz2, Zlib and Zip.
  • Apache Web Server >= 2.0 compiled with mod_rewrite module
  • MySQL >= 5.x (with InnoDB storage), MariaDB 5.5+, PostgreSQL (9.0 or above), or SQLite installed on your Linux virtual server.

Step 1: Update the System

Log in to your VPS via SSH as a sudo user:

ssh username@IP_Address

If your server uses a custom SSH port number, just append -p Port_number to the command and replace “Port_number” with your SSH port number.

Once you are logged in, issue the following commands to update the packages list and upgrade all installed packages:

sudo apt-get update
sudo apt-get upgrade

Step 2: Install MySQL and Create a Database

OwnCloud works with several database platforms, such as MySQL, PostgreSQL, MariaDB, and SQLite. In this guide, we will use MySQL.

If you don’t have MySQL or MariaDB installed on your server install it with the following command:

sudo apt-get install mysql-server

Once installed, set the default storage engine to InnoDB. Open the MySQL configuration file with:

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

and add default-storage-engine = innodb in the [mysqld] section:

[mysqld]
default-storage-engine = innodb

Restart and enable the MySQL service:

sudo systemctl restart mysql
sudo systemctl enable mysql

Login to the MySQL server with:

sudo mysql

Create a new database and user for ownCloud and grant permissions to the user:

create database owncloud;
grant all privileges on owncloud.* to owncloud@localhost identified by 'owncloud_password';

Step 3: Install ownCloud

At the time of writing the latest ownCloud version is 10.0.10.

Install the apt-transport-https package which necessary for enabling the owncloud repository:

sudo apt-get install apt-transport-https

Download the repository key using the wget command and import it with the apt-key command:

sudo  wget -qO- https://download.owncloud.org/download/repositories/stable/Ubuntu_18.04/Release.key | sudo apt-key add -

The output will look as the following:

OK

Next, enable the ownCloud repository by running the following command:

echo 'deb http://download.owncloud.org/download/repositories/10.0/Ubuntu_18.04/ /' > /etc/apt/sources.list.d/owncloud.list

Update the packages list and install the owncloud-files package with:

apt-get update
apt-get install owncloud-files

Once the installation is completed you can find the ownCloud files in the /var/www/owncloud directory.

Step 4: Install Apache and PHP 7.2

Installing Apache and PHP 7.2 is a very simple task.

To install Apache, PHP 7, and all of the necessary modules on your Ubuntu 18.04 server, run the following command:

sudo apt-get install apache2 libapache2-mod-php7.2 \
    openssl php-imagick php7.2-common php7.2-curl php7.2-gd \
    php7.2-imap php7.2-intl php7.2-json php7.2-ldap php7.2-mbstring \
    php7.2-mysql php7.2-pgsql php-smbclient php-ssh2 \
    php7.2-sqlite3 php7.2-xml php7.2-zip

Once the Apache installation is complete, run the following commands enable the necessary Apache modules:

sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod env
sudo a2enmod dir
sudo a2enmod mime

Restart the Apache service and enable Apache to start on boot with:

sudo systemctl enable apache2.service
sudo systemctl enable apache2.service

You can also check the php version by running:

php -v

The output will look like the following:

PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

Step 5: Configure Apache to Serve ownCloud

Now we need to configure Apache so it can serve the ownCloud directory.

Open your text editor and create a configuration file for ownCloud:

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

add the following contents:

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>

Enable the Apache ownCloud configuration:

sudo a2enconf owncloud

Restart the Apache web server for new changes to take effect:

sudo systemctl restart apache2

Accessing ownCloud

Open your web browser and type in the following URL to access the ownCloud web interface:

http://your_server_ip_address_or_domain_name/owncloud

From here you can finish the setup by following the steps below:

  1. Enter a username and password for the admin account.
  2. Click on the Storage & database link.
  3. Leave the default data folder setting.
  4. Click the MySQL/MariaDB button.
  5. Populate the fields with the database information we set above.
  6. Click Finish Setup.

That’s it, you have successfully installed ownCloud 10 on your Ubuntu server.


Of course, you don’t have to install and configure ownCloud 10 on a Ubuntu 18.04 VPS if you use one of our ownCloud VPS Hosting solutions, in which case you can simply ask our expert Linux admins to install and configure ownCloud 10 on Ubuntu 18.04 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on how to install and configure ownCloud 10 on a Ubuntu 18.04 VPS, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment