How to Install ownCloud with WSL on Windows 11
Running ownCloud on Windows 11 with WSL lets you host your own private cloud storage on your PC without a separate server. ownCloud is a self-hosted file sync and share platform. It works like Dropbox or Google Drive, but all your files stay on your own hardware.
This setup uses the Windows Subsystem for Linux (WSL), a built-in Windows 11 feature that runs Linux alongside your regular apps. WSL version 2 gives you full Linux compatibility, fast file speeds inside the Linux file system, and low resource usage. The stack you build here is Ubuntu, Apache, MariaDB and PHP, with ownCloud on top. Everything runs inside the Linux environment, so your Windows files and settings are not touched.
Install ownCloud on Windows 11 by first enabling WSL through Command Prompt with “wsl –install” and restarting. Then, install a Linux distribution like Ubuntu using “wsl –install -d ubuntu-20.04”. Finally, set up Apache and ownCloud within the Linux environment.
Install Windows Subsystem for Linux in 🪟 Windows 11
The Windows Subsystem for Linux (WSL) lets you run Linux programs and command-line tools inside Windows 11 without a separate computer or a manually built virtual machine. To set it up, open Command Prompt as an administrator, run the install command, and restart your computer to finish.
WSL needs hardware virtualization to be turned on. Most PCs have it on by default. If the install fails with a virtualization error, enable it in your BIOS or UEFI settings, then try again.
You need administrator rights to install WSL, so open Command Prompt as an administrator first.
- Click the Start button and type Command Prompt.
- Right-click the Command Prompt app in the results.
- Choose Run as administrator.
- Click Yes if User Account Control asks for permission. A black console window opens with a title that starts with “Administrator”.

With the console open, run the commands below to install the Windows Subsystem for Linux (WSL). Type them exactly as shown and press Enter.
wsl --install
Wait for WSL to download and install. This can take several minutes, depending on your connection. Don't close the window while text is still scrolling.
When it finishes, you should see a success message similar to the lines below:
Installing: Virtual Machine Platform Virtual Machine Platform has been installed. Installing: Windows Subsystem for Linux Windows Subsystem for Linux has been installed. Downloading: WSL Kernel Installing: WSL Kernel WSL Kernel has been installed. Downloading: GUI App Support Installing: GUI App Support GUI App Support has been installed. Downloading: Ubuntu The requested operation is successful. Changes will not be effective until the system is rebooted.
Restart your computer now. WSL is not fully active until you do.
After the restart, WSL should be installed and ready to use. To update it later, open Command Prompt as an administrator again and run the commands below:
wsl --update
Install Specific Linux distro on 🪟 Windows 11
Installing a specific Linux distribution through WSL lets you pick the exact operating system you want for your server project. You can list all available distributions with one command, then install the one you want with the standard install command.
This guide uses Ubuntu, because the Apache, MariaDB and PHP packages in later sections are installed with Ubuntu's package manager. If you pick a different distribution, those package commands will not work as shown.
wsl --list --online
You should now see a list of all the distributions you can install on WSL. The names in the list are the exact names you use in the install command.
NAME FRIENDLY NAME Ubuntu Ubuntu Debian Debian GNU/Linux kali-linux Kali Linux Rolling Ubuntu-18.04 Ubuntu 18.04 LTS Ubuntu-20.04 Ubuntu 20.04 LTS Ubuntu-22.04 Ubuntu 22.04 LTS Ubuntu-24.04 Ubuntu 24.04 LTS openSUSE-Tumbleweed openSUSE Tumbleweed openSUSE-Leap-15.6 openSUSE Leap 15.6 SUSE-Linux-Enterprise-15-SP5 SUSE Linux Enterprise 15 SP5
To install a distribution from the list, run the commands below with the distribution name. For example, to install Ubuntu 20.04, run:
wsl --install -d ubuntu-20.04You should get a message that the distribution was installed. If your list also shows a newer Ubuntu LTS release, you can use that instead. Just keep in mind that package versions, especially PHP, can differ from the ones shown in this guide.
Downloading: Ubuntu 20.04 LTS Installing: Ubuntu 20.04 LTS Ubuntu 20.04 LTS has been installed. Launching Ubuntu 20.04 LTS.
When the install finishes, an Ubuntu console opens and shows setup details. The first launch can take a minute while Ubuntu unpacks. It then asks you to create a Linux username and password. These are separate from your Windows account. Remember the password, because sudo asks for it every time you run an administrative command in the steps below.
Installing, this may take a few minutes.
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: Richard
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
Welcome to Ubuntu 20.04 LTS (GNU/Linux 4.4.0-22000-Microsoft x86_64)If you run into problems with the install, run the troubleshooting commands below. They help you check the WSL version, see which distributions are installed, and confirm the distribution runs under WSL 2.
wsl --set-default-version 2 bcdedit /set hypervisorlaunchtype auto
Install Apache HTTP Server
The Apache HTTP Server is the web server that handles incoming web traffic for your ownCloud installation. You install it in your Ubuntu environment by updating the package lists and then running the package install command in the Linux terminal.
Open your Ubuntu console, then run the commands below to install Apache on Ubuntu. Enter your Linux password if sudo asks for it, and answer Y if the installer asks to continue.
sudo apt update sudo apt install apache2
After Apache2 is installed, use the commands below to stop, start and restart the Apache2 service. You will need the restart command several times later in this guide.
sudo service apache2 stop sudo service apache2 start sudo service apache2 restart
To check that Apache is installed and working, open a web browser in Windows and browse to the server's hostname or IP address. With WSL 2, the address localhost from Windows normally reaches the web server running in Linux. If that page doesn't load, make sure Apache is started, then try the IP address of your Linux environment instead.
If everything works, you should see the Apache test page.
http://localhost

Install MariaDB Database Server
MariaDB is a fast, secure database server. It stores ownCloud's user accounts, settings and file index. You install it in your Ubuntu WSL environment with the package manager to get the database engine that ownCloud needs.
MariaDB is an open-source database server you can use with your own projects. It is fast and secure, and it is the default database server on many Linux systems.
Run the commands below in the Ubuntu console to install MariaDB:
sudo apt-get install mariadb-server mariadb-client
After MariaDB is installed, use the commands below to stop, start and restart the MariaDB service.
sudo service mysql stop sudo service mysql start sudo service mysql restart
Next, run the commands below to secure the database server with a root password. Do this even if the installer did not prompt you for one, because a fresh install has no root password set.
sudo mysql_secure_installation
When the script prompts you, answer the questions as listed below. The answer for each prompt is shown in red.
- Enter current password for root (enter for none): Press the Enter key, because no password is set yet.
- Set root password? [Y/n] : Y
- New password: Enter password. Nothing appears on screen while you type. That is normal.
- Re-enter new password: Repeat password
- Remove anonymous users? [Y/n] : Y
- Disallow root login remotely? [Y/n] : Y
- Remove test database and access to it? [Y/n] : Y
- Reload privilege tables now? [Y/n] : Y
To check that MariaDB is installed and working, log in to the database console with the commands below:
sudo mysql -u root -p
Type the root password you just set when prompted. The password is not shown as you type.
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 46
Server version: 10.3.29-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]>If you see a screen like the one below, the server is installed and running.
PHP and Related Modules
PHP is the programming language ownCloud runs on. It needs specific modules for image processing, database connections and file transfers. Install PHP together with its recommended extension packages from the terminal so ownCloud works correctly.
To install PHP and the recommended modules, run the commands below.
sudo apt install php libapache2-mod-php php-imagick php-imap php-json php-ldap php-common php-pgsql php-ssh2 php-sqlite3 php-xml php-mysql php-gmp php-curl php-intl php7.4-mbstring php-xmlrpc php-gd php-xml php-cli php-zip
That installs PHP with the modules that many PHP-based applications, including ownCloud, rely on. The exact PHP version depends on your Ubuntu release.
To check that PHP is installed, run the commands below:
php -v
You should see output like the one below. It shows the installed PHP version.
PHP 7.4.3 (cli) (built: Oct 6 2020 15:47:56) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
You can also test with a small PHP script that shows the installed version and which modules are enabled or disabled.
sudo nano /var/www/html/phpinfo.php
The command opens a text editor in the console. Type the content below into the file.
<?php phpinfo( ); ?>
Save the file and close the editor.
Next, open your browser and browse to your server hostname followed by phpinfo.php.
Restart Apache first, so it loads the PHP module, then type the address and open the file.
http://example.com/phpinfo.php
You should see the default PHP information page. Once you've confirmed it works, consider deleting the test file. It exposes details about your server that you don't want visible long term.

At this point, everything ownCloud needs is installed. Continue below to download ownCloud and configure it.
Create ownCloud Database
A dedicated database in MariaDB gives ownCloud a safe place to store user accounts, file indexes and app settings. You create it by logging in to the database server as root and running a few SQL statements. The steps below create the database, create a user and give that user access to it.
- Log on to the MariaDB database server with the commands below. Enter the root password when prompted.
sudo mysql -u root -p
- Create a database called owncloud.
CREATE DATABASE owncloud;- Create a database user called ownclouduser with a new password. Use a strong password and write it down. You enter it again in the ownCloud web installer.
CREATE USER 'ownclouduser'@'localhost' IDENTIFIED BY 'new_password_here';
- Grant the user full access to the database.
GRANT ALL ON owncloud.* TO 'ownclouduser'@'localhost' WITH GRANT OPTION;
- Save your changes and exit the database console.
FLUSH PRIVILEGES; EXIT;
Download ownCloud
Downloading the latest stable ownCloud release gives you the application files for your personal file storage service. You download the archive from the official project website and extract it into your web server directory.
When this article was written, the latest stable version of ownCloud was 10.7. Before you continue, visit the ownCloud download page and check whether a newer version is available. If there is one, use that version's download in the commands below. Also check that the PHP version on your Ubuntu release is supported by the ownCloud version you pick.
wget https://download.owncloud.org/community/owncloud-complete-20210326.zip -P /tmp sudo unzip /tmp/owncloud-complete-20210326.zip -d /var/www
Then run the commands below to set the correct ownership and permissions so ownCloud can read and write its files. Without them, the web installer fails with permission errors.
sudo chown -R www-data:www-data /var/www/owncloud/ sudo chmod -R 755 /var/www/owncloud/
Configure ownCloud Site
An ownCloud site configuration in Apache tells the web server where to find the application files and how to answer browser requests. You create a new configuration file in the Apache sites directory, paste in your settings, and enable the site.
sudo nano /etc/apache2/sites-available/owncloud.conf
Copy and paste the content below into the new file. Replace the highlighted line with your own domain name and directory root location. On a local WSL setup, a name such as localhost is fine for testing.
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/owncloud/
ServerName example.com
ServerAlias www.example.com
Alias /owncloud "/var/www/owncloud/"
<Directory /var/www/owncloud/>
Options +FollowSymlinks
AllowOverride All
Require all granted
<IfModule mod_dav.c Dav off
</IfModule SetEnv HOME /var/www/owncloud
SetEnv HTTP_HOME /var/www/owncloud
</Directory ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>Save the file and exit the editor.
With the VirtualHost configured, turn it on for ownCloud. Run the commands below to enable the VirtualHost and the extra Apache modules ownCloud needs.
sudo a2ensite owncloud.conf sudo a2enmod rewrite sudo a2enmod headers sudo a2enmod env sudo a2enmod dir sudo a2enmod mime
When that is done, restart Apache so the new site and modules take effect.
sudo service apache2 restart
Now open your browser and go to the server hostname or IP address to reach the ownCloud setup page. The ownCloud installer should load.
http://example.com
On the setup page, create an admin account, enter the database details you created earlier, and finish the installation. Use owncloud as the database name and ownclouduser as the database user, with the password you set. Choose a strong admin password, because this account controls everything in your cloud.

Log in with the admin account you just created and start building your environment.

Conclusion:
This post showed you how to install ownCloud on Windows 11 with WSL. If you find any errors above, please use the comment form below to report them.
Have a question about this guide?
Answered by AI from this guide. Good questions may be added to this page — please don't include personal details.
Did this guide fix your problem?
About the Author
Richard
Tech Writer, IT Professional
Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.
so far I have completed all the steps but when it comes to the last step to begin setting up ownCloud platform, my browser shows my ip-address refused to connect, please help me solve this issue.
did you ever solve this? i am having the same issue
I have installed as for as the mariadb, but if I try run or stop I get mysql: unrecognized service