0151.html 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Install Nextcloud on Windows with WSL2</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta charset="UTF-8">
  7. <meta name="keywords" content="Browser Based,Home Lab,Home Lab Ideas,Install Guide,Self-Hosted,Web Based,Web Based Tools,Apache,Apache HTTPD,Cloud Solution,Debian,Free Software,HTTPD,LAMP,Linux,MariaDB,MySQL,Nextcloud,PHP,PHP Application,PHP Software,Web Server,Windows,Linux On Windows,Subsystem,WSL,WSL Installation Guide,Windows Subsystem For Linux,How To Install WSL,How To,Tutorial,i12bretro">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="Install Nextcloud on Windows with WSL2">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <meta name="revised" content="04/01/2023 10:20:42 AM" />
  12. <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
  13. <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  14. <script type="text/javascript" src="includes/js/steps.js"></script>
  15. <link href="css/steps.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="gridContainer">
  19. <div class="topMargin"></div>
  20. <div id="listName" class="topMargin">
  21. <h1>Install Nextcloud on Windows with WSL2</h1>
  22. </div>
  23. <div></div>
  24. <div id="content">
  25. <h2>What is Nextcloud?</h2>
  26. <blockquote><em>Nextcloud is an open source, self-hosted file share and communication platform. Access &amp; sync your files, contacts, calendars &amp; communicate and collaborate across your devices. You decide what happens with your data, where it is and who can access it! -<a href="https://docs.nextcloud.com/" target="_blank">https://docs.nextcloud.com/</a></em></blockquote>
  27. <h2>Installing WSL</h2>
  28. <ol>
  29. <li>Launch Powershell as administrator</li>
  30. <li>Run the following command
  31. <div class="codeBlock PS"># enable WSL feature<br />
  32. dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart<br />
  33. # enable virtual machine platform<br />
  34. dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all</div>
  35. </li>
  36. <li>Type Y to reboot the system</li>
  37. <li>Launch Powershell as administrator and run the following additional commands to use WSL 2
  38. <div class="codeBlock PS"># enable virtualization platform<br />
  39. Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform<br />
  40. # enable wsl2<br />
  41. wsl --set-default-version 2<br />
  42. # download the wsl kernel update<br />
  43. $ProgressPreference = &#39;SilentlyContinue&#39;; Invoke-WebRequest https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi -OutFile .\wsl_update_x64.msi<br />
  44. # reset progress preference<br />
  45. $ProgressPreference = &#39;Continue&#39;<br />
  46. # install the downloaded file<br />
  47. .\wsl_update_x64.msi</div>
  48. </li>
  49. <li>Click the Start Button &gt; Search Microsoft Store &gt; Select Microsoft Store</li>
  50. <li>Search for the Linux distribution to install (Debian, Ubuntu, etc), Debian in this example</li>
  51. <li>Select the Linux distribution and click the Get button</li>
  52. <li>After the Linux distribution downloads and installs, click Open or select the distribution from the Start menu to launch it</li>
  53. <li>Input a username and password to be used in the Linux environment</li>
  54. </ol>
  55. <h2>Installing Nextcloud</h2>
  56. <ol>
  57. <li>Continue with the following commands in WSL
  58. <div class="codeBlock"># update software repositories<br />
  59. sudo apt update<br />
  60. # install software updates<br />
  61. sudo apt upgrade -y<br />
  62. # install prerequisite packages<br />
  63. sudo apt install unzip wget -y<br />
  64. # install Apache HTTPD and MySQL<br />
  65. sudo apt install apache2 mariadb-server mariadb-client -y<br />
  66. # install PHP components<br />
  67. sudo apt install php7.4 libapache2-mod-php7.4 php7.4-mysql php-common php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline php7.4-intl php7.4-json php7.4-gd php7.4-mbstring php7.4-mysql php7.4-xml php7.4-zip php7.4-curl -y<br />
  68. # start the mariadb service<br />
  69. sudo service mariadb start<br />
  70. # configure the MySQL database<br />
  71. sudo su<br />
  72. mysql_secure_installation</div>
  73. </li>
  74. <li>Press Enter to login as root</li>
  75. <li>Type N and press Enter to not switch to socket authentication</li>
  76. <li>Type Y and press Enter to set a root password, type the password twice to confirm</li>
  77. <li>Type Y and press Enter to remove anonymous users</li>
  78. <li>Type Y and press Enter to disallow root login remotely</li>
  79. <li>Type Y and press Enter to remove the test database</li>
  80. <li>Type Y and press Enter to reload privilege tables</li>
  81. <li>Run the following command to login into MySQL:
  82. <div class="codeBlock">mysql -u root -p</div>
  83. </li>
  84. <li>Authenticate with the root password set earlier</li>
  85. <li>Run the following commands to create the Nextcloud database and database user
  86. <div class="codeBlock">CREATE DATABASE nextclouddb;<br />
  87. GRANT ALL ON nextclouddb.* to &#39;nextcloud_rw&#39;@&#39;localhost&#39; IDENTIFIED BY &#39;N3xtCl0ud!&#39;;<br />
  88. FLUSH PRIVILEGES;<br />
  89. EXIT;<br />
  90. exit</div>
  91. </li>
  92. <li>Continue with the following commands to download and extract Nextcloud in the Apache webroot
  93. <div class="codeBlock"># download latest nextcloud version<br />
  94. wget -O /tmp/nextcloud.zip https://download.nextcloud.com/server/releases/latest.zip<br />
  95. # extract downloaded nextcloud archive<br />
  96. sudo unzip -q /tmp/nextcloud.zip -d /var/www<br />
  97. # set the owner of the new nextcloud directory to www-data<br />
  98. sudo chown -R www-data:www-data /var/www/nextcloud<br />
  99. # create a new nextcloud.conf file to configure the site<br />
  100. sudo nano /etc/apache2/sites-available/nextcloud.conf</div>
  101. </li>
  102. <li>Paste the following configuration into nextcloud.conf
  103. <p>Alias /nextcloud &quot;/var/www/nextcloud/&quot;<br />
  104. &lt;directory /var/www/html/nextcloud/&gt;<br />
  105. Options +FollowSymlinks<br />
  106. AllowOverride All<br />
  107. Require all granted</p>
  108. <p>Dav off</p>
  109. <p>SetEnv HOME /var/www/nextcloud<br />
  110. SetEnv HTTP_HOME /var/www/nextcloud<br />
  111. &lt;/directory&gt;</p>
  112. </li>
  113. <li>Press CTRL+O, Enter, CTRL+X to write the changes to nextcloud.conf</li>
  114. <li>Continue with the following commands to enable the site and restart Apache:
  115. <div class="codeBlock"># enable the nextcloud config<br />
  116. sudo a2ensite nextcloud<br />
  117. # enable required apache modules<br />
  118. sudo a2enmod rewrite headers env dir mime dav<br />
  119. # restart apache2 service for the changes to take effect<br />
  120. sudo service apache2 restart</div>
  121. </li>
  122. <li>Open a web browser and navigate to http://DNSorIP/nextcloud</li>
  123. <li>The Nextcloud setup screen should be displayed</li>
  124. <li>Enter a username and password</li>
  125. <li>Click the storage &amp; database link to expand the section</li>
  126. <li>Fill out the database connection information as follows
  127. <p>username: nextcloud_rw<br />
  128. password: N3xtCl0ud!<br />
  129. database name: nextclouddb<br />
  130. database host: localhost</p>
  131. </li>
  132. <li>Click Finish Setup</li>
  133. <li>After a few moments of setup Nextcloud will be up and running</li>
  134. <li>Choose to install recommended apps or skip</li>
  135. <li>Welcome to Nextcloud running on WSL</li>
  136. </ol> </div>
  137. </div>
  138. </body>
  139. </html>