OwnCloud is a free open-source cloud storage which enables you to create a private cloud. ownCloud is a personal cloud storage solution similar to Dropbox, or Microsoft OneDrive.
The difference is that your files will be stored on your Ubuntu home cloud server instead of a server located in an unknown location somewhere in the world.
Advantages: No monthly payments, added security and unlimited files storage.
Install ownCloud on Ubuntu 17.04
1. On the Ubuntu server, open a web browser and visit ownCloud.org
2. Click on the “Download” button on the top right corner of the page.
3. In the “Get Started” section, click on the “Packages For auto updates” tab. The one with the penguin icon on it.
4. Then click on “Continue” button at the bottom corner.
5. You’ll get Install Package screen. Here you’ll get the necessary commands to install ownCloud. They are not in order.
Execute each command in the order of the numbers I placed to the left. In step 7. I placed them in proper order so you can copy and paste it from there if you want.
6. On your Ubuntu 17.04 open the Terminal. To do so right click on the desktop and select Open Terminal.
7. Copy and paste the commands into Terminal. Hit the “Enter” key on the keyboard after each command:
sh -c “echo ‘deb http://download.owncloud.org/download/repositories/stable/Ubuntu_17.04/ /’ > /etc/apt/sources.list.d/owncloud.list”
wget -nv https://download.owncloud.org/download/repositories/stable/Ubuntu_17.04/Release.key -O Release.key
apt-key add – < Release.key
apt-get install owncloud
Note: “apt-get install owncloud” command will always install the latest version of owncloud.
8. During the install process, mySQL will require to create a “root” (admin) user password. Enter a password and confirm re-typing the password on the subsequent screen:
We are done setting up the ownCloud server. Now we need to setup the Router to enable access to it.
Access Owncloud from the LAN
To access ownCloud from inside the network, We need to know the IP address of the owncloud server and use it to access it by placing it in the search bar as follows:
1. Open the terminal and enter the following command:
2. Locate the IP address of the Ubuntu server, it should look something like: 192.x.x.x or 10.x.x.x
3. Place your LAN IP in the address bar like this:
4. You’ll be prompted to create admin account and password. Then click finish setup.
Enable SSL for Secure External Access
This process only applies if you are planning on connecting to the ownCloud from the WAN (outside the network) using mobile devices or tablet. Enable and configure SSL on Owncloud:
1. Open the terminal and run the following command:
sudo a2enmod ssl
2. Create a new directory for the self signed certificate:
sudo mkdir /etc/apache2/ssl
3. Create the self signed certificate and the server key that protects it, and placing both of them into the new directory:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/owncloud.key -out /etc/apache2/ssl/owncloud.crt
Note: The above certificate is valid for 365 days. We have mentioned validity days in the command.
4. Now we need to setup the certificate:
sudo nano /etc/apache2/sites-available/default-ssl.conf
5. The lines that need changing are the following:
ServerName IP :443 SSLEngine on SSLCertificateFile /etc/apache2/ssl/owncloud.crt SSLCertificateKeyFile /etc/apache2/ssl/owncloud.key
6. Activate the new virtual host
sudo a2ensite default-ssl
7. Restart apache
sudo service apache2 restart
Port Forward for External Access
Log into your router and get the WAN IP address:
Now we need to add the WAN IP to your trusted IP list and not to be overwritten by ownCloud. To do this open the Owncloud config file, enter:
sudo nano /var/www/owncloud/config/config.php
Here add the WAN IP (External IP address) you just got from the router to the trusted domains array. Your new entry should look something like this:
1 => 'xxx.xxx.xxx.xxx',
X are just placeholders. Replace the X’s with the WAN IP Address.
Now update the URL of the overwrite.cli.url line with your WAN IP Address. It should look something like this:
‘overwrite.cli.url’ => ‘https://xxx.xxx.xxx.xxx/owncloud’,
Here is an example of the completed config.txt file.
Hidden is the WAN IP. Once done save and exit.
Log back into your router and navigate to the port forward section.
Now port forward SSL port 443 to the Ubuntu server runnung ownCloud instance internal IP (LAN IP) address and save settings.
Now your ownCloud is ready to be accessed externally (WAN) and from your devices just download the ownCloud App and enter: “https:// WAN IP Address” on the address bar or devices. below is an example:
Basic First Access Setup
This applies in case you did not set it up from the LAN previously.
1. Accessing your ownCloud from outside the network: open your browser and enter the WAN IP address. i.e. “https://18.104.22.168/owncloud” you’ll be directed to your ownCloud storage server.
2. Accessing ownCloud From inside the network: open your browser and enter the Ubuntu IP address provided, in my case is “https://192.168.1.123/owncloud” you’ll be directed to your ownCloud storage server.
3. Because we installed SSL for more security you might get a certificate error, simply add the certificate to your exception list to proceed
4. You should be presented with a simple setup screen, Here enter a username and password to create an admin account. Click Finish setup.