NEW LOCATION

Olá Brazil Brazil NVMe-powered VPS Plans in Brazil Now Available.

Deploy Instantly
  • +357 2425 0808
  • Login
  • English

Home

Blog

How To Install OwnCloud on Ubuntu Server...

How To Install OwnCloud on Ubuntu Server 20.04 LTS

How To Install OwnCloud on Ubuntu Server 20.04 LTS

Christos Azami

Christos Azami · Systems Administrator

Nov 03, 2021 · Technical Tutorials

This is a step-by-step guide on how to install ownCloud Collaboration software on a fresh installation of Ubuntu 20.04 server. Run the following commands in your terminal to complete the installation.

Prerequisites

  • A fresh installation of Ubuntu 20.04 with SSH enabled.
  • This guide assumes that you are working as the root user.
  • Your ownCloud directory will be located in /var/www/owncloud/

Preparation

First, ensure that all the installed packages are entirely up to date, and that PHP is available in the APT repository. To do so, follow the instructions below:

apt update && \
  apt upgrade -y

Create the occ Helper Script

Create a helper script to simplify running occ commands.

Select all the commands below and just copy-paste to the terminal. 

FILE="/usr/local/bin/occ"
/bin/cat <<EOM >$FILE
#! /bin/bash
cd /var/www/owncloud
sudo -E -u www-data /usr/bin/php /var/www/owncloud/occ "\$@"
EOM

Make the helper script executable:

chmod +x /usr/local/bin/occ

Install the Required Packages

Select all the commands below and just copy-paste to the terminal.

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

Note : php 7.4 is the default version installable with Ubuntu 20.04

Install the Recommended Packages

Select all the commands below and just copy-paste to the terminal.

apt install -y \
  ssh bzip2 rsync curl jq \
  inetutils-ping coreutils

We are ready, now, to proceed with OwnCloud Installation.

Installation Steps

1. Configure Apache

1.1. Change the Document Root

sed -i "s#html#owncloud#" /etc/apache2/sites-available/000-default.conf
service apache2 restart

1.2. Create a Virtual Host Configuration

Select all the commands below and just copy-paste to the terminal.

FILE="/etc/apache2/sites-available/owncloud.conf"
/bin/cat <<EOM >$FILE
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>
EOM

2. Enable the Virtual Host Configuration

a2ensite owncloud.conf
service apache2 reload

3. Configure the Database

mysql -u root -e "CREATE DATABASE IF NOT EXISTS owncloud; \
GRANT ALL PRIVILEGES ON owncloud.* \
  TO owncloud@localhost \
  IDENTIFIED BY 'password'";

3.1. Enable the Recommended Apache Modules

echo "Enabling Apache Modules"
a2enmod dir env headers mime rewrite setenvif
service apache2 reload

4. Download ownCloud

cd /var/www/
wget https://download.owncloud.org/community/owncloud-10.8.0.tar.bz2 && \
tar -xjf owncloud-10.8.0.tar.bz2 && \
chown -R www-data. owncloud

5. Install ownCloud

Select all the commands below and just copy-paste to the terminal.

occ maintenance:install \
    --database "mysql" \
    --database-name "owncloud" \
    --database-user "owncloud" \
    --database-pass "password" \
    --admin-user "admin" \
    --admin-pass "admin"

6. Configure ownCloud’s Trusted Domains

myip=$(hostname -I|cut -f1 -d ' ')
occ config:system:set trusted_domains 1 --value="$myip"

7. Set Up a Cron Job

Set your background job mode to cron:

occ background:cron
echo "*/15  *  *  *  * /var/www/owncloud/occ system:cron" \
  > /var/spool/cron/crontabs/www-data
chown www-data.crontab /var/spool/cron/crontabs/www-data
chmod 0600 /var/spool/cron/crontabs/www-data

If you need to sync your users from an LDAP or Active Directory Server, add this additional Cron job. Every 15 minutes this cron job will sync LDAP users in ownCloud and disable the ones who are not available for ownCloud. Additionally, you get a log file in /var/log/ldap-sync/user-sync.log for debugging.

Select all the commands below and just copy-paste to the terminal.

