Teams often need reliable and secure ways to store, share, and collaborate on files — and ownCloud fits that need well. But getting it up and running isn’t always straightforward. You’ll need to pick the right server, configure the database, set permissions, and handle backups to keep your data safe and durable.
That’s where UpCloud comes in. With high-performance cloud servers and a managed Database-as-a-Service (DBaaS), it’s a solid foundation for hosting ownCloud.
In this tutorial, you’ll install ownCloud on an Ubuntu 22.04 LTS server using UpCloud’s infrastructure.
If you’re looking for a more general guide that covers other platforms like Debian and Docker, check out our earlier article: How to Install and Configure OwnCloud: A Step-by-Step Guide.
Prerequisites
- An UpCloud cloud server running Ubuntu 22.04 LTS
- An UpCloud Managed Database (DBaaS) instance running PostgreSQL 17.4
- Basic knowledge of the command line (CLI)
Step 1: Installing OwnCloud
You need to download and install a compatible version of ownCloud from the official repository onto your spun-up Upcloud server.
1. Connect to Your UpCloud Ubuntu Server and SSH into your spun-up UpCloud Ubuntu instance from your local machine:
ssh -i your-pem-key root@your-server-ip
2. Add the OwnCloud Repository:
echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/server:/10/Ubuntu_22.04/ /' | sudo tee /etc/apt/sources.list.d/isv:ownCloud:server:10.list
3. Import the Repository Key:
curl -fsSL https://download.opensuse.org/repositories/isv:ownCloud:server:10/Ubuntu_22.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/isv_ownCloud_server_10.gpg > /dev/null
4. Update Package Lists & Install OwnCloud:
sudo apt update
sudo apt install owncloud-complete-files
5. Verify the Installation – check if ownCloud files were installed successfully:
ls /var/www/owncloud/
Step 2: Install Apache and PHP (ownCloud Dependencies)
1. ownCloud needs a web server and PHP with specific extensions to run properly. Run the following to install them:
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install -y apache2 libapache2-mod-php7.4 php7.4-pgsql php7.4-pdo-pgsql php7.4-curl php7.4-gd php7.4-mbstring php7.4-zip php7.4-intl php7.4-xml php7.4-fileinfo
2. Then verify the installs:
php -v
sudo systemctl status apache2
3. Update Apache Configuration to Serve ownCloud
Edit Apache’s default virtual host file:
sudo nano /etc/apache2/sites-available/000-default.conf
4. Change the DocumentRoot
line to:
DocumentRoot /var/www/owncloud
5. Set Permissions for ownCloud Files
sudo chown -R www-data:www-data /var/www/owncloud
sudo chmod -R 755 /var/www/owncloud
6. Restart Apache
sudo systemctl restart apache2
reboot
Step 3: Connect ownCloud to UpCloud DBaaS (PostgreSQL)
In this step, you’ll connect ownCloud to a PostgreSQL database hosted on UpCloud’s Managed Database service (DBaaS).
1. Configure DB Access from the UpCloud Dashboard
From your UpCloud DBaaS Overview page, make the following adjustments:
- Enable: Automatic access from Utility network servers
- Ensure: Allow access from all IPs is disabled
This ensures only trusted services like your provisioned upcloud server can reach the database.

2. Get Your Database Credentials
Still in the Overview section:
- Find the Private connection section.
- Take note of the connection string, host, and port values.
- Be sure to use the primary connection, not read-only or replica endpoints.

