<?xml version="1.0" encoding="utf-8"?><!-- generator="b2evolution/7.2.5-stable" -->
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>RTFM</title>
		<link>https://www.disconnected-by-peer.at/RTFM/</link>
		<atom:link rel="self" type="application/rss+xml" href="https://www.disconnected-by-peer.at/RTFM/?tempskin=_rss2" />
		<description></description>
		<language>en-US</language>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=7.2.5-stable"/>
		<ttl>60</ttl>
				<item>
			<title>Nextcloud Installation on Debian 12</title>
			<link>https://www.disconnected-by-peer.at/RTFM/rtfm-main/nextcloud_installation_on_debian-12</link>
			<pubDate>Tue, 02 Jan 2024 22:25:00 +0000</pubDate>			<dc:creator>geos_one</dc:creator>
			<category domain="main">Uncategorized</category>			<guid isPermaLink="false">138@https://www.disconnected-by-peer.at/</guid>
						<description>&lt;p&gt;Nextcloud is open-source software for creating public and private file storage. It allows you to create your self-hosted services like Dropbox, Google Drive, or Mega.nz. Originally, it&#039;s created by the original owncloud developer Frank Karlitschek. In 2016, he forks the Owncloud project and creates a new project with the new name &amp;quot;Nextcloud&amp;quot;&lt;/p&gt;
