OwnCloud is open-source, cross-platform software that allows us to store and synchronize files across different devices and users. Having our own OwnCloud server gives us advantages over other private storage systems. The main advantages of having a server for Owncloud include greater privacy, costs tailored to our needs, full control over information, permission customization, encryption, a web/Android/iOS client, document editing, and many others.
Create your VPS for OwnCloud
To install OwnCloud, we will need a Linux server. As for hardware requirements for a Linux server for OwnCloud, we recommend starting with:
- The latest version of Ubuntu, Debian or AlmaLinux
- 1 vCores
- 2GB of RAM
- 30GB of SSD storage
How to create your first VPS Hosting for OwnCloud
If you have not yet created a VPS server on Clouding, you can click the following link, where we explain how to create your first cloud server.
Installing OwnCloud on a Linux server
In this example, we will use Ubuntu 20.04, Apache, MariaDB and to meet OwnCloud's requirements, we will run the following commands:
# apt update && apt upgrade -y
# apt install -y apache2 libapache2-mod-php mariadb-server openssl php-imagick php-common php-curl php-gd php-imap php-intl php-json php-mbstring php-mysql php-ssh2 php-xml php-zip php-apcu php-redis redis-server wget
# apt install -y ssh bzip2 rsync curl jq inetutils-ping coreutils
Next, we need to create a Virtualhost for OwnCloud:
# vi /etc/apache2/sites-available/owncloud.conf
Add the following content:
<VirtualHost *:80>
ServerName 80f8afcc-d0d9-4f91-b313-0686475d89a1.clouding.host
DocumentRoot /var/www/owncloud
Alias /owncloud "/var/www/owncloud/"
<Directory /var/www/owncloud/>
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/owncloud
SetEnv HTTP_HOME /var/www/owncloud
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
*In ServerName, we need to specify the domain we will use to access OwnCloud. In this case, we use the VPS hostname, which you can obtain from the client panel.
We enable the new Virtualhost with the following commands:
# a2ensite owncloud.conf
# service apache2 reloadWe connect to the MariaDB server and create a user and database for OwnCloud:
# mysql -u root -p
# CREATE DATABASE IF NOT EXISTS owncloud;
# CREATE USER 'owncloud'@'localhost' IDENTIFIED BY '12345';
# GRANT ALL PRIVILEGES ON *.* TO 'owncloud'@'localhost' WITH GRANT OPTION;
# FLUSH PRIVILEGES;
# exitNow that we have all the prerequisites installed, we can proceed to install OwnCloud. In this case, we will use the official OwnCloud repository:
# echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/server:/10/Ubuntu_20.04/ /' | sudo tee /etc/apt/sources.list.d/isv:ownCloud:server:10.list
# curl -fsSL https://download.opensuse.org/repositories/isv:ownCloud:server:10/Ubuntu_20.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/isv_ownCloud_server_10.gpg > /dev/null
# sudo apt update
# sudo apt install owncloud-complete-filesWe set the correct user permissions:
# cd /var/www/
# chown -R www-data:owncloud /var/www/owncloudNow we use the browser to access the URL http://80f8afcc-d0d9-4f91-b313-0686475d89a1.clouding.host/ that we configured in the Apache VirtualHost for OwnCloud.
To complete the installation, we will be prompted to create an administrator user and specify the path where the data will be stored:
We will also need to specify the user and database previously created for OwnCloud:
Finally, we log in with the user we created:
Once logged in, we can download the APP or start uploading files through the web browser:
To finish configuring OwnCloud, we will need to create a Cron Job, configure the cache and configure logrotate.
To create the cron job for OwnCloud, we run:
# crontab -u www-data -e */15 * * * * /usr/bin/php -f /var/www/owncloud/occ system:cronIf we access Ajustes -> General in OwnCloud through the web browser, we can see that cron runs correctly:
To configure the OwnCloud cache, we will run:
# vi /var/www/owncloud/config/config.phpAt the end of the file, just before the closing delimiter, we add the following lines:
'filelocking.enabled' => true,
'memcache.local' => '\OC\Memcache\APCu',
'memcache.locking' => '\OC\Memcache\APCu',
# touch /etc/logrotate.d/owncloudcat <<EOM >/etc/logrotate.d/owncloud
/var/www/owncloud/data/owncloud.log {
size 10M
rotate 12
copytruncate
missingok
compress
compresscmd /bin/gzip
}
EOM
Install a Let's Encrypt SSL certificate
If we need OwnCloud to work over HTTPS, we can install the certificate by following the steps at the following link Obtain Let's Encrypt certificates with Certbot
With these steps, we now have a production OwnCloud installation ready to store and share documents.