ownCloud is a file sharing server that permits you to store your personal content, like documents and pictures, in a centralized location, much like Dropbox. The difference with ownCloud is that it is free and open source, which allows anyone to use and examine it. It also returns the control and security of your sensitive data back to you, thus eliminating the use of a third-party cloud hosting service.
In this tutorial, we will install and configure an ownCloud instance on an Ubuntu 16.04 server.
PrerequisitesIn order to complete the steps in this guide, you will need the following:
- A sudo user on your server: You can create a user with sudo privileges by following the Ubuntu 16.04 initial server setup guide.
- A LAMP stack: ownCloud requires a web server, a database, and PHP in order to correctly function. Setting up a LAMP stack (Linux, Apache, MySQL, and PHP) server fulfills all of these requirements.
- An SSL certificate: How you set this up depends on whether or not you have a domain name that resolves to your server.
- If you have a domain name... the easiest way to secure your site is with Let's Encrypt, which provides free, trusted certificates.
- If you do not have a domain... and you are just using this configuration for testing or personal use, you can use a self-signed certificate instead. This provides the same type of encryption, but without the domain validation.
Step 1 — ownCloud InstallationThe ownCloud server package does not exist within Ubuntu's default repositories. However, ownCloud maintains a dedicated repository for Ubuntu.
To begin, download their release key using the
curlcommand and import it with the
curl https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/Release.key | sudo apt-key add -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1358 100 1358 0 0 2057 0 --:--:-- --:--:-- --:--:-- 2057
The 'Release.key' contains a PGP (Pretty Good Privacy) public key which
aptwill use to verify that the ownCloud package is authentic.
In addition to importing the key, create a file called
owncloud.listwith ownCloud's repository address in the sources directory for
echo 'deb http://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/ /' | sudo tee /etc/apt/sources.list.d/owncloud.list
After adding a new source, use the
apt-get updatecommand to make
aptaware of the change:
Finally, perform the installation of ownCloud using the
- sudo apt-get update
As a result of the ownCloud installation, a new configuration file was added to Apache's config directory. Use the
- sudo apt-get install owncloud
systemctlcommand to restart Apache and make it aware of the change:
With the ownCloud server installed, we will move on to setting up a database for it to use.
- sudo systemctl restart apache2.service
Step 2 — MySQL Database ConfigurationTo get started, log into MySQL with the administrative account:
Enter the password you set for the MySQL root user when you installed the software.
- mysql -u root -p
A separate database for ownCloud is required for administrative data to be stored. While you can call this database whatever you prefer, we decided on the name
owncloudto keep things simple.
Note: Every MySQL statement must end in a semi-colon (;). Be sure to check that this is present if you are running into any issues.
- CREATE DATABASE owncloud;
Next, create a separate MySQL user account that will interact with the newly created database. Creating one-function databases and accounts is a good idea from a management and security standpoint. As with the naming of the database, choose a username that you prefer. We elected to go with the name
owncloudin this guide.
GRANT ALL ON owncloud.* to 'owncloud'@'localhost' IDENTIFIED BY 'set_database_password';
Warning: Be sure to put an actual password where the command states:
With the user being assigned access to the database, perform the flush-privileges operation to ensure that the running instance of MySQL knows about the recent privilege assignment:
This concludes the configuration of MySQL, therefore we will quit the session by typing:
- FLUSH PRIVILEGES;
With the ownCloud server installed and the database set up, we are ready to turn our attention to configuring ownCloud.
Step 3 — ownCloud ConfigurationIn order to access the ownCloud web interface, open a web browser and navigate to the following:
If a self-signed certificate is being used, you will likely be presented with a warning because the certificate is not signed by one of your browser's trusted authorities. This is expected and normal. We are only interested in the encryption aspect of the certificate, not the third-party validation of our host's authenticity. Click the appropriate button or link to proceed to the ownCloud admin page.
You should see something like this:
Next, create an admin account by choosing a username (it is not recommended to use something like "admin" for security purposes) and a password.
Before clicking the Finish setup button, click on the Storage & database link:
Leave the Data folder setting as is and click the MySQL/MariaDB button in the Configure the database section. Enter the database information that you configured in the previous step.
Below is an example, which matches the database credentials that we used in this guide:
Click the Finish setup button to sign into ownCloud. A safe home for all your data splash screen should appear:
Click the x in the top-right corner of the splash screen to access the main interface:
Here, you can create or upload files to your personal cloud.
ConclusionownCloud can replicate the capabilities of popular third-party cloud storage services. Content can be shared between users or externally with public URLs. The advantage of ownCloud is that the information is stored securely in a place that you control.
Explore the interface and for additional functionality, install plugins using ownCloud's app store.