How to install OwnCloud 10 on Ubuntu 16.04

OwnCloud is a popular web application 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 the popular Google Drive, Dropbox, iCloud and other cloud platforms. OwnCloud is cross-platform and supports all popular operating systems, but this article was written specifically for Ubuntu 16.04. At the time of writing, the latest version of OwnCloud is 10.0.7.

1. Prerequisites

  • PHP> = 5.6 (PHP 7.0 or higher recommended), with the following extensions included in PHP: 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 (MySQL 5.5 or later), MariaDB 5.5+, PostgreSQL, or SQLite installed on your Linux virtual server.

2. System update

As usual, before installing system packages on the server, first update the system:

# sudo apt-get update && apt-get upgrade

3. Installing OwnCloud

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

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

Make sure apt-transport-https is installed as we will need it for the next step:

# sudo apt-get install apt-transport-https
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  aspell aspell-en dictionaries-common emacsen-common libaspell15 libexttextcat-2.0-0 libexttextcat-data liblua5.1-0 libyajl2
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
  apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 54 not upgraded.
Need to get 26.1 kB of archives.
After this operation, 215 kB of additional disk space will be used.
Get:1 https://archive.ubuntu.com/ubuntu xenial-updates/main amd64 apt-transport-https amd64 1.2.26 [26.1 kB]
Fetched 26.1 kB in 0s (60.8 kB/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 35616 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.2.26_amd64.deb ...
Unpacking apt-transport-https (1.2.26) ...
Setting up apt-transport-https (1.2.26) ...

Create a owncloud.list file in /etc/apt/sources.list.d so that we can add the OwnCloud repository to the server:

# echo 'deb https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/ /' | sudo tee /etc/apt/sources.list.d/owncloud.list
deb https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/ /

Now update the system packages again so that we can install the OwnCloud packages:

# sudo apt-get update
Hit:1 https://archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 https://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:3 https://archive.canonical.com/ubuntu xenial InRelease
Hit:4 https://security.ubuntu.com/ubuntu xenial-security InRelease
Ign:5 https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04  InRelease
Get:6 https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04  Release [986 B]
Get:7 https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04  Release.gpg [481 B]
Get:8 https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04  Packages [736 B]
Fetched 2203 B in 2s (1030 B/s)
Reading package lists... Done

Install OwnCloud by running the following command:

# sudo apt-get install owncloud-files
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  owncloud-files
0 upgraded, 1 newly installed, 0 to remove and 51 not upgraded.
Need to get 0 B/35.1 MB of archives.
After this operation, 118 MB of additional disk space will be used.
Selecting previously unselected package owncloud-files.
(Reading database ... 35869 files and directories currently installed.)
Preparing to unpack .../owncloud-files_10.0.7-1.1_all.deb ...
Unpacking owncloud-files (10.0.7-1.1) ...
Setting up owncloud-files (10.0.7-1.1) ...

We can now move on to the next step.

4. Creating a MySQL database for OwnCloud

Login to MySQL with root account:

# mysql -u root -p

We will now create a MySQL database for OwnCloud using the following query:

mysql> CREATE DATABASE owncloud;

Then run the following query to add a separate user for OwnCloud that will interact with the database:

mysql> GRANT ALL PRIVILEGES ON owncloud.* to 'owncloud'@'localhost' IDENTIFIED BY 'enter_username_password_here';

Run the following command to apply the privileges we have set:

mysql> FLUSH PRIVILEGES;

We can now log out of the MySQL session:

mysql> exit;

5. Setting up OwnCloud

First, make sure the following packages are installed as they are required by OwnCloud:

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

6. Configuring Apache for the OwnCloud server

Now we will need to configure Apache so that it can serve the ownCloud directory, add the following content below to the /etc/apache2/sites-available/owncloud.conf file using nano or your favorite editor:

# sudo nano /etc/apache2/sites-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>

Enable the following Apache modules:

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

Enable Apache OwnCloud configuration:

# sudo a2ensite owncloud.conf

Now restart the Apache web server:

# sudo systemctl restart apache2

Open your web browser and enter the following URL to access the OwnCloud web interface:

https://your_server_ip_address_or_domain_name/owncloud

From here, you can complete the installation by following the steps outlined below:

  • Enter the username and password for the administrator account.
  • Click the Storage & database link.
  • Leave the default for the data folder.
  • Click on the MySQL / MariaDB button.
  • We fill in the fields with the database information that we installed above.
  • Click Finish.

Now you should have successfully installed OwnCloud 10 on the server.

Please disable your ad blocker or whitelist this site!

Related Posts