Error-free installation of Owncloud Server on Windows 10 within 30 minutes using WSL!

Installation of the Owncloud server is tedious not because steps are lengthy but most of the commands are insufficient and lead to errors. As windows users are not well-versed with Linux commands, it becomes difficult for them to understand and reframe them.

When I searched about the installation of Owncloud on the internet, I found 90% of the content was meant for Linux. That makes it really difficult for Windows users to install it.

I started installing Owncloud on windows using many websites. But some codes are not 100% correct and led to errors in installation. This inspired me to write a blog having correct installation steps of Owncloud on windows 10. Even if you have completed partial steps, you can continue from step 3. It will not reinstall anything and you will get an output stating installations are already present.

I have added commands along with screenshots of output, that will help you to complete all the steps conveniently. At the end of this blog, you would be able to install Owncloud on Windows 10.

Let’s get started!

Step 1: Select the checkbox Windows subsystem for Linux

  • You will have to restart your system after completing step 1, so make sure you close all files before you start performing the following steps.
  • Press the Windows key and type “Turn Windows feature on or off” in the windows search box.
  • Click on it to open Windows Features. Select the checkbox in front of “Windows Subsystem for Linux” to enable the feature.
Fig. 1. Windows Features

Step 2: Installation of Ubuntu 20.04 (any version) Linux App

  • Press the Windows key, search Microsoft store on the windows search box and open it.
  • In the Microsoft store, search for Ubuntu 20.04. At first, it may give you an error saying “the thing you’re looking for isn’t here”.
Fig. 2. Error in Microsoft store
  • To resolve this problem, click on “Refresh the page” four to five times and it will open the installation page of Ubuntu 20.04. Click on the Get button and download Ubuntu 20.04.
Fig. 3. Ubuntu 20.04 in Microsoft Store

Step 3: Installation of Apache, MySQL plus PHP

Note: To properly paste the command, CTRL+C from blog and Right-click on ubuntu cmd, (copy the command given and right-click on the ubuntu command prompt.)

  • After installation of Ubuntu 20.04 LTS, a command prompt will open where paste these commands one by one and execute it. A screenshot is added below every command for clarity.
sudo apt-get update
Fig. 4. Sudo apt-get update on ubuntu 20.04 cmd
  • Install Apache2
sudo apt-get install apache2
  • Install MySQL server and MySQL client, PHP
sudo apt-get install mysql-server mysql-clientsudo apt-get install php libapache2-mod-php php-mysql php-gd php-json php-curl php-xml php-zip php.mb
Fig. 5. MySQL and PHP installation Commands on Ubuntu 20.04
sudo apt-get -y install libmcrypt-devsudo apt-get install php-intl
Fig. 6. Installation commands on Ubuntu 20.04

Step 4: Confirm Apache installation by visiting localhost

  • Run the following command to start Apache2. If this command gives you a warning, run the same command again and it will start Apache.
sudo service apache2 start
Fig. 7. Apache2 Ubuntu Default Page

Step 5: Download Owncloud server

  • Following are the commands to get the files required for setting up Owncloud:
sudo apt install wget unzip
wget https://download.owncloud.org/community/owncloud-complete-latest.zip
Fig. 9. Download Owncloud-complete-latest.zip file

Executing the following command will unzip the contents of the zip file in the Owncloud folder. This command may take 7–8 minutes depending upon your system.

unzip owncloud-complete-latest.zip

To move this extracted content from the owncloud folder to /var/www/ run the following command:

sudo mv owncloud/ /var/www/sudo chown -R www-data:www-data /var/www/owncloud/

The above commands will automatically download and extract the Owncloud files under the Apache directory.

Step 6: Creation of an Owncloud configuration file for Apache

Now create an Owncloud configuration file by executing the following command on Ubuntu cmd:

sudo nano /etc/apache2/sites-available/owncloud.conf

And then copy-paste the following lines in the opened file to point the Apache root directory towards the Owncloud as shown in Fig. 9.

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>

After you paste lines in the .conf file, press CTRL+O to Write Out.

Fig. 10. owncloud.conf content

Press Enter in front of “File Name to Write: /etc/apache2/sites-available/owncloud.conf” (Don’t write M-A).

Fig. 11. owncloud.conf file

In front of “Save this file”, Type Y for Yes and press Enter.

Press CTRL+X to save and exit.

Fig. 12. owncloud.conf file

Step 7: Create a symlink for Owncloud

To tell the Apache about the Owncloud configuration we will create a reference or symlink using the below command:

sudo ln -s /etc/apache2/sites-available/owncloud.conf /etc/apache2/sites-enabled/owncloud.conf

Step 8: Additional modules installation

Add these additional modules for proper Owncloud working.

sudo a2enmod headers env dir mime unique_id

After adding the modules restart the Apache server using the command:

sudo service apache2 restart

Step 9: Create a MySQL database for Owncloud

For every command in step 9, refer figure at the end of the step.

First of all stop and start MySQL. If it gives you a warning/error, try re-executing the same command and you are good to go.

sudo /etc/init.d/mysql stopsudo /etc/init.d/mysql start

Now let’s create a MySQL user and database for OwnCloud:

sudo mysql

We are creating a database with the name owncloud you can use some other name if you want.

CREATE DATABASE owncloud;

Now create a user with a password and at the same time assign all rights of the above-created database to that.

CREATE USER 'user'@'localhost' IDENTIFIED BY 'user';GRANT ALL ON owncloud.* TO 'user'@'localhost' WITH GRANT OPTION;

Flush privileges operations:

FLUSH PRIVILEGES;

Exit the MySQL using the command:

exit
Fig. 13. Create MySQL database for Owncloud

Step 10: Install, Setup, and Configuring ownCloud server on Windows 10

  • After completing all previous steps, Now, start apache2 and MySQL.
sudo service apache2 startsudo /etc/init.d/mysql start
  • Go to the browser and type http://localhost/owncloud/ or http://127.0.0.1/owncloud.
  • If you get an error that “The requested URL was not found on this server. Apache/2.4.41 (Ubuntu) Server at 192.168.0.3 Port 80”, Try running the following command in Ubuntu.
sudo service apache2 restart
Fig. 14. Create an admin account on Owncloud
  • After that, in the storage and database option, add MySQL database details created above; which means database username (‘user’ in our case), its password (password is also ‘user’), and the database name (‘owncloud’ in our case).
Fig. 15. Configure database and Finish setup
  • After providing all information, click on the Finish setup button. This setup may take 10–12 minutes depending upon your system.

Step 11: Login Owncloud server

  • After setup is finished, a login page will be provided.
  • Login with the username and password given in the previous step and this completes the installation of owncloud on windows.
Fig. 16. Login to OwnCloud
Fig. 17. Owncloud user interface
Fig. 18. Owncloud user interface

If you have completed all the above steps and compared your output with the end screen, that means you have successfully installed Owncloud!!

Share and help your friends as well 🙂

Leave a Reply