Install and configure OwnCloud on Ubuntu 21 / Debian 11

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"

Hi Guys ! Today we will do install OwnCloud on Ubuntu 21, but before that let’s have some theory.

OwnCloud is a self-hosted file sync and share server. It provides access to your data through a web interface, sync clients or WebDAV while providing a platform to view, sync and share across devices easily—all under your control. OwnCloud’s open architecture is extensible via a simple but powerful API for applications and plugins and it works with any storage.


  • Versioning: A file history permits you to roll back to a previous version.
  • Encryption: OwnCloud protects user data in transit; when it’s transmitted between client and server.
  • Drag and drop upload: Drag files from your desktop file manager to your OwnCloud instance.
  • Theming: Change the look of your OwnCloud instance.
  • Viewing ODF files: You can view Open Document Format files such as .odt documents and .ods spreadsheets.
  • Expansion via install able applications: From within the OwnCloud Marketplace, you can install a number of official and third party applications.
  • A mobile app for Android and iOS: Mobile apps allow you to interact with your OwnCloud server, such as for syncing, uploading, downloading, and viewing files.

Install OwnCloud on Ubuntu

Install the LAMP Stack

LAMP (Linux, Apache, MySQL, PHP) stack is required to install OwnCloud. In this section, you complete the steps to install a LAMP stack on your machine. Although you don’t have to use Apache as the web server, the OwnCloud developers highly recommend it over web servers like NGINX and lightHTTP.

  1. Install the LAMP stack with a single command:
    sudo apt install lamp-server^ -y
  2. When the installation is complete, enable and start Apache:
    sudo systemctl start apache2
  3. sudo systemctl enable apache2
  4. Start and enable the MySQL database:
    sudo systemctl start mysql sudo systemctl enable mysql
  5. Set a MySQL admin password and secure the installation:
    sudo mysql_secure_installation
    During this process, the system asks if you want to enable the VALIDATE PASSWORD COMPONENT. This feature ensures that all created passwords are strong and unique. Answer n (as in “no”). When prompted, type and verify a new secure password for the MySQL admin user. You are then prompted to answer four questions, to all of which you should respond y (as in “yes”).
  6. Install PHP and all the required PHP packages
    sudo apt install php php-opcache php-gd php-curl php-mysqlnd php-intl php-json php-ldap php-mbstring php-mysqlnd php-xml php-zip -y
  7. Restart Apache to enable any changes:
    sudo systemctl restart apache2

Create the OwnCloud Database

Now that you have installed the prerequisites, it’s time to create the OwnCloud database and user. The commands in this section are issued from within the MariaDB console.

  1. Access the MariaDB console:
    sudo mysql -u root -p
  2. create your OwnCloud database:
    CREATE DATABASE ownclouddb;
  3. Create a new user with the necessary privileges, including a strong and unique password. Be sure to substitute PASSWORD with your own password:
    GRANT ALL ON ownclouddb.* TO 'unixcop'@'unixcop.local' IDENTIFIED BY 'PASSWORD';
  4. Flush your database’s privileges: FLUSH PRIVILEGES;
  5. Finally, exit the database console: exit

Download OwnCloud

At this point, the system is ready for OwnCloud. Before you actually download the software, check the OwnCloud downloads page to confirm the most recent version.

  1. Download OwnCloud. wget
  2. Unzip the downloaded file: unzip
  1. When you unzip the file, a new directory named owncloud is created. Move the new directory to the Apache document root. This example uses the default directory for Apache site files: sudo mv owncloud /var/www/html/
  2. Change the ownership of the owncloud directory: sudo chown -R www-data: /var/www/html/owncloud

Create an Apache Configuration File

Apache requires a virtual host configuration file in order to server your OwnCloud instance to the web.

  1. Create an Apache configuration file using the Nano text editor:
    sudo vim /etc/apache2/sites-available/owncloud.conf
  2. Paste the following text into the new file. Replace mentions of with your own domain name or your IP Address
<VirtualHost \*:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/owncloud
    <Directory /var/www/html/owncloud>
         Options FollowSymlinks
         AllowOverride All
         Require all granted

ErrorLog ${APACHE_LOG_DIR}/example.com_error.log

CustomLog ${APACHE_LOG_DIR}/your-domain.com_access.log combined

  1. Save and close the file
  2. Enable the rewritemime, and unique_id Apache modules: sudo a2enmod rewrite mime unique_id
  3. Restart the Apache server:
    sudo systemctl restart apache2

The command line portion of the installation is complete.

Configure OwnCloud on Ubuntu

This section covers the web-based portion of the installation.

  1. Open a web browser and navigate to your site’s domain, if it has been configured to use a domain name like, http://unixcop.local/owncloud.
  2. Type a username and password for the admin user; click the Storage & Database drop-down; and then click MySQL/MariaDB.
Owncloud login page on Ubuntu
Owncloud login page on Ubuntu

After logging in, you will get the page like this

Owncloud on Ubuntu
Owncloud on Ubuntu
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"
Unix/Linux Guru and FOSS supporter


  1. debian:
    root@owncloud:/var/www/owncloud# apt install lamp-server^ -y
    Reading package lists… Done
    Building dependency tree… Done
    Reading state information… Done
    E: Unable to locate package lamp-server^
    E: Couldn’t find task ‘lamp-server’


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook