How to Install and Configure ownCloud on Debian 12
ownCloud is an open source file sharing and collaboration platform that allows you to securely store, sync, and access your files from anywhere.
Prerequisites
- Debian 12 installed.
- Root or sudo user access.
- Internet connectivity.
Since ownCloud is currently not compatible with Debian 12's default PHP version, this guide installs PHP 7.4 from the Sury PHP repository.
Update the System
Update the Debian system and installed packages.
apt update
apt upgrade -y
Install Apache and MariaDB
Install Apache and MariaDB.
apt install apache2 mariadb-server -y
Enable and start both services.
systemctl enable --now apache2 mariadb
Install PHP 7.4
Install the required packages.
apt install -y apt-transport-https ca-certificates software-properties-common lsb-release wget curl gnupg2
Import the Sury PHP repository GPG key.
wget -qO /etc/apt/trusted.gpg.d/sury.gpg https://packages.sury.org/php/apt.gpg
Add the Sury PHP repository.
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
Update the package list.
apt update
Install PHP 7.4 and the required extensions.
apt install php7.4 libapache2-mod-php7.4 php7.4-{mysql,intl,curl,gd,xml,mbstring,zip,bz2,gmp,imagick} -y
Disable any previously enabled PHP Apache modules.
a2dismod php8.5 || true
a2dismod php8.4 || true
a2dismod php8.2 || true
a2dismod php8.1 || true
a2dismod php8.0 || true
Enable PHP 7.4.
a2enmod php7.4
Configure PHP 7.4 as the default CLI version.
update-alternatives --install /usr/bin/php php /usr/bin/php7.4 74
update-alternatives --set php /usr/bin/php7.4
Restart Apache.
systemctl restart apache2
Verify the PHP version.
php -v
Install ownCloud Repository
Install the ownCloud repository.
echo "deb http://download.opensuse.org/repositories/isv:/ownCloud:/server:/10/Debian_12/ /" > /etc/apt/sources.list.d/owncloud.list
Import the repository GPG key.
curl -fsSL https://download.opensuse.org/repositories/isv:ownCloud:server:10/Debian_12/Release.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/owncloud.gpg
Update the package list.
apt update
Install ownCloud.
apt install owncloud-complete-files -y
Configure Apache for ownCloud
Create the Apache VirtualHost configuration.
cat > /etc/apache2/sites-available/owncloud.conf << 'EOF'
Alias / "/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>
EOF
Enable the ownCloud site.
a2ensite owncloud.conf
Disable the default Apache site.
a2dissite 000-default.conf
Enable the required Apache modules.
a2enmod rewrite headers env dir mime setenvif unique_id
Verify the Apache configuration.
apachectl -t
Restart Apache.
systemctl restart apache2
Create the ownCloud Database
Secure the MariaDB installation.
mysql_secure_installation
Login to MariaDB.
mysql
Or, if password authentication is enabled.
mysql -u root -p
Create the ownCloud database and user.
CREATE DATABASE ownclouddb CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'ocadmin'@'localhost' IDENTIFIED BY 'StrongP@ss';
GRANT ALL PRIVILEGES ON ownclouddb.* TO 'ocadmin'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Configure Firewall (Optional)
If UFW is enabled, allow HTTP and HTTPS.
ufw allow Apache Full
Complete the Installation
Open your browser and navigate to:
http://<server-IP>
Configure the installer using the following details:
- Admin Username: Choose your preferred username.
- Admin Password: Choose a secure password.

Database settings:
Database User: ocadmin
Database Password: StrongP@ss
Database Name: ownclouddb
Database Host: localhost

Click Finish Setup.
Once the installation is complete, log in using the administrator account created during the setup.

You should now see the ownCloud dashboard, where you can upload, manage, and share your files securely.

This concludes our guide on installing and configuring ownCloud on Debian 12.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS