DEV Community

Büşra
Büşra

Posted on

Windows WSL2 ile Nextcloud Kurma

Nextcloud, kullanıcıların dosya depolama, senkronizasyon, paylaşım ve işbirliği yapabileceği açık kaynaklı bir bulut depolama platformudur. İster kişisel kullanım için ister kurumsal düzeyde olsun, kullanıcılar Nextcloud'u kendi sunucularında veya barındırılan hizmetlerde kullanarak dosyalarını güvenli bir şekilde yönetebilirler. Güvenlik, esneklik ve genişletilebilirlik gibi özellikleriyle dikkat çeker.

  • Windows 10'da Komut İstemini yönetici olarak çalıştırıyoruz. PowerShell'i yönetici olarak çalıştırıyoruz.
PowerShell
# WSL özelliğini etkinleştiriyoruz
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
# Sanal makine platformunu etkileştiriyoruz
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all
Enter fullscreen mode Exit fullscreen mode

Bilgisayarı yeniden başlatıyoruz. Burada eğer sanal makine içinde sanal makine kuracaksak sanal makinenin CPU ayarlarından 'Virtualize IntelVT-x/EPT or AMD-V/RVI' ayarını etkinleştiriyoruz.

Image description

# Sanallaştırma paltformunu etkinkleştiriyoruz.
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
# wsl2 yi etkinleştiriyoruz
wsl --set-default-version 2
# wsl çekirdek güncellemesini indiriyoruz.
$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi -OutFile .\wsl_update_x64.msi
# ilerleme tercihni sıfırla
$ProgressPreference = 'Continue'
# indirilen dosyaları yüklüyoruz
.\wsl_update_x64.msi
Enter fullscreen mode Exit fullscreen mode
  • Windows bilgisayarımızdan Microsoft Store girip Debianı indiriyoruz.

Image description

  • Debian sanal makinesini açıp kullanıcı adı ve şifre belirliyoruz.
sudo apt update
sudo apt upgrade -y
sudo apt install unzip wget -y
sudo apt install apache2 mariadb-server mariadb-client -y
sudo apt install php8.2-* -y
sudo service mariadb start
sudo su
mysql_secure_installation
Enter fullscreen mode Exit fullscreen mode

Image description

mysql -u root -p

  • Nextcloud veritabanını oluşturuyoruz
CREATE DATABASE nextclouddb;
GRANT ALL ON nextclouddb.* to 'nextcloud_rw'@'localhost' IDENTIFIED BY 'N3xtCl0ud!';
FLUSH PRIVILEGES;
EXIT;
exit
Enter fullscreen mode Exit fullscreen mode
  • Apache web kökünde Nextcloud'u indirip çıkarmak için aşağıdaki komutlarla devam ediyoruz.
# en son nextcloud sürümünü indiriyoruz
wget -O /tmp/nextcloud.zip https://download.nextcloud.com/server/releases/latest.zip
# indirilen nextcloud versionunu çıkartıyoruz.
sudo unzip -q /tmp/nextcloud.zip -d /var/www
# Yeni nextcloud dizinin sahibini www-data olarak ayarlıyoruz
sudo chown -R www-data:www-data /var/www/nextcloud

Enter fullscreen mode Exit fullscreen mode
  • nextcloud.conf dosyası oluşturuyoruz.

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

Alias /nextcloud "/var/www/nextcloud/"
<directory /var/www/html/nextcloud/>
Options +FollowSymlinks
AllowOverride All
Require all granted

Dav off

SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
</directory>
Enter fullscreen mode Exit fullscreen mode
  • Siteyi etkinleştirmek için ve Apache'yi yeniden başlatmak için aşağıdaki komutlarla devam ediyoruz.
sudo a2ensite nextcloud
sudo a2enmod rewrite headers env dir mime dav
sudo service apache2 restart
Enter fullscreen mode Exit fullscreen mode
  • localhost/nextcloud/ sitesine gidiyoruz

username: nextcloud_rw
password: N3xtCl0ud!
database name: nextclouddb
database host: localhost

Image description

Top comments (1)

Collapse
 
scsoi profile image
疏影 •

Nice walkthrough for WSL2 + Nextcloud. The WSL2 networking quirks (localhost vs WSL IP, mirror mode vs NAT) catch everyone the first time.

A practical note from a Windows client perspective — once Nextcloud is running on WSL2, you usually want to access it from Windows apps (Office, File Explorer, etc.) as a regular drive. Three approaches:

  1. Nextcloud desktop sync client — official, works well but syncs everything (local cache = full drive size)

  2. rclone mount — points Windows File Explorer at the Nextcloud WebDAV endpoint; no local cache but reads go over loopback

  3. WebDAV mount tools — RaiDrive, NetDrive, or ScsDriver (I am the dev on that last one, 9.99 USD per year). ScsDriver specifically handles Nextcloud WebDAV quirks (chunked upload, PROPFIND on shared folders) better than the built-in Windows WebDAV client. See dev.to/scsoi for details.

For "I want Nextcloud to look like a normal D drive on my Windows desktop", ScsDriver or RaiDrive beats the desktop sync client because there is no local cache taking up space.

One more tip: if you go with WSL2 mirror networking mode (Windows 11 22H2+), localhost works directly — no need to figure out the WSL IP. Worth switching if you have not already.