&lt;p&gt;By this time, the Nextcloud project growing rapidly and becoming more than file hosting software, it&#039;s more like a file sync and content collaboration platform. Backed with a lot of plugins, Nextcloud becomes such a powerful collaboration software. You can install plugins for project management, video conferencing, collaborative editing, note-taking, email client, etc.&lt;/p&gt;
&lt;p&gt;In this guide, you will learn how to install Nextcloud on the latest Debian 12 Bookworm. You will be installing Nextcloud under the LAMP Stack (Linux, Apache2/httpd, MySQL/MariaDB, and PHP).&lt;/p&gt;
&lt;h3 class=&quot;evo_auto_anchor_header&quot; id=&quot;prerequisites&quot;&gt;Prerequisites&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;A Debian 12 server. Ensure all packages are updated to the latest version.&lt;/li&gt;
&lt;li&gt;A root user or a user with root privileges. This user will be used for installing new packages and editing system configurations.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 class=&quot;evo_auto_anchor_header&quot; id=&quot;get-root-and-update-repositories&quot;&gt;Get Root and Update Repositories&lt;/h3&gt;
&lt;p&gt;First, execute the following command to get the root privileges.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If you have &lt;strong&gt;sudo&lt;/strong&gt; installed, execute the sudo command below.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sudo su&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Now type the password login for your user.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;After that, update all your Debian repositories using the apt command below.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;apt update&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Install wget if missing&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;apt install wget&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h3 class=&quot;evo_auto_anchor_header&quot; id=&quot;installing-and-configuring-php&quot;&gt;Installing and Configuring PHP&lt;/h3&gt;
&lt;p&gt;For this guide, you will be deploying Nextcloud with the latest stable version of PHP 8.2.&lt;/p&gt;
&lt;p&gt;By default, the Debian repository provides packages for PHP 8.1. But, Nextcloud requires some additional PHP packages that can be installed from a 3rd-party repository. And you will be adding a new repository to your Debian system.&lt;/p&gt;
&lt;p&gt;1. Execute the command below to add a PHP repository for the Debian system.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Install the Sury php Repository&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;bash -c &quot;$(wget -qLO - https://packages.sury.org/php/README.txt)&quot;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h3 class=&quot;evo_auto_anchor_header&quot; id=&quot;installing-and-configuring-mariadb&quot;&gt;Installing and Configuring MariaDB&lt;/h3&gt;
&lt;p&gt;For this stage, you will be installing the mariadb database server, securing mariadb deployment, and creating a new database and user for Nextcloud.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To install the mariadb database server, run the command below and the MariaDB Repository via thew install script&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;bash -c &quot;$(wget -qLO - https://r.mariadb.com/downloads/mariadb_repo_setup)&quot;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h3 class=&quot;evo_auto_anchor_header&quot; id=&quot;install-the-needed-packages&quot;&gt;Install the needed packages&lt;/h3&gt;
&lt;p&gt;Now install all the packages for the system LAMP &amp;amp; Redis&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To install all the needed packages, run the command below.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;apt install -y mc unzip ffmpeg apache2 redis-server memcached libapache2-mod-php8.2 php-common php8.2 \&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;php8.2-{gd,curl,xml,zip,intl,mbstring,bz2,ldap,apcu,bcmath,gmp,imagick,igbinary,mysql,redis,smbclient,cli,common,opcache,readline,soap,memcached} \&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;imagemagick libmagickcore-6.q16-6-extra --allow-change-held-packages&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h3 class=&quot;evo_auto_anchor_header&quot; id=&quot;adapt-the-php-8-2-ini-values-for-netxtcloud&quot;&gt;Adapt the PHP 8.2 ini Values for Netxtcloud&lt;/h3&gt;
&lt;p&gt;The following ini settings should be adapted for Nextcloud.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Uncomment the date.timezone parameter and input the proper timezone for PHP.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/\;date.timezone =.*/date.timezone = Europe\/Vienna/&quot; /etc/php/8.2/apache2/php.ini&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Increase the default value of parameters memory_limit, upload_max_filesize, post_max_size, and max_execution_time. Change the value as you need.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/memory_limit =.*/memory_limit = 512M/&quot; /etc/php/8.2/apache2/php.ini&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/upload_max_filesize =.*/upload_max_filesize = 500M/&quot; /etc/php/8.2/apache2/php.ini&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/post_max_size =.*/post_max_size = 600M/&quot; /etc/php/8.2/apache2/php.ini&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/max_execution_time =.*/max_execution_time = 300/&quot; /etc/php/8.2/apache2/php.ini&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Enable file_uploads and allow_url_fopen by changing the default value to On.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/file_uploads =.*/file_uploads = on/&quot; /etc/php/8.2/apache2/php.ini&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/allow_url_fopen =.*/allow_url_fopen = On/&quot; /etc/php/8.2/apache2/php.ini&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Disable the parameter display_errors and output_buffering by changing the default value to Off.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/display_errors =.*/display_errors = Off/&quot; /etc/php/8.2/apache2/php.ini&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/output_buffering =.*/output_buffering = Off/&quot; /etc/php/8.2/apache2/php.ini&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;APCu is disabled by default on CLI which could cause issues with nextcloud’s cron jobs. so activate it&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &#039;$aapc.enable_cli=1&#039; /etc/php/8.2/mods-available/apcu.ini&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Uncomment the zend_extension parameter and change the value to opcache. This will enable PHP OPcache, which is needed for Nextcloud.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/\;zend_extension=opcache/zend_extension=opcache/&quot; /etc/php/8.2/apache2/php.ini&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Add the following lines to the [&lt;strong&gt;opcache&lt;/strong&gt;] section. The OPCache configuration is recommended by Nextcloud.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/\;opcache.enable=.*/opcache.enable = 1/&quot; /etc/php/8.2/apache2/php.ini&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/\;opcache.interned_strings_buffer=.*/opcache.interned_strings_buffer = 8/&quot; /etc/php/8.2/apache2/php.ini&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/\;opcache.max_accelerated_files=.*/opcache.max_accelerated_files = 10000/&quot; /etc/php/8.2/apache2/php.ini&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/\;opcache.memory_consumption=.*/opcache.memory_consumption = 128/&quot; /etc/php/8.2/apache2/php.ini&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/\;opcache.save_comments=.*/opcache.save_comments = 1/&quot; /etc/php/8.2/apache2/php.ini&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc6&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/\;opcache.revalidate_freq=.*/opcache.revalidate_freq = 1/&quot; /etc/php/8.2/apache2/php.ini&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Lastly, enter the systemctl command below to restart the apache2 service. Every time you make changes to the PHP configuration, restart the apache2 service to apply the changes that you&#039;ve made.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sudo systemctl restart apache2&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h3 class=&quot;evo_auto_anchor_header&quot; id=&quot;memcached-configuration&quot;&gt;memcached configuration&lt;/h3&gt;
&lt;p&gt;We install the memcached server to increase Nextcloud performance, as memcached reduces the load on the MariaDB Nextcloud database.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Customize the memcached configuration by customizing the configuration by running the commands below&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sed -i &quot;s/-m 64/-m 128/&quot; /etc/memcached.conf&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Lastly, enter the systemctl command below to restart the redis service. &lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;systemctl restart memcached.service&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You can verify that the Memcached daemon is running with ps ax&lt;/p&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;root@nextcloud:~# ps xa | grep memcached&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;23830 ?&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Ssl&amp;#160;&amp;#160;&amp;#160;&amp;#160;0:00 /usr/bin/memcached -m 128 -p 11211 -u memcache -l 127.0.0.1 -P /var/run/memcached/memcached.pid&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 class=&quot;evo_auto_anchor_header&quot; id=&quot;installing-and-configuring-mariadb&quot;&gt;Installing and Configuring MariaDB&lt;/h3&gt;
&lt;p&gt;For this stage, you will be installing the mariadb database server, securing mariadb deployment, and creating a new database and user for Nextcloud.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To install the mariadb database server, run the command below.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;apt install mariadb-server mariadb-client&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Type &#039;&lt;strong&gt;y&lt;/strong&gt;&#039; to confirm and install mariadb packages.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;image_block 5-installing-mariadb-server png&quot;&gt;&lt;a href=&quot;https://www.disconnected-by-peer.at/media/blogs/RTFM/quick-uploads/nextcloud_installation_on_debian-12/5-installing-mariadb-server.png?mtime=1704257073&quot; rel=&quot;lightbox[p138]&quot; id=&quot;link_69&quot;&gt;&lt;img title=&quot;&quot; alt=&quot;Installing MariaDB Server Debian 11&quot; src=&quot;https://www.disconnected-by-peer.at/media/blogs/RTFM/quick-uploads/nextcloud_installation_on_debian-12/_evocache/5-installing-mariadb-server.png/fit-400x320.png?mtime=1704257073&quot; width=&quot;400&quot; height=&quot;175&quot; class=&quot;loadimg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Once the installation is complete, check the mariadb service using the following command.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;systemctl is-enabled mariadb&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;systemctl status mariadb&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;The mariadb service is active and running, and it&#039;s enabled to start automatically at system startup.&lt;/li&gt;
&lt;/ul&gt;
[image:72::Checking MariaDB Database Service:6-checking-mariadb-service.png]
&lt;ul&gt;
&lt;li&gt;Next, you need to secure your mariadb deployment by setting up the root password for mariadb and remove some default configuration. To do that, you can use the command-line tool &#039;mysql_secure_installation&#039;, which is included on the default mariadb installation.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Execute the &amp;quot;&lt;strong&gt;mysql_secure_installation&lt;/strong&gt;&amp;quot; command below.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;mysql\_secure\_installation&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;At the first, you will be asked to enter the mariadb root password. Just press &#039;&lt;strong&gt;Enter&lt;/strong&gt;&#039; to continue.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Enter current password for root (enter for none):&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;OK, successfully used password, moving on...&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Type &#039;&lt;strong&gt;Y&lt;/strong&gt;&#039; to enable the &#039;&lt;strong&gt;unix_socket&lt;/strong&gt;&#039; authentication for the user &#039;&lt;strong&gt;root&lt;/strong&gt;&#039;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Switch to unix\_socket authentication \[Y/n\] Y&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Enabled successfully!&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Reloading privilege tables..&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt; ... Success!&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Type your strong mariadb root password and repeat, then press &amp;quot;&lt;strong&gt;Enter&lt;/strong&gt;&amp;quot; to continue.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Change the root password? \[Y/n\] Y&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;New password:&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Re-enter new password:&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Password updated successfully!&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Reloading privilege tables..&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc6&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt; ... Success!&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Now type &amp;quot;&lt;strong&gt;Y&lt;/strong&gt;&amp;quot; and press &amp;quot;&lt;strong&gt;Enter&lt;/strong&gt;&amp;quot; to remove the default anonymous user from the mariadb server.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;By default, a MariaDB installation has an anonymous user, allowing anyone&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;to log into MariaDB without having to have a user account created for&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;them.&amp;#160;&amp;#160;This is intended only for testing, and to make the installation&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;go a bit smoother.&amp;#160;&amp;#160;You should remove them before moving into a&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;production environment.&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc6&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc7&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Remove anonymous users? \[Y/n\] Y&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc8&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt; ... Success!&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;After that, disable the remote login for the default user &#039;&lt;strong&gt;root&lt;/strong&gt;&#039;. Type &amp;quot;&lt;strong&gt;Y&lt;/strong&gt;&amp;quot; and press &amp;quot;&lt;strong&gt;Enter&lt;/strong&gt;&amp;quot; to continue.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Normally, root should only be allowed to connect from &#039;localhost&#039;.&amp;#160;&amp;#160;This&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;ensures that someone cannot guess at the root password from the network.&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Disallow root login remotely? \[Y/n\] Y&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt; ... Success!&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Type &amp;quot;&lt;strong&gt;Y&lt;/strong&gt;&amp;quot; again to remove the default database &amp;quot;&lt;strong&gt;test&lt;/strong&gt;&amp;quot; and press &amp;quot;&lt;strong&gt;Enter&lt;/strong&gt;&amp;quot;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;By default, MariaDB comes with a database named &#039;test&#039; that anyone can&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;access.&amp;#160;&amp;#160;This is also intended only for testing, and should be removed&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;before moving into a production environment.&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Remove test database and access to it? \[Y/n\] Y&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc6&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt; - Dropping test database...&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc7&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt; ... Success!&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc8&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt; - Removing privileges on test database...&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc9&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt; ... Success!&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;And the last, type &amp;quot;&lt;strong&gt;Y&lt;/strong&gt;&amp;quot; again to reload all tables privileges to apply a new configuration.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Reloading the privilege tables will ensure that all changes made so far&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;will take effect immediately.&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Reload privilege tables now? \[Y/n\] Y&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt; ... Success!&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Now the process is complete and you will see the following output.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Cleaning up...&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;All done!&amp;#160;&amp;#160;If you&#039;ve completed all of the above steps, your MariaDB&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;installation should now be secure.&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc6&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Thanks for using MariaDB!&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h4 class=&quot;evo_auto_anchor_header&quot; id=&quot;creating-database-and-user-for-nextcloud&quot;&gt;Creating Database and User for Nextcloud&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;log in to the mariadb shell using the mysql command below.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;mysql -u root -p&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Now execute the following mysql query to create a new database &amp;quot;&lt;strong&gt;nextcloud&lt;/strong&gt;&amp;quot;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;CREATE DATABASE nextcloud;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Execute the following query to create a new database user &amp;quot;&lt;strong&gt;nextcloud&lt;/strong&gt;&amp;quot;. Change the &amp;quot;&lt;strong&gt;strongpassword&lt;/strong&gt;&amp;quot; with your strong password.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;CREATE USER nextcloud@localhost IDENTIFIED BY &#039;StrongPassword&#039;;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Allow the user &amp;quot;&lt;strong&gt;nextcloud&lt;/strong&gt;&amp;quot; to access and write the &amp;quot;&lt;strong&gt;nextcloud&lt;/strong&gt;&amp;quot; using the following query.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;GRANT ALL PRIVILEGES ON nextcloud.\* TO nextcloud@localhost;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Now reload all tables privileges to apply the new database configuration.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;FLUSH PRIVILEGES;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Then you can type &amp;quot;&lt;strong&gt;quit&lt;/strong&gt;&amp;quot; and press &amp;quot;&lt;strong&gt;Enter&lt;/strong&gt;&amp;quot; to exit from the mariadb shell.&lt;/li&gt;
&lt;/ul&gt;
[image:75::Create new database and user for Nextcloud:7-create-database-user-nextcloud.png]
&lt;h3 class=&quot;evo_auto_anchor_header&quot; id=&quot;generating-ssl-letsencrypt&quot;&gt;Generating SSL Letsencrypt&lt;/h3&gt;
&lt;p&gt;In this stage, you will be installing the certbot tool and generate the SSL certificates for the Nextcloud installation. You will be generating SSL Letsencrypts with the webroot plugin.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Execute the following command to install the certbot tool for generating SSL Letsencrypt.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;apt install certbot&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Type &#039;&lt;strong&gt;y&lt;/strong&gt;&#039; and press &#039;&lt;strong&gt;Enter&lt;/strong&gt;&#039; to continue the installation.&lt;/p&gt;
[image:78::Install Certbot:9-install-certbot.png]
&lt;ul&gt;
&lt;li&gt;Once the installation is complete, create a new directory for letsencrypt authorization using the following commands.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;mkdir -p /var/lib/letsencrypt/.well-known&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;chgrp www-data /var/lib/letsencrypt&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;chmod g+s /var/lib/letsencrypt&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Next, change the working directory to the &amp;quot;&lt;strong&gt;/etc/apache2/conf-available/&lt;/strong&gt;&amp;quot; and create a new configuration &amp;quot;&lt;strong&gt;well-known.conf&lt;/strong&gt;&amp;quot; using nano.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;cd /etc/apache2/conf-available/&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;mcedit well-known.conf&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Copy and paste the following configuration.&lt;/p&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Alias /.well-known/acme-challenge/ &quot;/var/lib/letsencrypt/.well-known/acme-challenge/&quot;&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&lt;directory &quot;/var/lib/letsencrypt/&quot;&gt;&amp;#160;&amp;#160;&lt;/directory&gt;&lt;/span&gt;&lt;/code&gt;=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;AllowOverride None&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Require method GET POST OPTIONS&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc6&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;/code&gt;tr&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;strong&gt;Ctrl+x&amp;quot; and type &amp;quot;&lt;strong&gt;y&lt;/strong&gt;&amp;quot; and press &#039;&lt;strong&gt;Enter&lt;/strong&gt;&#039; to save the configuration and exit.
&lt;p&gt;Now activate the new configuration by creating a symlink of the &#039;&lt;strong&gt;well-known.conf&lt;/strong&gt;&#039; file to the directory &lt;strong&gt;&#039;conf-enabled&#039;&lt;/strong&gt; using the &#039;&lt;strong&gt;ln&lt;/strong&gt;&#039; command below.&lt;/p&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;ln -s /etc/apache2/conf-available/well-known.conf /etc/apache2/conf-enabled/&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Now execute the following commands to verify the apache configuration and restart the apache service.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;apachectl configtest&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;systemctl restart apache2&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If you&#039;ve no error, you&#039;re ready to generate SSL Letsencrypt with the webroot plugin.&lt;/p&gt;
[image:81::Setup SSL Verification for Letsencrypt:10-setting-ssl-verification-letsencrypt.png]
&lt;ul&gt;
&lt;li&gt;Before generating SSL Letsencrypt, ensure your domain name is resolved to the server IP address. After that, you can generate SSL Letsencrypt with the webroot plugin by running the certbot command below. Also, change the email address and domain name to your own.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sudo certbot certonly --agree-tos --email user@email.com --webroot -w /var/lib/letsencrypt/ -d files.domain-name.io&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;When the process is complete, your SSL certificates are available at the &amp;quot;&lt;strong&gt;/etc/letsencrypt/live/files.domain-name.io/&lt;/strong&gt;&amp;quot; directory.&lt;/p&gt;
&lt;h3 class=&quot;evo_auto_anchor_header&quot; id=&quot;apache-web-server-configuration&quot;&gt;Apache Web server configuration&lt;/h3&gt;
&lt;p&gt;Configuring Apache requires the creation of a single configuration file. On Debian, Ubuntu, and their derivatives, this file will be /etc/apache2/sites-available/nextcloud.conf.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Change the working directory to &amp;quot;/etc/apache2/sites-available/&amp;quot; and create new configuration &amp;quot;nextcloud.conf&amp;quot; using mcedit.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;mcedit /etc/apache2/sites-available/nextcloud.conf&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;if you want http/2 &amp;amp; hsts support uncomment the Protocol &amp;amp; Header line&lt;/p&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&lt;virtualhost *:443&gt;&amp;#160;&amp;#160;&lt;/virtualhost&gt;&lt;/span&gt;&lt;/code&gt;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;DocumentRoot /var/www/nextcloud/&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;ServerName your.server.com&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;SSLEngine On&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc6&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;SSLCertificateFile /etc/letsencrypt/live/files.domain-name.io/fullchain.pem&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc7&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;SSLCertificateKeyFile /etc/letsencrypt/live/files.domain-name.io/privkey.pem&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc8&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc9&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&lt;directory /var/www/nextcloud&gt;&amp;#160;&amp;#160;&lt;/directory&gt;&lt;/span&gt;&lt;/code&gt;=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc0&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;Require all granted&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;AllowOverride All&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;Options +FollowSymLinks&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&lt;ifmodule mod_dav.c&gt;&amp;#160;&amp;#160;&lt;/ifmodule&gt;&lt;/span&gt;&lt;/code&gt;s=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Dav off&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&quot;amc_line&quot;&gt;&lt;div class=&quot;amc6&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&lt;p&gt;&amp;#160;&amp;#160;&lt;/p&gt;&lt;/span&gt;&lt;/code&gt;tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc7&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc8&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;SetEnv HOME /var/www/nextcloud&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc9&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;SetEnv HTTP_HOME /var/www/nextcloud&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc0&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&lt;p&gt;&amp;#160;&amp;#160;&lt;/p&gt;&lt;/span&gt;&lt;/code&gt;tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;/code&gt;tr&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;nd exit the editor.
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now enter the following systemctl command to restart the apache2 service and apply the Nextcloud virtual host configuration.&lt;/p&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;systemctl restart apache2&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h4 class=&quot;evo_auto_anchor_header&quot; id=&quot;additional-apache-configurations&quot;&gt;Additional Apache configurations&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;For Nextcloud to work correctly, we need the module mod_rewrite. Enable it by running:&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;a2enmod rewrite&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;a2enmod ssl&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Additional recommended modules are mod_headers, mod_env, mod_dir and mod_mime:&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;a2enmod headers&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;a2enmod env&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;a2enmod dir&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;a2enmod mime&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Next, run the a2ensite command below to enable the virtual host configuration nextcloud.conf. Then verify the overall Apache2 configuration via the apachectl command below.&lt;/p&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;a2ensite nextcloud.conf&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;apachectl configtest&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You should see the output Syntax OK if you have correct and proper Apache configurations. Now lets start with the nextcloud install&lt;/p&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;AH00112: Warning: DocumentRoot [/var/www/nextcloud/] does not exist&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;Syntax OK&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Lastly, enter the systemctl command below to restart the apache2 service. Every time you make changes to the PHP configuration, restart the apache2 service to apply the changes that you&#039;ve made.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;systemctl restart apache2.service&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h3 class=&quot;evo_auto_anchor_header&quot; id=&quot;installing-nextcloud-from-command-line&quot;&gt;Installing Nextcloud from command line&lt;/h3&gt;
&lt;p&gt;It is now possible to install Nextcloud entirely from the command line. This is convenient for scripted operations, headless servers, and sysadmins who prefer the command line. There are three stages to installing Nextcloud via the command line:&lt;/p&gt;
&lt;h3 class=&quot;evo_auto_anchor_header&quot; id=&quot;download-and-install-nextcloud&quot;&gt;Download and Install Nextcloud&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Change the working directory to &amp;quot;&lt;strong&gt;/var/www&lt;/strong&gt;&amp;quot; and download the latest version of Nextcloud source code using the wget command as below.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;cd /var/www/&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;wget https://download.nextcloud.com/server/releases/latest.zip&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;unzip latest.zip &amp;amp;&amp;amp; chown -R www-data:www-data /var/www/nextcloud &amp;amp;&amp;amp; rm -f latest.zip&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Change the ownership of your nextcloud directory to your HTTP user, like this example for Debian/Ubuntu.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;mkdir -p /var/lib/nextcloud /var/log/nextcloud&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;chown -R www-data:www-data /var/lib/nextcloud /var/www /var/log/nextcloud&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;```bash&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;* Use the occ command to complete your installation. This takes the place of running the graphical Installation Wizard&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc6&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;after the install we set some defaults and correct some values.&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc7&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;```bash&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc8&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sudo -u www-data php /var/www/nextcloud/occ maintenance:install --database &quot;mysql&quot; --database-name &quot;nextcloud&quot; --database-user &quot;nextcloud&quot; --database-pass &quot;StrongPassword&quot; --database-host &quot;localhost:3306&quot; --admin-user &quot;Admin&quot; --admin-pass &quot;SecurePassword&quot; --data-dir &quot;/var/lib/nextcloud&quot;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc9&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sudo -u www-data php /var/www/nextcloud/occ config:system:set trusted_domains 0 --value=nextcloud.disconnected-by-peer.at&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc0&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sudo -u www-data php /var/www/nextcloud/occ config:system:set overwritehost --value=nextcloud.disconnected-by-peer.at&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h4 class=&quot;evo_auto_anchor_header&quot; id=&quot;memory-caching&quot;&gt;Memory caching&lt;/h4&gt;
&lt;p&gt;You can significantly improve your Nextcloud server performance with memory caching, where frequently-requested objects are stored in memory for faster retrieval. There are two types of caches to use: a PHP opcode cache, which is commonly called opcache, and data cache for your web server, commonly called “memcache”.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Activate Memcached for local and distributed caching, as well as transactional file locking.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sudo -u www-data php /var/www/nextcloud/occ config:system:set &#039;memcache.local&#039;&amp;#160;&amp;#160;--value=&#039;\OC\Memcache\APCu&#039;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sudo -u www-data php /var/www/nextcloud/occ config:system:set &#039;memcache.distributed&#039;&amp;#160;&amp;#160;--value=&#039;\OC\Memcache\Memcached&#039;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sudo -u www-data php /var/www/nextcloud/occ config:system:set &#039;memcache.locking&#039;&amp;#160;&amp;#160;--value=&#039;\OC\Memcache\Memcached&#039;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sudo -u www-data php /var/www/nextcloud/occ config:system:set &#039;memcached_servers&#039; --value=&#039;NextCloudMemcached&#039;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sudo -u www-data sed -e &#039;s!.NextCloudMemcached.![\n&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;[ &quot;localhost&quot;, &quot;11211&quot; ],\n&amp;#160;&amp;#160;]!&#039; -i /var/www/nextcloud/config/config.php&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Set up a cron job for Nextcloud as “www-data” user:&lt;/p&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;crontab -u www-data -e&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Insert this line at the bottom&lt;/p&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;*/5 * * * * php -f /var/www/nextcloud/cron.php &gt; /dev/null 2&gt;&amp;amp;1&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Then save and close the file and reconfigure the Nextcloud job from “Ajax” to “Cron” using the Nextclouds CLI:&lt;/p&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sudo -u www-data php /var/www/nextcloud/occ background:cron&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h4 class=&quot;evo_auto_anchor_header&quot; id=&quot;pretty-urls&quot;&gt;Pretty URLs&lt;/h4&gt;
&lt;p&gt;Pretty URLs remove the index.php-part in all Nextcloud URLs, for example in sharing links like &lt;a href=&quot;https://example.org/nextcloud/index.php/s/Sv1b7krAUqmF8QQ&quot; class=&quot;linebreak&quot;&gt;https://example.org/nextcloud/index.php/s/Sv1b7krAUqmF8QQ&lt;/a&gt;, making URLs shorter and thus prettier.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;mod_env and mod_rewrite must be installed on your webserver and the .htaccess must be writable by the HTTP user&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sudo -u www-data php /var/www/nextcloud/occ config:system:set overwrite.cli.url --value=https://nextcloud.disconnected-by-peer.at&amp;#160;&amp;#160;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sudo -u www-data php /var/www/nextcloud/occ config:system:set &#039;htaccess.RewriteBase&#039; --value=&#039;/&#039;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;It isn’t installed in a subfolder. Finally run this occ-command to update your .htaccess file:&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;After each update, these changes are automatically applied to the .htaccess-file.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 class=&quot;evo_auto_anchor_header&quot; id=&quot;modify-the-user-ini&quot;&gt;Modify the “.user.ini”&lt;/h4&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sudo -u www-data sed -i &quot;s/output_buffering=.*/output_buffering=0/&quot; /var/www/nextcloud/.user.ini&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;and customize the Nextcloud apps as user www-data&lt;/li&gt;
&lt;/ul&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sudo -u www-data php /var/www/nextcloud/occ app:disable survey_client&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sudo -u www-data php /var/www/nextcloud/occ app:disable firstrunwizard&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sudo -u www-data php /var/www/nextcloud/occ app:enable admin_audit&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sudo -u www-data php /var/www/nextcloud/occ app:enable files_pdfviewer&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h4 class=&quot;evo_auto_anchor_header&quot; id=&quot;optional-nextcloud-office&quot;&gt;Optional Nextcloud Office:&lt;/h4&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sudo -u www-data /usr/bin/php /var/www/nextcloud/occ app:install richdocuments&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;sudo -u www-data /usr/bin/php /var/www/nextcloud/occ app:install richdocumentscode&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h4 class=&quot;evo_auto_anchor_header&quot; id=&quot;add-qownnote-api-to-the-nextcloud-install&quot;&gt;Add qOwnNote API  to the Nextcloud install&lt;/h4&gt;
&lt;p class=&quot;codeblock_title&quot;&gt;Code&lt;/p&gt;&lt;div class=&quot;codeblock codeblock_with_title amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code class=&quot;codeblock&quot;&gt;&lt;span class=&quot;amc_default&quot;&gt;sudo -u www-data /usr/bin/php /var/www/nextcloud/occ app:install qownnotesapi&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h3 class=&quot;evo_auto_anchor_header&quot; id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Congratulation! You have successfully installed Nextcloud on Debian 12 Bullseye. The Nextcloud server is running under the LAMP Stack with SSL enabled. Also, your Nextcloud installation is running with memory caching enabled with PHP APC and opcache extensions.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;https://www.disconnected-by-peer.at/RTFM/rtfm-main/nextcloud_installation_on_debian-12&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>Nextcloud is open-source software for creating public and private file storage. It allows you to create your self-hosted services like Dropbox, Google Drive, or Mega.nz. Originally, it's created by the original owncloud developer Frank Karlitschek. In 2016, he forks the Owncloud project and creates a new project with the new name &quot;Nextcloud&quot;</p>
<p>By this time, the Nextcloud project growing rapidly and becoming more than file hosting software, it's more like a file sync and content collaboration platform. Backed with a lot of plugins, Nextcloud becomes such a powerful collaboration software. You can install plugins for project management, video conferencing, collaborative editing, note-taking, email client, etc.</p>
<p>In this guide, you will learn how to install Nextcloud on the latest Debian 12 Bookworm. You will be installing Nextcloud under the LAMP Stack (Linux, Apache2/httpd, MySQL/MariaDB, and PHP).</p>
<h3 class="evo_auto_anchor_header" id="prerequisites">Prerequisites</h3>
<ul>
<li>A Debian 12 server. Ensure all packages are updated to the latest version.</li>
<li>A root user or a user with root privileges. This user will be used for installing new packages and editing system configurations.</li>
</ul>
<h3 class="evo_auto_anchor_header" id="get-root-and-update-repositories">Get Root and Update Repositories</h3>
<p>First, execute the following command to get the root privileges.</p>
<ul>
<li>If you have <strong>sudo</strong> installed, execute the sudo command below.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sudo su</span></code></td></tr></table></div>

<p>Now type the password login for your user.</p>
<ul>
<li>After that, update all your Debian repositories using the apt command below.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">apt update</span></code></td></tr></table></div>

<ul>
<li>Install wget if missing</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">apt install wget</span></code></td></tr></table></div>

<h3 class="evo_auto_anchor_header" id="installing-and-configuring-php">Installing and Configuring PHP</h3>
<p>For this guide, you will be deploying Nextcloud with the latest stable version of PHP 8.2.</p>
<p>By default, the Debian repository provides packages for PHP 8.1. But, Nextcloud requires some additional PHP packages that can be installed from a 3rd-party repository. And you will be adding a new repository to your Debian system.</p>
<p>1. Execute the command below to add a PHP repository for the Debian system.</p>
<ul>
<li>Install the Sury php Repository</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">bash -c "$(wget -qLO - https://packages.sury.org/php/README.txt)"</span></code></td></tr></table></div>

<h3 class="evo_auto_anchor_header" id="installing-and-configuring-mariadb">Installing and Configuring MariaDB</h3>
<p>For this stage, you will be installing the mariadb database server, securing mariadb deployment, and creating a new database and user for Nextcloud.</p>
<ul>
<li>To install the mariadb database server, run the command below and the MariaDB Repository via thew install script</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">bash -c "$(wget -qLO - https://r.mariadb.com/downloads/mariadb_repo_setup)"</span></code></td></tr></table></div>

<h3 class="evo_auto_anchor_header" id="install-the-needed-packages">Install the needed packages</h3>
<p>Now install all the packages for the system LAMP &amp; Redis</p>
<ul>
<li>To install all the needed packages, run the command below.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">apt install -y mc unzip ffmpeg apache2 redis-server memcached libapache2-mod-php8.2 php-common php8.2 \&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">php8.2-{gd,curl,xml,zip,intl,mbstring,bz2,ldap,apcu,bcmath,gmp,imagick,igbinary,mysql,redis,smbclient,cli,common,opcache,readline,soap,memcached} \&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock"><span class="amc_default">imagemagick libmagickcore-6.q16-6-extra --allow-change-held-packages</span></code></td></tr></table></div>

<h3 class="evo_auto_anchor_header" id="adapt-the-php-8-2-ini-values-for-netxtcloud">Adapt the PHP 8.2 ini Values for Netxtcloud</h3>
<p>The following ini settings should be adapted for Nextcloud.</p>
<ul>
<li>Uncomment the date.timezone parameter and input the proper timezone for PHP.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/\;date.timezone =.*/date.timezone = Europe\/Vienna/" /etc/php/8.2/apache2/php.ini</span></code></td></tr></table></div>

<ul>
<li>Increase the default value of parameters memory_limit, upload_max_filesize, post_max_size, and max_execution_time. Change the value as you need.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/memory_limit =.*/memory_limit = 512M/" /etc/php/8.2/apache2/php.ini&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/upload_max_filesize =.*/upload_max_filesize = 500M/" /etc/php/8.2/apache2/php.ini&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/post_max_size =.*/post_max_size = 600M/" /etc/php/8.2/apache2/php.ini&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/max_execution_time =.*/max_execution_time = 300/" /etc/php/8.2/apache2/php.ini</span></code></td></tr></table></div>

<ul>
<li>Enable file_uploads and allow_url_fopen by changing the default value to On.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/file_uploads =.*/file_uploads = on/" /etc/php/8.2/apache2/php.ini&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/allow_url_fopen =.*/allow_url_fopen = On/" /etc/php/8.2/apache2/php.ini</span></code></td></tr></table></div>

<ul>
<li>Disable the parameter display_errors and output_buffering by changing the default value to Off.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/display_errors =.*/display_errors = Off/" /etc/php/8.2/apache2/php.ini&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/output_buffering =.*/output_buffering = Off/" /etc/php/8.2/apache2/php.ini</span></code></td></tr></table></div>

<ul>
<li>APCu is disabled by default on CLI which could cause issues with nextcloud’s cron jobs. so activate it</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sed -i '$aapc.enable_cli=1' /etc/php/8.2/mods-available/apcu.ini</span></code></td></tr></table></div>

<ul>
<li>Uncomment the zend_extension parameter and change the value to opcache. This will enable PHP OPcache, which is needed for Nextcloud.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/\;zend_extension=opcache/zend_extension=opcache/" /etc/php/8.2/apache2/php.ini</span></code></td></tr></table></div>

<ul>
<li>Add the following lines to the [<strong>opcache</strong>] section. The OPCache configuration is recommended by Nextcloud.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/\;opcache.enable=.*/opcache.enable = 1/" /etc/php/8.2/apache2/php.ini&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/\;opcache.interned_strings_buffer=.*/opcache.interned_strings_buffer = 8/" /etc/php/8.2/apache2/php.ini&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/\;opcache.max_accelerated_files=.*/opcache.max_accelerated_files = 10000/" /etc/php/8.2/apache2/php.ini&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/\;opcache.memory_consumption=.*/opcache.memory_consumption = 128/" /etc/php/8.2/apache2/php.ini&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/\;opcache.save_comments=.*/opcache.save_comments = 1/" /etc/php/8.2/apache2/php.ini&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/\;opcache.revalidate_freq=.*/opcache.revalidate_freq = 1/" /etc/php/8.2/apache2/php.ini</span></code></td></tr></table></div>

<ul>
<li>Lastly, enter the systemctl command below to restart the apache2 service. Every time you make changes to the PHP configuration, restart the apache2 service to apply the changes that you've made.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sudo systemctl restart apache2</span></code></td></tr></table></div>

<h3 class="evo_auto_anchor_header" id="memcached-configuration">memcached configuration</h3>
<p>We install the memcached server to increase Nextcloud performance, as memcached reduces the load on the MariaDB Nextcloud database.</p>
<ul>
<li>Customize the memcached configuration by customizing the configuration by running the commands below</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sed -i "s/-m 64/-m 128/" /etc/memcached.conf</span></code></td></tr></table></div>

<ul>
<li>Lastly, enter the systemctl command below to restart the redis service. </li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">systemctl restart memcached.service</span></code></td></tr></table></div>

<ul>
<li><p>You can verify that the Memcached daemon is running with ps ax</p>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">root@nextcloud:~# ps xa | grep memcached</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">23830 ?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Ssl&#160;&#160;&#160;&#160;0:00 /usr/bin/memcached -m 128 -p 11211 -u memcache -l 127.0.0.1 -P /var/run/memcached/memcached.pid</span></code></td></tr></table></div></li>
</ul>
<h3 class="evo_auto_anchor_header" id="installing-and-configuring-mariadb">Installing and Configuring MariaDB</h3>
<p>For this stage, you will be installing the mariadb database server, securing mariadb deployment, and creating a new database and user for Nextcloud.</p>
<ul>
<li>To install the mariadb database server, run the command below.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">apt install mariadb-server mariadb-client</span></code></td></tr></table></div>

<ul>
<li>Type '<strong>y</strong>' to confirm and install mariadb packages.</li>
</ul>
<div class="5-installing-mariadb-server png"><a href="https://www.disconnected-by-peer.at/media/blogs/RTFM/quick-uploads/nextcloud_installation_on_debian-12/5-installing-mariadb-server.png?mtime=1704257073" rel="lightbox[p138]" id="link_69"><img title="" alt="Installing MariaDB Server Debian 11" src="https://www.disconnected-by-peer.at/media/blogs/RTFM/quick-uploads/nextcloud_installation_on_debian-12/_evocache/5-installing-mariadb-server.png/fit-320x320.png?mtime=1704257073" width="320" height="140" class="loadimg" /></a></div>
<ul>
<li>Once the installation is complete, check the mariadb service using the following command.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">systemctl is-enabled mariadb&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">systemctl status mariadb</span></code></td></tr></table></div>

<ul>
<li>The mariadb service is active and running, and it's enabled to start automatically at system startup.</li>
</ul>
[image:72::Checking MariaDB Database Service:6-checking-mariadb-service.png]
<ul>
<li>Next, you need to secure your mariadb deployment by setting up the root password for mariadb and remove some default configuration. To do that, you can use the command-line tool 'mysql_secure_installation', which is included on the default mariadb installation.</li>
</ul>
<ul>
<li>Execute the &quot;<strong>mysql_secure_installation</strong>&quot; command below.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">mysql\_secure\_installation</span></code></td></tr></table></div>

<ul>
<li>At the first, you will be asked to enter the mariadb root password. Just press '<strong>Enter</strong>' to continue.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">Enter current password for root (enter for none):&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">OK, successfully used password, moving on...</span></code></td></tr></table></div>

<ul>
<li>Type '<strong>Y</strong>' to enable the '<strong>unix_socket</strong>' authentication for the user '<strong>root</strong>'.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">Switch to unix\_socket authentication \[Y/n\] Y&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">Enabled successfully!&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock"><span class="amc_default">Reloading privilege tables..&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code class="codeblock"><span class="amc_default"> ... Success!</span></code></td></tr></table></div>

<ul>
<li>Type your strong mariadb root password and repeat, then press &quot;<strong>Enter</strong>&quot; to continue.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">Change the root password? \[Y/n\] Y&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">New password:&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock"><span class="amc_default">Re-enter new password:&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code class="codeblock"><span class="amc_default">Password updated successfully!&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code class="codeblock"><span class="amc_default">Reloading privilege tables..&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td><code class="codeblock"><span class="amc_default"> ... Success!</span></code></td></tr></table></div>

<ul>
<li>Now type &quot;<strong>Y</strong>&quot; and press &quot;<strong>Enter</strong>&quot; to remove the default anonymous user from the mariadb server.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">By default, a MariaDB installation has an anonymous user, allowing anyone&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">to log into MariaDB without having to have a user account created for&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock"><span class="amc_default">them.&#160;&#160;This is intended only for testing, and to make the installation&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code class="codeblock"><span class="amc_default">go a bit smoother.&#160;&#160;You should remove them before moving into a&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code class="codeblock"><span class="amc_default">production environment.</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td><code class="codeblock">&nbsp;</code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc7"></div></td><td><code class="codeblock"><span class="amc_default">Remove anonymous users? \[Y/n\] Y&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc8"></div></td><td><code class="codeblock"><span class="amc_default"> ... Success!</span></code></td></tr></table></div>

<ul>
<li>After that, disable the remote login for the default user '<strong>root</strong>'. Type &quot;<strong>Y</strong>&quot; and press &quot;<strong>Enter</strong>&quot; to continue.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">Normally, root should only be allowed to connect from 'localhost'.&#160;&#160;This&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">ensures that someone cannot guess at the root password from the network.</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock">&nbsp;</code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code class="codeblock"><span class="amc_default">Disallow root login remotely? \[Y/n\] Y&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code class="codeblock"><span class="amc_default"> ... Success!</span></code></td></tr></table></div>

<ul>
<li>Type &quot;<strong>Y</strong>&quot; again to remove the default database &quot;<strong>test</strong>&quot; and press &quot;<strong>Enter</strong>&quot;.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">By default, MariaDB comes with a database named 'test' that anyone can&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">access.&#160;&#160;This is also intended only for testing, and should be removed&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock"><span class="amc_default">before moving into a production environment.</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code class="codeblock">&nbsp;</code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code class="codeblock"><span class="amc_default">Remove test database and access to it? \[Y/n\] Y&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td><code class="codeblock"><span class="amc_default"> - Dropping test database...&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc7"></div></td><td><code class="codeblock"><span class="amc_default"> ... Success!&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc8"></div></td><td><code class="codeblock"><span class="amc_default"> - Removing privileges on test database...&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc9"></div></td><td><code class="codeblock"><span class="amc_default"> ... Success!</span></code></td></tr></table></div>

<ul>
<li>And the last, type &quot;<strong>Y</strong>&quot; again to reload all tables privileges to apply a new configuration.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">Reloading the privilege tables will ensure that all changes made so far&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">will take effect immediately.</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock">&nbsp;</code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code class="codeblock"><span class="amc_default">Reload privilege tables now? \[Y/n\] Y&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code class="codeblock"><span class="amc_default"> ... Success!</span></code></td></tr></table></div>

<ul>
<li>Now the process is complete and you will see the following output.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">Cleaning up...</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock">&nbsp;</code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock"><span class="amc_default">All done!&#160;&#160;If you've completed all of the above steps, your MariaDB&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code class="codeblock"><span class="amc_default">installation should now be secure.</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code class="codeblock">&nbsp;</code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td><code class="codeblock"><span class="amc_default">Thanks for using MariaDB!</span></code></td></tr></table></div>

<h4 class="evo_auto_anchor_header" id="creating-database-and-user-for-nextcloud">Creating Database and User for Nextcloud</h4>
<ul>
<li>log in to the mariadb shell using the mysql command below.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">mysql -u root -p</span></code></td></tr></table></div>

<ul>
<li>Now execute the following mysql query to create a new database &quot;<strong>nextcloud</strong>&quot;.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">CREATE DATABASE nextcloud;</span></code></td></tr></table></div>

<ul>
<li>Execute the following query to create a new database user &quot;<strong>nextcloud</strong>&quot;. Change the &quot;<strong>strongpassword</strong>&quot; with your strong password.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">CREATE USER nextcloud@localhost IDENTIFIED BY 'StrongPassword';</span></code></td></tr></table></div>

<ul>
<li>Allow the user &quot;<strong>nextcloud</strong>&quot; to access and write the &quot;<strong>nextcloud</strong>&quot; using the following query.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">GRANT ALL PRIVILEGES ON nextcloud.\* TO nextcloud@localhost;</span></code></td></tr></table></div>

<ul>
<li>Now reload all tables privileges to apply the new database configuration.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">FLUSH PRIVILEGES;</span></code></td></tr></table></div>

<ul>
<li>Then you can type &quot;<strong>quit</strong>&quot; and press &quot;<strong>Enter</strong>&quot; to exit from the mariadb shell.</li>
</ul>
[image:75::Create new database and user for Nextcloud:7-create-database-user-nextcloud.png]
<h3 class="evo_auto_anchor_header" id="generating-ssl-letsencrypt">Generating SSL Letsencrypt</h3>
<p>In this stage, you will be installing the certbot tool and generate the SSL certificates for the Nextcloud installation. You will be generating SSL Letsencrypts with the webroot plugin.</p>
<ul>
<li>Execute the following command to install the certbot tool for generating SSL Letsencrypt.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">apt install certbot</span></code></td></tr></table></div>

<p>Type '<strong>y</strong>' and press '<strong>Enter</strong>' to continue the installation.</p>
[image:78::Install Certbot:9-install-certbot.png]
<ul>
<li>Once the installation is complete, create a new directory for letsencrypt authorization using the following commands.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">mkdir -p /var/lib/letsencrypt/.well-known&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">chgrp www-data /var/lib/letsencrypt&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock"><span class="amc_default">chmod g+s /var/lib/letsencrypt</span></code></td></tr></table></div>

<ul>
<li>Next, change the working directory to the &quot;<strong>/etc/apache2/conf-available/</strong>&quot; and create a new configuration &quot;<strong>well-known.conf</strong>&quot; using nano.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">cd /etc/apache2/conf-available/&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">mcedit well-known.conf</span></code></td></tr></table></div>

<p>Copy and paste the following configuration.</p>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">Alias /.well-known/acme-challenge/ "/var/lib/letsencrypt/.well-known/acme-challenge/"&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default"><directory "/var/lib/letsencrypt/">&#160;&#160;</directory></span></code>="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;AllowOverride None&#160;&#160;</span></code></td></td></tr><tr class="amc_code_even">"amc_line"><div class="amc4"></div><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;Require method GET POST OPTIONS&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td><code class="codeblock"><span class="amc_default"><p></p></span></code>tr></td></tr></table></div>strong>Ctrl+x&quot; and type &quot;<strong>y</strong>&quot; and press '<strong>Enter</strong>' to save the configuration and exit.
<p>Now activate the new configuration by creating a symlink of the '<strong>well-known.conf</strong>' file to the directory <strong>'conf-enabled'</strong> using the '<strong>ln</strong>' command below.</p>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">ln -s /etc/apache2/conf-available/well-known.conf /etc/apache2/conf-enabled/</span></code></td></tr></table></div>

<ul>
<li>Now execute the following commands to verify the apache configuration and restart the apache service.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">apachectl configtest&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">systemctl restart apache2</span></code></td></tr></table></div>

<p>If you've no error, you're ready to generate SSL Letsencrypt with the webroot plugin.</p>
[image:81::Setup SSL Verification for Letsencrypt:10-setting-ssl-verification-letsencrypt.png]
<ul>
<li>Before generating SSL Letsencrypt, ensure your domain name is resolved to the server IP address. After that, you can generate SSL Letsencrypt with the webroot plugin by running the certbot command below. Also, change the email address and domain name to your own.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sudo certbot certonly --agree-tos --email user@email.com --webroot -w /var/lib/letsencrypt/ -d files.domain-name.io</span></code></td></tr></table></div>

<p>When the process is complete, your SSL certificates are available at the &quot;<strong>/etc/letsencrypt/live/files.domain-name.io/</strong>&quot; directory.</p>
<h3 class="evo_auto_anchor_header" id="apache-web-server-configuration">Apache Web server configuration</h3>
<p>Configuring Apache requires the creation of a single configuration file. On Debian, Ubuntu, and their derivatives, this file will be /etc/apache2/sites-available/nextcloud.conf.</p>
<ul>
<li>Change the working directory to &quot;/etc/apache2/sites-available/&quot; and create new configuration &quot;nextcloud.conf&quot; using mcedit.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">mcedit /etc/apache2/sites-available/nextcloud.conf</span></code></td></tr></table></div>

<ul>
<li>
<p>if you want http/2 &amp; hsts support uncomment the Protocol &amp; Header line</p>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default"><virtualhost *:443>&#160;&#160;</virtualhost></span></code>amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">DocumentRoot /var/www/nextcloud/&#160;&#160;</span></code></td></td></tr><tr class="amc_code_odd">"amc_line"><div class="amc3"></div><td><code class="codeblock"><span class="amc_default">ServerName your.server.com&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code class="codeblock">&nbsp;</code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code class="codeblock"><span class="amc_default">SSLEngine On&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td><code class="codeblock"><span class="amc_default">SSLCertificateFile /etc/letsencrypt/live/files.domain-name.io/fullchain.pem&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc7"></div></td><td><code class="codeblock"><span class="amc_default">SSLCertificateKeyFile /etc/letsencrypt/live/files.domain-name.io/privkey.pem&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc8"></div></td><td><code class="codeblock">&nbsp;</code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc9"></div></td><td><code class="codeblock"><span class="amc_default"><directory /var/www/nextcloud>&#160;&#160;</directory></span></code>="amc_code_even"><td class="amc_line"><div class="amc0"><div class="amc1"></div></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;Require all granted&#160;&#160;</span></code></td></td></tr><tr class="amc_code_odd">"amc_line"><div class="amc1"><div class="amc1"></div></div><td><code class="codeblock"><span class="amc_default">&#160;&#160;AllowOverride All&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"><div class="amc1"></div></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;Options +FollowSymLinks&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"><div class="amc1"></div></div></td><td><code class="codeblock">&nbsp;</code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"><div class="amc1"></div></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;<ifmodule mod_dav.c>&#160;&#160;</ifmodule></span></code>s="amc_code_odd"><td class="amc_line"><div class="amc5"><div class="amc1"></div></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;Dav off&#160;&#160;</span></code></td></td></tr><tr class="amc_code_even">"amc_line"><div class="amc6"><div class="amc1"></div></div><td><code class="codeblock"><span class="amc_default">&#160;&#160;<p>&#160;&#160;</p></span></code>tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc7"><div class="amc1"></div></div></td><td><code class="codeblock">&nbsp;</code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc8"><div class="amc1"></div></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;SetEnv HOME /var/www/nextcloud&#160;&#160;</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc9"><div class="amc1"></div></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;SetEnv HTTP_HOME /var/www/nextcloud&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc0"><div class="amc2"></div></div></td><td><code class="codeblock"><span class="amc_default"><p>&#160;&#160;</p></span></code>tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"><div class="amc2"></div></div></td><td><code class="codeblock"><span class="amc_default"><p></p></span></code>tr></td></tr></td></tr></td></tr></table></div>nd exit the editor.
</li>
</ul>
<p>Now enter the following systemctl command to restart the apache2 service and apply the Nextcloud virtual host configuration.</p>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">systemctl restart apache2</span></code></td></tr></table></div>

<h4 class="evo_auto_anchor_header" id="additional-apache-configurations">Additional Apache configurations</h4>
<ul>
<li>For Nextcloud to work correctly, we need the module mod_rewrite. Enable it by running:</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">a2enmod rewrite</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">a2enmod ssl</span></code></td></tr></table></div>

<ul>
<li>Additional recommended modules are mod_headers, mod_env, mod_dir and mod_mime:</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">a2enmod headers</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">a2enmod env</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock"><span class="amc_default">a2enmod dir</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code class="codeblock"><span class="amc_default">a2enmod mime</span></code></td></tr></table></div>

<p>Next, run the a2ensite command below to enable the virtual host configuration nextcloud.conf. Then verify the overall Apache2 configuration via the apachectl command below.</p>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">a2ensite nextcloud.conf&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;apachectl configtest</span></code></td></tr></table></div>

<p>You should see the output Syntax OK if you have correct and proper Apache configurations. Now lets start with the nextcloud install</p>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">AH00112: Warning: DocumentRoot [/var/www/nextcloud/] does not exist</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">Syntax OK</span></code></td></tr></table></div>

<ul>
<li>Lastly, enter the systemctl command below to restart the apache2 service. Every time you make changes to the PHP configuration, restart the apache2 service to apply the changes that you've made.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">systemctl restart apache2.service</span></code></td></tr></table></div>

<h3 class="evo_auto_anchor_header" id="installing-nextcloud-from-command-line">Installing Nextcloud from command line</h3>
<p>It is now possible to install Nextcloud entirely from the command line. This is convenient for scripted operations, headless servers, and sysadmins who prefer the command line. There are three stages to installing Nextcloud via the command line:</p>
<h3 class="evo_auto_anchor_header" id="download-and-install-nextcloud">Download and Install Nextcloud</h3>
<ul>
<li>Change the working directory to &quot;<strong>/var/www</strong>&quot; and download the latest version of Nextcloud source code using the wget command as below.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">cd /var/www/</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;wget https://download.nextcloud.com/server/releases/latest.zip</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;unzip latest.zip && chown -R www-data:www-data /var/www/nextcloud && rm -f latest.zip</span></code></td></tr></table></div>

<ul>
<li>Change the ownership of your nextcloud directory to your HTTP user, like this example for Debian/Ubuntu.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">mkdir -p /var/lib/nextcloud /var/log/nextcloud</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;chown -R www-data:www-data /var/lib/nextcloud /var/www /var/log/nextcloud</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock"><span class="amc_default">```bash</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code class="codeblock"><span class="amc_default">* Use the occ command to complete your installation. This takes the place of running the graphical Installation Wizard</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code class="codeblock">&nbsp;</code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td><code class="codeblock"><span class="amc_default">after the install we set some defaults and correct some values.</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc7"></div></td><td><code class="codeblock"><span class="amc_default">```bash</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc8"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;sudo -u www-data php /var/www/nextcloud/occ maintenance:install --database "mysql" --database-name "nextcloud" --database-user "nextcloud" --database-pass "StrongPassword" --database-host "localhost:3306" --admin-user "Admin" --admin-pass "SecurePassword" --data-dir "/var/lib/nextcloud"</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc9"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;sudo -u www-data php /var/www/nextcloud/occ config:system:set trusted_domains 0 --value=nextcloud.disconnected-by-peer.at</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc0"><div class="amc1"></div></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;sudo -u www-data php /var/www/nextcloud/occ config:system:set overwritehost --value=nextcloud.disconnected-by-peer.at</span></code></td></tr></table></div>

<h4 class="evo_auto_anchor_header" id="memory-caching">Memory caching</h4>
<p>You can significantly improve your Nextcloud server performance with memory caching, where frequently-requested objects are stored in memory for faster retrieval. There are two types of caches to use: a PHP opcode cache, which is commonly called opcache, and data cache for your web server, commonly called “memcache”.</p>
<ul>
<li>Activate Memcached for local and distributed caching, as well as transactional file locking.</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sudo -u www-data php /var/www/nextcloud/occ config:system:set 'memcache.local'&#160;&#160;--value='\OC\Memcache\APCu'</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;sudo -u www-data php /var/www/nextcloud/occ config:system:set 'memcache.distributed'&#160;&#160;--value='\OC\Memcache\Memcached'</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;sudo -u www-data php /var/www/nextcloud/occ config:system:set 'memcache.locking'&#160;&#160;--value='\OC\Memcache\Memcached'</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;sudo -u www-data php /var/www/nextcloud/occ config:system:set 'memcached_servers' --value='NextCloudMemcached'</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;sudo -u www-data sed -e 's!.NextCloudMemcached.![\n&#160;&#160;&#160;&#160;&#160;&#160;[ "localhost", "11211" ],\n&#160;&#160;]!' -i /var/www/nextcloud/config/config.php</span></code></td></tr></table></div>

<p>Set up a cron job for Nextcloud as “www-data” user:</p>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">crontab -u www-data -e</span></code></td></tr></table></div>

<p>Insert this line at the bottom</p>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">*/5 * * * * php -f /var/www/nextcloud/cron.php > /dev/null 2>&1</span></code></td></tr></table></div>

<p>Then save and close the file and reconfigure the Nextcloud job from “Ajax” to “Cron” using the Nextclouds CLI:</p>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sudo -u www-data php /var/www/nextcloud/occ background:cron</span></code></td></tr></table></div>

<h4 class="evo_auto_anchor_header" id="pretty-urls">Pretty URLs</h4>
<p>Pretty URLs remove the index.php-part in all Nextcloud URLs, for example in sharing links like <a href="https://example.org/nextcloud/index.php/s/Sv1b7krAUqmF8QQ" class="linebreak">https://example.org/nextcloud/index.php/s/Sv1b7krAUqmF8QQ</a>, making URLs shorter and thus prettier.</p>
<ul>
<li>mod_env and mod_rewrite must be installed on your webserver and the .htaccess must be writable by the HTTP user</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sudo -u www-data php /var/www/nextcloud/occ config:system:set overwrite.cli.url --value=https://nextcloud.disconnected-by-peer.at&#160;&#160;</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;sudo -u www-data php /var/www/nextcloud/occ config:system:set 'htaccess.RewriteBase' --value='/'</span></code></td></tr></table></div>

<ul>
<li>It isn’t installed in a subfolder. Finally run this occ-command to update your .htaccess file:</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess</span></code></td></tr></table></div>

<ul>
<li>After each update, these changes are automatically applied to the .htaccess-file.</li>
</ul>
<h4 class="evo_auto_anchor_header" id="modify-the-user-ini">Modify the “.user.ini”</h4>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sudo -u www-data sed -i "s/output_buffering=.*/output_buffering=0/" /var/www/nextcloud/.user.ini</span></code></td></tr></table></div>

<ul>
<li>and customize the Nextcloud apps as user www-data</li>
</ul>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sudo -u www-data php /var/www/nextcloud/occ app:disable survey_client</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;sudo -u www-data php /var/www/nextcloud/occ app:disable firstrunwizard</span></code></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;sudo -u www-data php /var/www/nextcloud/occ app:enable admin_audit</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;sudo -u www-data php /var/www/nextcloud/occ app:enable files_pdfviewer</span></code></td></tr></table></div>

<h4 class="evo_auto_anchor_header" id="optional-nextcloud-office">Optional Nextcloud Office:</h4>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sudo -u www-data /usr/bin/php /var/www/nextcloud/occ app:install richdocuments</span></code></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code class="codeblock"><span class="amc_default">&#160;&#160;&#160;&#160;sudo -u www-data /usr/bin/php /var/www/nextcloud/occ app:install richdocumentscode</span></code></td></tr></table></div>

<h4 class="evo_auto_anchor_header" id="add-qownnote-api-to-the-nextcloud-install">Add qOwnNote API  to the Nextcloud install</h4>
<p class="codeblock_title">Code</p><div class="codeblock codeblock_with_title amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code class="codeblock"><span class="amc_default">sudo -u www-data /usr/bin/php /var/www/nextcloud/occ app:install qownnotesapi</span></code></td></tr></table></div>

<h3 class="evo_auto_anchor_header" id="conclusion">Conclusion</h3>
<p>Congratulation! You have successfully installed Nextcloud on Debian 12 Bullseye. The Nextcloud server is running under the LAMP Stack with SSL enabled. Also, your Nextcloud installation is running with memory caching enabled with PHP APC and opcache extensions.</p><div class="item_footer"><p><small><a href="https://www.disconnected-by-peer.at/RTFM/rtfm-main/nextcloud_installation_on_debian-12">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>https://www.disconnected-by-peer.at/RTFM/rtfm-main/nextcloud_installation_on_debian-12#comments</comments>
			<wfw:commentRss>https://www.disconnected-by-peer.at/RTFM/?tempskin=_rss2&#38;disp=comments&#38;p=138</wfw:commentRss>
		</item>
			</channel>
</rss>
