{"id":1894,"date":"2025-04-17T08:00:00","date_gmt":"2025-04-17T05:00:00","guid":{"rendered":"https:\/\/upcloud.com\/global\/us\/resources\/tutorials\/installing-owncloud-on-upcloud-server-and-dbaas-a-full-setup-guide\/"},"modified":"2025-04-17T08:00:00","modified_gmt":"2025-04-17T05:00:00","slug":"installing-owncloud-on-upcloud-server-and-dbaas-a-full-setup-guide","status":"publish","type":"tutorial","link":"https:\/\/upcloud.com\/global\/resources\/tutorials\/installing-owncloud-on-upcloud-server-and-dbaas-a-full-setup-guide\/","title":{"rendered":"Installing ownCloud on UpCloud server and DBaaS: A Full Setup Guide"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Teams often need reliable and secure ways to store, share, and collaborate on files \u2014 and ownCloud fits that need well. But getting it up and running isn\u2019t always straightforward. You\u2019ll need to pick the right server, configure the database, set permissions, and handle backups to keep your data safe and durable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s where UpCloud comes in. With high-performance <a href=\"https:\/\/upcloud.com\/global\/products\/cloud-servers\">cloud servers<\/a> and a <a href=\"https:\/\/upcloud.com\/global\/products\/managed-databases\">managed Database-as-a-Service (DBaaS)<\/a>, it\u2019s a solid foundation for hosting ownCloud.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this tutorial, you\u2019ll install ownCloud on an Ubuntu 22.04 LTS server using UpCloud\u2019s infrastructure.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you\u2019re looking for a more general guide that covers other platforms like Debian and Docker, check out our earlier article: <em><a href=\"https:\/\/upcloud.com\/global\/resources\/tutorials\/how-to-install-and-configure-owncloud-a-step-by-step-guide\" data-type=\"link\" data-id=\"https:\/\/upcloud.com\/global\/resources\/tutorials\/how-to-install-and-configure-owncloud-a-step-by-step-guide\">How to Install and Configure OwnCloud: A Step-by-Step Guide<\/a>.<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/upcloud.com\/global\/docs\/guides\/deploy-server\/\">An UpCloud cloud server running Ubuntu 22.04 LTS<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/upcloud.com\/global\/docs\/products\/managed-postgresql\/\">An UpCloud Managed Database (DBaaS) instance running PostgreSQL 17.4<\/a><\/li>\n\n\n\n<li>Basic knowledge of the command line (CLI)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Installing OwnCloud&nbsp;<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You need to download and install a compatible version of ownCloud from the <a href=\"https:\/\/software.opensuse.org\/download.html?project=isv:ownCloud:server:10&amp;package=owncloud-complete-files\" target=\"_blank\" rel=\"noopener\">official repository<\/a> onto your spun-up Upcloud server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. Connect to Your UpCloud Ubuntu Server and SSH into your spun-up UpCloud Ubuntu instance from your local machine:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">ssh -i your-pem-key root@your-server-ip<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. Add the OwnCloud Repository:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">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<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. Import the Repository Key:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">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 &gt; \/dev\/null<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">4. Update Package Lists &amp; Install OwnCloud:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sudo apt update\nsudo apt install owncloud-complete-files<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">5. &nbsp;Verify the Installation \u2013 check if ownCloud files were installed successfully:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">ls \/var\/www\/owncloud\/<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Install Apache and PHP (ownCloud Dependencies)<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">1. ownCloud needs a web server and PHP with specific extensions to run properly. Run the following to install them:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sudo add-apt-repository ppa:ondrej\/php\nsudo apt update\nsudo 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<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. Then verify the installs:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">php -v\nsudo systemctl status apache2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. Update Apache Configuration to Serve ownCloud<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Edit Apache\u2019s default virtual host file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sudo nano \/etc\/apache2\/sites-available\/000-default.conf<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">4. Change the<code> DocumentRoot<\/code> line to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">DocumentRoot \/var\/www\/owncloud<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">5. Set Permissions for ownCloud Files<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sudo chown -R www-data:www-data \/var\/www\/owncloud\nsudo chmod -R 755 \/var\/www\/owncloud<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">6. Restart Apache<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sudo systemctl restart apache2\nreboot<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Connect ownCloud to UpCloud DBaaS (PostgreSQL)<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In this step, you\u2019ll connect ownCloud to a PostgreSQL database hosted on <a href=\"https:\/\/upcloud.com\/global\/products\/managed-databases\">UpCloud\u2019s Managed Database service (DBaaS)<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. Configure DB Access from the UpCloud Dashboard<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">From your UpCloud DBaaS Overview page, make the following adjustments:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Enable<\/strong>: Automatic access from Utility network servers<\/li>\n\n\n\n<li><strong>Ensure<\/strong>: Allow access from all IPs is disabled<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This ensures only trusted services like your provisioned upcloud server can reach the database.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-141-1024x326.png\" alt=\"-\" class=\"wp-image-49730\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">2. Get Your Database Credentials<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Still in the Overview section:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Find the <strong>Private connection<\/strong> section.<\/li>\n\n\n\n<li>Take note of the <strong>connection string<\/strong>, <strong>host<\/strong>, and <strong>port<\/strong> values.<\/li>\n\n\n\n<li>Be sure to <strong>use the primary connection<\/strong>, not read-only or replica endpoints.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-142-1024x342.png\" alt=\"-\" class=\"wp-image-49731\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3. Install the PostgreSQL Client on your server<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SSH into your Ubuntu server and run the following commands in your provisioned UpCloud server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sudo apt update\nsudo apt install -y postgresql-client<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">4. Connect to the Database via psql<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Replace the string below with the actual one from your DBaaS console and the command in one line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">psql \npostgres:\/\/upadmin:AVNS_QJ52PdAZP1g3@database-for-owncloud-opzqciybqqmo.db.upclouddatabases.com:11569\/defaultdb?sslmode=require<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">5. Create Database and User for ownCloud<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once you&#8217;re connected to PostgreSQL via psql, run the following SQL commands \u2014 but make sure to replace the placeholders with your own preferred values:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">CREATE DATABASE &lt;your-db-name&gt;;\nCREATE USER &lt;your-db-username&gt; WITH PASSWORD '&lt;your-db-password&gt;';\nGRANT ALL PRIVILEGES ON DATABASE &lt;your-db-name&gt; TO &lt;your-db-username&gt;;\n\\c &lt;your-db-name&gt;\nGRANT ALL ON SCHEMA public TO &lt;your-db-username&gt;;\n\\q<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">CREATE DATABASE owncloud;\nCREATE USER ownclouduser WITH PASSWORD 'owncloudpass123';\nGRANT ALL PRIVILEGES ON DATABASE owncloud TO ownclouduser;\n\\c owncloud\nGRANT ALL ON SCHEMA public TO ownclouduser;\n\\q<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This creates a dedicated user and database for ownCloud, following least-privilege principles.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">6. Run ownCloud Setup with PostgreSQL Details<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to your ownCloud installation directory: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">cd \/var\/www\/owncloud<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now that the database is ready, you can run the ownCloud install command using<strong> occ.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before running it, make sure to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Replace <code>&lt;your-db-host&gt; <\/code>and <code>&lt;your-db-port&gt; <\/code>with the <strong>host and port values<\/strong> from your UpCloud DBaaS <strong>Private connection<\/strong> section.<\/li>\n\n\n\n<li>Replace the database name, username, and password with the ones you created earlier.<\/li>\n\n\n\n<li>Set your preferred ownCloud <strong>admin username and password<\/strong>.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Here\u2019s the command format, run each line at a time:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sudo -u www-data php occ maintenance:install \\\n  --database \"pgsql\" \\\n  --database-name \"owncloud\" \\\n  --database-host \"&lt;your-db-host&gt;:&lt;your-db-port&gt;\" \\\n  --database-user \"&lt;your-db-username&gt;\" \\\n  --database-pass \"&lt;your-db-password&gt;\" \\\n  --admin-user \"&lt;your-owncloud-admin&gt;\" \\\n  --admin-pass \"&lt;your-owncloud-admin-password&gt;\" \\\n  --verbose<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sudo -u www-data php occ maintenance:install \\\n  --database \"pgsql\" \\\n  --database-name \"owncloud\" \\\n  --database-host \"database-for-owncloud-opzqciybqqmo.db.upclouddatabases.com:11569\" \\\n  --database-user \"ownclouduser\" \\\n  --database-pass \"owncloudpass123\" \\\n  --admin-user \"admin\" \\\n  --admin-pass \"admin1234&amp;$\" \\\n  --verbose<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If everything goes well, you should see a message like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">ownCloud was successfully installed<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This confirms that ownCloud is now fully set up and connected to your UpCloud DBaaS PostgreSQL instance.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: Configuring the Admin Panel<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">At this point, ownCloud is installed, dependencies are in place, and Apache is already serving your instance. Now it\u2019s time to add your server\u2019s IP to ownCloud\u2019s trusted domain list and complete the setup via the web interface.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. Enter the ownCloud configuration file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sudo nano \/var\/www\/owncloud\/config\/config.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. Inside the<code> trusted_domains<\/code> array, add your server\u2019s public IP address. It should look like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">'trusted_domains' =&gt; \narray (\n  0 =&gt; 'localhost',\n  1 =&gt; '94.237.50.118', \/\/ replace with your actual server IP\n),<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Click on Ctrl X, Y, and Enter to save.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 5: Complete the Web-Based Setup<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now open a browser and go to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">http:\/\/your-server-ip<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Log in using the credentials you set during the terminal-based install:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">Username: your-owncloud-username  \nPassword: your-owncloud-password<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You should land on the ownCloud dashboard.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 6: Enabling Backups on UpCloud<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Server Backups (VM Snapshots)<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>To schedule a flexible backup:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Simple backups<\/strong> \u2013 quick, fixed-schedule option<\/li>\n\n\n\n<li><strong>Flexible backups<\/strong> \u2013 lets you set the exact time, backup frequency (daily or weekly), and retention period (up to 3 years)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>To schedule a flexible backup:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to your UpCloud Control Panel.<\/li>\n\n\n\n<li>Open your ownCloud server.<\/li>\n\n\n\n<li>Navigate to the <strong>Backups<\/strong> tab.<\/li>\n\n\n\n<li>Select <strong>Flexible backup<\/strong>.<\/li>\n\n\n\n<li>Set:\n<ul class=\"wp-block-list\">\n<li>Backup time<\/li>\n\n\n\n<li>Frequency (daily or select days)<\/li>\n\n\n\n<li>Retention period<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-143-1024x483.png\" alt=\"-\" class=\"wp-image-49732\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Click <strong>Save<\/strong>, and UpCloud will handle the rest.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Database Backups (UpCloud DBaaS)<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">UpCloud\u2019s Managed Database for PostgreSQL includes <strong>automatic backups<\/strong>. These are created regularly to capture your database state and can be restored quickly in case of corruption or data loss.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You don\u2019t need to set this up manually; backups are automated.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Go to the Backups tab in your PostgreSQL instance to check your database backup.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-145-1024x361.png\" alt=\"-\" class=\"wp-image-49734\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You can restore data by cloning the DB backups into a new instance.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/upcloud.com\/media\/image-144-1024x625.png\" alt=\"-\" class=\"wp-image-49733\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Wrapping Up<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">By now, you have a fully set up ownCloud on an UpCloud server with a PostgreSQL database powered by UpCloud\u2019s 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Whether you\u2019re 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/upcloud.com\/global\/products\"><strong>Explore more UpCloud tools<\/strong><\/a> to extend your infrastructure.<\/p>\n","protected":false},"author":83,"featured_media":49823,"comment_status":"open","ping_status":"closed","template":"","community-category":[223],"class_list":["post-1894","tutorial","type-tutorial","status-publish","has-post-thumbnail","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/tutorial\/1894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/tutorial"}],"about":[{"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/types\/tutorial"}],"author":[{"embeddable":true,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/users\/83"}],"replies":[{"embeddable":true,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/comments?post=1894"}],"version-history":[{"count":0,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/tutorial\/1894\/revisions"}],"wp:attachment":[{"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/media?parent=1894"}],"wp:term":[{"taxonomy":"community-category","embeddable":true,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/community-category?post=1894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}