<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nextcloud Archives - ServerStadium</title>
	<atom:link href="https://serverstadium.com/knowledge-base/tag/nextcloud/feed/" rel="self" type="application/rss+xml" />
	<link>https://serverstadium.com/knowledge-base/tag/nextcloud/</link>
	<description>Public Cloud Solution by ServerStadium</description>
	<lastBuildDate>Thu, 27 Apr 2023 11:06:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>

<image>
	<url>https://serverstadium.com/wp-content/uploads/2023/04/cropped-favicon-1-32x32.png</url>
	<title>nextcloud Archives - ServerStadium</title>
	<link>https://serverstadium.com/knowledge-base/tag/nextcloud/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Installing NextCloud in ServerStadium Detail Steps from the Beginning to the Very End</title>
		<link>https://serverstadium.com/knowledge-base/installing-nextcloud/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Mon, 22 Aug 2022 10:06:56 +0000</pubDate>
				<guid isPermaLink="false">https://cloudraya.com/knowledge-base/?p=2244</guid>

					<description><![CDATA[<p>Have you ever saved your data without the ability to configure it in a more customizable way and free? It must be hard, isn’t it?  One of the solutions for managing our data in a more advanced and safer way is by using NextCloud. What is NextCloud? In short, NextCloud is an open-source platform for&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/installing-nextcloud/">Installing NextCloud in ServerStadium Detail Steps from the Beginning to the Very End</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Have you ever saved your data without the ability to configure it in a more customizable way and free? It must be hard, isn’t it? </p>



<p class="wp-block-paragraph">One of the solutions for managing our data in a more advanced and safer way is by using NextCloud.</p>



<div class="wp-block-spacer" style="height: 30px;" aria-hidden="true"> </div>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">What is NextCloud?</h2>



<div class="wp-block-spacer" style="height: 11px;" aria-hidden="true"> </div>



<p class="wp-block-paragraph">In short, NextCloud is an open-source platform for cloud storage solutions that allow users to self-host. Functionally it is similar to the cloud storage solutions that we often here, and of course, most of us have used them (Dropbox, Google Drive, One Drive, etc.). </p>



<p class="wp-block-paragraph">Unlike other cloud providers, <strong>NextCloud</strong> is more concerned about our data privacy. Besides that, NextCloud can be installed on our on-premise server or in a private virtual server (ServerStadium’s VM, for example). By that, we have more control over our data. </p>



<p class="wp-block-paragraph">We can also upload files to our NextCloud and then synchronize the files to our computer, laptop, or smartphone. </p>



<p class="wp-block-paragraph">NextCloud also provides many extension apps, making it more useful than cloud storage.  </p>



<div class="wp-block-spacer" style="height: 30px;" aria-hidden="true"> </div>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">The Impact and Benefit of Using NextCloud</h2>



<div class="wp-block-spacer" style="height: 11px;" aria-hidden="true"> </div>



<p class="wp-block-paragraph">There are many impacts and benefits that we can get by using NextCloud; they are:  </p>



<ul class="wp-block-list">
<li>Full control of our infrastructure </li>
<li>Accessible from all devices, anywhere </li>
<li><em>Groupware, </em>sharing files within users or groups will be so much easier and well-controlled</li>
<li>Reliable and safe </li>
<li>All-in-one-platform (file, address, calendar, chat, edit, email) </li>
<li>Open-source and free </li>
<li>End-to-end encryption, meaning the file can be encrypted in the client’s device before being uploaded to the server. So, even when someone tried to breach our server, they could not read our file.  </li>
</ul>



<div class="wp-block-spacer" style="height: 30px;" aria-hidden="true"> </div>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">When Do We Need NextCloud Solution? </h2>



<div class="wp-block-spacer" style="height: 11px;" aria-hidden="true"> </div>



<p class="wp-block-paragraph">From the benefits mentioned, these are the right moments for us to use NextCloud: </p>



<ul class="wp-block-list">
<li>When cyber security becomes your main concern </li>
<li>If you want to have alternative media for your main public cloud storage </li>
<li>When you need more control of your data </li>
<li>When you want to handle the limitation of scalability  </li>
</ul>



<div class="wp-block-spacer" style="height: 30px;" aria-hidden="true"> </div>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">ServerStadium x NextCloud</h2>



<div class="wp-block-spacer" style="height: 11px;" aria-hidden="true"> </div>



<p class="wp-block-paragraph">Deploying NextCloud in <a href="https://serverstadium.com/" target="_blank" rel="noreferrer noopener">ServerStadium</a>’s VM will give many benefits and advantages to you; they are:   </p>



<ul class="wp-block-list">
<li>It helps you to manage cloud storage in a much easier way </li>
<li>Enjoy the best time to use NextCloud and ServerStadium’s user-friendly panel  </li>
<li>Increase your storage capacity easier needs anytime </li>
<li>Advance security with ServerStadium’s Security Profile </li>
<li>Responsive support from ServerStadium’s support team, who is always ready to help </li>
</ul>



<div class="wp-block-spacer" style="height: 30px;" aria-hidden="true"> </div>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">System &amp; Specification Requirements </h2>



<div class="wp-block-spacer" style="height: 11px;" aria-hidden="true"> </div>



<p class="wp-block-paragraph">Several requirements are recommended by NextCloud to be followed so the performance, stability, and functionality can run well: </p>



<ul class="wp-block-list">
<li>OS: Ubuntu 20.04 lts (recommended) </li>
<li>Database: MySQL 8.0+ or MariaDB 10.2/10.3/10.4/10.5 (recommended) </li>
<li>Webserver: Apache 2.4 with mod php or php-fpm (recommended) </li>
<li>PHP Runtime: 7.4, 8.0, 8.1 (recommended) </li>
</ul>



<p class="wp-block-paragraph">The system’s Requirement specification in running NextCloud’s server varies depending on the total users, applications, files, and server activity volume. </p>



<p class="wp-block-paragraph">Though NextCloud needs a minimum of <strong>128MB RAM</strong>, NextCloud recommends having a minimum of <strong>512MB RAM</strong> in our system. </p>



<p class="wp-block-paragraph">The number of CPU can be started with 1 CPU, but also can use more CPUs if the number of users and workloads increases. </p>



<div class="wp-block-spacer" style="height: 30px;" aria-hidden="true"> </div>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Install NextCloud in ServerStadium </h2>



<div class="wp-block-spacer" style="height: 11px;" aria-hidden="true"> </div>



<p class="wp-block-paragraph">We should take several steps before installing NextCloud in ServerStadium’s VM. </p>



<h4 class="wp-block-heading">1. Prepare VM </h4>



<p class="wp-block-paragraph"> First, prepare VM in ServerStadium. For this article, I will use VM with this specification: </p>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture2.png"><img fetchpriority="high" decoding="async" width="975" height="586" class="wp-image-2283" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture2.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture2.png 975w, https://serverstadium.com/wp-content/uploads/2022/08/Picture2-300x180.png 300w, https://serverstadium.com/wp-content/uploads/2022/08/Picture2-768x462.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></a></figure>



<ul class="wp-block-list">
<li>Linux Ubuntu 20.04 </li>
<li>2 Core CPU </li>
<li>2GB RAM </li>
</ul>



<h4 class="wp-block-heading">2. Ubuntu Software Packages Updates </h4>



<p class="wp-block-paragraph">Access the VM; then we have to update the repository and software package first </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo apt update </code></pre>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo apt upgrade </code></pre>



<h4 class="wp-block-heading">3. Install LAMP Stack (Apache MariaDB PHP) </h4>



<p class="wp-block-paragraph">Because NextCloud is written in PHP, we must first install LAMP Stack in our Ubuntu VM. </p>



<h5 class="wp-block-heading">Install Apache Web Server</h5>



<p class="wp-block-paragraph">Insert this command:</p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo apt install -y apache2 apache2-utils</code></pre>



<p class="wp-block-paragraph">↳ <strong>Apache20-utils</strong> command will install some utilities that can be useful, like Apache HTTP Server Benchmarking Tool and etc. </p>



<p class="wp-block-paragraph">After the installation, Apache must be automatically turned on; we can check the status with systemcl. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#systemctl status apache2 </code></pre>



<p class="wp-block-paragraph">Use this command to let the Apache always on automatically: </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo systemctl enable apache2 </code></pre>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture3.png"><img decoding="async" width="829" height="595" class="wp-image-2284" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture3.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture3.png 829w, https://serverstadium.com/wp-content/uploads/2022/08/Picture3-300x215.png 300w, https://serverstadium.com/wp-content/uploads/2022/08/Picture3-768x551.png 768w" sizes="(max-width: 829px) 100vw, 829px" /></a></figure>



<p class="wp-block-paragraph">↳ Now we access the public IP from our VM in a browser; a default page from Apache2 Ubuntu should appear. </p>



<p class="wp-block-paragraph">Now we need to set <strong>www-data </strong>(Apache user) as owner of a web root, because in default, web root is owned by the root user. Use this command: </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo chown www-data:www-data /var/www/html/ -R </code></pre>



<h5 class="wp-block-heading">Install MariaDB Database Server </h5>



<p class="wp-block-paragraph">In this article, we will use <strong>MariaDB </strong>as server database. Insert this command to install it: </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo apt install mariadb-server mariadb-client </code></pre>



<p class="wp-block-paragraph">After installing, MariaDB will automatically be active, we can check the status with <strong>systemctl</strong> </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#systemctl status mariadb </code></pre>



<p class="wp-block-paragraph"> Use this command to make MariaDB always automatically active on every system booting: </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo systemctl enable mariadb </code></pre>



<p class="wp-block-paragraph">Now we run the post-installation security script </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo mysql_secure_installation </code></pre>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture4.png"><img decoding="async" width="591" height="181" class="wp-image-2285" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture4.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture4.png 591w, https://serverstadium.com/wp-content/uploads/2022/08/Picture4-300x92.png 300w" sizes="(max-width: 591px) 100vw, 591px" /></a></figure>



<p class="wp-block-paragraph">↳ When we asked to insert root password from MariaDB, we only need to click <strong>Enter</strong> because we just installed MariaDB. Then, push the Y button to start setting a root password. </p>



<p class="wp-block-paragraph">For further steps, you can look into this image below: </p>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture5.png"><img loading="lazy" decoding="async" width="650" height="795" class="wp-image-2286" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture5.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture5.png 650w, https://serverstadium.com/wp-content/uploads/2022/08/Picture5-245x300.png 245w" sizes="(max-width: 650px) 100vw, 650px" /></a></figure>



<p class="wp-block-paragraph">By default, MariaDB’s package in Ubuntu uses <strong>unix_socket </strong>to authenticate user login. In other words, we can use <em>user pass</em> from OS for login to MariaDB’s console. So, we can run the command to login without inserting the password root from MariaDB. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo mariadb -u root </code></pre>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture6.png"><img loading="lazy" decoding="async" width="640" height="166" class="wp-image-2287" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture6.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture6.png 640w, https://serverstadium.com/wp-content/uploads/2022/08/Picture6-300x78.png 300w" sizes="(max-width: 640px) 100vw, 640px" /></a></figure>



<h5 class="wp-block-heading">Installing PHP </h5>



<p class="wp-block-paragraph">In this article, I will be using version 7.4, which is a stable version of PHP and runs smoothly with NextCloud. Enter the following command to install PHP and some common PHP modules. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#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 </code></pre>



<p class="wp-block-paragraph">Activate the PHP module and then restart Apache Web Server. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo a2enmod php7.4 </code></pre>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo systemctl restart apache2 </code></pre>



<p class="wp-block-paragraph"> We also can check the information on PHP by giving the below command. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#php -–version </code></pre>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture7.png"><img decoding="async" class="wp-image-2288" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture7.png" alt="" /></a></figure>



<h4 class="wp-block-heading">4. Installing NextCloud </h4>



<p class="wp-block-paragraph"> Okay, after<strong> LAMP stack </strong>is installed in our VM, we can now move to the NextCloud installation and configure some of the essential things so that NextCloud can run well. </p>



<h5 class="wp-block-heading">Download NextCloud on Ubuntu </h5>



<p class="wp-block-paragraph"> In the terminal, insert this command to download the newest version from NextCloud. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#wget <a href="https://download.nextcloud.com/server/releases/latest.zip" target="_blank" rel="noreferrer noopener">https://download.nextcloud.com/server/releases/latest.zip</a> </code></pre>



<p class="wp-block-paragraph">Once the download is finished, extract this archive by using <strong>package unzip. </strong>Then we can process the package installation. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo apt install unzip </code></pre>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo unzip latest.zip -d /var/www/ </code></pre>



<p class="wp-block-paragraph">↳ <strong>–d </strong>option in the command functioned to decide the target directory. Meaning, the NextCloud files will be extracted to <strong>/var/www/nextcloud/</strong>. </p>



<p class="wp-block-paragraph">After that, we need to change the owner from this directory to <strong>www-data </strong>so that the web server (Apache) can access and write to this directory. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo chown www-data:www-data /var/www/nextcloud/ -R </code></pre>



<h5 class="wp-block-heading">Making Database and user for NextCloud in MariaDB </h5>



<p class="wp-block-paragraph">Log in to MariaDB </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code># sudo mariadb -u root </code></pre>



<p class="wp-block-paragraph">Then we make a database for NextCloud. For this article, I will add the database that is <strong>nextcloud_db. </strong>You can customize it to your needs. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>create database nextcloud_db; </code></pre>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture8.png"><img loading="lazy" decoding="async" width="411" height="76" class="wp-image-2289" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture8.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture8.png 411w, https://serverstadium.com/wp-content/uploads/2022/08/Picture8-300x55.png 300w" sizes="(max-width: 411px) 100vw, 411px" /></a></figure>



<p class="wp-block-paragraph"> Now let’s make a user for this database; you can set username and password based on your needs. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>create user admin@localhost identified by 'password-anda'; </code></pre>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture8-1.png"><img decoding="async" class="wp-image-2290" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture8-1.png" alt="" /></a></figure>



<p class="wp-block-paragraph">The last step, give this user all the privileges in the NextCloud database.</p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>grant all privileges on nextcloud_db.* to admin@localhost identified by 'password-anda'; </code></pre>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>flush privileges; </code></pre>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture10.png"><img loading="lazy" decoding="async" width="787" height="123" class="wp-image-2292" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture10.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture10.png 787w, https://serverstadium.com/wp-content/uploads/2022/08/Picture10-300x47.png 300w, https://serverstadium.com/wp-content/uploads/2022/08/Picture10-768x120.png 768w" sizes="(max-width: 787px) 100vw, 787px" /></a></figure>



<p class="wp-block-paragraph">Then, insert <strong>exit</strong> as the command. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>exit; </code></pre>



<h5 class="wp-block-heading">Create Apache Virtual Host for NextCloud </h5>



<p class="wp-block-paragraph">We need to create and edit the file <strong>nextcloud.conf </strong>from <strong>/etc/apache2/sites-available/</strong> directory. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo nano /etc/apache2/sites-available/nextcloud.conf </code></pre>



<p class="wp-block-paragraph">Then, copy-paste this text below into a file. After that, save the file. </p>



<figure class="wp-block-table is-style-stripes">
<table>
<tbody>
<tr>
<td>&lt;VirtualHost *:80&gt;<br />        DocumentRoot &#8220;/var/www/nextcloud&#8221;<br />        ServerName files.tiyanwants.website<br /> <br />        ErrorLog ${APACHE_LOG_DIR}/nextcloud.error<br />        CustomLog ${APACHE_LOG_DIR}/nextcloud.access combined<br /> <br />        &lt;Directory /var/www/nextcloud/&gt;<br />            Require all granted<br />            Options FollowSymlinks MultiViews<br />            AllowOverride All<br /> <br />           &lt;IfModule mod_dav.c&gt;<br />               Dav off<br />           &lt;/IfModule&gt;<br /> <br />        SetEnv HOME /var/www/nextcloud<br />        SetEnv HTTP_HOME /var/www/nextcloud<br />        Satisfy Any<br /> <br />       &lt;/Directory&gt;<br /> <br />&lt;/VirtualHost&gt;</td>
</tr>
</tbody>
</table>
</figure>



<p class="wp-block-paragraph">I will use <strong>files.tiyanwants.website </strong>as the domain in this article. You can always suit your needs. And, of course, don’t forget to add DNS A record for this domain inside your DNS Zone editor. </p>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture11.png"><img loading="lazy" decoding="async" width="1276" height="366" class="wp-image-2293" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture11.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture11.png 1276w, https://serverstadium.com/wp-content/uploads/2022/08/Picture11-300x86.png 300w, https://serverstadium.com/wp-content/uploads/2022/08/Picture11-1024x294.png 1024w, https://serverstadium.com/wp-content/uploads/2022/08/Picture11-768x220.png 768w" sizes="(max-width: 1276px) 100vw, 1276px" /></a></figure>



<p class="wp-block-paragraph">After that, activate this virtual host. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo a2ensite nextcloud.conf </code></pre>



<p class="wp-block-paragraph">Run this command to activate the Apache module you need </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo a2enmod rewrite headers env dir mime setenvif ssl </code></pre>



<p class="wp-block-paragraph">Lastly, restart Apache to deploy the changes. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo systemctl restart apache2 </code></pre>



<h5 class="wp-block-heading">Install and Activate PHP Modul </h5>



<p class="wp-block-paragraph">Run this command for the required PHP module installation and recommend by NextCloud. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo apt install imagemagick php-imagick libapache2-mod-php7.4 php7.4-common php7.4-mysql php7.4-fpm php7.4-gd php7.4-json php7.4-curl php7.4-zip php7.4-xml php7.4-mbstring php7.4-bz2 php7.4-intl php7.4-bcmath php7.4-gmp </code></pre>



<p class="wp-block-paragraph"> Reload Apache to activate this module with the below command </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo systemctl reload apache2 </code></pre>



<h5 class="wp-block-heading">Activate HTTPS </h5>



<p class="wp-block-paragraph">At this point, we should be able to access <strong>NextCloud web install wizard</strong> in our browser. </p>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture12.png"><img loading="lazy" decoding="async" width="939" height="394" class="wp-image-2294" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture12.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture12.png 939w, https://serverstadium.com/wp-content/uploads/2022/08/Picture12-300x126.png 300w, https://serverstadium.com/wp-content/uploads/2022/08/Picture12-768x322.png 768w" sizes="(max-width: 939px) 100vw, 939px" /></a></figure>



<p class="wp-block-paragraph">But it will be better to activate HTTPS inside our NextCloud domain before entering sensitive information. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo apt install certbot python3-certbot-apache </code></pre>



<p class="wp-block-paragraph">↳ <strong><em>Python3-certbot-apache </em></strong>is an Apache plugin. </p>



<p class="wp-block-paragraph">Run the below command to get a <strong>free TLS certificate</strong> using <strong>Apache Plugin.</strong> </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo certbot --apache --agree-tos --redirect --staple-ocsp --email wisesa.tiyan@gmail.com -d files.tiyanwants.website </code></pre>



<p class="wp-block-paragraph">Where: </p>



<ul class="wp-block-list">
<li>&#8211;apache2: use Apache’s authenticator and installation </li>
<li>&#8211;agree-tos: Agree to <strong>Let’s Encrypt </strong>service requirement </li>
<li>&#8211;redirect: Implement HTTPS by adding 301 redirect </li>
<li>&#8211;staple-ocsp: Activate <strong>Stapel OCSP</strong> </li>
<li>&#8211;email: Email used for registration and recovery contact </li>
<li>-d is followed by a list of domain names, separated by commas. You can add up to 100 domain names </li>
</ul>



<p class="wp-block-paragraph">There will be some options that we need to fill. Once it finishes, TLS certification will automatically obtain and configured for us; it shows by the message below. </p>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture13.png"><img loading="lazy" decoding="async" width="703" height="388" class="wp-image-2295" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture13.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture13.png 703w, https://serverstadium.com/wp-content/uploads/2022/08/Picture13-300x166.png 300w" sizes="(max-width: 703px) 100vw, 703px" /></a></figure>



<p class="wp-block-paragraph">The next configuration is to enable HSTS (HTTP Strict Transport Security). Because sometimes, <strong>Certbot can&#8217;t automatically add HSTS header in Apache configuration file for NextCloud.</strong> Let&#8217;s edit this file first. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo nano /etc/apache2/sites-enabled/nextcloud-le-ssl.conf </code></pre>



<p class="wp-block-paragraph"> Then, add this line to SSL server block to activate <strong>HSTS header.</strong> </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>Header always set Strict-Transport-Security "max-age=31536000" </code></pre>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture14.png"><img loading="lazy" decoding="async" width="788" height="327" class="wp-image-2296" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture14.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture14.png 788w, https://serverstadium.com/wp-content/uploads/2022/08/Picture14-300x124.png 300w, https://serverstadium.com/wp-content/uploads/2022/08/Picture14-768x319.png 768w" sizes="(max-width: 788px) 100vw, 788px" /></a></figure>



<p class="wp-block-paragraph">Lastly, restart Apache so the changes will be successfully implemented.</p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo systemctl reload apache2 </code></pre>



<h5 class="wp-block-heading">Cloud Finalization </h5>



<p class="wp-block-paragraph">When we want to access our NextCloud dashboard, we are now automatically using HTTPS. </p>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture15.png"><img loading="lazy" decoding="async" width="880" height="431" class="wp-image-2297" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture15.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture15.png 880w, https://serverstadium.com/wp-content/uploads/2022/08/Picture15-300x147.png 300w, https://serverstadium.com/wp-content/uploads/2022/08/Picture15-768x376.png 768w" sizes="(max-width: 880px) 100vw, 880px" /></a></figure>



<p class="wp-block-paragraph">To finish the installation on this wizard page, we need to do several things: </p>



<ol class="wp-block-list">
<li>Create admin account </li>
</ol>



<ol class="wp-block-list" start="2">
<li>Decide NextCloud’s data folder location </li>
</ol>



<ol class="wp-block-list" start="3">
<li>entering database detail that have been made in step 2, and </li>
</ol>



<ol class="wp-block-list" start="4">
<li>Decide the host address </li>
</ol>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture16.png"><img loading="lazy" decoding="async" width="329" height="277" class="wp-image-2298" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture16.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture16.png 329w, https://serverstadium.com/wp-content/uploads/2022/08/Picture16-300x253.png 300w" sizes="(max-width: 329px) 100vw, 329px" /></a></figure>



<p class="wp-block-paragraph">↳ Input username and password for admin user. </p>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture17.png"><img loading="lazy" decoding="async" width="343" height="154" class="wp-image-2299" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture17.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture17.png 343w, https://serverstadium.com/wp-content/uploads/2022/08/Picture17-300x135.png 300w" sizes="(max-width: 343px) 100vw, 343px" /></a></figure>



<p class="wp-block-paragraph">↳ A data folder is a place where the user’s files are saved. It would be better to place a data directory outside of the webroot directory from NextCloud. Instead of saving the users file in <strong>/var/www/nextcloud/data/, </strong>we can change it to <strong>/var/www/nextcloud-data</strong>. </p>



<p class="wp-block-paragraph">We can do it with this command. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo mkdir /var/www/nextcloud-data </code></pre>



<p class="wp-block-paragraph">Then, make sure Apache’s user (<strong>www-data</strong>) has permission to write into the data directory.</p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo chown www-data:www-data /var/www/nextcloud-data -R </code></pre>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture18.png"><img loading="lazy" decoding="async" width="305" height="351" class="wp-image-2300" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture18.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture18.png 305w, https://serverstadium.com/wp-content/uploads/2022/08/Picture18-261x300.png 261w" sizes="(max-width: 305px) 100vw, 305px" /></a></figure>



<p class="wp-block-paragraph">↳ Re-input the database detail that we have made in previous steps. </p>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture19.png"><img loading="lazy" decoding="async" width="294" height="153" class="wp-image-2301" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture19.png" alt="" /></a></figure>



<p class="wp-block-paragraph">↳ We can use <strong>default localhost </strong>as host address, or we can input <strong>localhost:3306, </strong>because MariaDB uses port 3306. </p>



<p class="wp-block-paragraph">After that, click “install”. Then we will be redirected to the main page of NextCloud’s dashboard. </p>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture20.png"><img loading="lazy" decoding="async" width="1021" height="506" class="wp-image-2302" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture20.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture20.png 1021w, https://serverstadium.com/wp-content/uploads/2022/08/Picture20-300x149.png 300w, https://serverstadium.com/wp-content/uploads/2022/08/Picture20-768x381.png 768w" sizes="(max-width: 1021px) 100vw, 1021px" /></a></figure>



<p class="wp-block-paragraph">Okay, now we can use NextCloud as our Private Cloud Storage.</p>



<h4 class="wp-block-heading">5. Essential Additional Configuration </h4>



<h5 class="wp-block-heading">Increase PHP Memory Limit </h5>



<p class="wp-block-paragraph">The default limitation of PHP memory is <strong>128MB, </strong>but NextCloud recommends 512MB for better performance. To change the PHP memory limit, edit this <strong>PHP</strong> file, </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo nano /etc/php/7.4/apache2/php.ini </code></pre>



<p class="wp-block-paragraph">Direct to this line </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>memory_limit = 128M </code></pre>



<p class="wp-block-paragraph">Change the value into </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>memory_limit = 512M </code></pre>



<figure class="wp-block-image size-full is-resized"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture21.png"><img loading="lazy" decoding="async" class="wp-image-2303" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture21.png" alt="" width="625" height="99" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture21.png 455w, https://serverstadium.com/wp-content/uploads/2022/08/Picture21-300x47.png 300w" sizes="(max-width: 625px) 100vw, 625px" /></a></figure>



<p class="wp-block-paragraph"><strong>Save &amp; close, </strong>then restart Apache so the company will implement the changes. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo systemctl reload apache2 </code></pre>



<h5 class="wp-block-heading">Configure Redis Cache for NextCloud </h5>



<p class="wp-block-paragraph">We will activate the cache memory for NextCloud by using <strong>Redis. </strong>Run this command to install<strong> Redis </strong>from the Ubuntu repository. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo apt install redis-server </code></pre>



<p class="wp-block-paragraph">To configure <strong>Redis </strong>as cache for NextCloud, we need to install a PHP extension so it can interact with <strong>Redis.</strong></p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo apt install php-redis </code></pre>



<p class="wp-block-paragraph">Next, edit NextCloud’s file configuration. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo nano /var/www/nextcloud/config/config.php </code></pre>



<p class="wp-block-paragraph">Add the following line before the end. <strong>); </strong></p>



<figure class="wp-block-table">
<table class="has-cyan-bluish-gray-background-color has-background">
<tbody>
<tr>
<td>&#8216;memcache.distributed&#8217; =&gt; &#8216;\OC\Memcache\Redis&#8217;,<br />&#8216;memcache.local&#8217; =&gt; &#8216;\OC\Memcache\Redis&#8217;,<br />&#8216;memcache.locking&#8217; =&gt; &#8216;\OC\Memcache\Redis&#8217;,<br />&#8216;redis&#8217; =&gt; array(<br />     &#8216;host&#8217; =&gt; &#8216;localhost&#8217;,<br />     &#8216;port&#8217; =&gt; 6379,<br />     ),</td>
</tr>
</tbody>
</table>
</figure>



<figure class="wp-block-image size-full is-resized"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture22.png"><img loading="lazy" decoding="async" class="wp-image-2304" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture22.png" alt="" width="617" height="232" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture22.png 437w, https://serverstadium.com/wp-content/uploads/2022/08/Picture22-300x113.png 300w" sizes="(max-width: 617px) 100vw, 617px" /></a></figure>



<p class="wp-block-paragraph">Save and close the file. Then, restart Apache and PHP-FPM. </p>



<pre class="wp-block-code has-cyan-bluish-gray-background-color has-background"><code>#sudo systemctl restart apache2 </code></pre>



<div class="wp-block-spacer" style="height: 30px;" aria-hidden="true"> </div>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Case Study</h2>



<div class="wp-block-spacer" style="height: 11px;" aria-hidden="true"> </div>



<p class="wp-block-paragraph">Okay, after we have successfully installed NextCloud in the VM, let&#8217;s try to make a case study in using NextCloud. With the following case studies: </p>



<ol class="wp-block-list">
<li>Have 2 groups of divisions<br />a. Sales<br />b. Billing</li>
</ol>



<ol class="wp-block-list" start="2">
<li> Will choose one division leader to manage the group.  </li>
</ol>



<ol class="wp-block-list" start="3">
<li>Making “file-sharing” based on the groups. However, the <strong>Customer’s Invoice</strong> <strong>file </strong>from <strong>Billing division</strong>, is shared with the <strong>Sales Division</strong> as well.</li>
</ol>



<p class="wp-block-paragraph">Let’s see these steps to achieve the goal. </p>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture23.png"><img loading="lazy" decoding="async" width="563" height="345" class="wp-image-2305" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture23.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture23.png 563w, https://serverstadium.com/wp-content/uploads/2022/08/Picture23-300x184.png 300w" sizes="(max-width: 563px) 100vw, 563px" /></a></figure>



<p class="wp-block-paragraph">↳ First, access U<strong>sers </strong>menu </p>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/23-2.png"><img loading="lazy" decoding="async" width="742" height="240" class="wp-image-2306" src="https://serverstadium.com/wp-content/uploads/2022/08/23-2.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/23-2.png 742w, https://serverstadium.com/wp-content/uploads/2022/08/23-2-300x97.png 300w" sizes="(max-width: 742px) 100vw, 742px" /></a></figure>



<p class="wp-block-paragraph">↳ Then, click A<strong>dd Group, </strong>and input the group’s name. </p>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture24.png"><img decoding="async" class="wp-image-2307" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture24.png" alt="" /></a></figure>



<p class="wp-block-paragraph">↳ Now we are adding new users and then deciding which group the new user belongs to. </p>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/24.png"><img decoding="async" class="wp-image-2308" src="https://serverstadium.com/wp-content/uploads/2022/08/24.png" alt="" /></a></figure>



<p class="wp-block-paragraph">↳ In <b>the Active Users menu, edit the user who will become the group&#8217;s division administrator</b>. </p>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture26.png"><img loading="lazy" decoding="async" width="1021" height="414" class="wp-image-2310" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture26.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/08/Picture26.png 1021w, https://serverstadium.com/wp-content/uploads/2022/08/Picture26-300x122.png 300w, https://serverstadium.com/wp-content/uploads/2022/08/Picture26-768x311.png 768w" sizes="(max-width: 1021px) 100vw, 1021px" /></a></figure>



<p class="wp-block-paragraph">↳ After that, now let&#8217;s switch accounts to one of the users that we have made, then access the menu <strong>File</strong>. </p>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/26-2-1.png"><img decoding="async" class="wp-image-2311" src="https://serverstadium.com/wp-content/uploads/2022/08/26-2-1.png" alt="" /></a></figure>



<p class="wp-block-paragraph">↳ Decide which file we will share and choose the group. In the <strong>Sharing</strong> tab, decide which group will be shared the file with. </p>



<figure class="wp-block-image size-full"><a href="https://serverstadium.com/wp-content/uploads/2022/08/Picture27.png"><img decoding="async" class="wp-image-2312" src="https://serverstadium.com/wp-content/uploads/2022/08/Picture27.png" alt="" /></a></figure>



<p class="wp-block-paragraph">↳ We can see the file shared by the Billing group to the Sales group also appear inside the file list. </p>



<div class="wp-block-spacer" style="height: 30px;" aria-hidden="true"> </div>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Conclusion </h2>



<div class="wp-block-spacer" style="height: 11px;" aria-hidden="true"> </div>



<p class="wp-block-paragraph">From this article, we learned together how to install NextCloud. Starting from how to install it on ServerStadium&#8217;s VM and its configuration to the case study examples in it. </p>



<p class="wp-block-paragraph">If you want to see the video tutorial version, you can access it on ServerStadium&#8217;s Youtube channel or through this link.</p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio">
<div class="wp-block-embed__wrapper">https://www.youtube.com/watch?v=9jVu8bF0f-M</div>
</figure>



<p class="wp-block-paragraph">For questions or discussions about this tutorial, you can directly submit them in the comments column. </p>
<p>The post <a href="https://serverstadium.com/knowledge-base/installing-nextcloud/">Installing NextCloud in ServerStadium Detail Steps from the Beginning to the Very End</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Install Nextcloud on ServerStadium Cloud</title>
		<link>https://serverstadium.com/knowledge-base/how-to-install-nextcloud-on-serverstadium/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Thu, 27 May 2021 01:22:07 +0000</pubDate>
				<guid isPermaLink="false">https://cloudraya.com/knowledge-base/?p=1108</guid>

					<description><![CDATA[<p>Nextcloud is an open-source file-sync and file collaboration server which can be used for self-host. It also comes with an Enterprise Edition with enterprise support. There are various methods to deploy Nextcloud : Manual install Docker image Web installer This article will guide you on installing Nextcloud in ServerStadium using Manual install and Docker. Server&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/how-to-install-nextcloud-on-serverstadium/">How to Install Nextcloud on ServerStadium Cloud</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Nextcloud is an open-source file-sync and file collaboration server which can be used for self-host. It also comes with an Enterprise Edition with enterprise support.</p>



<p class="wp-block-paragraph">There are various methods to deploy Nextcloud :</p>



<ol class="wp-block-list">
<li>Manual install</li>
<li>Docker image</li>
<li>Web installer</li>
</ol>



<p class="wp-block-paragraph">This article will guide you on installing Nextcloud in ServerStadium using Manual install and Docker.</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Server Requirements</h2>



<p class="wp-block-paragraph"><strong>Server OS</strong>:</p>



<ul class="wp-block-list">
<li><strong>Ubuntu 20.04 LTS</strong> (recommended)</li>
<li><strong>Red Hat Enterprise Linux 8</strong> (recommended)</li>
<li>Debian 10 (Buster)</li>
<li>SUSE Linux Enterprise Server 15</li>
<li>openSUSE Leap 42.1+</li>
<li>CentOS 8</li>
</ul>



<p class="wp-block-paragraph"><strong>Database</strong>:</p>



<ul class="wp-block-list">
<li><strong>MySQL 8.0+ or MariaDB 10.2+</strong> (recommended)</li>
<li>Oracle Database 11g (<em>only as part of an enterprise subscription</em>)</li>
<li>PostgreSQL 9.6/10/11/12/13</li>
<li>SQLite (<em>only recommended for testing and minimal-instances</em>)</li>
</ul>



<p class="wp-block-paragraph"><strong>PHP runtime:</strong></p>



<ul class="wp-block-list">
<li>7.3</li>
<li>7.4 (recommended)</li>
</ul>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Manual Installation</h2>



<h3 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Preparation</h3>



<p class="wp-block-paragraph">This section will guide you on preparing your server before installing it with Nextcloud.</p>



<p class="wp-block-paragraph">Assuming that you&#8217;ve already installed and configured the server with LEMP stack. However, if you haven&#8217;t, you can read the following articles:</p>



<ul class="wp-block-list">
<li><a href="https://serverstadium.com/knowledge-base/installing-lemp-stack-on-ubuntu-1804/" target="_blank" rel="noreferrer noopener">Installing LEMP stack on ServerStadium</a></li>
</ul>



<p class="wp-block-paragraph">For RHEL 8 / CentOS 8, make sure you have turned off SELinux.</p>



<p class="wp-block-paragraph">Ensure you are already allowed ports 80 and 443 globally in your Security Profile.</p>



<h4 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Getting Nextcloud Package</h4>



<p class="wp-block-paragraph">Get the latest Nextcloud package from here: https://download.nextcloud.com/server/releases/latest.tar.bz2</p>



<p class="wp-block-paragraph">The above link will always point to the latest version of Nextcloud. But if you wish to install a specific version, you can find it here: <a href="https://download.nextcloud.com/server/releases/">https://download.nextcloud.com/server/releases/</a></p>



<p class="wp-block-paragraph">Download the file using <code>curl</code></p>



<pre class="wp-block-code"><code>cd
curl -O https://download.nextcloud.com/server/releases/latest.tar.bz2</code></pre>



<p class="wp-block-paragraph">Then extract it to somewhere you wish, but by default, it usually goes to <code>/var/www/</code>, for Ubuntu 20.04:</p>



<pre class="wp-block-code"><code>cd
tar -C /var/www -xvf latest.tar.bz2</code></pre>



<p class="wp-block-paragraph">For <strong>RHEL 8 / CentOS 8 ,</strong> you will need to install <code>bzip2</code> package first:</p>



<pre class="wp-block-code"><code>dnf install bzip2 -y
mkdir -p /var/www
tar -C /var/www -xvf latest.tar.bz2</code></pre>



<p class="wp-block-paragraph">Next, you need to change the owner of the extracted Nextcloud folder. It must be matched with the user, defined in the web server settings. The default user on Ubuntu is <code>www-data</code>, on RHEL 8 / CentOS 8; however, you will have to match the ownership as the web server you are using, either <code>apache</code> or <code>nginx</code>.</p>



<pre class="wp-block-code"><code>chown -R www-data.www-data /var/www/nextcloud</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="776" height="424" class="wp-image-1189" src="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-44-34.jpg" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-44-34.jpg 776w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-44-34-300x164.jpg 300w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-44-34-768x420.jpg 768w" sizes="(max-width: 776px) 100vw, 776px" /></figure>



<h4 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Creating Database and Database User</h4>



<p class="wp-block-paragraph">Create a database and a database user for our Nextcloud instance.</p>



<pre class="wp-block-code"><code>mysql -uroot -p
CREATE DATABASE nextclouddb;
CREATE USER 'dbuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON nextclouddb.* TO 'dbuser'@'localhost';
FLUSH PRIVILEGES;</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="776" height="424" class="wp-image-1190" src="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-46-59.jpg" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-46-59.jpg 776w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-46-59-300x164.jpg 300w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-46-59-768x420.jpg 768w" sizes="(max-width: 776px) 100vw, 776px" /></figure>



<h4 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">PHP Modules</h4>



<p class="wp-block-paragraph">Install the following PHP 7.4 modules</p>



<p class="wp-block-paragraph"><strong>Ubuntu 20.04</strong></p>



<pre class="wp-block-code"><code>apt install php7.4-common php7.4-curl php7.4-gd php7.4-gd php7.4-json php7.4-xml php7.4-mbstring php7.4-zip php7.4-mysql php7.4-gmp php7.4-ldap php7.4-bcmath php7.4-bz2 php7.4-imap php7.4-intl php7.4-apcu php7.4-imagick</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="776" height="424" class="wp-image-1191" src="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-49-13.jpg" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-49-13.jpg 776w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-49-13-300x164.jpg 300w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-49-13-768x420.jpg 768w" sizes="(max-width: 776px) 100vw, 776px" />
<figcaption>Ubuntu 20.04 &#8211; Installing PHP modules</figcaption>
</figure>



<p class="wp-block-paragraph"><strong>RHEL 8 / CentOS 8</strong></p>



<p class="wp-block-paragraph">Don&#8217;t forget to enable PHP 7.4 module</p>



<pre class="wp-block-code"><code>dnf module enable php:7.4
dnf install php-common php-curl php-gd php-json php-xml php-mysqlnd php-mbstring php-zip php-gmp php-ldap php-bcmath php-bz2 php-intl php-apcu php-imagick</code></pre>



<h4 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">PHP Configuration</h4>



<p class="wp-block-paragraph">Modify the following lines in your <code>www.conf</code>. For Ubuntu 20.04, it should be located in <code>/etc/php/7.4/fpm/pool.d/www.conf</code> and for RHEL 8 / CentOS 8, it&#8217;s normally located in <code>/etc/php-fpm.d/www.conf</code></p>



<pre class="wp-block-code"><code>;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
;env[TEMP] = /tmp</code></pre>



<p class="wp-block-paragraph">Make sure those lines are uncommented.</p>



<figure class="wp-block-image size-large"><img decoding="async" class="wp-image-1199" src="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-23-41.jpg" alt="" /></figure>



<p class="wp-block-paragraph">Then restart php-fpm</p>



<p class="wp-block-paragraph">Ubuntu : <code>systemctl restart php7.4-fpm</code></p>



<p class="wp-block-paragraph">RHEL 8 / CentOS 8 : <code>systemctl restart php-fpm</code></p>



<h4 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Webserver &#8211; Nginx</h4>



<p class="wp-block-paragraph">You need to create a new server block for <code>nextcloud.conf</code> which will serve Nextcloud files.</p>



<pre class="wp-block-code"><code>upstream php-handler {
    #server 127.0.0.1:9000;
    server unix:/var/run/php/php7.4-fpm.sock;
}

server {
    listen 80;
    listen [::]:80;
    server_name cloud.example.com;

    # Enforce HTTPS
    return 301 https://$server_name$request_uri;
}

server {
    listen 443      ssl http2;
    listen [::]:443 ssl http2;
    server_name cloud.example.com;

    # Use Mozilla's guidelines for SSL/TLS settings
    # &lt;https://mozilla.github.io/server-side-tls/ssl-config-generator/&gt;
    ssl_certificate     /etc/ssl/nginx/cloud.example.com.crt;
    ssl_certificate_key /etc/ssl/nginx/cloud.example.com.key;

    # HSTS settings
    # WARNING: Only add the preload option once you read about
    # the consequences in &lt;https://hstspreload.org/&gt;. This option
    # will add the domain to a hardcoded list that is shipped
    # in all major browsers and getting removed from this list
    # could take several months.
    #add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;

    # set max upload size
    client_max_body_size 512M;
    fastcgi_buffers 64 4K;

    # Enable gzip but do not remove ETag headers
    gzip on;
    gzip_vary on;
    gzip_comp_level 4;
    gzip_min_length 256;
    gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
    gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;

    # Pagespeed is not supported by Nextcloud, so if your server is built
    # with the `ngx_pagespeed` module, uncomment this line to disable it.
    #pagespeed off;

    # HTTP response headers borrowed from Nextcloud `.htaccess`
    add_header Referrer-Policy                      "no-referrer"   always;
    add_header X-Content-Type-Options               "nosniff"       always;
    add_header X-Download-Options                   "noopen"        always;
    add_header X-Frame-Options                      "SAMEORIGIN"    always;
    add_header X-Permitted-Cross-Domain-Policies    "none"          always;
    add_header X-Robots-Tag                         "none"          always;
    add_header X-XSS-Protection                     "1; mode=block" always;

    # Remove X-Powered-By, which is an information leak
    fastcgi_hide_header X-Powered-By;

    # Path to the root of your installation
    root /var/www/nextcloud;

    # Specify how to handle directories -- specifying `/index.php$request_uri`
    # here as the fallback means that Nginx always exhibits the desired behaviour
    # when a client requests a path that corresponds to a directory that exists
    # on the server. In particular, if that directory contains an index.php file,
    # that file is correctly served; if it doesn't, then the request is passed to
    # the front-end controller. This consistent behaviour means that we don't need
    # to specify custom rules for certain paths (e.g. images and other assets,
    # `/updater`, `/ocm-provider`, `/ocs-provider`), and thus
    # `try_files $uri $uri/ /index.php$request_uri`
    # always provides the desired behaviour.
    index index.php index.html /index.php$request_uri;

    # Rule borrowed from `.htaccess` to handle Microsoft DAV clients
    location = / {
        if ( $http_user_agent ~ ^DavClnt ) {
            return 302 /remote.php/webdav/$is_args$args;
        }
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    # Make a regex exception for `/.well-known` so that clients can still
    # access it despite the existence of the regex rule
    # `location ~ /(\\.|autotest|...)` which would otherwise handle requests
    # for `/.well-known`.
    location ^~ /.well-known {
        # The following 6 rules are borrowed from `.htaccess`

        rewrite ^/\\.well-known/host-meta\\.json  /public.php?service=host-meta-json  last;
        rewrite ^/\\.well-known/host-meta        /public.php?service=host-meta       last;
        rewrite ^/\\.well-known/webfinger        /public.php?service=webfinger       last;
        rewrite ^/\\.well-known/nodeinfo         /public.php?service=nodeinfo        last;

        location = /.well-known/carddav     { return 301 /remote.php/dav/; }
        location = /.well-known/caldav      { return 301 /remote.php/dav/; }

        try_files $uri $uri/ =404;
    }

    # Rules borrowed from `.htaccess` to hide certain paths from clients
    location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)  { return 404; }
    location ~ ^/(?:\\.|autotest|occ|issue|indie|db_|console)              { return 404; }

    # Ensure this block, which passes PHP files to the PHP process, is above the blocks
    # which handle static assets (as seen below). If this block is not declared first,
    # then Nginx will encounter an infinite rewriting loop when it prepends `/index.php`
    # to the URI, resulting in a HTTP 500 error response.
    location ~ \\.php(?:$|/) {
        fastcgi_split_path_info ^(.+?\\.php)(/.*)$;
        set $path_info $fastcgi_path_info;

        try_files $fastcgi_script_name =404;

        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_param HTTPS on;

        fastcgi_param modHeadersAvailable true;         # Avoid sending the security headers twice
        fastcgi_param front_controller_active true;     # Enable pretty urls
        fastcgi_pass php-handler;

        fastcgi_intercept_errors on;
        fastcgi_request_buffering off;
    }

    location ~ \\.(?:css|js|svg|gif)$ {
        try_files $uri /index.php$request_uri;
        expires 6M;         # Cache-Control policy borrowed from `.htaccess`
        access_log off;     # Optional: Don't log access to assets
    }

    location ~ \\.woff2?$ {
        try_files $uri /index.php$request_uri;
        expires 7d;         # Cache-Control policy borrowed from `.htaccess`
        access_log off;     # Optional: Don't log access to assets
    }

    location / {
        try_files $uri $uri/ /index.php$request_uri;
    }
}</code></pre>



<p class="wp-block-paragraph">You&#8217;ll need to adjust the <code>server_name</code> to match your domain, and don&#8217;t forget to fix the SSL certificate and key location as well. You may also need to modify the php-fpm configuration, whether you use a Unix socket or not.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="776" height="424" class="wp-image-1192" src="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-51-28.jpg" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-51-28.jpg 776w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-51-28-300x164.jpg 300w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-51-28-768x420.jpg 768w" sizes="(max-width: 776px) 100vw, 776px" />
<figcaption>Ubuntu 20.04 &#8211; /etc/nginx/sites-available/nextcloud.conf</figcaption>
</figure>



<p class="wp-block-paragraph">For the certificate, you might want to put your commercially signed certificate or use letsencrypt or even a self-signed one. Here&#8217;s how to generate a self-signed certificate: LINK</p>



<p class="wp-block-paragraph"><strong>Ubuntu 20.04</strong></p>



<p class="wp-block-paragraph">Place the configuration on <code>/etc/nginx/sites-available</code> then you&#8217;ll have to do this to activate it:</p>



<pre class="wp-block-code"><code>cd /etc/nginx/sites-enabled
ln -s ../sites-available/nextcloud.conf .</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="776" height="424" class="wp-image-1193" src="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-52-32.jpg" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-52-32.jpg 776w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-52-32-300x164.jpg 300w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-52-32-768x420.jpg 768w" sizes="(max-width: 776px) 100vw, 776px" /></figure>



<p class="wp-block-paragraph"><strong>RHEL 8 / CentOS 8 </strong></p>



<p class="wp-block-paragraph">Put the configuration on <code>/etc/nginx/conf.d/</code></p>


<hr class="wp-block-separator has-css-opacity" />


<p class="wp-block-paragraph">Then make sure that the configuration is correct and then reload <code>nginx</code>:</p>



<pre class="wp-block-code"><code># check configurations
nginx -t
# reload nginx
nginx -s reload</code></pre>



<p class="wp-block-paragraph">For RHEL 8 / CentOS 8, you might need to adjust your <code>php-fpm</code> configuration if it&#8217;s not done yet. Find the below lines in <code>/etc/php-fpm.d/www.conf</code> and change the values accordingly:</p>



<pre class="wp-block-code"><code>..
user = nginx
group = nginx
..
listen.owner = nginx
listen.group = nginx
..</code></pre>



<p class="wp-block-paragraph">Later on, after Nextcloud installation, if you encounter a login redirect loop, you might want to check the ownership of <code>/var/lib/php/session</code> to make sure it&#8217;s owned by <code>nginx</code> group at least.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="776" height="424" class="wp-image-1194" src="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-55-33.jpg" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-55-33.jpg 776w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-55-33-300x164.jpg 300w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-06-55-33-768x420.jpg 768w" sizes="(max-width: 776px) 100vw, 776px" />
<figcaption>Ubuntu 20.04 &#8211; Reload Nginx</figcaption>
</figure>



<h3 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Installing Nextcloud</h3>



<p class="wp-block-paragraph">Open your browser and access your predefined domain. Mine was <code>https://cloud.example.lan</code>. Then fill out the fields with the required data. For the Data Folder field, if you&#8217;re unsure, then just leave it untouched.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1138" height="806" class="wp-image-1195" src="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-08-00.jpg" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-08-00.jpg 1138w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-08-00-300x212.jpg 300w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-08-00-1024x725.jpg 1024w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-08-00-768x544.jpg 768w" sizes="(max-width: 1138px) 100vw, 1138px" /></figure>



<p class="wp-block-paragraph">After filling out everything, then click Finish setup.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1138" height="806" class="wp-image-1196" src="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-08-27.jpg" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-08-27.jpg 1138w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-08-27-300x212.jpg 300w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-08-27-1024x725.jpg 1024w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-08-27-768x544.jpg 768w" sizes="(max-width: 1138px) 100vw, 1138px" /></figure>



<p class="wp-block-paragraph">Wait for the installation and pay attention, do not close this tab / browser until the installation finishes.</p>



<figure class="wp-block-image size-large"><img decoding="async" class="wp-image-1197" src="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-14-36.jpg" alt="" /></figure>



<p class="wp-block-paragraph">The last thing to do is go to <a href="https://cloud.example.lan/settings/admin/overview"><code>https://YOUR_NEXCLOUD_DOMAIN/settings/admin/overview</code></a> and do what the checklist says. It&#8217;s to make sure that your setup is complete.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1138" height="806" class="wp-image-1198" src="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-40-55.jpg" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-40-55.jpg 1138w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-40-55-300x212.jpg 300w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-40-55-1024x725.jpg 1024w, https://serverstadium.com/wp-content/uploads/2021/05/Screenshot-from-2021-05-27-07-40-55-768x544.jpg 768w" sizes="(max-width: 1138px) 100vw, 1138px" /></figure>



<p class="wp-block-paragraph">Once you complete them, then your Nextcloud is ready to be used! Yay</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Docker Image</h2>



<p class="wp-block-paragraph">Deploying Nextcloud using Docker image is a lot easier than the manual one. You&#8217;ll need to pull the nextcloud image and then run it. That&#8217;s it.</p>



<p class="wp-block-paragraph">Assuming that you already have docker installed on your machine. But if you haven&#8217;t yet, you can read the tutorial via this link.</p>



<p class="wp-block-paragraph">Here&#8217;s how to deploy Nextcloud using Docker</p>



<h3 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Docker Compose (recommended)</h3>



<p class="wp-block-paragraph">Copy and paste the following snippet and save it as <code>docker-compose.yml</code></p>



<pre class="wp-block-code"><code>---
version: "2.1"
services:
  nextcloud:
    image: ghcr.io/linuxserver/nextcloud
    container_name: nextcloud
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Asia/Jakarta
    volumes:
      - /path/to/appdata:/config
      - /path/to/data:/data
    ports:
      - 443:443
    restart: unless-stopped
</code></pre>



<p class="wp-block-paragraph">Make sure you have adjusted the necessary values to match your environment.</p>



<p class="wp-block-paragraph">Finally, run the below command to deploy it:</p>



<pre class="wp-block-code"><code>docker-compose up
</code></pre>



<h3 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Docker CLI</h3>



<p class="wp-block-paragraph">Using docker-compose is preferred. You can easily make changes and then redeploy the container. But if you prefer the CLI way, here&#8217;s the snippet:</p>



<pre class="wp-block-code"><code>docker run -d \\
  --name=nextcloud \\
  -e PUID=1000 \\
  -e PGID=1000 \\
  -e TZ=Asia/Jakarta \\
  -p 443:443 \\
  -v /path/to/appdata:/config \\
  -v /path/to/data:/data \\
  --restart unless-stopped \\
  ghcr.io/linuxserver/nextcloud
</code></pre>



<p class="wp-block-paragraph">As always, you&#8217;ll have to modify some values to match your environment.</p>



<h3 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Installation</h3>



<p class="wp-block-paragraph">The installation process is the same as the manual approach.</p>


<hr class="wp-block-separator has-css-opacity" />


<p class="wp-block-paragraph">If you need a thorough guide, you can read the official documentation here: <a href="https://docs.nextcloud.com/server/latest/admin_manual/contents.html">https://docs.nextcloud.com/server/latest/admin_manual/contents.html</a></p>
<p>The post <a href="https://serverstadium.com/knowledge-base/how-to-install-nextcloud-on-serverstadium/">How to Install Nextcloud on ServerStadium Cloud</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