3. Install the PostgreSQL Client on your server
SSH into your Ubuntu server and run the following commands in your provisioned UpCloud server:
sudo apt update
sudo apt install -y postgresql-client
4. Connect to the Database via psql
Replace the string below with the actual one from your DBaaS console and the command in one line:
psql
postgres://upadmin:AVNS_QJ52PdAZP1g3@database-for-owncloud-opzqciybqqmo.db.upclouddatabases.com:11569/defaultdb?sslmode=require
5. Create Database and User for ownCloud
Once you’re connected to PostgreSQL via psql, run the following SQL commands — but make sure to replace the placeholders with your own preferred values:
CREATE DATABASE <your-db-name>;
CREATE USER <your-db-username> WITH PASSWORD '<your-db-password>';
GRANT ALL PRIVILEGES ON DATABASE <your-db-name> TO <your-db-username>;
\c <your-db-name>
GRANT ALL ON SCHEMA public TO <your-db-username>;
\q
For example:
CREATE DATABASE owncloud;
CREATE USER ownclouduser WITH PASSWORD 'owncloudpass123';
GRANT ALL PRIVILEGES ON DATABASE owncloud TO ownclouduser;
\c owncloud
GRANT ALL ON SCHEMA public TO ownclouduser;
\q
This creates a dedicated user and database for ownCloud, following least-privilege principles.
6. Run ownCloud Setup with PostgreSQL Details
Navigate to your ownCloud installation directory:
cd /var/www/owncloud
Now that the database is ready, you can run the ownCloud install command using occ.
Before running it, make sure to:
- Replace
<your-db-host>
and<your-db-port>
with the host and port values from your UpCloud DBaaS Private connection section. - Replace the database name, username, and password with the ones you created earlier.
- Set your preferred ownCloud admin username and password.
Here’s the command format, run each line at a time:
sudo -u www-data php occ maintenance:install \
--database "pgsql" \
--database-name "owncloud" \
--database-host "<your-db-host>:<your-db-port>" \
--database-user "<your-db-username>" \
--database-pass "<your-db-password>" \
--admin-user "<your-owncloud-admin>" \
--admin-pass "<your-owncloud-admin-password>" \
--verbose
For Example:
sudo -u www-data php occ maintenance:install \
--database "pgsql" \
--database-name "owncloud" \
--database-host "database-for-owncloud-opzqciybqqmo.db.upclouddatabases.com:11569" \
--database-user "ownclouduser" \
--database-pass "owncloudpass123" \
--admin-user "admin" \
--admin-pass "admin1234&$" \
--verbose
If everything goes well, you should see a message like:
ownCloud was successfully installed
This confirms that ownCloud is now fully set up and connected to your UpCloud DBaaS PostgreSQL instance.
Step 4: Configuring the Admin Panel
At this point, ownCloud is installed, dependencies are in place, and Apache is already serving your instance. Now it’s time to add your server’s IP to ownCloud’s trusted domain list and complete the setup via the web interface.
1. Enter the ownCloud configuration file:
sudo nano /var/www/owncloud/config/config.php
2. Inside the trusted_domains
array, add your server’s public IP address. It should look like this:
'trusted_domains' =>
array (
0 => 'localhost',
1 => '94.237.50.118', // replace with your actual server IP
),
Click on Ctrl X, Y, and Enter to save.
Step 5: Complete the Web-Based Setup
Now open a browser and go to:
http://your-server-ip
Log in using the credentials you set during the terminal-based install:
Username: your-owncloud-username
Password: your-owncloud-password
You should land on the ownCloud dashboard.
Step 6: Enabling Backups on UpCloud
Backups are essential for protecting your ownCloud setup, both the files on your server and the data inside your database. UpCloud makes it easy to back up both.
Server Backups (VM Snapshots)
UpCloud offers a reliable backup solution for your cloud server. In case of accidental data loss, corruption, or a failed update, it lets you back up your server for easy restoration. UpCloud offers two options: Simple and Flexible backups.
To schedule a flexible backup:
- Simple backups – quick, fixed-schedule option
- Flexible backups – lets you set the exact time, backup frequency (daily or weekly), and retention period (up to 3 years)
To schedule a flexible backup:
- Go to your UpCloud Control Panel.
- Open your ownCloud server.
- Navigate to the Backups tab.
- Select Flexible backup.
- Set:
- Backup time
- Frequency (daily or select days)
- Retention period

Click Save, and UpCloud will handle the rest.
Database Backups (UpCloud DBaaS)
UpCloud’s Managed Database for PostgreSQL includes automatic backups. These are created regularly to capture your database state and can be restored quickly in case of corruption or data loss.
You don’t need to set this up manually; backups are automated.
Go to the Backups tab in your PostgreSQL instance to check your database backup.

You can restore data by cloning the DB backups into a new instance.

Wrapping Up
By now, you have a fully set up ownCloud on an UpCloud server with a PostgreSQL database powered by UpCloud’s Managed DBaaS. From installing dependencies to configuring the admin panel and enabling reliable backup systems, your file-sharing environment is now flexible, secure, and fully under your control.
Whether you’re building a personal cloud drive or hosting files for a team, this setup gives you the performance and peace of mind that comes with running everything on UpCloud.
Explore more UpCloud tools to extend your infrastructure.