Owncloud is a private hosted cloud server used for file sharing, file storage and data synchronization. It can be used as an alternative to other commercial services like OneDrive, GoogleDrive, Drop Box etc. It’s a great tool for secure collaboration of data between teams.
Owncloud has many absorbing aspects:
- Versioning – A file history that allows you to roll back to a previous version of that file, back in time.
- Encryption – It protects user data when its being transmitted between client and server.
- Drag & Drop Upload – Files can be just drag and dropped in to interface of Owncloud file manager.
- Theming – Change the look of Owncloud web interface or customize the way you want.
- View ODF Files – You can view Open Document Format Files like .odt (documents) and .ods (spreadsheets), without downloading.
- Desktop/Mobile Client Apps – There are Windows, Linux, Mac, Android & iOS apps available to interact with Owncloud Server for syncing, uploading, downloading and viewing files.
Why to have your own Owncloud server
- To save sensitive data, but not on some third-party tool or using some commercial option.
- Own a business and want to keep everything in-house.
- Looking for expandable storage solution.
- Accessible from anywhere around the globe on both Mobile and PC.
Installation
This manual will help you install Owncloud on Debian 10, which is one of the most dependable OS currently available in the market. You can set it up on any other OS also.
Step 1: Install LAMP Stack
Since Owncloud run in browser and we need to save data also in database. First we need to create a base for this application. LAMP stack will help us creating that base. Its an open-source stack used to host web applications. It stands for Linux Apache MySQL(MariaDB) PHP.
First update newly installed operating system repositories.
# apt update && sudo apt upgrade
Next, install Apache Web Server, MariaDB database server and PHP packages required to host Owncloud by running following commands. To know about each package visit https://www.php.net/manual/en/
# apt-get install apache2 mariadb-server libapache2-mod-php openssl php-imagick php-common php-curl php-gd php-imap php-intl php-json php-ldap php-mbstring php-mysql php-pgsql php-smbclient php-ssh2 php-sqlite3 php-xml php-zip php-apcu -y
Once all packages are installed, start and enable Apache with following commands:
# systemctl start apache2
# systemctl enable apache2
# systemctl status apache2
If Apache is up and running, you will get an output indicating ‘active’ , after running status command.
Check PHP Version using this command to make sure it is installed and working properly.
# php -v
Start and enable Database with the following commands.
# systemctl start mariadb
# systemctl enable mariadb
# systemctl status mariadb
Set a MariaDB admin password and secure the installation using following command.
# mysql_secure_installation
When prompted, hit Enter on your keyboard (as there is no current MariaDB admin password). Answer y (as in “yes”) to set the admin password, and type and verify a new secure password for the MariaDB admin user. Finally, the database setup prompts you to answer four questions. Answer y (as in “yes”) to each of these questions.
Step 2: Create a Database
In the next step we have to create a database to handle OwnCloud’s files during and after the installation.
Access MariaDB console
# mysql -u root -p
Create a database for OwnCloud
MariaDB [(none)]> CREATE DATABASE owncloud;
Create user for OwnCloud DB and give necessary privileges to that user
MariaDB [(none)]> GRANT ALL ON owncloud.* TO 'owncloud_user'@'localhost' IDENTIFIED BY 'P@ssword';
Finally, flush and exit
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
Step 3: Install OwnCloud
As this point, server is ready for owncloud. Please check ownCloud Download Page to confirm the most recent version.
Download ownCloud. As of now, the latest version is 10.8.0.
wget https://download.owncloud.org/community/owncloud-10.8.0.zip
Download Unzip, and extract zip file just downloaded
sudo apt-get install zip -y
unzip owncloud-10.8.0.zip
After unziping, a new directory owncloud will be created, move that directory to Apache’s root folder and change ownership.
sudo mv owncloud /var/www/html/
sudo chown -R www-data: /var/www/html/owncloud
Step 4: Create Apache Configuration File
Apache needs virtual host configuration file to serve ownCloud instance to web.
sudo nano /etc/apache2/sites-available/owncloud.conf
Paste the following text into the new file. Replace mentions of example.com with your own domain name or your Server IP Address:
Save and close the file once done
File: /etc/apache2/sites-available/owncloud.conf
<VirtualHost \*:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/owncloud
ServerName example.com
<Directory /var/www/html/owncloud>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/example.com_error.log
CustomLog ${APACHE_LOG_DIR}/your-domain.com_access.log combined
</VirtualHost>
Enable the rewrite, mime, and unique_id Apache modules:
sudo a2enmod rewrite mime unique_id
Restart the Apache server:
sudo systemctl restart apache2
Step 5: Configure ownCloud (web based configuration)
Open a web browser and navigate to your site’s domain, if it has been configured to use one http://example.com/owncloud. If you configured Apache to point to your server’s IP address, navigate to http://192.0.2.0/owncloud and replace the example IP address with your own. You should see the ownCloud web-based installer.
Type a username and password for the admin user; click the Storage & Database drop-down; and then click MySQL/MariaDB.
The database information section is now available. Enter the following information:
- Database User:
ownclouduser - Database password: the password you set for the ownCloud database user
- Database:
ownclouddb - Localhost: leave as the default
Click Finish setup. When the install completes, the ownCloud login page appears. Login with the newly-created admin credentials. Once logged in, you are taken to the main ownCloud page.
You now have a working instance of ownCloud, running on Debian 10.