echo "*/15 * * * * /var/www/owncloud/occ user:sync 'OCA\User_LDAP\User_Proxy' -m disable -vvv >> /var/log/ldap-sync/user-sync.log 2>&1" >> /var/spool/cron/crontabs/www-data
chown www-data.crontab  /var/spool/cron/crontabs/www-data
chmod 0600  /var/spool/cron/crontabs/www-data
mkdir -p /var/log/ldap-sync
touch /var/log/ldap-sync/user-sync.log
chown www-data. /var/log/ldap-sync/user-sync.log

8. Configure Caching and File Locking

Execute these commands:

Select all the commands below and just copy-paste to the terminal.

occ config:system:set \
   memcache.local \
   --value '\OC\Memcache\APCu'
occ config:system:set \
   memcache.locking \
   --value '\OC\Memcache\Redis'
occ config:system:set \
   redis \
   --value '{"host": "127.0.0.1", "port": "6379"}' \
   --type json

9. Configure Log Rotation

Execute this command to set up log rotation.

Select all the commands below and just copy-paste to the terminal.

FILE="/etc/logrotate.d/owncloud"
sudo /bin/cat <<EOM >$FILE
/var/www/owncloud/data/owncloud.log {
  size 10M
  rotate 12
  copytruncate
  missingok
  compress
  compresscmd /bin/gzip
}
EOM

10. Finalize the Installation

Make sure the permissions are correct.

cd /var/www/
chown -R www-data. owncloud

Get OwnCloud as Virtual or Dedicated Server

NetShop ISP offers OwnCloud as a Virtual Private Server (VPS) or you can install it on a Bare-metal Dedicated Server.

Minimum VPS Plan: 1 vCPU, 512GB RAM, 20GB SSD. Locations: Cyprus, Malta, United Kingdom, Netherlands, Singapore

Minimum Specs Dedicated Server: Check our Offers to find the server with the best pricing that matches your budget.

Press Releases
78

Free VPS Trial

No Credit Card Required.

Recent Posts

How To Extract Certificates and Private Key from .PFX file

How To Extract Certificates and Private Key from .PFX file

19 November, 2024

NetShop ISP CEO Stefano Sordini to Moderate Key Panel on Forex AI Automation at Cyprus Fintech Summit 2024

NetShop ISP CEO Stefano Sordini to Moderate Key Panel on Forex AI Automation at Cyprus Fintech Summit 2024

15 November, 2024

Preparing for the Daylight Saving Time (DST) Change: Essential Updates for MetaTrader 4/5 Platforms

Preparing for the Daylight Saving Time (DST) Change: Essential Updates for MetaTrader 4/5 Platforms

25 October, 2024

NetShop ISP Celebrates 20 Years of Innovation and Excellence in Hosting and Data Center Solutions

NetShop ISP Celebrates 20 Years of Innovation and Excellence in Hosting and Data Center Solutions

22 October, 2024

NetShop ISP Makes Waves at Forex Expo Dubai 2024: Showcasing Cutting-Edge Hosting for the Financial Services Industry

NetShop ISP Makes Waves at Forex Expo Dubai 2024: Showcasing Cutting-Edge Hosting for the Financial Services Industry

09 October, 2024

#letushostyou

Award Winning Hosting Provider established in 2004.

120 Faneromenis Avenue, Imperial Tower, 2nd Floor, Larnaca 6031, Cyprus

Products

Bare Metal Servers

Customized Servers

Virtual / Cloud Servers

Forex VPS

Storage VPS

cPanel Web Hosting

Reseller Web Hosting

Colocation

Addons

Premium DNS

Email Hosting

Cloud Backup

DDoS Protection

Licenses

SSL Certificates

Domain Names

Premium SLAs

About Us

Data Center Locations

Looking Glass

Our Company

Contact Us

Careers in Cyprus

Become a Partner

Awards

Certifications

© 2024 S.S. NetShop Internet Services Ltd. All rights reserved.  Terms & Conditions  |  Privacy Policy
CY Reg. Number: HE 217340 | EU VAT Number: CY10217340J

Visa
Mastercard
PayPal
Bitcoin
Tether
Ethereum
Litecoin
Wise
Revolut
Wire Transfer