In this tutorial we’ll learn how to install OwnCloud on Ubuntu 16.04. We will also install and configure its prerequisites. Owncloud is a file synchronization and collaboration platform that can run on your own server. Featuring a nice web interface, clients for all major operating systems, and standards-compliant use of APIs and protocols, Owncloud can replace many popular cloud services with a solution that respects autonomy and privacy.
I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 16.04 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
Install OwnCloud on Ubuntu 16.04
Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:
apt-get update -y && apt-get upgrade -y
Step 2. Installing LAMP on Ubuntu 16.04.
You should check out this LAMP stack install tutorial for Ubuntu 16.04, if you haven’t installed LAMP yet. Once it’s installed, come back here and read on. We also will install the required packages for LAMP stack and the important PHP extension that Owncloud relies on:
apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0 php7.0-mcrypt php7.0-gd php7.0-mbstring php7.0-zip php7.0-dom php7.0-xml
Step 3. Installing OwnCloud.
OwnCloud provides you the official deb packages for the installation of ownCloud. Setup ownCloud repository using the following command:
nano /etc/apt/sources.list.d/owncloud.list deb http://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/ /
In order to ensure that the packages we install are official, we’ll also retrieve the GPG key for the Owncloud repository we’ve just added:
wget https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/Release.key apt-key add Release.key
Install ownCloud using the following command:
apt-get update apt-get -y install owncloud
Step 4. Configure Database for OwnCloud.
Next, we need to create a database for the OwnCloud installation:
mysql -uroot -p
Run the following command to create a database for OwnCloud:
MariaDB> CREATE DATABASE owncloud; MariaDB> CREATE USER 'cloud'@'localhost' IDENTIFIED BY 'cloudpassword'; MariaDB> GRANT ALL PRIVILEGES ON owncloud.* TO 'cloud'@'localhost'; MariaDB> FLUSH PRIVILEGES; MariaDB> exit
Finally, give proper permission to OwnCloud directory:
chown -R www-data. /var/www/owncloud/ systemctl restart apache2.service
Step 6. Accessing OwnCloud Web Installation.
Now you can access the OwnCloud web install wizard in your browser by entering the domain name or http://your_ip/owncloud/ to continue your OwnCloud installation. Start by creating your username and password. Not only will this user be able to sync files and store contacts, but it will also have administrative privileges for Owncloud itself.
Congratulation’s! You have successfully configured OwnCloud on your Ubuntu 16.04 LTS server.