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

<channel>
	<title>Debian &#8211; Sandy Scott&#039;s Web Spot</title>
	<atom:link href="https://www.sandyscott.net/tag/debian/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sandyscott.net</link>
	<description>My little corner of the web</description>
	<lastBuildDate>Mon, 05 Apr 2021 14:39:06 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>
	<item>
		<title>Linux software updates &#8211; How to resolve changed configuration files.</title>
		<link>https://www.sandyscott.net/2021/04/linux-software-updates-how-to-resolve-changed-configuration-files/</link>
					<comments>https://www.sandyscott.net/2021/04/linux-software-updates-how-to-resolve-changed-configuration-files/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Fri, 02 Apr 2021 15:46:00 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apt]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[dpkg]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=821</guid>

					<description><![CDATA[Sometimes, when you&#8217;re updating software on your Linux machine, the person maintaining the package will have also updated the default configuration file that ships with the software. This is an issue if you have customised that configuration file on your system &#8211; the system doesn&#8217;t know whether it should keep...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2021/04/linux-software-updates-how-to-resolve-changed-configuration-files/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p>Sometimes, when you&#8217;re updating software on your Linux machine, the person maintaining the package will have also updated the default configuration file that ships with the software.</p>



<p>This is an issue if you have customised that configuration file on your system &#8211; the system doesn&#8217;t know whether it should keep your version, use the new one, or something else. So it asks you to decide what to do about it.</p>



<p>I&#8217;m using Debian, which uses the <code>dpkg </code>package management system &#8211; that name may be unfamiliar, but if you&#8217;ve used any of the Debain family (Ubuntu, Mint, MX, elementary etc.) you will have used one of the friendlier wrappers around it: <code>apt </code>or <code>apt-get</code>.</p>



<p>Today, it&#8217;s the Collabora Office configuration file that has been updated:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}">Configuration file '/etc/loolwsd/loolwsd.xml'
 ==&gt; Modified (by you or by a script) since installation.
 ==&gt; Package distributor has shipped an updated version.
   What would you like to do about it ? Your options are:
    Y or I : install the package maintainer's version
    N or O : keep your currently-installed version
      D    : show the differences between the versions
      Z    : start a shell to examine the situation
 The default action is to keep your current version.
*** loolwsd.xml (Y/I/N/O/D/Z) [default=N] ?</pre></div>



<ul class="wp-block-list"><li>The first option is self-explanatory &#8211; you&#8217;ll lose any customizations you&#8217;ve made, but that might be OK for you.</li><li>Keeping your currently-installed version is usually OK &#8211; well designed software shouldn&#8217;t break because it&#8217;s missing a line in an old configuration file.</li></ul>



<p>In either case the system will keep a copy of the one you don&#8217;t pick, so you can change your mind later. If you choose to use the package mantainer&#8217;s version, there will be a copy of your old one with <code>.dpkg-old</code> added to the filename. If you keep you own config file, the package maintainer&#8217;s version will be saved alongside it, with <code>.dpkg-dist</code> added to the filename.</p>



<ul class="wp-block-list"><li>Choosing option D can help you decide &#8211; but ultimately doesn&#8217;t resolve the situation.</li><li>Option Z is the point of today&#8217;s post &#8211; this is how you can fix the situation.</li></ul>



<p>Lets hit Z, and this is what I get:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}"> The default action is to keep your current version.
*** loolwsd.xml (Y/I/N/O/D/Z) [default=N] ? Z
Useful environment variables:
 - DPKG_SHELL_REASON
 - DPKG_CONFFILE_OLD
 - DPKG_CONFFILE_NEW
Type 'exit' when you're done.
root@waldorf:/# </pre></div>



<p>The system tells you about 3 environment variables that might be useful to help fix the situation. here I&#8217;ve use the echo command (with a $ before the environment variable name) to see what&#8217;s in them:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}">root@waldorf:/# echo $DPKG_SHELL_REASON
conffile-prompt
root@waldorf:/# echo $DPKG_CONFFILE_OLD
/etc/loolwsd/loolwsd.xml
root@waldorf:/# echo $DPKG_CONFFILE_NEW
/etc/loolwsd/loolwsd.xml.dpkg-new</pre></div>



<p>DPKG_CONFFILE_PROMPT isn&#8217;t much use to us, but the other two are. We can start a program to compare and merge the differences between the two. I&#8217;m using Neovim in diff mode &#8211; there are lots of otherways of doing this &#8211; I&#8217;d suggest you do your research and find your preferred merge tool or text editor.</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}">root@waldorf:/# nvim -d $DPKG_CONFFILE_OLD $DPKG_CONFFILE_NEW</pre></div>



<p>I wont to get into the details of how to use [Neo]vim, but if you&#8217;re already a vim user and haven&#8217;t used diff mode before, these commands will get you started. <a href="https://neovim.io/doc/user/diff.html">You can find more info in the documentation.</a></p>



<figure class="wp-block-table"><table><tbody><tr><td><strong>Keystrokes</strong></td><td><strong>Command</strong></td></tr><tr><td>&lt;Ctrl-w&gt; l</td><td>Move to the right window</td></tr><tr><td>&lt;Ctrl-w&gt; h</td><td>Move to the left window</td></tr><tr><td>]c</td><td>Move to the next change</td></tr><tr><td>[c</td><td>Move to the previous change</td></tr><tr><td>:diffget</td><td>Copy the change you&#8217;re on from the other window</td></tr><tr><td>:diffput</td><td>Push the change from your current window into the other one.</td></tr></tbody></table></figure>



<dl class="wp-block-simple-definition-list-blocks-list"></dl>



<p>Note that the last two commands will make the files the same at that point</p>



<p>Modifiy one of the files (I typically modify my old file &#8211; pulling the changes from the new one that I want, and leaving the ones that I don&#8217;t), then save and exit your text editor or mergetool</p>



<p>Type exit at the prompt, then the system will ask you again what you want to do:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">*** loolwsd.xml (Y/I/N/O/D/Z) [default=N] ?</pre></div>



<p>In this case I&#8217;ll choose N or O because I&#8217;ve made the changes I want to the original config file.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2021/04/linux-software-updates-how-to-resolve-changed-configuration-files/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Server Setup 0: Contents</title>
		<link>https://www.sandyscott.net/2020/06/server-setup-0-contents/</link>
					<comments>https://www.sandyscott.net/2020/06/server-setup-0-contents/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Thu, 04 Jun 2020 08:29:10 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Collabora]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nextcloud]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=666</guid>

					<description><![CDATA[Hello and welcome to my series of posts on setting up a server to run Debian Linux, hosting a WordPress and a Nextcloud installation The idea is to take you through all the steps needed to get up and running, some basic familiarity with computers and Linux is assumed, but...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/06/server-setup-0-contents/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p>Hello and welcome to my series of posts on setting up a server to run Debian Linux, hosting a WordPress and a Nextcloud installation</p>



<p>The idea is to take you through all the steps needed to get up and running, some basic familiarity with computers and Linux is assumed, but not a lot.</p>



<ul class="wp-block-list"><li><a href="https://www.sandyscott.net/2020/05/18/server-setup-1-os-installation/" data-type="350">Server Setup 1: OS installation</a><br>This goes through a few pre-requisites, and then launches into the installation.</li><li><a href="https://www.sandyscott.net/2020/05/18/server-setup-2-initial-tweaks/" data-type="419">Server Setup 2: Initial tweaks</a><br>These first few steps will make your life easier when administering this server.</li><li><a href="https://www.sandyscott.net/2020/05/19/server-setup-3-install-webserver/" data-type="475">Server Setup 3: Install Webserver</a><br>We&#8217;ll install and test the webserver software &#8211; Apache.</li><li><a href="https://www.sandyscott.net/2020/05/20/server-setup-4-going-public/" data-type="508">Server Setup 4: Going Public</a><br>Configure the server, DNS and your router to allow public access to a placeholder website.</li><li><a href="https://www.sandyscott.net/2020/05/21/server-setup-5-https/" data-type="519">Server Setup 5: HTTPS</a><br>Enable secure connections to your new website with Lets Encrypt and certbot.</li><li><a href="https://www.sandyscott.net/2020/05/21/server-setup-4-wordpress-pre-requisites/" data-type="484">Server Setup 6: WordPress Pre-requisites</a><br>Get ourselves ready to install WordPress &#8211; we need PHP and a database.</li><li><a href="https://www.sandyscott.net/2020/05/21/server-setup-7-install-wordpress/" data-type="539">Server Setup 7: Install WordPress</a><br>Get WordPress installed so you have a functional website!</li><li><a href="https://www.sandyscott.net/2020/05/21/server-setup-8-wordpress-tweaks/" data-type="562">Server Setup 8: WordPress tweaks</a><br>A few tweaks to optimise WordPress.</li><li><a href="https://www.sandyscott.net/2020/05/21/server-setup-9-nextcloud-prep/" data-type="564">Server Setup 9: Nextcloud Prep</a><br>Preparatory work before the Nextcloud installation.</li><li><a href="https://www.sandyscott.net/2020/05/21/server-setup-10-nextcloud-installation/" data-type="575">Server Setup 10: Nextcloud Installation</a><br>Get the database and files system configured, then install Nextcloud</li><li><a href="https://www.sandyscott.net/2020/05/22/server-setup-11-config-improvements/" data-type="582">Server Setup 11: Config Improvements</a><br>Some little tweaks to improve the security of our server</li><li><a href="https://www.sandyscott.net/2020/05/24/server-setup-12-collabora/" data-type="612">Server Setup 12: Collabora</a><br>Install and configure Collabora Online Development Edition</li><li><a href="https://www.sandyscott.net/2020/05/25/server-setup-13-security-improvements/" data-type="621">Server Setup 13: Security Improvements</a><br>Move the WordPress configuration out of the web root</li><li><a href="https://www.sandyscott.net/2020/06/01/server-setup-14-backups/" data-type="516">Server Setup 14: Backups</a><br>This shows how to collect together all the data you need to completely back up your server.</li><li><a href="https://www.sandyscott.net/2020/06/01/server-setup-15-optional-extras/" data-type="602">Server Setup 15: Optional Extras</a><br>Further optional tweaks to make your installation better.</li></ul>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/06/server-setup-0-contents/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Server Setup 15: Optional Extras</title>
		<link>https://www.sandyscott.net/2020/06/server-setup-15-optional-extras/</link>
					<comments>https://www.sandyscott.net/2020/06/server-setup-15-optional-extras/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Mon, 01 Jun 2020 17:56:43 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nextcloud]]></category>
		<category><![CDATA[tmux]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=602</guid>

					<description><![CDATA[Now you&#8217;re up and running with what should be a stable and secure installation of WordPress and Nextcloud with Collabora. There are plenty more tweaks you can work on yourself: Server Administration Advanced HTTPS &#8211; you can check your config with https://www.ssllabs.com/ssltest/. You have choices about how you want to...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/06/server-setup-15-optional-extras/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p><em>If this is your first time looking at a post from this series, have a look at this summary: <a href="https://www.sandyscott.net/2020/06/04/server-setup-0-contents/" data-type="666">Server Setup 0: Contents</a></em></p>



<p>Now you&#8217;re up and running with what should be a stable and secure installation of WordPress and Nextcloud with Collabora.</p>



<p>There are plenty more tweaks you can work on yourself:</p>



<h2 class="wp-block-heading">Server Administration</h2>



<ul class="wp-block-list"><li>Advanced HTTPS &#8211; you can check your config with <a href="https://www.ssllabs.com/ssltest/">https://www.ssllabs.com/ssltest/</a>. You have choices about how you want to set up your system &#8211; more secure or more compatible with older clients. <a href="https://ssl-config.mozilla.org/#server=apache">This tool from Mozilla</a>  provides recommendations for the the Apache configuration you need.</li><li>Email configuration &#8211; This allows either system to send emails. Best way to do it us an existing email service, and let your server connect to that. s-nail and exim can both do this.</li><li>You can keep you system automatically up to date with the <code>unattened-upgrades</code> package &#8211; this keeps your system up to date. If email is configure it&#8217;ll send you an summary of what it&#8217;s updated.</li></ul>



<h2 class="wp-block-heading">WordPress:</h2>



<p>WordPress relies on htaccess for a few things, mainly nicely writing urls for permalinks. However, .htaccess files have a problem &#8211; they&#8217;re checked every time someone visits your site. You can reconfigure apache to load the data from the .htaccess file once, instead of on every request.</p>



<p>Be careful, there may be multiple .htaccess files, and some plugins install their own, so use these commands to find them all:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">cd /var/www/wordpress
find | grep htaccess</pre></div>



<h2 class="wp-block-heading">Nextcloud</h2>



<p>A few ideas:</p>



<ul class="wp-block-list"><li>Work your way through the list in administration section &#8211; the links to the documentation will help a lot.</li><li>Background jobs: Try setting up a systemd timer or traditional crontab. Have a look in <strong>Basic Settings</strong> in the <strong>Settings</strong> menu for an Administrator. </li><li>Scan you installation for security issues <a href="https://scan.nextcloud.com/">https://scan.nextcloud.com/</a></li><li>Include .htaccess instead of loading it every time, like for WordPress.</li></ul>



<h2 class="wp-block-heading">User friendliness</h2>



<p>These are a few niceties you might try to help with general use:</p>



<ul class="wp-block-list"><li>Set up passwordless login: <a href="https://linuxize.com/post/how-to-setup-passwordless-ssh-login/">https://linuxize.com/post/how-to-setup-passwordless-ssh-login/</a></li><li>Use <a href="https://github.com/tmux/tmux/wiki">tmux </a>to keep you shell sessions alive.</li></ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/06/server-setup-15-optional-extras/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Server Setup 14: Backups</title>
		<link>https://www.sandyscott.net/2020/06/server-setup-14-backups/</link>
					<comments>https://www.sandyscott.net/2020/06/server-setup-14-backups/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Mon, 01 Jun 2020 17:43:04 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[SpiderOak]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=516</guid>

					<description><![CDATA[There&#8217;s lots of ways you could lose your website &#8211; a hard drive can fail, the server could be damaged by a lightning strike, or even stolen in a burglary. To get back up and running you&#8217;ll need to fix or replace the hardware, but this post is meant to...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/06/server-setup-14-backups/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p><em>If this is your first time looking at a post from this series, have a look at this summary: <a href="https://www.sandyscott.net/2020/06/04/server-setup-0-contents/" data-type="666">Server Setup 0: Contents</a></em></p>



<p>There&#8217;s lots of ways you could lose your website &#8211; a hard drive can fail, the server could be damaged by a lightning strike, or even stolen in a burglary. To get back up and running you&#8217;ll need to fix or replace the hardware, but this post is meant to make sure you have the data you need restore all the applications too.</p>



<h2 class="wp-block-heading">Backup Options</h2>



<p>There are a few ways to approach backups, but the key things are:</p>



<ul class="wp-block-list"><li>What to back up</li><li>Where to back up</li></ul>



<p>I&#8217;ll be focussing on <strong>What</strong>, but will mention a few of your options for <strong>Where</strong> at the end.</p>



<h2 class="wp-block-heading">What to back up</h2>



<h3 class="wp-block-heading">Whole system</h3>



<p>The first thing I should mention is that you might have the option of backing up the whole system in one go. Many systems administrators don&#8217;t install their servers directly onto a computer, they use Virtualisation, which means first you install a special kind of operating system called a hypervisor, whose only job is to create and run virtual machines (VM) &#8211; a computer within the computer. You can then install the OS you really want for your server into one of these virtual machines.</p>



<p>It has many advantages, but I&#8217;ve brought it up now because many hypervisors have the option to create snapshots. This is a complete picture of the installation, so if you need to restore your system, it&#8217;s just a case of loading the most recent snapshot and you&#8217;re back up and running.</p>



<p>However a big disadvantage of this system is performance, especially on older computers with limited resources, which is why I haven&#8217;t done it in this tutorial. Virtualisation is a huge topic, so if it sounds interesting, then go read up on it.</p>



<p>There are also utilites that can clone your entire hard drive, so restoring your system should be a case of of putting that cloned hard drive into new server and starting it up. This approach has it&#8217;s disadvantages too &#8211; the backup will be as big as your hard drive, so your backup location needs a lot of storage space. It also works best if the system is off while the cloning occurs, so you&#8217;ll need to plan some regular downtime to use this backup strategy.</p>



<h3 class="wp-block-heading">Specific Items</h3>



<p>An advantage of backing up specific items is knowledge &#8211; you know what you&#8217;ve got. The tools for managing those pieces are often more common and more widely compatible than those for managing whole system backups.</p>



<p>Our strategy has two steps:</p>



<p></p>



<ul class="wp-block-list"><li>Create and populate a staging directory to hold all of the data we want to back up.</li><li>Actually do the backup to get the data off the server to somewhere else. (Backups stored on the same computer, especially on the same HDD, are a waste of time)</li></ul>



<p>Create the backup staging area:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;sudo Shell&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo mkdir /var/backup_staging
sudo chmod -R go-rwx /var/backup_staging
sudo mkdir /var/backup_staging/scripts</pre></div>



<p>We&#8217;ll write a <strong>Shell</strong> script. You might not realise it, but the shell is the program you&#8217;re interracting with when you are entering commands. This means our script can use the same commands.</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudoedit /var/backup_staging/scripts/backup.sh</pre></div>



<p>Enter the following as the first lists of this file:</p>



<p></p>



<pre class="wp-block-code"><code>#!/bin/sh
# Backup scripts</code></pre>



<p>Like a lot of files we&#8217;ve worked on, the # at the beginning of a line means a comment, so wouldn&#8217;t normally matter. However, in this case, the first line is important to tell the system how to run this file. The second line is a real comment &#8211; a title for our script.</p>



<h3 class="wp-block-heading">General</h3>



<p>You probably what to back up these areas:</p>



<ul class="wp-block-list"><li>We&#8217;ve done a lot of work configuring Apache &#8211; we should definitely save those modifed configuration files: <code>/etc/apache2</code></li><li>Getting new SSL certificates isn&#8217;t too hard, but it doesn&#8217;t hurt to have them if speed things along : <code>/etc/letsencrypt</code></li><li>If you&#8217;re doing other things with this server you might have saved files your home directory: <code>/home/[your username].</code></li></ul>



<p>Create backup directories for these:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo mkdir --parents /var/backup_staging/etc/apache2
sudo mkdir /var/backup_staging/etc/letsencrypt
sudo mkdir --parents /var/backup_staging/home/[your username]</pre></div>



<p>The idea is we&#8217;ll mirror the structure of the filesystem, which means you won&#8217;t get any clashes if you add to this in future. Add these lines our script <code>/var/backup_staging/scripts/backup.sh</code></p>



<pre class="wp-block-code"><code>rsync -Aax --delete /etc/apache2/ /var/backup_staging/etc/apache2/
rsync -Aax --delete /etc/letsencrypt/ /var/backup_staging/etc/letsencrypt
rsync -Aax --delete /home/&#91;your username]/ /var/backup_staging/home/&#91;your username]/</code></pre>



<p>Each of these lines runs the <code>rsync</code> program, which basically copies one folder into another. The options we&#8217;ve selected mean that the backup should be an exact mirror of the original, but it&#8217;ll only move or update the files that have changed. rsync can do a lot more than this, including transferring files to another computer, but you can research that on your own.</p>



<p></p>



<h3 class="wp-block-heading">WordPress</h3>



<p>There are two main pieces to the backup, files and the database.</p>



<h4 class="wp-block-heading">Files</h4>



<ul class="wp-block-list"><li>WordPress uploads folder. Any images you upload to your site are saved in here, and that&#8217;s the only copy. Find it at <code>/var/www/wordpress/wp-content/uploads</code>.</li><li>At the time of writing the entire size of my wordpress folder is only 114 megabytes, including the uploads folder mentioned above. You might as well back up the whole thing. <code>/var/www/wordpress</code>.</li><li>We moved the wordpress configuration into a file outsite the web root, so make sure that&#8217;s backed up: <code>/var/www_config</code>.</li></ul>



<p>Create directories for these:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo mkdir --parents /var/backup_staging/www/wordpres
sudo mkdir /var/backup_staging/www_config</pre></div>



<p>Add add these lines to the script to copy them into the backup staging location.</p>



<pre class="wp-block-code"><code>rsync -Aax --delete /var/www/wordpress /var/backup_staging/var/www/wordpress
rsync -Aax --delete /var/www_config/ /var/backup_staging/var/www_config/
</code></pre>



<p></p>



<h4 class="wp-block-heading">Database</h4>



<p>The database is a critical component of both WordPress and Nextcloud, so we need to back this up, but it takes a little planning.</p>



<p>We&#8217;re going to use mysqldump, which logs into your database server, and saves the whole database (or even multiple databases) in a sql file. The idea is you can just execute this sql file on a database server and the database will be recreated.</p>



<p>The command history is considered insecure, so we don&#8217;t want to put our database password in on the command line. The database credentials go in a separate file:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudoedit /var/backup_staging/scripts/wordpress.cnf</pre></div>



<p>Add this to wordpress.cnf, filling in your database username and password, (with single quote round it in case of special characters)</p>



<pre class="wp-block-code"><code>&#91;mysqldump]
user=wp_usr
password='wordpress_database_password'</code></pre>



<p>And now add this line to your backup script:</p>



<pre class="wp-block-code"><code>mysqldump --defaults-file=/var/backup_temp/scripts/wordpress.cnf --skip-dump-date --add-drop-table sswp > /var/backup_temp/sswp-current.sql
</code></pre>



<p>Explanation:</p>



<ul class="wp-block-list"><li><code>mysqldump </code>is the utility that spits out a sql that&#8217;s a backup of a database.<ul><li><code>--defaults-file</code> tells mysqldump to read the username and password the file we specified</li><li><code>--skip-dump-date</code> means the sql won&#8217;t include the date the dump was done, so if the database hasn&#8217;t changed between dumps, the sql file will be identical</li><li>&#8211;add-drop-table means the recovery can be more reliable, if riskier for the data you have on the system you&#8217;re installing the recovered data on.</li><li>&gt; means the data is written the file specified.</li></ul></li></ul>



<h3 class="wp-block-heading">Nextcloud</h3>



<p>Nextcloud also has files and data that we want to back up. There&#8217;s a greater chance of inconsistencies between the files and database, and it&#8217;s down to you how much care you take over this.</p>



<h4 class="wp-block-heading">Maintenance Mode</h4>



<p>Like we did for WordPress, create a file containing the Nextcloud database login details. I&#8217;d call it <code>/var/backup_staging/scripts/nextcloud.cnf</code>. Use the same format, just with the Nextcloud database details instead of the WordPress ones.</p>



<p>First, we&#8217;ll put Nextcloud into maintenance mode, add this line to your script:</p>



<pre class="wp-block-code"><code>sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on</code></pre>



<p>This runs the occ script, which performs various utility tasks on a Nextcloud installation.</p>



<h4 class="wp-block-heading">Database</h4>



<p>Now we can safely dump the database contents. Add this line to the backup script:.</p>



<pre class="wp-block-code"><code>mysqldump --defaults-file=/var/backup_staging/scripts/nextcloud.cnf --single-transaction --skip-dump-date --add-drop-table nextcloud > /var/backup_staging/nextcloud.sql
</code></pre>



<h4 class="wp-block-heading">Files</h4>



<p>We have a choice here:</p>



<ol class="wp-block-list"><li>Minimum Downtime. Copy the enitire Nextcloud Data folder into the staging folder, then turn off maintenance mode. The downside of this you need twice as much storage space.</li><li>Minimum Storage: Back up the Nextcloud data folder in place, then turn off maintenance mode. Your site will be down for as long as it takes the backup to complete.</li></ol>



<p>Pick an option, and add the relevant lines to the end of your backup script</p>



<p>Option 1:</p>



<pre class="wp-block-code"><code>rsync -Aax --delete /var/www/wordpress /var/backup_staging/var/www/wordpress
rsync -Aax --delete /var/nc_data/ /var/backup_staging/var/nc_data/
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off
# # # # # # # # # # # # # # # # # #
# Placeholder for backup commands
# Back up /var/backup_staging only
# # # # # # # # # # # # # # # # # #</code></pre>



<p>Option 2:</p>



<pre class="wp-block-code"><code>rsync -Aax --delete /var/www/wordpress /var/backup_staging/var/www/wordpress
# # # # # #
# Placeholder for backup commands
# Back up /var/backup_staging and /var/nc_data
# # # # # #
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off</code></pre>



<h2 class="wp-block-heading">Where to back up</h2>



<p>All we&#8217;ve done so far is to stage all the useful data from our websites in a single folder.</p>



<p>We need to get it off your server to different location, preferably serveral locations. A common rule about backups is the 3-2-1 rule:</p>



<ul class="wp-block-list"><li>3 copies of your data</li><li>2 of those copies on different of media</li><li>1 copy is offsite.</li></ul>



<p>The &#8220;2 different media&#8221; rule protects against hard drive failure, and the offsite rule can protect against a whole host of ways to lose your data: physical theft, fire, lightning damage and more.</p>



<p>So how can you do this?</p>



<ul class="wp-block-list"><li>A few portable HDDs can be a simple option &#8211; you&#8217;ll need to remember to plug them in, you may need to configure your backup script to mount it. Keep one at your mum&#8217;s house and swap it out every week or so.</li><li>Another server. If you (or a friend) have another server with plenty of space, you could back up to that. <code>rsync </code>doesn&#8217;t just copy folders on one computer &#8211; it&#8217;s really meant for transfering files to a remote computer over SSH. A sample command might look like this:</li></ul>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">rsync -az /var/backup_staging/ username@remoteserver:/var/remote_backups</pre></div>



<ul class="wp-block-list"><li>For either of these options, consider using software that encrypts the data. <a href="http://duplicity.nongnu.org/">Duplicity</a> works a bit like rsync, but allows for encryption and incremental backups.</li><li>Use a backup service. These companies usually have their own software and servers. Look for encryption and trustworthiness (I would <strong>never</strong> use a free service for something like backup). It&#8217;s also essential that they offer a Linux client with a command line interface so we can add it to our script. I use <a href="https://spideroak.com/">SpiderOak </a> &#8211; there are plenty other others out there, do your research!</li></ul>



<p>Once you&#8217;ve picked your method, replace the placeholder in our backup script with whatever commands you need to make that run.</p>



<h2 class="wp-block-heading">Run it regularly</h2>



<p>Our backup script is great and all, but unless you run it regularly, it&#8217;s pretty pointless. We&#8217;ll use <code>cron </code>to run this script every night (or whenever you want).</p>



<p>Edit the system crontab:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo crontab -e</pre></div>



<p>Add this line to the bottom, then save and exit the file.</p>



<pre class="wp-block-code"><code>  5 2   *   *   *  /bin/sh /var/backup_staging/scripts/backup.sh</code></pre>



<p>The lines at the top of the crontab script tell you how to use it. The 5 and 2 means the command will run at 5 minutes past 2am (02:05 24 hour clock), and the stars means it won&#8217;t consider the other options (day of week, day or month or month) are ignored. <code>/bin/sh</code> is the program that will run our script.</p>



<h2 class="wp-block-heading">Test!</h2>



<p>This is critical &#8211; after you&#8217;ve done your first backup, take a good look at:</p>



<ul class="wp-block-list"><li>Is everything you expected there?</li><li>Nothing is corrupted</li></ul>



<p>IT professionals regularly do &#8220;recovery drills&#8221;. i.e. practice what they&#8217;d do to get IT systems up and running after a distaster, which helps find problems with the backups. Have a go at using your backups to rebuild you site, maybe in a VM on your client computer.</p>



<p>Good luck!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/06/server-setup-14-backups/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Server Setup 13: Security Improvements</title>
		<link>https://www.sandyscott.net/2020/05/server-setup-13-security-improvements/</link>
					<comments>https://www.sandyscott.net/2020/05/server-setup-13-security-improvements/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Mon, 25 May 2020 11:20:15 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=621</guid>

					<description><![CDATA[One recommendation that many security experts make is that the WordPress configuration files should be outside the web root. Lets make this change. WordPress Create a new folder called /var/www_config. Put a new folder in here, wordpress Copy the WordPress configuration file across, and set it&#8217;s permissions so no-one apart...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/05/server-setup-13-security-improvements/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p><em>If this is your first time looking at a post from this series, have a look at this summary: <a href="https://www.sandyscott.net/2020/06/04/server-setup-0-contents/" data-type="666">Server Setup 0: Contents</a></em></p>



<p>One recommendation that many security experts make is that the WordPress configuration files should be outside the web root. Lets make this change.</p>



<h2 class="wp-block-heading">WordPress</h2>



<p>Create a new folder called <code>/var/www_config</code>. Put a new folder in here, <code>wordpress</code></p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">cd /var
sudo mkdir www_config
cd www_config
sudo mkdir wordpress</pre></div>



<p>Copy the WordPress configuration file across, and set it&#8217;s permissions so no-one apart from www-data (and root, of course) can read it:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo cp -a /var/www/wordpress/wp-config.php /var/www_config/wordpress/
sudo chown -R www-data:www-data /var/www_config
sudo chmod -R u=rX,go= /var/www_config</pre></div>



<p>Now we need to tell Apache that the when PHP scripts on the wordpress site run, they can only access the folders we want them to:</p>



<ul class="wp-block-list"><li>/var/www/wordpress : our wordpress installation</li><li>/var/www_config/wordpress : our wordpress config</li><li>/tmp : WordPress needs this for handling plugin upgrades etc.</li></ul>



<p>Modify the wordpress Apache site configuration file and add this line inside the VirtualHost section:</p>



<p><code>php_admin_value open_basedir "/var/www/wordpress/:/var/www_config/wordpress/:/tmp/"</code></p>



<p>Now reload Apache.</p>



<p>Finally, WordPress still needs to be able to find this file, so replace the contents of the original wp_config.php with this:</p>



<pre class="wp-block-code"><code>&lt;?php

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

/** Location of your WordPress configuration. */
require_once('/var/www_config/wordpress/wp-config.php');</code></pre>



<p>It&#8217;ll take effect the moment you save it, so now visit your site from the client, and hopefully nothing has broken!</p>



<h2 class="wp-block-heading">Nextcloud</h2>



<p>For some reason this isn&#8217;t as widely recommended by Nextcloud users. I&#8217;ll investigate and update this post with my suggestion.</p>



<p>For now, just make sure only www-data can read and write the config file:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;sudo cp -a /var/www/wordpress/wp-config.php /var/www_config/wordpress/Shell&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo chown -R www-data:www-data /var/www/nextcloud/config/
sudo chmod -R u=rX,go= /var/www/nextcloud/config/</pre></div>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/05/server-setup-13-security-improvements/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Server Setup 12: Collabora</title>
		<link>https://www.sandyscott.net/2020/05/server-setup-12-collabora/</link>
					<comments>https://www.sandyscott.net/2020/05/server-setup-12-collabora/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Sun, 24 May 2020 18:37:57 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Collabora]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nextcloud]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=612</guid>

					<description><![CDATA[The final of the 3 big pieces &#8211; this provides document editing capability in Nextcloud. Install Collabora There are a couple of ways to install Collabora, and the recommended way is to use a Docker image. That isn&#8217;t ideal for us because the Docker version will use more resources which...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/05/server-setup-12-collabora/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p><em>If this is your first time looking at a post from this series, have a look at this summary: <a href="https://www.sandyscott.net/2020/06/04/server-setup-0-contents/" data-type="666">Server Setup 0: Contents</a></em></p>



<p>The final of the 3 big pieces &#8211; this provides document editing capability in Nextcloud.</p>



<h2 class="wp-block-heading">Install Collabora</h2>



<p>There are a couple of ways to install Collabora, and the recommended way is to use a Docker image. That isn&#8217;t ideal for us because the Docker version will use more resources which we can&#8217;t afford if you&#8217;re running this on something old. Instead, Collabora provide respositories, so these commands will:</p>



<ol class="wp-block-list"><li>Install a little tool me we need</li><li>Get the security keys so the repository is safe to use</li><li>Add the repository to our <code>/etc/apt/sources.list</code>.</li><li>Install Collabora</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo apt install gnupg
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0C54D189F4BA284D
sudo echo 'deb https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-debian10 ./' | sudo tee -a /etc/apt/sources.list
sudo apt update &amp;&amp; sudo apt install loolwsd code-brand</pre></div>



<h2 class="wp-block-heading">Configure Collabora</h2>



<p>Modify <code>/etc/loolwsd/loolwsd.xml</code></p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudoedit /etc/loolwsd/loolwsd.xml</pre></div>



<p>We&#8217;ll disable SSL in collabora itself, because Apache will handle that. Find <code>&lt;ssl desc="SSL settings"&gt;</code>. Look at the line below. Change the second-to last word to <code>false</code>. It should now be this:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;xml&quot;,&quot;mime&quot;:&quot;application/xml&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;XML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;xml&quot;}">&lt;enable type=&quot;bool&quot; desc=&quot;Controls whether SSL encryption between browser and loolwsd is enabled (do not disable for production deployment). If default is false, must first be compiled with SSL support to enable.&quot; default=&quot;true&quot;&gt;false&lt;/enable&gt;</pre></div>



<p>In the line below that, the second-to last word should be <code>true</code>.</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;xml&quot;,&quot;mime&quot;:&quot;application/xml&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;XML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;xml&quot;}">&lt;termination desc=&quot;Connection via proxy where loolwsd acts as working via https, but actually uses http.&quot; type=&quot;bool&quot; default=&quot;true&quot;&gt;true&lt;/termination&gt;</pre></div>



<p>Now find <code>&lt;wopi desc="Allow/de.....</code> Add a line below it, swapping in your <strong>Nextcloud</strong> domain name, with the dots <code>"."</code> escaped with backslashes <code>"\."</code>.</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">&lt;host desc=&quot;Regex pattern of hostname to allow or deny.&quot; allow=&quot;true&quot;&gt;nextcloud\.example\.org&lt;/host&gt;</pre></div>



<p>Save and close the file, then restart Collabora</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&lt;code&gt;sudo systemctl restart loolwsd&lt;/code&gt;Shell&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo systemctl restart loolwsd</pre></div>



<h2 class="wp-block-heading">Test</h2>



<p>There isn&#8217;t a whole lot of testing we can do on Collabora as an intermediate step, but this will at least confirm the server is running. This command asks Collabora for a file saying what it&#8217;s capable of:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">cd ~
wget http://localhost:9980/hosting/capabilities</pre></div>



<p>If it seems to run OK, you should now have a file called <code>capabilites </code>in your home (~) directory. Lets look at what&#8217;s inside:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;cShell&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">cat ~/capabilities</pre></div>



<pre class="wp-block-code"><code>{"convert-to":{"available":true},"hasMobileSupport":true,"hasTemplateSaveAs":false,"hasTemplateSource":true,"productName":"Collabora Online Development Edition"}</code></pre>



<p>Looking good!</p>



<h2 class="wp-block-heading">Configure Apache</h2>



<p>In this situation, all Apache has to do is act as a proxy between Collabora and the internet &#8211; we can&#8217;t connect it directly because otherwise the other sites (WordPress and Nextcloud) wouldn&#8217;t work.</p>



<p>Enable these 3 modules:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo a2enmod proxy proxy_http proxy_wstunnel</pre></div>



<p>Edit the main Collabora SSL Apache configuration file:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudoedit /etc/apache2/sites-available/collabora-le-ssl.conf</pre></div>



<p>Change it to this:</p>



<pre class="wp-block-code"><code>&lt;VirtualHost *:443&gt;
    ServerName collabora.example.org
    ErrorLog ${APACHE_LOG_DIR}/collabora_error.log
    CustomLog ${APACHE_LOG_DIR}/collabora_access.log combined

    SSLCertificateFile /etc/letsencrypt/live/collabora.example.org/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/collabora.example.org/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
	# Encoded slashes need to be allowed
	AllowEncodedSlashes NoDecode

	# Container uses a unique non-signed certificate
	SSLProxyEngine On
	SSLProxyVerify None
	SSLProxyCheckPeerCN Off
	SSLProxyCheckPeerName Off

	# keep the host
	ProxyPreserveHost On

	# static html, js, images, etc. served from loolwsd
	# loleaflet is the client part of Collabora Online
	ProxyPass           /loleaflet http://127.0.0.1:9980/loleaflet retry=0
	ProxyPassReverse    /loleaflet http://127.0.0.1:9980/loleaflet

	# WOPI discovery URL
	ProxyPass           /hosting/discovery http://127.0.0.1:9980/hosting/discovery retry=0
	ProxyPassReverse    /hosting/discovery http://127.0.0.1:9980/hosting/discovery

	# Capabilities
	ProxyPass           /hosting/capabilities http://127.0.0.1:9980/hosting/capabilities retry=0
	ProxyPassReverse    /hosting/capabilities http://127.0.0.1:9980/hosting/capabilities

&lt;/VirtualHost&gt;</code></pre>



<p>Basically, the bits we&#8217;ve added are a two-way connector between Apache and Collabora, and it needs slightly different things for all of the different features.</p>



<p>Reload Apache.</p>



<p>Configure Nextcloud</p>



<ol class="wp-block-list"><li>Log into Nextcloud with your admin account.</li><li>Click on the circle with your initial in the top right corner, choose Apps.</li><li>Click on <strong>Office &amp; text</strong> from the menu on the left.</li><li>Find Collabora Online and click <strong>Download and enable</strong><br></li></ol>



<figure class="wp-block-image size-large"><a href="https://www.sandyscott.net/wp-content/uploads/2020/05/image-44.png"><img fetchpriority="high" decoding="async" width="358" height="297" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image-44.png" alt="" class="wp-image-616" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image-44.png 358w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-44-300x249.png 300w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-44-150x124.png 150w" sizes="(max-width: 358px) 100vw, 358px" /></a></figure>



<ol class="wp-block-list" start="5"><li>Click on the circle with your initial in the top right corner, choose Settings.</li><li>Click on Collabora Online near the bottom of the menu on the left.</li><li>Choose <strong>Use your own server</strong></li><li>Enter your Collabora domain name with the https:// and then hit save.</li></ol>



<figure class="wp-block-image size-medium"><a href="https://www.sandyscott.net/wp-content/uploads/2020/05/image-45.png"><img decoding="async" width="300" height="171" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image-45-300x171.png" alt="" class="wp-image-617" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image-45-300x171.png 300w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-45-150x85.png 150w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-45.png 750w" sizes="(max-width: 300px) 100vw, 300px" /></a></figure>



<p>Now go back to the files section and give it a try!</p>



<ul class="wp-block-list"><li>You should have the option to create a <strong>New Document</strong>, <strong>New Spreadsheet</strong> or <strong>New Presentation</strong> from the &#8220;+&#8221; icon.</li></ul>



<figure class="wp-block-image size-medium"><a href="https://www.sandyscott.net/wp-content/uploads/2020/05/image-46.png"><img decoding="async" width="209" height="300" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image-46-209x300.png" alt="" class="wp-image-618" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image-46-209x300.png 209w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-46-104x150.png 104w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-46.png 236w" sizes="(max-width: 209px) 100vw, 209px" /></a></figure>



<ul class="wp-block-list"><li>Or if you have any files on Open Document (.odt, .ods, .odp) or Open Office XML (.docx, .xlsx, .pptx) formats you can try opening them. They should open for editing in Collabora:</li></ul>



<figure class="wp-block-image size-large is-resized"><a href="https://www.sandyscott.net/wp-content/uploads/2020/05/image-47.png"><img loading="lazy" decoding="async" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image-47.png" alt="" class="wp-image-619" width="299" height="195" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image-47.png 598w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-47-300x196.png 300w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-47-150x98.png 150w" sizes="(max-width: 299px) 100vw, 299px" /></a></figure>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/05/server-setup-12-collabora/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Server Setup 11: Config Improvements</title>
		<link>https://www.sandyscott.net/2020/05/server-setup-11-config-improvements/</link>
					<comments>https://www.sandyscott.net/2020/05/server-setup-11-config-improvements/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Fri, 22 May 2020 17:08:31 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nextcloud]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=582</guid>

					<description><![CDATA[Before enabling public access to Nextcloud, lets take a moment to improve things a little. Apache Config First up, let&#8217;s force the use of the HTTPS and make sure we haven&#8217;t left any security holes by stripping back the HTTP config file to it&#8217;s bare bones. The default Apache configuration...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/05/server-setup-11-config-improvements/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p><em>If this is your first time looking at a post from this series, have a look at this summary: <a href="https://www.sandyscott.net/2020/06/04/server-setup-0-contents/" data-type="666">Server Setup 0: Contents</a></em></p>



<p>Before enabling public access to Nextcloud, lets take a moment to improve things a little.</p>



<h2 class="wp-block-heading">Apache Config</h2>



<p>First up, let&#8217;s force the use of the HTTPS and make sure we haven&#8217;t left any security holes by stripping back the HTTP config file to it&#8217;s bare bones.</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;sudoedit /etc/apache2/sites-available/nextcloud.confShell&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudoedit /etc/apache2/sites-available/nextcloud.conf</pre></div>



<pre class="wp-block-code"><code>&lt;VirtualHost *:80>
	ServerName nextcloud.example.org
	Redirect permanent / https://nextcloud.example.org/
&lt;/VirtualHost></code></pre>



<p>The default Apache configuration gives access to a little too much &#8211; we can lock that down, and just open up the bits we want later with the site-specific configuration files.</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudoedit /etc/apache2/apache2.conf</pre></div>



<p>Look for this section and put a <code>#</code> at the beginning of every line so they&#8217;re ignored.</p>



<pre class="wp-block-code"><code>&lt;Directory /usr/share>
	AllowOverride None
	Require all granted
&lt;/Directory>

&lt;Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride None
	Require all granted
&lt;/Directory></code></pre>



<p>Now we have to give access back just where want it:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudoedit /etc/apache2/sites-available/nextcloud-le-ssl.conf</pre></div>



<p>Before the <code>ErrorLog </code>line, add this:</p>



<pre class="wp-block-code"><code>&lt;Directory /var/www/nextcloud>
    Require all granted
&lt;/Directory></code></pre>



<p>Then do the same for the WordPress config:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudoedit /etc/apache2/sites-available/wordpress-le-ssl.conf	</pre></div>



<p>Before the <code>ErrorLog </code>line, add this:</p>



<pre class="wp-block-code"><code>&lt;Directory /var/www/wordpress>
    Require all granted
&lt;/Directory></code></pre>



<p>Restart Apache (you should know how to do that by now &#8211; look back through the previous posts until you find it.)</p>



<h2 class="wp-block-heading">Nextcloud Administration Warnings</h2>



<p>Log into your nextcloud administrator account, click on the circle with your initial in the top right corner, choose setttings. On the page that pops up, pick Overview from the menu on the right.</p>



<p>The system will think for a moment, then show a list of warnings:</p>



<figure class="wp-block-image size-medium"><a href="https://www.sandyscott.net/wp-content/uploads/2020/05/image-43.png"><img loading="lazy" decoding="async" width="300" height="279" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image-43-300x279.png" alt="" class="wp-image-599" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image-43-300x279.png 300w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-43-1024x954.png 1024w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-43-768x715.png 768w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-43-150x140.png 150w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-43.png 1035w" sizes="(max-width: 300px) 100vw, 300px" /></a></figure>



<p>If your list is the same as mine, I&#8217;ll show you how to fix the first 2, but you can work through the others on your own if you like.</p>



<h2 class="wp-block-heading">PHP Memory Limit</h2>



<p><strong><em>&#8220;The PHP memory limit is below the recommended value of 512MB.&#8221;</em></strong></p>



<p>It isn&#8217;t essential to fix this, and if you&#8217;re running nextcloud on an old, lower powered machine I wouldn&#8217;t recommend it, because that&#8217;s the limit per script, and a script fires up every time someone access your site, so with a few users doing heavy things, you&#8217;ll have a problem.</p>



<p>If you do want to do it, edit the PHP configuration file:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudoedit /etc/php/7.3/apache2/php.ini</pre></div>



<p>Find this line and change the number to what you want:</p>



<pre class="wp-block-code"><code>memory_limit = 512M</code></pre>



<p>Then restart Apache</p>



<h2 class="wp-block-heading">Enable HSTS</h2>



<p><strong><em>&#8220;The &#8220;Strict-Transport-Security&#8221; HTTP header is not set to at least &#8220;15552000&#8221; seconds. For enhanced security, it is recommended to enable HSTS as described in the <a href="https://docs.nextcloud.com/server/18/go.php?to=admin-security">security tips <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2197.png" alt="↗" class="wp-smiley" style="height: 1em; max-height: 1em;" /></a>.&#8221;</em></strong></p>



<p>You can follow that link in the tip to find out the details of how we fix this, but these are the steps:</p>



<p>Enable the Apache headers module:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo a2enmod headers</pre></div>



<p>Modify the Nextcloud apache configuration:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudoedit /etc/apache2/sites-available/nextcloud-le-ssl.conf</pre></div>



<p>Add this after the ServerName line:</p>



<pre class="wp-block-code"><code>Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"</code></pre>



<p>And reload Apache</p>



<h2 class="wp-block-heading">Re-enable public access</h2>



<p>Now we&#8217;ve dealt with a few potential security issues, you can enable access to Nextcloud from outside you network.</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;sudShell&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudoedit /etc/apache2/sites-available/nextcloud-le-ssl.conf</pre></div>



<p>Either delete, or comment out these 3 lines. You can make a line into a comment by putting a # at the beginning of the line. That means it will be ignored.</p>



<pre class="wp-block-code"><code>&lt;Location />
    Require ip xxx.xxx.xxx.0/24
&lt;/Location></code></pre>



<p>Reload apache and you&#8217;re done!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/05/server-setup-11-config-improvements/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Server Setup 10: Nextcloud Installation</title>
		<link>https://www.sandyscott.net/2020/05/server-setup-10-nextcloud-installation/</link>
					<comments>https://www.sandyscott.net/2020/05/server-setup-10-nextcloud-installation/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Thu, 21 May 2020 21:44:43 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MariaDB]]></category>
		<category><![CDATA[Nextcloud]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=575</guid>

					<description><![CDATA[Database Again, same as for WordPress, we need a database and a user. Same command to login as the root database server user: a similar set of SQL commands to set up the nextcloud database: Disable Public Access &#8211; a different way Like before, we don&#8217;t want the Nextclound site...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/05/server-setup-10-nextcloud-installation/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p><em>If this is your first time looking at a post from this series, have a look at this summary: <a href="https://www.sandyscott.net/2020/06/04/server-setup-0-contents/" data-type="666">Server Setup 0: Contents</a></em></p>



<h2 class="wp-block-heading">Database</h2>



<p>Again, same as for WordPress, we need a database and a user. Same command to login as the root database server user:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo mysql -u root -p</pre></div>



<p>a similar set of SQL commands to set up the nextcloud database:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">CREATE USER 'nc_usr'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE IF NOT EXISTS nc_db CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES on nc_db.* to 'nc_usr'@'localhost';
FLUSH privileges;
EXIT;</pre></div>



<h2 class="wp-block-heading">Disable Public Access &#8211; a different way</h2>



<p>Like before, we don&#8217;t want the Nextclound site to be public until we&#8217;ve completed the installation &amp; configuration. On the other hand, we don&#8217;t want to do the same as before (cutting our server off from the internet by turning off port forwarding on the router) because we have an active WordPress installation that people might be using.</p>



<p>To do this we&#8217;ll tell Apache to only respond to requests (for the Nextcloud site) from your internal network, not from the public internet:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;sudShell&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudoedit /etc/apache2/sites-available/nextcloud.conf</pre></div>



<p>Add this section, just before the <code>ErrorLog</code> line, replacing the xxx.xxx.xxx with the first 3 blocks of your IP address on your network.</p>



<pre class="wp-block-code"><code>&lt;Location />
    Require ip xxx.xxx.xxx.0/24
&lt;/Location></code></pre>



<p>Reload apache:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;suShell&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo systemctl reload apache</pre></div>



<h2 class="wp-block-heading">Download the installer script</h2>



<p>Navigate to the nextcloud folder</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">cd /var/www/nextcloud</pre></div>



<p>Download the installer script, and pass ownership of it and the entire nextcloud folder to www-data (which is apache, remember).</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo wget https://download.nextcloud.com/server/installer/setup-nextcloud.php
sudo chown -R www-data:www-data /var/www/nextcloud</pre></div>



<p>We should also create a data folder outside the <code>/var/www</code> folder, which improves security:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo mkdir /var/nc_data
sudo chown -R www-data:www-data /var/nc_data</pre></div>



<h2 class="wp-block-heading">Run Installation Script</h2>



<p>On the client machine, open a browser and go to <a href="http://nextcloud.example.org/setup-nextcloud.php">nextcloud.example.org/setup-nextcloud.php</a></p>



<p>You should see the Setup Wizard, most it should be easy to understand, click your way through:</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="797" height="624" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image-34.png" alt="" class="wp-image-566" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image-34.png 797w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-34-300x235.png 300w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-34-768x601.png 768w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-34-150x117.png 150w" sizes="(max-width: 797px) 100vw, 797px" /></figure>



<p>Put a &#8220;.&#8221; in the box like it says because the Nextcloud installer is already in the correct place</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="364" height="444" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image-35.png" alt="" class="wp-image-569" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image-35.png 364w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-35-246x300.png 246w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-35-123x150.png 123w" sizes="(max-width: 364px) 100vw, 364px" /></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="362" height="356" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image-36.png" alt="" class="wp-image-570" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image-36.png 362w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-36-300x295.png 300w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-36-150x148.png 150w" sizes="(max-width: 362px) 100vw, 362px" /></figure>



<ul class="wp-block-list"><li>Enter the details for the database and database user you created above.</li><li>Make an admin account with a strong password.</li><li>Change the data folder to the one we just created:<code> /var/nc_data</code>,</li><li>I&#8217;d recommend unticking the <strong>Install recommended apps</strong> box. You can add them later if you like.</li></ul>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="315" height="1024" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image-42-315x1024.png" alt="" class="wp-image-596" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image-42-315x1024.png 315w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-42-92x300.png 92w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-42-46x150.png 46w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-42.png 368w" sizes="(max-width: 315px) 100vw, 315px" /></figure>



<p>Once this is done you should be able to log in and start using it!</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/05/server-setup-10-nextcloud-installation/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Server Setup 9: Nextcloud Prep</title>
		<link>https://www.sandyscott.net/2020/05/server-setup-9-nextcloud-prep/</link>
					<comments>https://www.sandyscott.net/2020/05/server-setup-9-nextcloud-prep/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Thu, 21 May 2020 21:22:16 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[certbot]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nextcloud]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=564</guid>

					<description><![CDATA[First, we need 1 extra PHP module: Like with WordPress, we&#8217;ll create a folder and apache configuration for Nextcloud: And we&#8217;ll use essentially the same apache configuration we used for wordpress, with a few tweaks. We&#8217;ll also create a temporary configuration for collabora while we&#8217;re here: This is just a...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/05/server-setup-9-nextcloud-prep/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p><em>If this is your first time looking at a post from this series, have a look at this summary: <a href="https://www.sandyscott.net/2020/06/04/server-setup-0-contents/" data-type="666">Server Setup 0: Contents</a></em></p>



<p>First, we need 1 extra PHP module:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;sudShell&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo apt install php-gd</pre></div>



<p>Like with WordPress, we&#8217;ll create a folder and apache configuration for Nextcloud:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">cd /var/www
sudo mkdir nextcloud
sudoedit /etc/apache2/sites-available/nextcloud.conf</pre></div>



<p>And we&#8217;ll use essentially the same apache configuration we used for wordpress, with a few tweaks.</p>



<pre class="wp-block-code"><code>&lt;VirtualHost *:80>
    ServerName nextcloud.example.org
    DocumentRoot /var/www/nextcloud
    
    &lt;Directory /var/www/nextcloud/>
        Require all granted
        AllowOverride All
        Options FollowSymLinks MultiViews

        &lt;IfModule mod_dav.c>
            Dav off
        &lt;/IfModule>
    &lt;/Directory>

    ErrorLog ${APACHE_LOG_DIR}/nextcloud_error.log
    CustomLog ${APACHE_LOG_DIR}/nextcloud_access.log combined
&lt;/VirtualHost></code></pre>



<p>We&#8217;ll also create a temporary configuration for collabora while we&#8217;re here:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudoedit /etc/apache2/sites-available/collabora.conf</pre></div>



<pre class="wp-block-code"><code>&lt;VirtualHost *:80>
    ServerName collabora.example.org
    ErrorLog ${APACHE_LOG_DIR}/collabora_error.log
    CustomLog ${APACHE_LOG_DIR}/collabora_access.log combined
&lt;/VirtualHost></code></pre>



<p>This is just a barebones template that&#8217;s just enough to let us set up HTTPS later.</p>



<p>Enable the sites and reload apache:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo a2ensite nextcloud collabora
sudo systemctl reload apache2</pre></div>



<h2 class="wp-block-heading">DNS</h2>



<p>We need to create DNS Entries for Nextcloud and Collabora:</p>



<ol class="wp-block-list"><li>Log into the control panel for your domain.</li><li>Create a <strong>CNAME </strong>record<ul><li>Domain: e.g. <strong>nextcloud.example.org</strong></li><li>Data: e.g. <strong>example.org</strong> if you had a fixed IP, or the dynamic DNS server address you created e.g. <strong><strong>anotherexample.ddns.net</strong></strong></li></ul></li><li>Do the exact same for <strong>collabora.example.org</strong></li></ol>



<h2 class="wp-block-heading">HTTPS</h2>



<p>Use certbot again to enable https on both <strong>nextcloud.example.org</strong> and <strong>collabora.example.org</strong></p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo certbot --apache</pre></div>



<p>When it asks you which sites you want to activate HTTPS for, you can select multiple options by putting a comma separated list. You can also choose to allow certbot to automatically reconfigure apache to <strong>Redirect</strong> (option 2 when it asks you).</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/05/server-setup-9-nextcloud-prep/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Server Setup 6: WordPress Pre-requisites</title>
		<link>https://www.sandyscott.net/2020/05/server-setup-4-wordpress-pre-requisites/</link>
					<comments>https://www.sandyscott.net/2020/05/server-setup-4-wordpress-pre-requisites/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Thu, 21 May 2020 14:13:22 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=484</guid>

					<description><![CDATA[WordPress is a very flexible platform, but there are a few key pieces that are essential for it to run: A websever We installed Apache in an earlier post so that&#8217;s covered, though we will need some extra modules. PHP This is the programming language WordPress is built in and...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/05/server-setup-4-wordpress-pre-requisites/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p><em>If this is your first time looking at a post from this series, have a look at this summary: <a href="https://www.sandyscott.net/2020/06/04/server-setup-0-contents/" data-type="666">Server Setup 0: Contents</a></em></p>



<p>WordPress is a very flexible platform, but there are a few key pieces that are essential for it to run:</p>



<ul class="wp-block-list"><li>A websever<ul><li>We installed Apache in an earlier post so that&#8217;s covered, though we will need some extra modules.</li></ul></li><li>PHP<ul><li>This is the programming language WordPress is built in and runs on, so our server needs to have it installed.</li></ul></li><li>A Database<ul><li>We&#8217;ll install MariaDB, which is powerful &amp; popular solution.</li></ul></li></ul>



<p>The full details are on the WordPress website, and we&#8217;ll refer back to this for the specifics in a bit: <a href="https://make.wordpress.org/hosting/handbook/handbook/server-environment/">https://make.wordpress.org/hosting/handbook/handbook/server-environment/</a></p>



<p>First, lets install PHP</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo apt install php</pre></div>



<p>It&#8217;s worth paying some attention to what apt is actually doing at his point:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sandy@waldorf:/var/www/test$ sudo apt install php
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libapache2-mod-php7.3 libsodium23 php-common php7.3 php7.3-cli php7.3-common php7.3-json
  php7.3-opcache php7.3-readline psmisc
Suggested packages:
  php-pear
The following NEW packages will be installed:
  libapache2-mod-php7.3 libsodium23 php php-common php7.3 php7.3-cli php7.3-common php7.3-json
  php7.3-opcache php7.3-readline psmisc
0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,377 kB of archives.
After this operation, 17.7 MB of additional disk space will be used.
Do you want to continue? [Y/n]
</pre></div>



<p>In the list of packages that will be installed, <code>php7.3</code> has been selected. This is the current stable version of PHP, and is the default in Debian 10. Also, <code>libapache2-mod-php7.3</code> will be installed &#8211; this is the Apache module that lets it run php code when to create the web pages you see.</p>



<p>We can test this with the <code>phpinfo();</code> function, which does a similar thing to the http://test.example.org/server-info page we created in the previous post.</p>



<p>Create a file called phpinfo.php in the folder for the test website:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudoedit /var/www/test/phpinfo.php</pre></div>



<p>Type in this line:</p>



<pre class="wp-block-code"><code>&lt;?php phpinfo(); ?></code></pre>



<p>Now visit <a href="http://test.example.org/phpinfo.php">http://test.example.org/phpinfo.php</a>. You should get a long page full of information that looks like this:</p>



<figure class="wp-block-image size-full is-resized"><a href="https://www.sandyscott.net/wp-content/uploads/2020/05/image-19.png"><img loading="lazy" decoding="async" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image-19.png" alt="" class="wp-image-485" width="521" height="246" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image-19.png 1041w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-19-300x141.png 300w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-19-1024x483.png 1024w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-19-768x362.png 768w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-19-150x71.png 150w" sizes="(max-width: 521px) 100vw, 521px" /></a></figure>



<p>All of the headings on this page after <strong>HTTP Headers Information</strong> and before <strong>Additional Modules</strong> are the modules that PHP has loaded and can be used by php webpages on your server.</p>



<p>If we compare that list of modules, to the list of extensions required by WordPress, we might find some gaps. This is the list from my server:</p>



<figure class="wp-block-table php-wp-modulecompattable"><table class="has-fixed-layout"> <thead> <tr> <th>Required by WordPress</th> <th>Installed on myserver</th> </tr> </thead> <tbody> <tr class="php-wp-module-notrequired"> <td> </td> <td>calendar</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>Core</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>ctype</td> </tr> <tr class="php-wp-module-requiredbutmissing"> <td>curl</td> <td></td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>date</td> </tr> <tr class="php-wp-module-requiredbutmissing"> <td>dom</td> <td></td> </tr> <tr class="php-wp-module-requiredandpresent"> <td>exif</td> <td>exif</td> </tr> <tr class="php-wp-module-requiredandpresent"> <td>fileinfo</td> <td>fileinfo</td> </tr> <tr class="php-wp-module-notrequired"> <td></td> <td>filter</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>ftp</td> </tr> <tr> <td></td> <td></td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>gettext</td> </tr> <tr class="php-wp-module-requiredandpresent"> <td>hash</td> <td>hash</td> </tr> <tr class="php-wp-module-notrequired"> <td></td> <td>iconv</td> </tr> <tr class="php-wp-module-requiredbutmissing"> <td>imagick</td> <td></td> </tr> <tr class="php-wp-module-requiredandpresent"> <td>json</td> <td>json</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>libxml</td> </tr> <tr class="php-wp-module-requiredbutmissing"> <td>mbstring</td> <td></td> </tr> <tr class="php-wp-module-requiredbutmissing"> <td>mysqli</td> <td></td> </tr> <tr class="php-wp-module-requiredandpresent"> <td>openssl</td> <td>openssl</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>pcntl</td> </tr> <tr class="php-wp-module-requiredandpresent"> <td>pcre</td> <td>pcre</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>PDO</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>Phar</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>posix</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>readline</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>Reflection</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>session</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>shmop</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>sockets</td> </tr> <tr class="php-wp-module-requiredandpresent"> <td>libsodium* (the documentation is slightly out of date, sodium replaces libsodium)</td> <td>sodium</td> </tr> <tr class="php-wp-module-notrequired"> <td></td> <td>SPL</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>standard</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>sysvmsg</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>sysvsem</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>sysvshm</td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>tokenizer</td> </tr> <tr class="php-wp-module-requiredbutmissing"> <td>xml</td> <td></td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>Zend OPcache</td> </tr> <tr class="php-wp-module-requiredbutmissing"> <td>zip</td> <td></td> </tr> <tr class="php-wp-module-notrequired"> <td> </td> <td>zlib</td> </tr> </tbody> </table> </figure>



<p>So the missing ones are:</p>



<ul class="wp-block-list"><li>curl</li><li>dom</li><li>imagick</li><li>mbstring</li><li>mysqli</li><li>xml</li><li>zip</li></ul>



<p>So we&#8217;ll install them. The package names take the form of <code>php-</code> or <code>php7.3-</code>  and then the module name. The <code>dom</code> module is provided within the <code>php-xml</code> package. <code>mysqli </code>is in <code>php-mysql</code>.</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo apt install php-curl php-imagick php7.3-mbstring php-mysql php-xml php-zip</pre></div>



<p>For some reason, some of these need to be enabled manually,  the others just work.</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo phpenmod -s apache2 curl mbstring mysqli</pre></div>



<p>Restart the webserver:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo systemctl restart apache2</pre></div>



<h2 class="wp-block-heading">Database</h2>



<p>The Database holds all of the live content in your wordpress blog, like the posts and comments. It also has all of the user information.</p>



<p>We&#8217;ll install mariadb</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo apt install mariadb-server</pre></div>



<p>Now we&#8217;ll use a ready-made script to set basic security options. You&#8217;ll need to create a strong password for root user for the database server (not the same as the root user of the system).</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo mysql_secure_installation</pre></div>



<p>Say yes to all of the options, entering the database server root password when prompted.</p>



<p>Now create the actual worpress database in the database server. Start by logging into the database with the mysql command line client, and enter the password when prompted.</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo mysql -u root -p</pre></div>



<pre class="wp-block-code"><code>sandy@waldorf:/etc/php/7.3/apache2$ sudo mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 57
Server version: 10.3.22-MariaDB-0+deb10u1 Debian 10

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB &#91;(none)]></code></pre>



<p>You&#8217;re now logged into a special command line that&#8217;s just for working on the database server. This command creates the database &#8211; the name could be anything &#8211; just remember it for later. I&#8217;ve called mine <code>wp_db</code>.</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text/x-sql&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}">CREATE DATABASE wp_db;</pre></div>



<p>Then next command creates the user that WordPress will use to access this database. It also sets their password and gives them access to the database. Fill in your own values for <code>wp_db</code>, <code>wp_usr </code>and <code>password</code>.</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text/x-sql&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}">GRANT ALL PRIVILEGES ON wp_db.* TO &quot;wp_usr&quot;@&quot;localhost&quot; IDENTIFIED BY &quot;password&quot;;</pre></div>



<p>Now force the database to reload that user information and exit:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text/x-sql&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}">FLUSH PRIVILEGES;
EXIT</pre></div>



<p>This is what the whole interraction looks like on my system:</p>



<pre class="wp-block-code"><code>sandy@waldorf:/etc/php/7.3/apache2$ sudo mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 57
Server version: 10.3.22-MariaDB-0+deb10u1 Debian 10

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB &#91;(none)]> CREATE DATABASE wp_db;
Query OK, 1 row affected (0.001 sec)

MariaDB &#91;(none)]> GRANT ALL PRIVILEGES ON wp_db.* TO "wp_usr"@"localhost" IDENTIFIED BY "password";
Query OK, 0 rows affected (0.001 sec)

MariaDB &#91;(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

MariaDB &#91;(none)]> EXIT
Bye</code></pre>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/05/server-setup-4-wordpress-pre-requisites/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
