ownCloud is an open-source file sharing server and collaboration platform. It allows controlling data on users' servers and environments. Once configured, ownCloud provides easy access to all your data - whenever you want, wherever you want.
ownCloud Features
- Access everything wherever you want
- Share with anybody on your terms
- Mobile and Desktop Syncing
- End-to-end encryption support
- Extensible through an Agile App framework
ownCloud is free to download and install on your private servers without paying to service providers.
In this article, we will help you install and configure ownCloud on your Ubuntu machine. This tutorial is thoroughly tested on Ubuntu 18.04 LTS.
Install ownCloud on Ubuntu 18.04 LTS
Before setting up Owncloud, you need to install Apache, PHP, and MySQL.
Step 1 - Install Apache HTTP Server
Let's start with updating the system repositories. Launch the Terminal and enter the following command:
sudo apt-get update
Install Apache:
sudo apt-get install apache2
Generally, the Apache service starts automatically. Check the status using the command:
sudo systemctl status apache2.service
If you see the service has not started, you can start it manually using the following command.
sudo systemctl start apache2
Enable Apache On system boot.
sudo systemctl enable apache2
Allow Apache ports from the Ubuntu Firewall.
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
Reload firewall and check the Firewall status.
sudo ufw reload sudo ufw status
To check the Apache installation running status, launch the browser using hostname or server IP address.
http://hotname or IP/
If you see the Apache default page, it means everything went well.
Step 2 - Install MySQL
Let's start with checking for available MySQL version.
sudo apt-cache policy mysql-server
As you see there is a new version available. We shall install using the command as follows:
sudo apt-get install mysql-server mysql-client
Securing MySQL installation
sudo mysql_secure_installation
You should see a prompt if you want to configure the VALIDATE PASSWORD PLUGIN. Type “Y” to yes and hit Enter to continue.
Then you should see a prompt to select a level of password validation. Select password strength and continue
Go ahead and provide a password for MySQL root user.
It should ask “Do you wish to continue with the password provided?”. Type “Y” and hit Enter.
You should see a series of questions - type “Y” for each one of them.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y
By now you should have installed MySQL and also securely configured it. You can access MySQL server using the root login and password.
sudo mysql -u root -p
Step 3 - Install PHP
We should first check for available PHP versions and then install it.
sudo apt-cache policy php
Install PHP.
sudo apt-get install php php-cgi libapache2-mod-php php-common php-pear php-mbstring php-mysql php-curl php-json
Step 4 - Install ownCloud
You can add the repository key to apt.
sudo wget -nv https://download.owncloud.org/download/repositories/production/Ubuntu_18.04/Release.key -O Release.key
sudo apt-key add - < Release.key
Run the following shell commands to add the repository:
sudo echo 'deb http://download.owncloud.org/download/repositories/production/Ubuntu_18.04/ /' | sudo tee /etc/apt/sources.list.d/owncloud.list
Update repositories.
sudo apt-get update
Install additional PHP packages.
sudo apt install php-bz2 php-curl php-gd php-imagick php-intl php-mbstring php-xml php-zip
Install ownCloud package.
sudo apt-get install owncloud-files
Generally, the ownCloud package we installed copies the web files to “/var/www/owncloud” on the server.
Step 5 - Configure Apache with SSL
Now we shall create a virtual host for ownCloud.
Create a folder for SSL certificates.
sudo mkdir /etc/apache2/ssl
Enable SSL module.
sudo a2enmod ssl
Restart Apache.
sudo systemctl restart apache2
Copy your SSL certificates to “/etc/apache2/ssl/ ” folder
Create a virtual host file.
sudo vim /etc/apache2/sites-available/fosslinuxowncloud.com.conf
Add the following lines to file. Replace ServerName with fosslinuxowncloud with whatever you want.
ServerName fosslinuxowncloud.com ServerAlias www.fosslinuxowncloud.com ServerAdmin [email protected] DocumentRoot /var/www/owncloud Options -Indexes +FollowSymLinks AllowOverride All ErrorLog $APACHE_LOG_DIR/fosslinuxowncloud.com-error.log CustomLog $APACHE_LOG_DIR/fosslinuxowncloud.com-access.log combinedServerName fosslinuxowncloud.com ServerAlias www.fosslinuxowncloud.com ServerAdmin [email protected] DocumentRoot /var/www/owncloud Options -Indexes +FollowSymLinks AllowOverride All ErrorLog $APACHE_LOG_DIR/fosslinuxowncloud.com-ssl-error.log CustomLog $APACHE_LOG_DIR/fosslinuxowncloud.com-ssl-access.log combined SSLEngine on SSLCertificateFile /etc/apache2/ssl/fosslinuxowncloud.cer SSLCertificateKeyFile /etc/apache2/ssl/fosslinuxowncloud.key SSLCertificateChainFile /etc/apache2/ssl/fosslinuxowncloud.ca
You can give whatever name to your SSL certificate files.
SSLCertificateFile /etc/apache2/ssl/certificatefile-name.cer SSLCertificateKeyFile /etc/apache2/ssl/certificate-key-name.key SSLCertificateChainFile /etc/apache2/ssl/chain-certificate-name.ca
Check the syntax of the configuration file.
sudo apachectl -t
If you get a “Syntax OK” message, use this command line to disable the default, virtual host.
sudo a2dissite 000-default.conf
The following commands should enable new virtual hosts.
sudo a2ensite fosslinuxowncloud.com.conf
Restart Apache to activate changes.
sudo systemctl restart apache2
Step 6 - Configuring the MySQL Database for Owncloud
Access MySQL using the root account.
sudo mysql -u root -p
Create a database, and name it as you want.
create database fosslinuxowncloud;
Create a DB user and grant privileges.
create user 'ownclouduser'@'localhost' identified BY 'QB35JaFV6A9=BJRiT90';
grant all privileges on fosslinuxowncloud.* to ownclouduser@localhost;
Flush privileges.
flush privileges;
Step 7 - Configure ownCloud
Open a web browser and navigate to the following address to access the ownCloud web interface.
https://Domain-Name or IP
Create an admin account by choosing a username and a password. No need to modify Data Folder.
Fill out the details of the database name, database username, and database password. Here we installed the database in the same server, so we leave the database host as “localhost”.
Click the “Finish setup” button to finish configuring.
Now it should redirect to login page. You can provide given username and password to access the dashboard.
You can use a desktop or mobile client to sync your data to your ownCloud. Download OwnCloud client from here.
Step 8 - Install Owncloud client on Ubuntu 18.04 Desktop
Run following commands to add the repository. We should run commands as root user.
wget -nv https://download.opensuse.org/repositories/isv:ownCloud:desktop/Ubuntu_18.04/Release.key -O Release.key
apt-key add - < Release.key
Update repository.
apt-get update
Add repository.
sh -c "echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Ubuntu_18.04/ /' > /etc/apt/sources.list.d/isv:ownCloud:desktop.list"
Update repository.
apt-get update
Install client.
apt-get install owncloud-client
After installation is complete, open ownCloud desktop Sync client, add your Domain name and click next.
Then you should get User credentials window where you should provide your username and password.
Then you can select the local folder and configure sync settings.
Owncloud-Local-Folder-Options
After you click connect, it should sync data with the server.
You can add your files to the ownCloud local folder. For example, I have added an image to the folder.
Then it should sync to the server.
Now you can go to the server and check the data. You can see the added image on the server.
If you have come this far, you successfully installed and configured the ownCloud server and also synced files with its desktop client.
How did your installation go? Let us know your feedback in the comments below, and don't forget to share this article with your friends and colleagues who may find it useful.