<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>http://vwiki.co.uk/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sstrutt</id>
	<title>vwiki - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="http://vwiki.co.uk/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sstrutt"/>
	<link rel="alternate" type="text/html" href="http://vwiki.co.uk/Special:Contributions/Sstrutt"/>
	<updated>2026-06-03T17:55:10Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Regex_Examples&amp;diff=2755</id>
		<title>Regex Examples</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Regex_Examples&amp;diff=2755"/>
		<updated>2024-09-27T13:55:18Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Useful/Standard RegEx */ Added CIDR&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See the [[Regular Expressions]] page for more detail on syntax.&lt;br /&gt;
&lt;br /&gt;
== Useful/Standard RegEx ==&lt;br /&gt;
{|class=&amp;quot;vwikitable&amp;quot; &lt;br /&gt;
|- &lt;br /&gt;
! Matches                  !!  Expression&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;IPv4 Address&#039;&#039;&#039;&lt;br /&gt;
| &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; \b((25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)\.){3}(25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)\b &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;IPv4 Address&#039;&#039;&#039; alternative&lt;br /&gt;
| &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; \b(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\b &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;IPv4 CIDR Address&#039;&#039;&#039;&lt;br /&gt;
| &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; \b(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/([1-9]|1[0-9]|2[0-9]|3[1-2])\b &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Hostname&#039;&#039;&#039; (no domain)&lt;br /&gt;
| &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; \A(\w|-)+ &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Email address&#039;&#039;&#039;&lt;br /&gt;
| &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Multiple whitespace&#039;&#039;&#039;&lt;br /&gt;
| &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; \b {2,}\b &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Detailed Examples ==&lt;br /&gt;
=== Logfile Name ===&lt;br /&gt;
&#039;&#039;&#039; &amp;lt;code&amp;gt; \d{4}-[A-Za-z]{3}-Week\d{1}.log &amp;lt;/code&amp;gt; &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Example matches...&lt;br /&gt;
* &amp;lt;code&amp;gt; 2010-Feb-Week4.log &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; 2009-Dec-Week2.log &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; 1234-aBc-Week0.log &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Between Parentheses ===&lt;br /&gt;
&#039;&#039;&#039; &amp;lt;code&amp;gt; (?&amp;lt;=\[)(.*?)(?=\]) &amp;lt;/code&amp;gt; &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Matches everything between &amp;lt;code&amp;gt; [ &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; ]&amp;lt;/code&amp;gt;, so for example...&lt;br /&gt;
* &amp;lt;code&amp;gt; VMFS_SCSI_DS_01 &amp;lt;/code&amp;gt; is matched from &amp;lt;code&amp;gt; [VMFS_SCSI_DS_01] My_VM/MyVM.vmdk &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Its essentially done via three chunks of the regex...&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; (?&amp;lt;=\[) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Requires that &amp;lt;code&amp;gt; [ &amp;lt;/code&amp;gt; immediately proceeds the match&lt;br /&gt;
# &amp;lt;code&amp;gt; (.*?) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* Matches everything&lt;br /&gt;
# &amp;lt;code&amp;gt; (?=\]) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* Requires that &amp;lt;code&amp;gt; ] &amp;lt;/code&amp;gt; immediately follows the match&lt;br /&gt;
&lt;br /&gt;
=== VMHBA LUN ID ===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;code&amp;gt; (?&amp;lt;=:)([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finds a number between 0 and 255 immediately after a &amp;lt;code&amp;gt;:&amp;lt;/code&amp;gt; at the end of a line, specifically intended to get the LUN ID from a VMware canonical path, so for example...&lt;br /&gt;
* &amp;lt;code&amp;gt;13&amp;lt;/code&amp;gt; is matched from &amp;lt;code&amp;gt;vmhba3:0:13&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Stepping through the regex...&lt;br /&gt;
# &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; (?&amp;lt;=:) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Requires that &amp;lt;code&amp;gt; : &amp;lt;/code&amp;gt; immediately proceeds the match&lt;br /&gt;
# &amp;lt;code&amp;gt;([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Matches any number between 0 and 255&lt;br /&gt;
# &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Ensures that the proceeding match occurs at the end of a line&lt;br /&gt;
&lt;br /&gt;
=== vRanger Backup text in VM Notes ===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;code&amp;gt;\s?\bvRanger.*Repository \[.*\]\s?&amp;lt;/code&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Finds the text created by vRanger in a VM&#039;s notes (so you can strip it out)...&lt;br /&gt;
* EG &amp;lt;code&amp;gt;vRanger Pro Backup: Type [Full] Result [Success] Time [27/09/2010 06:46:54] Repository [VC_Server]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Stepping through the regex...&lt;br /&gt;
# &amp;lt;code&amp;gt;\s?&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Matches any white-space at the start of the match&lt;br /&gt;
# &amp;lt;code&amp;gt;\bvRanger.*&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Matches &amp;lt;code&amp;gt;vRanger&amp;lt;/code&amp;gt; at the start of a word and anything after until...&lt;br /&gt;
# &amp;lt;code&amp;gt;Repository \[.*\]&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Matches the end of a vRanger text segment, &amp;lt;code&amp;gt;Repository [hostname]&amp;lt;/code&amp;gt;&lt;br /&gt;
# &amp;lt;code&amp;gt;\s?&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Matches any white-space at the end of the match&lt;br /&gt;
&lt;br /&gt;
=== Script Version ===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;code&amp;gt;(?&amp;lt;=v)[0-9]+(\.[0-9]+)+(?=.)&amp;lt;/code&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Gets the script version number off the end of a script name&lt;br /&gt;
* EG Get &amp;lt;code&amp;gt; 1.2.3 &amp;lt;/code&amp;gt; from &amp;lt;code&amp;gt;Script-v1.2.3.ps1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Stepping through the regex...&lt;br /&gt;
# &amp;lt;code&amp;gt;(?&amp;lt;=v)&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Requires that &amp;lt;code&amp;gt;v&amp;lt;/code&amp;gt; immediately precedes the match&lt;br /&gt;
# &amp;lt;code&amp;gt;[0-9]+&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Matches one or more digits&lt;br /&gt;
# &amp;lt;code&amp;gt;(\.[0-9]+)+&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Matches &amp;lt;code&amp;gt;.n&amp;lt;/code&amp;gt; one or more times&lt;br /&gt;
# &amp;lt;code&amp;gt;(?=.)&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Requires that &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; follows the match&lt;br /&gt;
&lt;br /&gt;
=== Lab Manager VM Prefix ===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;code&amp;gt;(\b\d{6}-)&amp;lt;/code&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Matches the numeric prefix at the start of a Lab Manager VM name&lt;br /&gt;
* EG Matches &amp;lt;code&amp;gt;002310-&amp;lt;/code&amp;gt; from &amp;lt;code&amp;gt; 002310-Server-A-10&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Regex]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2748</id>
		<title>Virtual Machine (KVM)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2748"/>
		<updated>2023-04-22T12:33:50Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Create Server (no GUI) */ Updated&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Note that VMs are known as &#039;&#039;&#039;domains&#039;&#039;&#039; in the KVM world.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
This guide assumes you have a basic working environment, run the &amp;lt;code&amp;gt;kvm-ok&amp;lt;/code&amp;gt; command to sanity check...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@kvm-host:# kvm-ok&lt;br /&gt;
INFO: /dev/kvm exists&lt;br /&gt;
KVM acceleration can be used&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install Media ===&lt;br /&gt;
You need to have a local copy of the appropriate ISO.  If you have the ISO file already, upload to your KVM server, alternatively download from the site using &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Ubuntu Desktop LTS&#039;&#039;&#039; - http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso&lt;br /&gt;
&lt;br /&gt;
== Create Virtual Machine ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter                    !! Example                     !! Usage&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;            || VM-Name                     || Name of virtual machine (typically this should match the intended hostname of the VM)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;     || &amp;quot;Test VM to be used for X&amp;quot;  || Description of virtual machine&#039;s purpose etc&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-type&amp;lt;/code&amp;gt;         || Linux                       || OS family, can be  Linux, Solaris, Unix or Windows&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-variant&amp;lt;/code&amp;gt;      || ubuntu16.04                 || Distribution type for the above (run &amp;lt;code&amp;gt;osinfo-query os&amp;lt;/code&amp;gt; to view what is available)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ram&amp;lt;/code&amp;gt;             || 2048                        || vRAM in GB&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;disk path&amp;lt;/code&amp;gt;       || /vm-store/images/VM-Name.img,bus=virtio,size=50 || Virtual disk path, using virtio bus and with a 50GB disk&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;graphics&amp;lt;/code&amp;gt;        || none                        || If noneset, VM will be created with a serial display output (as opposed to VNC window)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cdrom&amp;lt;/code&amp;gt;           || /home/user/cdrom.iso        || Path to installation ISO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;network&amp;lt;/code&amp;gt;         || bridge:br0                  || Network connection details&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Create Server (no GUI) ===&lt;br /&gt;
Update &amp;lt;code&amp;gt;location&amp;lt;/code&amp;gt; path to reflect where your install ISO is located, and the &amp;lt;code&amp;gt;disk&amp;lt;/code&amp;gt; path for where VM disk files are intended to be.  &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--extra-args &amp;quot;console=ttyS0&amp;quot;&amp;lt;/code&amp;gt; option allows a local console to be accessed from the host machine (to allow OS install etc before the VM is on a network), though note that it can&#039;t be used with &amp;lt;code&amp;gt;--cdrom&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;--location&amp;lt;/code&amp;gt; has been used instead.  Note that where installing Ubuntu guests v22.04 and upwards the kernel and initrd paths on the ISO need to be specified with the ISO location.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name ubuntu22-vm \&lt;br /&gt;
--ram 2048 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics none \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/ubuntu22-vm.img,size=20,bus=virtio \&lt;br /&gt;
--extra-args &amp;quot;console=ttyS0&amp;quot; \&lt;br /&gt;
--location ubuntu-22.04-live-server-amd64.iso,kernel=casper/vmlinuz,initrd=casper/initrd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should be presented with the console of the VM as it installs, however if you lose connection etc, connect to the console of the server using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;.  Make sure you set a static IP and install SSH during setup (select &#039;&#039;&#039;OpenSSH server&#039;&#039;&#039; during &#039;&#039;Software selection&#039;&#039; section). Once installation is completed, SSH to the server and setup normal console access (as the instructions in the section below).  Its highly recommended that you follow the steps below to ensure that Console access is available via the KVM host if needed.&lt;br /&gt;
&lt;br /&gt;
==== Eject CD-ROM ====&lt;br /&gt;
If you need to eject the CD-ROM towards the end o the installation process, first identify the disk target name (eg hda, hdb, etc) then eject&lt;br /&gt;
 virsh edit server-name&lt;br /&gt;
 virsh change-media server-name hda --eject&lt;br /&gt;
&lt;br /&gt;
==== Console Access ====&lt;br /&gt;
# Update the &amp;lt;code&amp;gt;/etc/default/grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Add &amp;lt;code&amp;gt;console=ttyS0&amp;lt;/code&amp;gt; to the config line &amp;lt;code&amp;gt;GRUB_CMDLINE_LINUX_DEFAULT&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;quiet splash console=ttyS0&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update grub&lt;br /&gt;
#* &amp;lt;code&amp;gt;update-grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the guest machine&lt;br /&gt;
&lt;br /&gt;
Connect using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;, you may need to hit Return once to show the logon prompt.&lt;br /&gt;
&lt;br /&gt;
=== Create Workstation (GUI) ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name ubuntu-desktop \&lt;br /&gt;
--ram 2048 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--cdrom=/mnt/md0/kvm/iso/ubuntu-16.04.3-desktop-amd64.iso \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics vnc,listen=0.0.0.0 \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/ubuntu-desktop.img,size=40,bus=virtio&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the command has got as far as &amp;lt;code&amp;gt;Waiting for installation to complete.&amp;lt;/code&amp;gt; you need to connect to the VNC console session, to find the port number to connect on query the config from &#039;&#039;another&#039;&#039; SSH session connected to the host (typically VNC uses ports starting from 5900 upwards).  Cancelling the command causes the VM/domain to power off, which you won&#039;t want to happen until you&#039;ve completed setup of the VM.&lt;br /&gt;
  virsh dumpxml ubuntu-desktop | grep vnc&lt;br /&gt;
&lt;br /&gt;
== Move Virtual Machine ==&lt;br /&gt;
If you want to move your domain/VM to another KVM host and don&#039;t have shared storage you can manually copy the data and VM config across to another host and import it.&lt;br /&gt;
&lt;br /&gt;
# Shutdown the virtual machine&lt;br /&gt;
#* Preferably from the OS so it gets a graceful shutdown, alternatively stop the VM from KVM&lt;br /&gt;
# Export the config&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh dumpxl &amp;lt;VMname&amp;gt; &amp;gt; /tmp/VMName.xml&amp;lt;/code&amp;gt;&lt;br /&gt;
# Copy the VM disk file(s) and config XML to their new host&lt;br /&gt;
#* Disk file(s) should go the location from which your VM&#039;s will run from&lt;br /&gt;
# Update the config, if necessary...&lt;br /&gt;
#* Disk file path - If the VM disks are in a different path on the new server up date the path in the XML file, look for &amp;lt;code&amp;gt;source file=&amp;lt;/code&amp;gt;&lt;br /&gt;
#* CPU type - If the physical CPU type is different on the new host, you may need to update the VM config to allow for this, update the &amp;lt;code&amp;gt;cpu mode&amp;lt;/code&amp;gt; config to match the capabilities of the destination host, or just set to &amp;lt;code&amp;gt;&amp;lt;cpu mode=&#039;host-passthrough&#039;/&amp;gt;&amp;lt;/code&amp;gt;.  See https://www.berrange.com/posts/2018/06/29/cpu-model-configuration-for-qemu-kvm-on-x86-hosts/ for more info.&lt;br /&gt;
# Import the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh define /path/to/VMName.xml &amp;lt;/code&amp;gt;&lt;br /&gt;
# Start the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh start &amp;lt;VMName&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add Disk ==&lt;br /&gt;
# Create new disk image file&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; qemu-img create -f qcow2 /var/lib/libvirt/images/vm-name-disk1.img 20G &amp;lt;/code&amp;gt;&lt;br /&gt;
# Attach disk image to virtual machine&lt;br /&gt;
#* Use &amp;lt;code&amp;gt;df&amp;lt;/code&amp;gt; in the VM to determine next disk label, eg &amp;lt;code&amp;gt;vdb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; qemu-img create -f qcow2 /var/lib/libvirt/images/vm-name-disk1.img 20G -o preallocation=full &amp;lt;/code&amp;gt;&lt;br /&gt;
#** To create a thin provisioned file use the following (however you may find the disk the OS sees is small (~200K), if so, use the command above)&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; virsh attach-disk vm-name /var/lib/libvirt/images/vm-name-disk1.img vdb --cache none &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update file owner and group to match other disk images&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;  chown libvirt-qemu /var/lib/libvirt/images/vm-name-disk1.img &amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;  chgrp libvirt-qemu /var/lib/libvirt/images/vm-name-disk1.img &amp;lt;/code&amp;gt;&lt;br /&gt;
# Attach disk&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh attach-disk --domain vm-name /var/lib/libvirt/images/vm-name-disk1.img --target vdb --persistent --config --live &amp;lt;/code&amp;gt;&lt;br /&gt;
# In the VM, format the disk using defaults..&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; fdisk /dev/vdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Command: n &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Partition type: p, &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Partition number: &amp;lt;default&amp;gt;, &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;First sector: &amp;lt;default&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Last sector: &amp;lt;default&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Command: w &amp;lt;/code&amp;gt;&lt;br /&gt;
# Format new partition&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mkfs.ext4 /dev/vdb1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# Create mount directory&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mkdir /vdb1/ &amp;lt;/code&amp;gt;&lt;br /&gt;
# Mount the the disk&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mount /dev/vdb1 /vdb1/ &amp;lt;/code&amp;gt;&lt;br /&gt;
# Add an appropriate entry to fstab so the disk gets mounted on next boot&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; /dev/vdb1    /vdb1    ext4     defaults    0 0 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other Config ==&lt;br /&gt;
=== Auto Start ===&lt;br /&gt;
To ensure that a VM domain starts with the host server issue the following commands (replace &amp;lt;code&amp;gt;vm-name&amp;lt;/code&amp;gt; with the name of your VM&lt;br /&gt;
 virsh autostart vm-name&lt;br /&gt;
&lt;br /&gt;
To disable issue&lt;br /&gt;
 virsh autostart vm-name --disable&lt;br /&gt;
&lt;br /&gt;
To see what machines are/aren&#039;t set to start automatically&lt;br /&gt;
 virsh list --all --autostart&lt;br /&gt;
 virsh list --all --no-autostart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:KVM]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2747</id>
		<title>Virtual Machine (KVM)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2747"/>
		<updated>2022-07-28T08:11:30Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Auto Start */ Minor update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Note that VMs are known as &#039;&#039;&#039;domains&#039;&#039;&#039; in the KVM world.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
This guide assumes you have a basic working environment, run the &amp;lt;code&amp;gt;kvm-ok&amp;lt;/code&amp;gt; command to sanity check...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@kvm-host:# kvm-ok&lt;br /&gt;
INFO: /dev/kvm exists&lt;br /&gt;
KVM acceleration can be used&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install Media ===&lt;br /&gt;
You need to have a local copy of the appropriate ISO.  If you have the ISO file already, upload to your KVM server, alternatively download from the site using &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Ubuntu Desktop LTS&#039;&#039;&#039; - http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso&lt;br /&gt;
&lt;br /&gt;
== Create Virtual Machine ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter                    !! Example                     !! Usage&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;            || VM-Name                     || Name of virtual machine (typically this should match the intended hostname of the VM)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;     || &amp;quot;Test VM to be used for X&amp;quot;  || Description of virtual machine&#039;s purpose etc&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-type&amp;lt;/code&amp;gt;         || Linux                       || OS family, can be  Linux, Solaris, Unix or Windows&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-variant&amp;lt;/code&amp;gt;      || ubuntu16.04                 || Distribution type for the above (run &amp;lt;code&amp;gt;osinfo-query os&amp;lt;/code&amp;gt; to view what is available)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ram&amp;lt;/code&amp;gt;             || 2048                        || vRAM in GB&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;disk path&amp;lt;/code&amp;gt;       || /vm-store/images/VM-Name.img,bus=virtio,size=50 || Virtual disk path, using virtio bus and with a 50GB disk&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;graphics&amp;lt;/code&amp;gt;        || none                        || If noneset, VM will be created with a serial display output (as opposed to VNC window)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cdrom&amp;lt;/code&amp;gt;           || /home/user/cdrom.iso        || Path to installation ISO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;network&amp;lt;/code&amp;gt;         || bridge:br0                  || Network connection details&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Create Server (no GUI) ===&lt;br /&gt;
Update paths to reflect where install ISO, and where VM disk files are intended to be.  &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--extra-args &amp;quot;console=ttyS0&amp;quot;&amp;lt;/code&amp;gt; option allows a local console to be accessed from the host machine (to allow OS install etc before the VM is on a network), though note that it can&#039;t be used with &amp;lt;code&amp;gt;--cdrom&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;--location&amp;lt;/code&amp;gt; has been used instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name server-name \&lt;br /&gt;
--ram 1024 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics none \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/server-name.img,size=20,bus=virtio \&lt;br /&gt;
--extra-args &amp;quot;console=ttyS0&amp;quot; \&lt;br /&gt;
--location /mnt/md0/kvm/iso/ubuntu-16.04.3-server-amd64.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should be presented with the console of the VM as it installs, however if you lose connection etc, connect to the console of the server using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;.  Make sure you set a static IP and install SSH during setup (select &#039;&#039;&#039;OpenSSH server&#039;&#039;&#039; during &#039;&#039;Software selection&#039;&#039; section). Once installation is completed, SSH to the server and setup normal console access (as the instructions in the section below).  Its highly recommended that you follow the steps below to ensure that Console access is available via the KVM host if needed.&lt;br /&gt;
&lt;br /&gt;
==== Eject CD-ROM ====&lt;br /&gt;
If you need to eject the CD-ROM towards the end o the installation process, first identify the disk target name (eg hda, hdb, etc) then eject&lt;br /&gt;
 virsh edit server-name&lt;br /&gt;
 virsh change-media server-name hda --eject&lt;br /&gt;
&lt;br /&gt;
==== Console Access ====&lt;br /&gt;
# Update the &amp;lt;code&amp;gt;/etc/default/grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Add &amp;lt;code&amp;gt;console=ttyS0&amp;lt;/code&amp;gt; to the config line &amp;lt;code&amp;gt;GRUB_CMDLINE_LINUX_DEFAULT&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;quiet splash console=ttyS0&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update grub&lt;br /&gt;
#* &amp;lt;code&amp;gt;update-grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the guest machine&lt;br /&gt;
&lt;br /&gt;
Connect using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;, you may need to hit Return once to show the logon prompt.&lt;br /&gt;
&lt;br /&gt;
=== Create Workstation (GUI) ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name ubuntu-desktop \&lt;br /&gt;
--ram 2048 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--cdrom=/mnt/md0/kvm/iso/ubuntu-16.04.3-desktop-amd64.iso \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics vnc,listen=0.0.0.0 \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/ubuntu-desktop.img,size=40,bus=virtio&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the command has got as far as &amp;lt;code&amp;gt;Waiting for installation to complete.&amp;lt;/code&amp;gt; you need to connect to the VNC console session, to find the port number to connect on query the config from &#039;&#039;another&#039;&#039; SSH session connected to the host (typically VNC uses ports starting from 5900 upwards).  Cancelling the command causes the VM/domain to power off, which you won&#039;t want to happen until you&#039;ve completed setup of the VM.&lt;br /&gt;
  virsh dumpxml ubuntu-desktop | grep vnc&lt;br /&gt;
&lt;br /&gt;
== Move Virtual Machine ==&lt;br /&gt;
If you want to move your domain/VM to another KVM host and don&#039;t have shared storage you can manually copy the data and VM config across to another host and import it.&lt;br /&gt;
&lt;br /&gt;
# Shutdown the virtual machine&lt;br /&gt;
#* Preferably from the OS so it gets a graceful shutdown, alternatively stop the VM from KVM&lt;br /&gt;
# Export the config&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh dumpxl &amp;lt;VMname&amp;gt; &amp;gt; /tmp/VMName.xml&amp;lt;/code&amp;gt;&lt;br /&gt;
# Copy the VM disk file(s) and config XML to their new host&lt;br /&gt;
#* Disk file(s) should go the location from which your VM&#039;s will run from&lt;br /&gt;
# Update the config, if necessary...&lt;br /&gt;
#* Disk file path - If the VM disks are in a different path on the new server up date the path in the XML file, look for &amp;lt;code&amp;gt;source file=&amp;lt;/code&amp;gt;&lt;br /&gt;
#* CPU type - If the physical CPU type is different on the new host, you may need to update the VM config to allow for this, update the &amp;lt;code&amp;gt;cpu mode&amp;lt;/code&amp;gt; config to match the capabilities of the destination host, or just set to &amp;lt;code&amp;gt;&amp;lt;cpu mode=&#039;host-passthrough&#039;/&amp;gt;&amp;lt;/code&amp;gt;.  See https://www.berrange.com/posts/2018/06/29/cpu-model-configuration-for-qemu-kvm-on-x86-hosts/ for more info.&lt;br /&gt;
# Import the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh define /path/to/VMName.xml &amp;lt;/code&amp;gt;&lt;br /&gt;
# Start the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh start &amp;lt;VMName&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add Disk ==&lt;br /&gt;
# Create new disk image file&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; qemu-img create -f qcow2 /var/lib/libvirt/images/vm-name-disk1.img 20G &amp;lt;/code&amp;gt;&lt;br /&gt;
# Attach disk image to virtual machine&lt;br /&gt;
#* Use &amp;lt;code&amp;gt;df&amp;lt;/code&amp;gt; in the VM to determine next disk label, eg &amp;lt;code&amp;gt;vdb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; qemu-img create -f qcow2 /var/lib/libvirt/images/vm-name-disk1.img 20G -o preallocation=full &amp;lt;/code&amp;gt;&lt;br /&gt;
#** To create a thin provisioned file use the following (however you may find the disk the OS sees is small (~200K), if so, use the command above)&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; virsh attach-disk vm-name /var/lib/libvirt/images/vm-name-disk1.img vdb --cache none &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update file owner and group to match other disk images&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;  chown libvirt-qemu /var/lib/libvirt/images/vm-name-disk1.img &amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;  chgrp libvirt-qemu /var/lib/libvirt/images/vm-name-disk1.img &amp;lt;/code&amp;gt;&lt;br /&gt;
# Attach disk&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh attach-disk --domain vm-name /var/lib/libvirt/images/vm-name-disk1.img --target vdb --persistent --config --live &amp;lt;/code&amp;gt;&lt;br /&gt;
# In the VM, format the disk using defaults..&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; fdisk /dev/vdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Command: n &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Partition type: p, &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Partition number: &amp;lt;default&amp;gt;, &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;First sector: &amp;lt;default&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Last sector: &amp;lt;default&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Command: w &amp;lt;/code&amp;gt;&lt;br /&gt;
# Format new partition&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mkfs.ext4 /dev/vdb1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# Create mount directory&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mkdir /vdb1/ &amp;lt;/code&amp;gt;&lt;br /&gt;
# Mount the the disk&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mount /dev/vdb1 /vdb1/ &amp;lt;/code&amp;gt;&lt;br /&gt;
# Add an appropriate entry to fstab so the disk gets mounted on next boot&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; /dev/vdb1    /vdb1    ext4     defaults    0 0 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other Config ==&lt;br /&gt;
=== Auto Start ===&lt;br /&gt;
To ensure that a VM domain starts with the host server issue the following commands (replace &amp;lt;code&amp;gt;vm-name&amp;lt;/code&amp;gt; with the name of your VM&lt;br /&gt;
 virsh autostart vm-name&lt;br /&gt;
&lt;br /&gt;
To disable issue&lt;br /&gt;
 virsh autostart vm-name --disable&lt;br /&gt;
&lt;br /&gt;
To see what machines are/aren&#039;t set to start automatically&lt;br /&gt;
 virsh list --all --autostart&lt;br /&gt;
 virsh list --all --no-autostart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:KVM]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2746</id>
		<title>Virtual Machine (KVM)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2746"/>
		<updated>2022-07-28T08:10:50Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Auto Start */ Added list VMs with/without autostart&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Note that VMs are known as &#039;&#039;&#039;domains&#039;&#039;&#039; in the KVM world.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
This guide assumes you have a basic working environment, run the &amp;lt;code&amp;gt;kvm-ok&amp;lt;/code&amp;gt; command to sanity check...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@kvm-host:# kvm-ok&lt;br /&gt;
INFO: /dev/kvm exists&lt;br /&gt;
KVM acceleration can be used&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install Media ===&lt;br /&gt;
You need to have a local copy of the appropriate ISO.  If you have the ISO file already, upload to your KVM server, alternatively download from the site using &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Ubuntu Desktop LTS&#039;&#039;&#039; - http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso&lt;br /&gt;
&lt;br /&gt;
== Create Virtual Machine ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter                    !! Example                     !! Usage&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;            || VM-Name                     || Name of virtual machine (typically this should match the intended hostname of the VM)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;     || &amp;quot;Test VM to be used for X&amp;quot;  || Description of virtual machine&#039;s purpose etc&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-type&amp;lt;/code&amp;gt;         || Linux                       || OS family, can be  Linux, Solaris, Unix or Windows&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-variant&amp;lt;/code&amp;gt;      || ubuntu16.04                 || Distribution type for the above (run &amp;lt;code&amp;gt;osinfo-query os&amp;lt;/code&amp;gt; to view what is available)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ram&amp;lt;/code&amp;gt;             || 2048                        || vRAM in GB&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;disk path&amp;lt;/code&amp;gt;       || /vm-store/images/VM-Name.img,bus=virtio,size=50 || Virtual disk path, using virtio bus and with a 50GB disk&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;graphics&amp;lt;/code&amp;gt;        || none                        || If noneset, VM will be created with a serial display output (as opposed to VNC window)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cdrom&amp;lt;/code&amp;gt;           || /home/user/cdrom.iso        || Path to installation ISO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;network&amp;lt;/code&amp;gt;         || bridge:br0                  || Network connection details&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Create Server (no GUI) ===&lt;br /&gt;
Update paths to reflect where install ISO, and where VM disk files are intended to be.  &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--extra-args &amp;quot;console=ttyS0&amp;quot;&amp;lt;/code&amp;gt; option allows a local console to be accessed from the host machine (to allow OS install etc before the VM is on a network), though note that it can&#039;t be used with &amp;lt;code&amp;gt;--cdrom&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;--location&amp;lt;/code&amp;gt; has been used instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name server-name \&lt;br /&gt;
--ram 1024 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics none \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/server-name.img,size=20,bus=virtio \&lt;br /&gt;
--extra-args &amp;quot;console=ttyS0&amp;quot; \&lt;br /&gt;
--location /mnt/md0/kvm/iso/ubuntu-16.04.3-server-amd64.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should be presented with the console of the VM as it installs, however if you lose connection etc, connect to the console of the server using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;.  Make sure you set a static IP and install SSH during setup (select &#039;&#039;&#039;OpenSSH server&#039;&#039;&#039; during &#039;&#039;Software selection&#039;&#039; section). Once installation is completed, SSH to the server and setup normal console access (as the instructions in the section below).  Its highly recommended that you follow the steps below to ensure that Console access is available via the KVM host if needed.&lt;br /&gt;
&lt;br /&gt;
==== Eject CD-ROM ====&lt;br /&gt;
If you need to eject the CD-ROM towards the end o the installation process, first identify the disk target name (eg hda, hdb, etc) then eject&lt;br /&gt;
 virsh edit server-name&lt;br /&gt;
 virsh change-media server-name hda --eject&lt;br /&gt;
&lt;br /&gt;
==== Console Access ====&lt;br /&gt;
# Update the &amp;lt;code&amp;gt;/etc/default/grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Add &amp;lt;code&amp;gt;console=ttyS0&amp;lt;/code&amp;gt; to the config line &amp;lt;code&amp;gt;GRUB_CMDLINE_LINUX_DEFAULT&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;quiet splash console=ttyS0&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update grub&lt;br /&gt;
#* &amp;lt;code&amp;gt;update-grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the guest machine&lt;br /&gt;
&lt;br /&gt;
Connect using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;, you may need to hit Return once to show the logon prompt.&lt;br /&gt;
&lt;br /&gt;
=== Create Workstation (GUI) ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name ubuntu-desktop \&lt;br /&gt;
--ram 2048 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--cdrom=/mnt/md0/kvm/iso/ubuntu-16.04.3-desktop-amd64.iso \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics vnc,listen=0.0.0.0 \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/ubuntu-desktop.img,size=40,bus=virtio&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the command has got as far as &amp;lt;code&amp;gt;Waiting for installation to complete.&amp;lt;/code&amp;gt; you need to connect to the VNC console session, to find the port number to connect on query the config from &#039;&#039;another&#039;&#039; SSH session connected to the host (typically VNC uses ports starting from 5900 upwards).  Cancelling the command causes the VM/domain to power off, which you won&#039;t want to happen until you&#039;ve completed setup of the VM.&lt;br /&gt;
  virsh dumpxml ubuntu-desktop | grep vnc&lt;br /&gt;
&lt;br /&gt;
== Move Virtual Machine ==&lt;br /&gt;
If you want to move your domain/VM to another KVM host and don&#039;t have shared storage you can manually copy the data and VM config across to another host and import it.&lt;br /&gt;
&lt;br /&gt;
# Shutdown the virtual machine&lt;br /&gt;
#* Preferably from the OS so it gets a graceful shutdown, alternatively stop the VM from KVM&lt;br /&gt;
# Export the config&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh dumpxl &amp;lt;VMname&amp;gt; &amp;gt; /tmp/VMName.xml&amp;lt;/code&amp;gt;&lt;br /&gt;
# Copy the VM disk file(s) and config XML to their new host&lt;br /&gt;
#* Disk file(s) should go the location from which your VM&#039;s will run from&lt;br /&gt;
# Update the config, if necessary...&lt;br /&gt;
#* Disk file path - If the VM disks are in a different path on the new server up date the path in the XML file, look for &amp;lt;code&amp;gt;source file=&amp;lt;/code&amp;gt;&lt;br /&gt;
#* CPU type - If the physical CPU type is different on the new host, you may need to update the VM config to allow for this, update the &amp;lt;code&amp;gt;cpu mode&amp;lt;/code&amp;gt; config to match the capabilities of the destination host, or just set to &amp;lt;code&amp;gt;&amp;lt;cpu mode=&#039;host-passthrough&#039;/&amp;gt;&amp;lt;/code&amp;gt;.  See https://www.berrange.com/posts/2018/06/29/cpu-model-configuration-for-qemu-kvm-on-x86-hosts/ for more info.&lt;br /&gt;
# Import the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh define /path/to/VMName.xml &amp;lt;/code&amp;gt;&lt;br /&gt;
# Start the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh start &amp;lt;VMName&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add Disk ==&lt;br /&gt;
# Create new disk image file&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; qemu-img create -f qcow2 /var/lib/libvirt/images/vm-name-disk1.img 20G &amp;lt;/code&amp;gt;&lt;br /&gt;
# Attach disk image to virtual machine&lt;br /&gt;
#* Use &amp;lt;code&amp;gt;df&amp;lt;/code&amp;gt; in the VM to determine next disk label, eg &amp;lt;code&amp;gt;vdb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; qemu-img create -f qcow2 /var/lib/libvirt/images/vm-name-disk1.img 20G -o preallocation=full &amp;lt;/code&amp;gt;&lt;br /&gt;
#** To create a thin provisioned file use the following (however you may find the disk the OS sees is small (~200K), if so, use the command above)&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; virsh attach-disk vm-name /var/lib/libvirt/images/vm-name-disk1.img vdb --cache none &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update file owner and group to match other disk images&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;  chown libvirt-qemu /var/lib/libvirt/images/vm-name-disk1.img &amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;  chgrp libvirt-qemu /var/lib/libvirt/images/vm-name-disk1.img &amp;lt;/code&amp;gt;&lt;br /&gt;
# Attach disk&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh attach-disk --domain vm-name /var/lib/libvirt/images/vm-name-disk1.img --target vdb --persistent --config --live &amp;lt;/code&amp;gt;&lt;br /&gt;
# In the VM, format the disk using defaults..&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; fdisk /dev/vdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Command: n &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Partition type: p, &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Partition number: &amp;lt;default&amp;gt;, &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;First sector: &amp;lt;default&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Last sector: &amp;lt;default&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Command: w &amp;lt;/code&amp;gt;&lt;br /&gt;
# Format new partition&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mkfs.ext4 /dev/vdb1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# Create mount directory&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mkdir /vdb1/ &amp;lt;/code&amp;gt;&lt;br /&gt;
# Mount the the disk&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mount /dev/vdb1 /vdb1/ &amp;lt;/code&amp;gt;&lt;br /&gt;
# Add an appropriate entry to fstab so the disk gets mounted on next boot&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; /dev/vdb1    /vdb1    ext4     defaults    0 0 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other Config ==&lt;br /&gt;
=== Auto Start ===&lt;br /&gt;
To ensure that a VM domain starts with the host server issue the following commands (replace &amp;lt;code&amp;gt;vm-name&amp;lt;/code&amp;gt; with the name of your VM&lt;br /&gt;
 virsh autostart vm-name&lt;br /&gt;
&lt;br /&gt;
To disable issue&lt;br /&gt;
 virsh autostart vm-name --disable&lt;br /&gt;
&lt;br /&gt;
To see what machines are/aren&#039;t set to start automatically&lt;br /&gt;
 virsh list --autostart&lt;br /&gt;
 virsh list --all --no-autostart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:KVM]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Installation_v8_(Zimbra)&amp;diff=2745</id>
		<title>Installation v8 (Zimbra)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Installation_v8_(Zimbra)&amp;diff=2745"/>
		<updated>2022-06-05T11:53:28Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: Initial creation from v6/v7 page (still WIP)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Zimbra FOSS Installation Guide&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Note that if you are installing on a server with a private address that is to be [[Acronyms#N|NAT]]&#039;ed to a publicly accessible address you&#039;ll need ensure that you&#039;ve got [[Split_DNS_(Zimbra)|Split-DNS]] set-up, and I&#039;d recommend a quick read through the [[Split_DNS_(Zimbra)#DNS Records|DNS requirements]] regardless.&lt;br /&gt;
 &lt;br /&gt;
== Pre-Requisites ==&lt;br /&gt;
* &#039;&#039;&#039;Working Ubuntu LTS Server installation&#039;&#039;&#039; - see [[Installation_(Ubuntu)|Ubuntu Installation]] for further install info together with https://www.zimbra.com/downloads/zimbra-collaboration-open-source/ (will redirect you to a trail registration page that you need to complete 1st, have never been contacted by them)&lt;br /&gt;
** Base install with OpenSSH Server&lt;br /&gt;
** DNS Server - Only required if you need to use Split DNS and need to provide resolution of the internal IP address of the server (EG you don&#039;t have an existing local DNS Server under your control that you can add your Zimbra server in to)&lt;br /&gt;
* &#039;&#039;&#039;Internet/public IP address&#039;&#039;&#039;&lt;br /&gt;
** Can be shared with other services so long as there&#039;s no TCP port conflicts and you have a router that can perform the appropriate NAT&#039;ing &lt;br /&gt;
*** See http://wiki.zimbra.com/wiki/Ports#External_Access for required TCP ports&lt;br /&gt;
* &#039;&#039;&#039;MX (Mail Exchange) DNS record&#039;&#039;&#039; pointing to public IP address&lt;br /&gt;
** Additionally an internal only MX record pointing to the server&#039;s internal/private IP address - only if you need to use SplitDNS&lt;br /&gt;
&lt;br /&gt;
=== Server Specification&amp;lt;ref&amp;gt;Zimbra System Requirements for v8.5 - https://www.zimbra.com/open-source-email-overview/ (will redirect you to a trail registration page, no financial info or commitment required)&amp;lt;/ref&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
! Specification !! CPU         !! Memory !! Free Disk !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| Minimum       || 1 x 2.0 GHz || 4 GB   || 10 GB     || Below Zimbra minimum spec, but workable for a small number of accounts (eg &amp;lt;10 active mailboxes)&lt;br /&gt;
|-&lt;br /&gt;
| Recommended   || 2 x 2.0 GHz || 8 GB   || 10 GB     || Recommended minimum production spec advised by Zimbra&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note: Free Disk does &#039;&#039;not&#039;&#039; include allocation for mail storage&#039;&#039;&#039; So you will need additional free space for users data.&lt;br /&gt;
&lt;br /&gt;
Memory seems to be the main choke point for Zimbra, and will run a bit faster if you can spare a bit more.  The less RAM the server has, less data can be cached into memory, and so the more disk IO that is required, and consequently the higher demand there will be on getting good IO throughput from the servers disks.&amp;lt;ref&amp;gt;Zimbra Performance Tuning - http://wiki.zimbra.com/wiki/Performance_Tuning_Guidelines_for_Large_Deployments&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Procedure ==&lt;br /&gt;
# Locate the appropriate download URL at https://www.zimbra.com/try/zimbra-collaboration-open-source/, aand copy the link to the download&lt;br /&gt;
# Download the target of the link to your server&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; wget http://files.zimbra.com/downloads/8.8.15_GA/zcs-8.8.15_GA_4179.UBUNTU20_64.20211118033954.tgz &amp;lt;/code&amp;gt;&lt;br /&gt;
# Uncompress the package&lt;br /&gt;
#* &amp;lt;code&amp;gt; tar xzf zcs-8.8.15_GA_4179.UBUNTU20_64.20211118033954.tgz &amp;lt;/code&amp;gt;&lt;br /&gt;
# Change directory into the folder and start the install (needs to be run as root, using sudo works)&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; cd zcs-8.8.15_GA_4179.UBUNTU20_64.20211118033954 &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; ./install.sh &amp;lt;/code&amp;gt;&lt;br /&gt;
#* Accept the EULA, update your &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt; file if required and restart&lt;br /&gt;
# When prompted accept using Zimbra&#039;s package repository&lt;br /&gt;
# Accept the default packages except &amp;lt;code&amp;gt; zimbra-dnscache &amp;lt;/code&amp;gt; (unless you know of any others you specifically want to exclude as well)&lt;br /&gt;
# Answer &amp;lt;code&amp;gt;Y&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;The system will be modified.  Continue?&amp;lt;/code&amp;gt; query&lt;br /&gt;
#* The install will proceed, note that some steps take longer and the install script might appear to hang occasionally&lt;br /&gt;
# Once the packages are installed the installer may complain about your domain not having a DNS record - &amp;lt;code&amp;gt;DNS ERROR resolving MX for ...&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Change the domain to your publicly registered domain (without server hostname, so &amp;lt;code&amp;gt;sandfordit.com&amp;lt;/code&amp;gt; rather than &amp;lt;code&amp;gt;mail.sandfordit.com&amp;lt;/code&amp;gt;&lt;br /&gt;
#* If this fails to resolve the error, there is a problem with your network/DNS setup&lt;br /&gt;
#* If this is a new server that you don&#039;t want to receive inbound email immediately create a low priority MX record temporarily&lt;br /&gt;
# At the end of the base install, address the unconfigured item (ie an admin password)&lt;br /&gt;
# Write the config to disk and allow the system to be configured&lt;br /&gt;
&lt;br /&gt;
Once the install is completed, login to administer the exchange server using a URL similar to https://your-mail-svr:7071&lt;br /&gt;
&lt;br /&gt;
== Post Install Config ==&lt;br /&gt;
=== Enforce HTTPS for Clients ===&lt;br /&gt;
To enforce user connections using Zimbra Desktop or the web client to [[Acronyms#H|HTTPS]] use the following command as the zimbra user (EG &amp;lt;code&amp;gt; su -zimbra &amp;lt;/code&amp;gt;)&lt;br /&gt;
 zmtlsctl https&lt;br /&gt;
&lt;br /&gt;
Requires a restart to take effect...&lt;br /&gt;
 zmcontrol restart&lt;br /&gt;
&lt;br /&gt;
For more info see http://wiki.zimbra.com/wiki/CLI_zmtlsctl_to_set_Web_Server_Mode&lt;br /&gt;
&lt;br /&gt;
=== High CPU Workaround ===&lt;br /&gt;
Zimbra seems to have some reoccurring issues with regular high CPU spikes, some as often as every minute, caused by background maintenance tasks.  With the increasing prevalence of virtualisation, this appears to be being noticed more frequently by users, and can a reoccurring thread in the forums.  The following can aid in reducing this, which look to limit and reduce the logging retention and failed process checking that occurs.  The config changes are relatively aggressive, so you may wish to alter less from the default.&lt;br /&gt;
{| class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
! Command							!! Comments								!! Default&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; zmlocalconfig -e zmmtaconfig_interval=600 &amp;lt;/code&amp;gt;	|| Increase service failure watchdog interval to 600 secs (10 mins)	|| &amp;lt;code&amp;gt;60&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; zmprov mcf zimbraLogRawLifetime 7d &amp;lt;/code&amp;gt;		|| Reduce raw log retention to 7 days					|| &amp;lt;code&amp;gt;31d&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; zmprov mcf zimbraLogSummaryLifetime 30d &amp;lt;/code&amp;gt;	|| Reduce summary log retention to 30 days				|| &amp;lt;code&amp;gt;730d&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; zmprov ms &amp;lt;hostname&amp;gt; -zimbraServiceEnabled logger &amp;lt;/code&amp;gt; || Toggles/disables the logger service - I don&#039;t do this myself, seems too drastic &amp;lt;br&amp;gt;&lt;br /&gt;
Replace &amp;lt;code&amp;gt;&amp;lt;hostname&amp;gt;&amp;lt;/code&amp;gt; with [[Acronyms#F|FQDN]] of your Zimbra server &amp;lt;br&amp;gt;&lt;br /&gt;
To check services enabled  &amp;lt;code&amp;gt; zmprov gs &amp;lt;hostname&amp;gt; &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; grep zimbraServiceEnabled &amp;lt;/code&amp;gt; &lt;br /&gt;
| Enabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additionally its common to tune down the frequency of scheduled tasks (edit config file with &amp;lt;code&amp;gt; crontab -e &amp;lt;/code&amp;gt;, some lines in table below truncated with &amp;lt;code&amp;gt;...&amp;lt;/code&amp;gt;)&lt;br /&gt;
{| class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
! Original							!! Change to							!! Comments&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt; */2 * * * * /opt/zimbra/libexec/zmstatuslog &amp;lt;/code&amp;gt;	|| &amp;lt;code&amp;gt; */60 * * * * /opt/zimbra/libexec/zmstatuslog &amp;lt;/code&amp;gt;	|| Reduce status logging to hourly (from every 2 mins)&lt;br /&gt;
Will cause a bigger CPU spike on the hour.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; 00,10,20,30,40,50 * * * * /opt/zimbra/libexec/zmlogprocess ...&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt; */15 * * * * /opt/zimbra/libexec/zmlogprocess ...&amp;lt;/code&amp;gt; || Reduce log processing to every 15 mins&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Reduce AV Memory Usage ===&lt;br /&gt;
Anti-virus spawns a number of threads so that it can concurrently process incoming and outgoing email.  If your server isn&#039;t expected to under much load and/or you&#039;re not too worried about mail queueing waiting to be scanned you can reduce the number of instances of amavisd that get spawned.&lt;br /&gt;
&lt;br /&gt;
The default is 10 processes.  Reducing the number of process may reduce the amount of RAM used by AV scanning may allow other components of the system to use more RAM, effectively improving the responsiveness of the server, at the expense of reducing the speed of email delivery.  However,you may find that each process is now using more RAM so overall usage hasn&#039;t decreased.&lt;br /&gt;
&lt;br /&gt;
Log in to your server and as the zimbra user edit &amp;lt;code&amp;gt;/opt/zimbra/conf/amavisd.conf.in&amp;lt;/code&amp;gt; and change the &amp;lt;code&amp;gt;$max_servers&amp;lt;/code&amp;gt; config line.  No less than 2 is recommended, eg&lt;br /&gt;
* &amp;lt;code&amp;gt;$max_servers = 5; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Zimbra]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=MediaWiki:Sitenotice&amp;diff=2744</id>
		<title>MediaWiki:Sitenotice</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=MediaWiki:Sitenotice&amp;diff=2744"/>
		<updated>2022-06-05T11:52:14Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: Remove GoogleAdsense banner&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Split_DNS_(Zimbra)&amp;diff=2743</id>
		<title>Split DNS (Zimbra)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Split_DNS_(Zimbra)&amp;diff=2743"/>
		<updated>2022-06-05T11:51:49Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* DNS Records */ Updated&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://en.wikipedia.org/wiki/Split-horizon_DNS Split DNS] is required for [[:Category:Zimbra|Zimbra]] where your server is on an internal ([http://www.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces private address range]) network&amp;lt;ref name=&amp;quot;PrivAddr&amp;quot; /&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Zimbra needs to be able to resolve its own Mail Exchanger (MX) [[Acronyms#D|DNS]] record, otherwise its services will not start.  Therefore if your server is known publicly by one IP address, but in fact has a different internal address (and the public IP is [[Acronyms#N|NAT]]&#039;ed to the internal IP) you&#039;ll need to use split DNS.  This allows your server to be known by one IP address on the internet, and a different address internally, but with the same hostname regardless of where you are.  There are two methods described below that enable you to achieve this...&lt;br /&gt;
# [[#Localhost DNS Server Setup|Localhost DNS Server Setup]] - DNS server installed locally on the Zimbra server.&lt;br /&gt;
# [[#Local Network DNS Server Setup|Local Network DNS Server Setup]] - DNS server on your local network, if you have one available.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note that Split DNS, Split-Horizon DNS, Split-Brain DNS all refer to the same technique&#039;&#039;&#039;, and the terminology can be used interchangeably.&lt;br /&gt;
&lt;br /&gt;
== DNS Records ==&lt;br /&gt;
Firstly, you need to own a public DNS domain name, then create two DNS records...&lt;br /&gt;
# &#039;&#039;&#039;MX record&#039;&#039;&#039; - Mail Exchanger (MX) record&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; sandfordit.com [MX] -&amp;gt; mail.sandfordit.com &amp;lt;/code&amp;gt;&lt;br /&gt;
#* where &amp;lt;code&amp;gt; sandfordit.com &amp;lt;/code&amp;gt; is the domain you own, and &amp;lt;code&amp;gt; mail.sandfordit.com &amp;lt;/code&amp;gt; is hostname of your email server (the can be anything you like). Email addressed to &amp;lt;code&amp;gt;&amp;lt;anything&amp;gt;@sandfordit.com&amp;lt;/code&amp;gt; will be directed to the server in this record.&lt;br /&gt;
#* You&#039;ll need to give the record a weighting (this allows you to have multiple email servers for the same domain).  The lower the number the higher the server&#039;s priority, assuming you only have one email server, its common to use &amp;lt;code&amp;gt;10&amp;lt;/code&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;A record&#039;&#039;&#039; - Standard DNS record&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mail.sandfordit.com [A] -&amp;gt; 158.25.34.124 &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; 158.25.34.124 &amp;lt;/code&amp;gt; is the static IP address assigned to your email server.  You&#039;ll need to set-up a NAT on your router (often called a virtual server in domestic firewalls/routers) to map incoming mail on TCP 25 to your email server&#039;s actual address (EG &amp;lt;code&amp;gt; 158.25.34.124:25 -&amp;gt; 192.168.1.150:25 &amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Note, instead of an A record, a CNAME record can be used instead (though the CNAME record will still need to point to a valid A record).  Using a CNAME can be preferable, where you might, in the future, want to send inbound email traffic to another email server, addressed by a different A record.&lt;br /&gt;
&lt;br /&gt;
== Localhost DNS Server Setup ==&lt;br /&gt;
In order to get round the fact that your exchange server won&#039;t have the same IP (or name even) on the public internet as it will on your internal network, a DNS server is installed on the exchange server to provide MX record resolution.  Procedure assumes DNS (Bind) is already installed (use &amp;lt;code&amp;gt;apt-get install bind9&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Terminology...&lt;br /&gt;
* &#039;&#039;&#039;Private&#039;&#039;&#039; = Home or internal network IP address and network name (eg &amp;lt;code&amp;gt;192.168.1.150&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mail.home.int&amp;lt;/code&amp;gt;)&lt;br /&gt;
* &#039;&#039;&#039;Public&#039;&#039;&#039; = Global internet, ISP assigned IP address and registered domain name (eg &amp;lt;code&amp;gt;158.25.34.124&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mail.sandfordit.com&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Firstly, add the IP(&#039;s) of the DNS servers you use for resolution on your other machines to your local DNS server&#039;s list of forwarders (so that your exchange server forwards DNS resolution requests for unknown names to your normal DNS servers), edit &amp;lt;code&amp;gt;/etc/bind/named.conf.options&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
options {&lt;br /&gt;
        directory &amp;quot;/var/cache/bind&amp;quot;;&lt;br /&gt;
        query-source address * port 53;&lt;br /&gt;
&lt;br /&gt;
        forwarders {&lt;br /&gt;
                192.168.1.1; 158.25.30.10;&lt;br /&gt;
        };&lt;br /&gt;
&lt;br /&gt;
        auth-nxdomain no;    # conform to RFC1035&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt; to force the server to use its local DNS server for resolution&lt;br /&gt;
 nameserver 127.0.0.1&lt;br /&gt;
&lt;br /&gt;
Restart bind using &amp;lt;code&amp;gt; /etc/init.d/bind9 restart &amp;lt;/code&amp;gt; and check you can resolve external addresses properly.&lt;br /&gt;
&lt;br /&gt;
Now create the internal zone that will eventually contain the local MX record for your exchange server, append the following to &amp;lt;code&amp;gt; /etc/bind/named.conf.local &amp;lt;/code&amp;gt;, using your publicly registered domain name&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
zone &amp;quot;sandfordit.com&amp;quot;  {&lt;br /&gt;
    type master;&lt;br /&gt;
    file &amp;quot;/etc/bind/db.sandfordit.com&amp;quot;;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lastly create the database file for you DNS domain &amp;lt;code&amp;gt;/etc/bind/db.sandfordit.com&amp;lt;/code&amp;gt;, using your publicly registered domain name and private (internal) IP address for your exchange server...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
;&lt;br /&gt;
; BIND data file for sandfordit.com&lt;br /&gt;
;&lt;br /&gt;
$TTL    604800&lt;br /&gt;
@       IN      SOA     mail.sandfordit.com. admin.sandfordit.com. (&lt;br /&gt;
                         070725         ; Serial&lt;br /&gt;
                         604800         ; Refresh&lt;br /&gt;
                          86400         ; Retry&lt;br /&gt;
                        2419200         ; Expire&lt;br /&gt;
                         604800 )       ; Negative Cache TTL&lt;br /&gt;
;&lt;br /&gt;
@       IN      NS      mail&lt;br /&gt;
        IN      MX      10 mail&lt;br /&gt;
        IN      A       192.168.1.150&lt;br /&gt;
mail    IN      A       192.168.1.150&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Local Network DNS Server Setup ==&lt;br /&gt;
This is most appropriate to use if you have an existing internal DNS server, that internal clients are already using.  Note that all clients&lt;br /&gt;
of the DNS server will use it to resolve &#039;&#039;&#039;all&#039;&#039;&#039; addresses for the domain that your Zimbra server is on.  So if your domain is &amp;lt;code&amp;gt;sandfordit.com&amp;lt;/code&amp;gt;, all name resolution for that zone will be handled by it.  So if you have a server on the internet (eg &amp;lt;code&amp;gt; www.sandfordit.com &amp;lt;/code&amp;gt;, you will need to have a local record for it added to your DNS.  Otherwise local clients will request a DNS resolution with your local DNS, which will simply respond that there is no such host, and the local client will be unable to connect.&lt;br /&gt;
&lt;br /&gt;
So if you have to create a new zone in order to get Split DNS working, you may need to add additional records that replicate existing public DNS records.  If you already have a zone in your DNS server (which should already be up to date), or have no other device address in that DNS domain, then this shouldn&#039;t be a problem.&lt;br /&gt;
&lt;br /&gt;
If you are in any doubt, installing a local DNS server on your Zimbra server is the safest way to proceed.  Any problems you cause should be restricted to that server, and won&#039;t impact any other working servers.  One of the biggest risks when tinkering with DNS is that records get cached, everywhere, so once you&#039;ve fixed whatever problem you&#039;ve caused, you may have to wait days for the fix to have rippled around.&lt;br /&gt;
&lt;br /&gt;
# If it doesn&#039;t already exist, create a new zone for your domain, eg &amp;lt;code&amp;gt; sandfordit.com &amp;lt;/code&amp;gt;&lt;br /&gt;
# Within that zone, create an&lt;br /&gt;
#* &#039;&#039;&#039;A record&#039;&#039;&#039; for your server&#039;s hostname and internal IP address&lt;br /&gt;
#* &#039;&#039;&#039;MX record&#039;&#039;&#039;, pointing to the A record just created&lt;br /&gt;
&lt;br /&gt;
== Additional Notes ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;PrivAddr&amp;quot;&amp;gt;For example, your Zimbra server may have an IP address of 10.0.1.5 or 192.168.3.7, but from the outside world its accessible via a public address such as 159.105.10.35&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Zimbra]]&lt;br /&gt;
[[Category:DNS]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Main_Page&amp;diff=2742</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Main_Page&amp;diff=2742"/>
		<updated>2022-06-05T11:51:09Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: Remove SEO&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--       OVERALL CONTENTS CONTAINER       --&amp;gt;&lt;br /&gt;
{| style=&amp;quot;width: 100%; margin:4px 0 0 0; background:none; border-spacing: 0px;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--       LEFT-HAND CONTENTS COLUMN        --&amp;gt;&lt;br /&gt;
| style=&amp;quot;width:33%; border:1px solid #9eb19e; background:#fafffa; vertical-align:top; color:#000;&amp;quot; |&lt;br /&gt;
{| style=&amp;quot;width:100%; vertical-align:top; background:#fafffa;&amp;quot;&lt;br /&gt;
! style=&amp;quot;padding:2px;&amp;quot; | &amp;lt;h2 style=&amp;quot;margin:3px; background:#ddeddd; font-size:120%; font-weight:bold; border:1px solid #9eb19e; text-align:left; color:#000; padding:0.2em 0.4em;&amp;quot;&amp;gt;[[:Category:VMware|VMware]]&amp;lt;/h2&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;color:#000;&amp;quot; | &amp;lt;div style=&amp;quot;padding:2px 5px&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;[[:Category:vCentre|Virtual Centre]]&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;[[:Category:ESX|ESX]]&#039;&#039;&#039;&lt;br /&gt;
** [[ESX On ESX]] - Lab in a box&lt;br /&gt;
* &#039;&#039;&#039;[[:Category:Virtual_Machine|Virtual Machines]]&#039;&#039;&#039;&lt;br /&gt;
** [[VMware Converter]], [[OVF Tool]]&lt;br /&gt;
* &#039;&#039;&#039;[[:Category:PowerCLI|PowerCLI]]&#039;&#039;&#039;, &#039;&#039;&#039;[[RemoteCLI]]&#039;&#039;&#039;, &#039;&#039;&#039;[[vSphere Management Assistant|vMA]]&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;[[VMware Server]]&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;[[Lab Manager]]&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;[[:Category:VCP|Certification]]&#039;&#039;&#039;&lt;br /&gt;
** &#039;&#039;&#039;[[VCP5|VCP5 Study Notes]]&#039;&#039;&#039; &lt;br /&gt;
** &#039;&#039;&#039;[[VCP4|VCP4 Study Notes]]&#039;&#039;&#039; &lt;br /&gt;
** &#039;&#039;&#039;[[VCP3|VCP3 Study Notes]]&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;padding:2px;&amp;quot; | &amp;lt;h2 style=&amp;quot;margin:3px; background:#ddeddd; font-size:120%; font-weight:bold; border:1px solid #9EB19E; text-align:left; color:#000; padding:0.2em 0.4em;&amp;quot;&amp;gt;To do&amp;lt;/h2&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;color:#000; padding:2px 5px;&amp;quot; | &amp;lt;div&amp;gt;&lt;br /&gt;
&amp;lt;!-- &amp;lt;addthis /&amp;gt; --&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
| style=&amp;quot;border:1px solid transparent;&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--        MIDDLE CONTENTS COLUMN        --&amp;gt;&lt;br /&gt;
| style=&amp;quot;width:33%; border:1px solid #9eb19e; background:#fafffa; vertical-align:top;&amp;quot;|&lt;br /&gt;
{| style=&amp;quot;width:100%; vertical-align:top; background:#fafffa;&amp;quot;&lt;br /&gt;
! style=&amp;quot;padding:2px;&amp;quot; | &amp;lt;h2 style=&amp;quot;margin:3px; background:#ddeddd; font-size:120%; font-weight:bold; border:1px solid #9EB19E; text-align:left; color:#000; padding:0.2em 0.4em;&amp;quot;&amp;gt;Tools&amp;lt;/h2&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;color:#000; padding:2px 5px 5px;&amp;quot; | &amp;lt;div&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;[[:Category:PowerShell|PowerShell]]&#039;&#039;&#039; - Windows PowerShell&lt;br /&gt;
** &#039;&#039;&#039;[[:Category:PowerCLI|PowerCLI]]&#039;&#039;&#039; - VMware PowerShell module&lt;br /&gt;
** &#039;&#039;&#039;[[SNMP and PowerShell]]&#039;&#039;&#039; - PS SNMP client&lt;br /&gt;
* [[AutoIT]]&lt;br /&gt;
* [[MS-DOS]]&lt;br /&gt;
* [[PHP]]&lt;br /&gt;
* [[RRDTool]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;padding:2px;&amp;quot; | &amp;lt;h2 style=&amp;quot;margin:3px; background:#ddeddd; font-size:120%; font-weight:bold; border:1px solid #9EB19E; text-align:left; color:#000; padding:0.2em 0.4em;&amp;quot;&amp;gt;Operating Systems&amp;lt;/h2&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;color:#000; padding:2px 5px;&amp;quot; | &amp;lt;div&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;[[Windows 7]]&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;[[Windows 2008]]&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;[[:Category:Ubuntu|Ubuntu]]&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;[[Linux]]&#039;&#039;&#039; - Generic commands&lt;br /&gt;
* [[Red Hat]]&lt;br /&gt;
* [[BusyBox]] - Cut-down Linux&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
| style=&amp;quot;border:1px solid transparent;&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--        RIGHT-HAND CONTENTS COLUMN        --&amp;gt;&lt;br /&gt;
| style=&amp;quot;width:33%; border:1px solid #9eb19e; background:#fafffa; vertical-align:top;&amp;quot;|&lt;br /&gt;
{| style=&amp;quot;width:100%; vertical-align:top; background:#fafffa;&amp;quot;&lt;br /&gt;
! style=&amp;quot;padding:2px;&amp;quot; | &amp;lt;h2 style=&amp;quot;margin:3px; background:#ddeddd; font-size:120%; font-weight:bold; border:1px solid #9eb19e; text-align:left; color:#000; padding:0.2em 0.4em;&amp;quot;&amp;gt;[[:Category:Applications|Applications]]&amp;lt;/h2&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;color:#000; padding:2px 5px 5px;&amp;quot; | &amp;lt;div&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;[[:Category:Zimbra|Zimbra]]&#039;&#039;&#039; - Email / collaboration&lt;br /&gt;
** [[Z-Push_v2_with_Zimbra|Z-Push]] - [http://en.wikipedia.org/wiki/ActiveSync ActiveSync] for Zimbra [[Acronyms#F|FOSS]]&lt;br /&gt;
** [[Monitoring Zimbra with Nagios]]&lt;br /&gt;
* &#039;&#039;&#039;[[:Category:Apache|Apache]]&#039;&#039;&#039; - Web server&lt;br /&gt;
* &#039;&#039;&#039;[[:Category:MySQL|MySQL]]&#039;&#039;&#039; - MySQL&lt;br /&gt;
* &#039;&#039;&#039;[[MS SQL]]&#039;&#039;&#039; - Microsoft SQL&lt;br /&gt;
* &#039;&#039;&#039;[[AWStats]]&#039;&#039;&#039; - Website analytics reporting&lt;br /&gt;
* &#039;&#039;&#039;[[Cacti]]&#039;&#039;&#039; - Capacity logging system utilising RRDTool&lt;br /&gt;
* &#039;&#039;&#039;[[Nagios]]&#039;&#039;&#039; - Monitoring system&lt;br /&gt;
* [[Useful Software|Other Useful Software]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;padding:2px;&amp;quot; | &amp;lt;h2 style=&amp;quot;margin:3px; background:#ddeddd; font-size:120%; font-weight:bold; border:1px solid #9EB19E; text-align:left; color:#000; padding:0.2em 0.4em;&amp;quot;&amp;gt;Random Info&amp;lt;/h2&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;color:#000; padding:2px 5px 5px;&amp;quot; | &amp;lt;div&amp;gt;&lt;br /&gt;
* [[:Category:Networking|Networking]]&lt;br /&gt;
* [[Large Memory Pages]]&lt;br /&gt;
* [[Regular Expressions]]&lt;br /&gt;
* [[Acronyms]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;!--        NEW ARTICLES        --&amp;gt;&lt;br /&gt;
&amp;lt;table style=&amp;quot;margin:4px 0 0 0; width:100%; background:none; border-spacing: 0px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;width:100%; border:1px solid #9EB19E; background:#fff5fa; vertical-align:top; color:#000;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;table style=&amp;quot;vertical-align:top; background:#fafffa; color:#000; width:100%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;th style=&amp;quot;padding:2px;&amp;quot;&amp;gt;&amp;lt;h2 style=&amp;quot;margin:3px; background:#ddeddd; font-size:120%; font-weight:bold; border:1px solid #9EB19E; text-align:left; color:#000; padding:0.2em 0.4em&amp;quot;&amp;gt;New Articles&amp;lt;/h2&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;color:#000;&amp;quot;&amp;gt;&amp;lt;div style=&amp;quot;padding:2px 5px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=vWiki&lt;br /&gt;
|keywords=vmware,powershell,powercli,script,windows,ubuntu,mysql,zimbra&lt;br /&gt;
|description=Infrastructure, Virtualisation, and PowerShell wiki&lt;br /&gt;
}}&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2741</id>
		<title>Virtual Machine (KVM)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2741"/>
		<updated>2022-05-06T11:56:46Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Create Server (no GUI) */ Added &amp;quot;Eject CD-ROM&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Note that VMs are known as &#039;&#039;&#039;domains&#039;&#039;&#039; in the KVM world.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
This guide assumes you have a basic working environment, run the &amp;lt;code&amp;gt;kvm-ok&amp;lt;/code&amp;gt; command to sanity check...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@kvm-host:# kvm-ok&lt;br /&gt;
INFO: /dev/kvm exists&lt;br /&gt;
KVM acceleration can be used&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install Media ===&lt;br /&gt;
You need to have a local copy of the appropriate ISO.  If you have the ISO file already, upload to your KVM server, alternatively download from the site using &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Ubuntu Desktop LTS&#039;&#039;&#039; - http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso&lt;br /&gt;
&lt;br /&gt;
== Create Virtual Machine ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter                    !! Example                     !! Usage&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;            || VM-Name                     || Name of virtual machine (typically this should match the intended hostname of the VM)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;     || &amp;quot;Test VM to be used for X&amp;quot;  || Description of virtual machine&#039;s purpose etc&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-type&amp;lt;/code&amp;gt;         || Linux                       || OS family, can be  Linux, Solaris, Unix or Windows&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-variant&amp;lt;/code&amp;gt;      || ubuntu16.04                 || Distribution type for the above (run &amp;lt;code&amp;gt;osinfo-query os&amp;lt;/code&amp;gt; to view what is available)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ram&amp;lt;/code&amp;gt;             || 2048                        || vRAM in GB&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;disk path&amp;lt;/code&amp;gt;       || /vm-store/images/VM-Name.img,bus=virtio,size=50 || Virtual disk path, using virtio bus and with a 50GB disk&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;graphics&amp;lt;/code&amp;gt;        || none                        || If noneset, VM will be created with a serial display output (as opposed to VNC window)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cdrom&amp;lt;/code&amp;gt;           || /home/user/cdrom.iso        || Path to installation ISO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;network&amp;lt;/code&amp;gt;         || bridge:br0                  || Network connection details&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Create Server (no GUI) ===&lt;br /&gt;
Update paths to reflect where install ISO, and where VM disk files are intended to be.  &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--extra-args &amp;quot;console=ttyS0&amp;quot;&amp;lt;/code&amp;gt; option allows a local console to be accessed from the host machine (to allow OS install etc before the VM is on a network), though note that it can&#039;t be used with &amp;lt;code&amp;gt;--cdrom&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;--location&amp;lt;/code&amp;gt; has been used instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name server-name \&lt;br /&gt;
--ram 1024 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics none \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/server-name.img,size=20,bus=virtio \&lt;br /&gt;
--extra-args &amp;quot;console=ttyS0&amp;quot; \&lt;br /&gt;
--location /mnt/md0/kvm/iso/ubuntu-16.04.3-server-amd64.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should be presented with the console of the VM as it installs, however if you lose connection etc, connect to the console of the server using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;.  Make sure you set a static IP and install SSH during setup (select &#039;&#039;&#039;OpenSSH server&#039;&#039;&#039; during &#039;&#039;Software selection&#039;&#039; section). Once installation is completed, SSH to the server and setup normal console access (as the instructions in the section below).  Its highly recommended that you follow the steps below to ensure that Console access is available via the KVM host if needed.&lt;br /&gt;
&lt;br /&gt;
==== Eject CD-ROM ====&lt;br /&gt;
If you need to eject the CD-ROM towards the end o the installation process, first identify the disk target name (eg hda, hdb, etc) then eject&lt;br /&gt;
 virsh edit server-name&lt;br /&gt;
 virsh change-media server-name hda --eject&lt;br /&gt;
&lt;br /&gt;
==== Console Access ====&lt;br /&gt;
# Update the &amp;lt;code&amp;gt;/etc/default/grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Add &amp;lt;code&amp;gt;console=ttyS0&amp;lt;/code&amp;gt; to the config line &amp;lt;code&amp;gt;GRUB_CMDLINE_LINUX_DEFAULT&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;quiet splash console=ttyS0&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update grub&lt;br /&gt;
#* &amp;lt;code&amp;gt;update-grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the guest machine&lt;br /&gt;
&lt;br /&gt;
Connect using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;, you may need to hit Return once to show the logon prompt.&lt;br /&gt;
&lt;br /&gt;
=== Create Workstation (GUI) ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name ubuntu-desktop \&lt;br /&gt;
--ram 2048 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--cdrom=/mnt/md0/kvm/iso/ubuntu-16.04.3-desktop-amd64.iso \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics vnc,listen=0.0.0.0 \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/ubuntu-desktop.img,size=40,bus=virtio&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the command has got as far as &amp;lt;code&amp;gt;Waiting for installation to complete.&amp;lt;/code&amp;gt; you need to connect to the VNC console session, to find the port number to connect on query the config from &#039;&#039;another&#039;&#039; SSH session connected to the host (typically VNC uses ports starting from 5900 upwards).  Cancelling the command causes the VM/domain to power off, which you won&#039;t want to happen until you&#039;ve completed setup of the VM.&lt;br /&gt;
  virsh dumpxml ubuntu-desktop | grep vnc&lt;br /&gt;
&lt;br /&gt;
== Move Virtual Machine ==&lt;br /&gt;
If you want to move your domain/VM to another KVM host and don&#039;t have shared storage you can manually copy the data and VM config across to another host and import it.&lt;br /&gt;
&lt;br /&gt;
# Shutdown the virtual machine&lt;br /&gt;
#* Preferably from the OS so it gets a graceful shutdown, alternatively stop the VM from KVM&lt;br /&gt;
# Export the config&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh dumpxl &amp;lt;VMname&amp;gt; &amp;gt; /tmp/VMName.xml&amp;lt;/code&amp;gt;&lt;br /&gt;
# Copy the VM disk file(s) and config XML to their new host&lt;br /&gt;
#* Disk file(s) should go the location from which your VM&#039;s will run from&lt;br /&gt;
# Update the config, if necessary...&lt;br /&gt;
#* Disk file path - If the VM disks are in a different path on the new server up date the path in the XML file, look for &amp;lt;code&amp;gt;source file=&amp;lt;/code&amp;gt;&lt;br /&gt;
#* CPU type - If the physical CPU type is different on the new host, you may need to update the VM config to allow for this, update the &amp;lt;code&amp;gt;cpu mode&amp;lt;/code&amp;gt; config to match the capabilities of the destination host, or just set to &amp;lt;code&amp;gt;&amp;lt;cpu mode=&#039;host-passthrough&#039;/&amp;gt;&amp;lt;/code&amp;gt;.  See https://www.berrange.com/posts/2018/06/29/cpu-model-configuration-for-qemu-kvm-on-x86-hosts/ for more info.&lt;br /&gt;
# Import the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh define /path/to/VMName.xml &amp;lt;/code&amp;gt;&lt;br /&gt;
# Start the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh start &amp;lt;VMName&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add Disk ==&lt;br /&gt;
# Create new disk image file&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; qemu-img create -f qcow2 /var/lib/libvirt/images/vm-name-disk1.img 20G &amp;lt;/code&amp;gt;&lt;br /&gt;
# Attach disk image to virtual machine&lt;br /&gt;
#* Use &amp;lt;code&amp;gt;df&amp;lt;/code&amp;gt; in the VM to determine next disk label, eg &amp;lt;code&amp;gt;vdb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; qemu-img create -f qcow2 /var/lib/libvirt/images/vm-name-disk1.img 20G -o preallocation=full &amp;lt;/code&amp;gt;&lt;br /&gt;
#** To create a thin provisioned file use the following (however you may find the disk the OS sees is small (~200K), if so, use the command above)&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; virsh attach-disk vm-name /var/lib/libvirt/images/vm-name-disk1.img vdb --cache none &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update file owner and group to match other disk images&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;  chown libvirt-qemu /var/lib/libvirt/images/vm-name-disk1.img &amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;  chgrp libvirt-qemu /var/lib/libvirt/images/vm-name-disk1.img &amp;lt;/code&amp;gt;&lt;br /&gt;
# Attach disk&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh attach-disk --domain vm-name /var/lib/libvirt/images/vm-name-disk1.img --target vdb --persistent --config --live &amp;lt;/code&amp;gt;&lt;br /&gt;
# In the VM, format the disk using defaults..&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; fdisk /dev/vdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Command: n &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Partition type: p, &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Partition number: &amp;lt;default&amp;gt;, &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;First sector: &amp;lt;default&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Last sector: &amp;lt;default&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Command: w &amp;lt;/code&amp;gt;&lt;br /&gt;
# Format new partition&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mkfs.ext4 /dev/vdb1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# Create mount directory&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mkdir /vdb1/ &amp;lt;/code&amp;gt;&lt;br /&gt;
# Mount the the disk&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mount /dev/vdb1 /vdb1/ &amp;lt;/code&amp;gt;&lt;br /&gt;
# Add an appropriate entry to fstab so the disk gets mounted on next boot&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; /dev/vdb1    /vdb1    ext4     defaults    0 0 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other Config ==&lt;br /&gt;
=== Auto Start ===&lt;br /&gt;
To ensure that a VM domain starts with the host server issue the following commands (replace &amp;lt;code&amp;gt;vm-name&amp;lt;/code&amp;gt; with the name of your VM&lt;br /&gt;
 virsh autostart vm-name&lt;br /&gt;
&lt;br /&gt;
To disable issue&lt;br /&gt;
 virsh autostart vm-name --disable&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:KVM]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Ubuntu_(PowerShell)&amp;diff=2740</id>
		<title>Ubuntu (PowerShell)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Ubuntu_(PowerShell)&amp;diff=2740"/>
		<updated>2021-12-05T13:19:02Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: Added Path Permission Error&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Installation ==&lt;br /&gt;
For the latest info, see https://docs.microsoft.com/en-us/powershell/scripting/install/install-ubuntu&lt;br /&gt;
&lt;br /&gt;
 apt install wget apt-transport-https software-properties-common&lt;br /&gt;
 wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb&lt;br /&gt;
 dpkg -i packages-microsoft-prod.deb&lt;br /&gt;
&lt;br /&gt;
=== Path Permission Error ===&lt;br /&gt;
If you get the following error whenever running a command - &#039;&#039;&#039;Error reading or writing history file&#039;&#039;&#039;.  Its likely PowerShell was installed as root, but you&#039;re now running as a standard user, do the following...&lt;br /&gt;
 sudo pwsh&lt;br /&gt;
 $refDir = Resolve-Path &#039;~&#039;&lt;br /&gt;
 $dstDir = Resolve-Path &#039;~/.local/share/powershell&#039;&lt;br /&gt;
 chown -R --reference=$refDir $dstDir&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
Above came from https://github.com/PowerShell/PowerShell/issues/10601&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
To enter the PowerShell command line interface use the following command&lt;br /&gt;
 pwsh&lt;br /&gt;
&lt;br /&gt;
To run a PowerShell script&lt;br /&gt;
 pwsh ./do-something.ps1&lt;br /&gt;
&lt;br /&gt;
[[Category:Ubuntu]]&lt;br /&gt;
[[Category:PowerShell]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Ubuntu_(PowerShell)&amp;diff=2739</id>
		<title>Ubuntu (PowerShell)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Ubuntu_(PowerShell)&amp;diff=2739"/>
		<updated>2021-12-05T07:32:02Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: Initial creation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Installation ==&lt;br /&gt;
For the latest info, see https://docs.microsoft.com/en-us/powershell/scripting/install/install-ubuntu&lt;br /&gt;
&lt;br /&gt;
 apt install wget apt-transport-https software-properties-common&lt;br /&gt;
 wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb&lt;br /&gt;
 dpkg -i packages-microsoft-prod.deb&lt;br /&gt;
&lt;br /&gt;
[[Category:Ubuntu]]&lt;br /&gt;
[[Category:PowerShell]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Backup_MySQL_(Ubuntu)&amp;diff=2738</id>
		<title>Backup MySQL (Ubuntu)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Backup_MySQL_(Ubuntu)&amp;diff=2738"/>
		<updated>2021-01-18T15:06:33Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* The Script */ Updated URL in script&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This backup script is a more elaborate version of the one to found [[MySQL_(Ubuntu)#Backup|here]], this backup script...&lt;br /&gt;
* Backs up all databases on a server&lt;br /&gt;
** You can exclude databases if required&lt;br /&gt;
* Only backs up databases that have changed since the last backup&lt;br /&gt;
* FTP&#039;s backup&#039;s off to server (uses [http://lftp.yar.ru/ &amp;lt;code&amp;gt;lftp&amp;lt;/code&amp;gt;], install with &amp;lt;code&amp;gt;apt-get install lftp&amp;lt;/code&amp;gt;)&lt;br /&gt;
** Can use [[Acronyms#F|FTPS]] for secure backup transfer&lt;br /&gt;
&lt;br /&gt;
=== Set-up === &lt;br /&gt;
# Create the required folders using...&lt;br /&gt;
#* &amp;lt;code&amp;gt; mkdir backup &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; mkdir backup/mysql &amp;lt;/code&amp;gt;&lt;br /&gt;
# Create the file below (editing as required) as &amp;lt;code&amp;gt; /backup/mysql.sh &amp;lt;/code&amp;gt;&lt;br /&gt;
# Make the file executable&lt;br /&gt;
#* &amp;lt;code&amp;gt; chmod +x /backup/mysql.sh &amp;lt;/code&amp;gt;&lt;br /&gt;
# Perform a test run of the backup&lt;br /&gt;
# Schedule the script to run with crontab&lt;br /&gt;
#* &amp;lt;code&amp;gt; crontab -e &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; 30 1 * * *      /bin/bash       /backup/mysql.sh &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To create a MySQL user with limited privileges to run the backup with use...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;mysql&amp;quot;&amp;gt;&lt;br /&gt;
GRANT SELECT,LOCK TABLES ON *.* TO backup@&#039;localhost&#039; IDENTIFIED BY &#039;password&#039;;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The Script ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# MySQL Database backup script&lt;br /&gt;
#&lt;br /&gt;
# Simon Strutt (Apr 2012)&lt;br /&gt;
#&lt;br /&gt;
# See https://vwiki.co.uk/Backup_MySQL_(Ubuntu)&lt;br /&gt;
&lt;br /&gt;
### MySQL Server Login and local backup info ###&lt;br /&gt;
MUSER=&amp;quot;backup&amp;quot;                          # MySQL user&lt;br /&gt;
MPASS=&amp;quot;password&amp;quot;                        # MySQL password&lt;br /&gt;
MHOST=&amp;quot;localhost&amp;quot;&lt;br /&gt;
MYSQL=&amp;quot;$(which mysql)&amp;quot;&lt;br /&gt;
MYSQLDUMP=&amp;quot;$(which mysqldump)&amp;quot;&lt;br /&gt;
BAK=&amp;quot;/backup/mysql/data&amp;quot;                # Where backups will go&lt;br /&gt;
STAMPS=&amp;quot;/backup/mysql/stamps&amp;quot;           # Where last backup timestamps go&lt;br /&gt;
LOG=&amp;quot;/backup/mysql.log&amp;quot;&lt;br /&gt;
GZIP=&amp;quot;$(which gzip)&amp;quot;&lt;br /&gt;
NOW=$(date -u +%Y%m%d)&lt;br /&gt;
DBS2EXCLUDE=&amp;quot;Syslog&amp;quot;                    # Databases to exclude (; seperated, eg db1;db2)&lt;br /&gt;
&lt;br /&gt;
## FTP info&lt;br /&gt;
FTPDIR=&amp;quot;/backup/server1/db&amp;quot;             # Folder path on FTP server&lt;br /&gt;
FTPUSER=&amp;quot;backup-user&amp;quot;                   # FTP username&lt;br /&gt;
FTPPASS=&amp;quot;backup-pass&amp;quot;                   # FTP password&lt;br /&gt;
FTPSERVER=&amp;quot;ftp.domain.com&amp;quot;              # FTP server name/IP&lt;br /&gt;
FTPS=0                                  # Set to 1 enable FTP over SSL/TLS&lt;br /&gt;
&lt;br /&gt;
## Functions&lt;br /&gt;
Logger()&lt;br /&gt;
{&lt;br /&gt;
        echo `date &amp;quot;+%a %d/%m/%y %H:%M:%S&amp;quot;`: $1 &amp;gt;&amp;gt; $LOG&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
## Main Script&lt;br /&gt;
Logger &amp;quot;Started backup script...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Create folders that don&#039;t exist&lt;br /&gt;
[ ! -d $BAK ] &amp;amp;&amp;amp; mkdir -p $BAK&lt;br /&gt;
[ ! -d $STAMPS ] &amp;amp;&amp;amp; mkdir -p $STAMPS&lt;br /&gt;
[ ! -d $BAK/prev ] &amp;amp;&amp;amp; mkdir -p $BAK/prev&lt;br /&gt;
&lt;br /&gt;
# Move previous backups to tmp dir&lt;br /&gt;
#mv $BAK/*.gz $BAK/tmp&lt;br /&gt;
&lt;br /&gt;
DBS=&amp;quot;$($MYSQL -u $MUSER -h $MHOST -p$MPASS -Bse &#039;show databases&#039;)&amp;quot;&lt;br /&gt;
for db in $DBS&lt;br /&gt;
do&lt;br /&gt;
    # Check db shouldn&#039;t be excluded from backup&lt;br /&gt;
    if echo &amp;quot;${DBS2EXCLUDE}&amp;quot; | grep -q ${db}&lt;br /&gt;
    then&lt;br /&gt;
        Logger &amp;quot;$db backup excluded, skipping&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
        # Is backup required?&lt;br /&gt;
        DBUPDATE=`mysql -u $MUSER -h $MHOST -p$MPASS -Bse &amp;quot;SELECT max(update_time) FROM information_schema.tables WHERE table_schema=&#039;${db}&#039;&amp;quot;`&lt;br /&gt;
        DBUPDATEU=`date --date &amp;quot;${DBUPDATE}&amp;quot; +%s`&lt;br /&gt;
        #Logger &amp;quot;$db last update was $DBUPDATE&amp;quot;&lt;br /&gt;
        if [ -f ${STAMPS}/${db} ]&lt;br /&gt;
        then&lt;br /&gt;
            BAKDATE=`cat ${STAMPS}/${db}`&lt;br /&gt;
            BAKDATEU=`date --date &amp;quot;${BAKDATE}&amp;quot; +%s`&lt;br /&gt;
            #Logger &amp;quot;$db last backup was $BAKDATE&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
            BAKDATEU=0&lt;br /&gt;
            Logger &amp;quot;$db no last backup stamp&amp;quot;&lt;br /&gt;
        fi&lt;br /&gt;
        if [ &amp;quot;${DBUPDATEU}&amp;quot; -gt &amp;quot;${BAKDATEU}&amp;quot; ]&lt;br /&gt;
        then&lt;br /&gt;
            # Backup db (move previous to prev, and write stamp file first)&lt;br /&gt;
            rm -f $BAK/prev/$db.*.gz&lt;br /&gt;
            [ -f $BAK/$db.*.gz ] &amp;amp;&amp;amp; mv $BAK/$db.*.gz $BAK/prev&lt;br /&gt;
            FILE=$BAK/$db.$NOW.gz&lt;br /&gt;
            Logger &amp;quot;$db backing up to $FILE&amp;quot;&lt;br /&gt;
            date +&#039;%F %T&#039; &amp;gt; $STAMPS/$db&lt;br /&gt;
            $MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS --skip-lock-tables $db | $GZIP -9 &amp;gt; $FILE&lt;br /&gt;
            RETURNVALUE=$?&lt;br /&gt;
            if [ ! &amp;quot;${RETURNVALUE}&amp;quot; == &amp;quot;0&amp;quot; ]; then&lt;br /&gt;
                Logger &amp;quot;$db backup experienced error (${RETURNVALUE})&amp;quot;&lt;br /&gt;
                rm $STAMPS/$db&lt;br /&gt;
            fi&lt;br /&gt;
        else&lt;br /&gt;
            Logger &amp;quot;$db backup not required (last backup $BAKDATE, last db update $DBUPDATE)&amp;quot;&lt;br /&gt;
        fi&lt;br /&gt;
    fi&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
Logger &amp;quot;Completed local backup&amp;quot;&lt;br /&gt;
&lt;br /&gt;
## FTP to remote server&lt;br /&gt;
if [ ${FTPS} == 0 ]&lt;br /&gt;
then&lt;br /&gt;
    lftp -u ${FTPUSER},${FTPPASS} -e &amp;quot;set net:max-retries 5; cd ${FTPDIR}; mput ${BAK}/*.gz; exit&amp;quot; ${FTPSERVER}&lt;br /&gt;
else&lt;br /&gt;
    lftp -u ${FTPUSER},${FTPPASS} -e &amp;quot;set ftp:ssl-force true,ftp:ssl-protect-data true,net:max-retries 5; cd ${FTPDIR}; mput ${BAK}/*.gz; exit&amp;quot; ${FTPSERVER}&lt;br /&gt;
fi&lt;br /&gt;
RETURNVALUE=$?&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;${RETURNVALUE}&amp;quot; == &amp;quot;0&amp;quot; ]; then&lt;br /&gt;
 Logger &amp;quot;FTP upload completed successfully&amp;quot;&lt;br /&gt;
else&lt;br /&gt;
 Logger &amp;quot;FTP upload failed !!!&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;----------------------------------------------&amp;quot; &amp;gt;&amp;gt; $LOG&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:MySQL]]&lt;br /&gt;
[[category:Ubuntu]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2737</id>
		<title>Installation (Ubuntu)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2737"/>
		<updated>2020-10-08T07:42:35Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Persistent Route */ Typo fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Whilst this page was written with the installation of a Ubuntu Server 10.04 LTS in mind, it can also be used for Ubuntu 12.&lt;br /&gt;
&lt;br /&gt;
== Prepare Virtual Machine ==&lt;br /&gt;
# Create a virtual machine with the following options (use Custom)&lt;br /&gt;
#* Guest OS: Linux &amp;gt; Ubuntu 64bit&lt;br /&gt;
#* CPU: 1&lt;br /&gt;
#* Memory: 512 MB&lt;br /&gt;
#* Disk: 36GB&lt;br /&gt;
# Then add a second 36GB disk on a separate physical datastore (if you intend to use software RAID)&lt;br /&gt;
# Attach Ubuntu install ISO to the CD-ROM&lt;br /&gt;
&lt;br /&gt;
Note that the specs above should be altered to suit your purposes.  Whilst there is no need to use a 64 bit OS as opposed to 32 bit if you don&#039;t need to address lots of memory, it is standard these days. &lt;br /&gt;
&lt;br /&gt;
== OS Installation ==&lt;br /&gt;
Installing Ubuntu Server (LTS) is relatively painless, its generally a case of following the default or sensible choices for your locale.  However, below are step-by-step instructions, which you probably won&#039;t require, but may help if you&#039;re not familiar with the terminology.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re completely new make sure you read through the instructions 1st, so that you&#039;re prepared for the information you&#039;ll need to provide.&lt;br /&gt;
&lt;br /&gt;
# Select language for installer&lt;br /&gt;
# Select &#039;&#039;&#039;Install Ubuntu Server&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Choose Language&#039;&#039;&#039; screens &lt;br /&gt;
## Select language for server (and remainder of the installer)&lt;br /&gt;
## Select location&lt;br /&gt;
# &#039;&#039;&#039;Ubuntu Installer Main Menu&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; for questions to determine appropriate keyboard, or &#039;&#039;No&#039;&#039; to just select a keyboard layout&lt;br /&gt;
# &#039;&#039;&#039;Configure the network&#039;&#039;&#039; screen&lt;br /&gt;
## Enter the hostname for the server (not a FQDN, so &amp;lt;code&amp;gt;hostname&amp;lt;/code&amp;gt; rather than &amp;lt;code&amp;gt;hostname.domain.com&amp;lt;/code&amp;gt;)&lt;br /&gt;
# &#039;&#039;&#039;Configure the clock&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to accept the suggested timezone, or &#039;&#039;No&#039;&#039; to alter&lt;br /&gt;
# &#039;&#039;&#039;Partition disks&#039;&#039;&#039; screens&lt;br /&gt;
#* If you want to install the server onto software [[Acronyms#R|RAID]]&#039;ed disks see [[#Install on Software RAID|Install on Software RAID]]&lt;br /&gt;
## Select &#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&lt;br /&gt;
## Select the disk to partition and install the OS onto&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks and configure LVM&#039;&#039;&lt;br /&gt;
## Accept the full amount to partition&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Set up users and passwords&#039;&#039;&#039; screens&lt;br /&gt;
## Enter your name&lt;br /&gt;
## Enter your username (that you will use to login with)&lt;br /&gt;
## Enter your password&lt;br /&gt;
##* If you use a weak password (eg less that 8 characters) you&#039;ll be asked to confirm this is OK once you&#039;ve verified it&lt;br /&gt;
## Re-enter (verify) your password&lt;br /&gt;
## Select &#039;&#039;No&#039;&#039; to not &#039;&#039;Encrypt your home drive&#039;&#039;&lt;br /&gt;
##* If you are really worried about your dat being compromised you should consider encrypting the whole drive during its partitioning&lt;br /&gt;
# &#039;&#039;&#039;Configure the package manager&#039;&#039;&#039; screen&lt;br /&gt;
## Enter proxy server details if required for server to access the internet for updates&lt;br /&gt;
# &#039;&#039;&#039;Select and install software&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;No automatic updates&#039;&#039; if you want to control how updates are applied yourself, otherwise select &#039;&#039;Install security updates automatically&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Software selection&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;&#039;OpenSSH Server&#039;&#039;&#039; (press [Space] when item is highlighted), this allows you to Putty/SSH to the server&lt;br /&gt;
## Select any other required software, eg&lt;br /&gt;
##* DNS Server - Only required if you want your server to be a DNS server; or in order to configure split DNS, which is required for an exchange server install&lt;br /&gt;
##* LAMP Server - Only required for Apache webserver (with MySQL and PHP)&lt;br /&gt;
# &#039;&#039;&#039;Configuring grub-pc&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Install the GRUB boot loader to the master boot record&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Finish the installation&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Continue&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Install on Software RAID ===&lt;br /&gt;
On the &#039;&#039;&#039;Partition Disks&#039;&#039;&#039; screens use the following to setup software RAID during OS installation.&lt;br /&gt;
&lt;br /&gt;
* If setting up software RAID follow the steps below, otherwise just select &#039;&#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&#039;&lt;br /&gt;
# Select &#039;&#039;&#039;&amp;quot;Manual&#039;&#039;&#039;&lt;br /&gt;
# Then create a partition...&lt;br /&gt;
## Select the first disk (&#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;) and on the next screen, &#039;&#039;&#039;Yes&#039;&#039;&#039;, to &#039;&#039;&#039;Create new empty partition table on this device?&#039;&#039;&#039;&lt;br /&gt;
## Select the FREE SPACE, then &#039;&#039;&#039;Create a new Partition&#039;&#039;&#039;, and use all but the last 2GB of space, &lt;br /&gt;
## And then select type of &#039;&#039;&#039;Primary&#039;&#039;&#039;, and create at &#039;&#039;&#039;Beginning&#039;&#039;&#039;&lt;br /&gt;
## Change &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, and change the &#039;&#039;&#039;&#039;&#039;Bootable flag&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;Yes&#039;&#039;&#039;, the select &#039;&#039;&#039;Done setting up this partition&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above on the remaining FREE SPACE on &#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;, to create another primary &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, but &#039;&#039;&#039;&#039;not&#039;&#039; bootable&#039;&#039;&#039;&lt;br /&gt;
# Select the second disk, &amp;lt;code&amp;gt;sdb&amp;lt;/code&amp;gt;, and repeat the steps taken for &amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt; to create two identical partitions&lt;br /&gt;
# On the same screen, select the &#039;&#039;&#039;Configure Software RAID&#039;&#039;&#039; option (at the top), and then confirm through the next screen&lt;br /&gt;
# Create a RAID pack/multidisk...&lt;br /&gt;
## Select &#039;&#039;&#039;Create MD device&#039;&#039;&#039;, then select &#039;&#039;&#039;RAID1&#039;&#039;&#039; (ie a mirror), then confirm 2 &#039;&#039;Active devices&#039;&#039;, and 0 &#039;&#039;Spare devices&#039;&#039;&lt;br /&gt;
## Select both &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda1&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb1&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions, and then select &#039;&#039;&#039;Finish&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above to create a RAID volume using &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda2&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb2&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions&lt;br /&gt;
# Now select the RAID device #0 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Ext3...&#039;&#039;&#039;&lt;br /&gt;
# Change the &#039;&#039;&#039;&#039;&#039;Mount point&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;/&#039;&#039;&#039;, then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039;&lt;br /&gt;
# Now select the RAID device #1 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Swap area&#039;&#039;&#039;&lt;br /&gt;
# Then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039; then finally &#039;&#039;&#039;Finish partitioning and write changes to disk&#039;&#039;&#039;, and confirm to &#039;&#039;&#039;Write the changes to disks&#039;&#039;&#039;&lt;br /&gt;
# Accept the &amp;quot;The kernel was unable to re-read...system will need to restart&amp;quot; complaints for each RAID multidisk, after which the install will continue (note there&#039;s a little more to do post install to ensure you can boot using the second disk should the first fail).&lt;br /&gt;
&lt;br /&gt;
Much of this page was originally borrowed heavily from the following pages - they are well worth a read! &lt;br /&gt;
* http://www.howtoforge.com/perfect-server-ubuntu8.04-lts&lt;br /&gt;
* http://www.howtoforge.com/how-to-install-ubuntu8.04-with-software-raid1&lt;br /&gt;
&lt;br /&gt;
== Post OS Install Config ==&lt;br /&gt;
=== Enable Root ===&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd root &amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
For Ubuntu 18...&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd&amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
=== Finish Software RAID config ===&lt;br /&gt;
&#039;&#039;&#039; Only if configured during install &#039;&#039;&#039;&lt;br /&gt;
# Start-up grub (by entering &amp;lt;code&amp;gt; grub &amp;lt;/code&amp;gt; and enter the following commands (seems to work better via SSH than direct console)...&lt;br /&gt;
#* &amp;lt;code&amp;gt; device (hd1) /dev/sdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; root (hd1,0) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; setup (hd1) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; quit &amp;lt;/code&amp;gt;&lt;br /&gt;
# Then edit the &amp;lt;code&amp;gt; /boot/grub/menu.lst &amp;lt;/code&amp;gt; config file.  Go to the end of the file where the boot options are, and create a copy of the first option and edit the following lines&lt;br /&gt;
#* &amp;lt;code&amp;gt; title &amp;lt;/code&amp;gt; Add &amp;quot;Primary disk fail&amp;quot; or something similar to end&lt;br /&gt;
#* &amp;lt;code&amp;gt; root &amp;lt;/code&amp;gt; Change &amp;lt;code&amp;gt; hd0 &amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt; hd1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# To check the RAID setup of your drives use&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md0 &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md1 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Change IP Address (Pre v18) ==&lt;br /&gt;
=== v8 Hardy Heron / v10 Lucid Lynx ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        network 192.168.1.0&lt;br /&gt;
        broadcast 192.168.1.255&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Check that DNS resolution is setup correctly in &amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt;.  Add additional DNS nameservers as required, as found in in order of preference.  You can also add the domain of the server (&amp;lt;code&amp;gt;domain&amp;lt;/code&amp;gt;), and add domain suffix searches (&amp;lt;code&amp;gt;search&amp;lt;/code&amp;gt;), both are optional.  For example...&lt;br /&gt;
 nameserver 192.168.1.20&lt;br /&gt;
 nameserver 127.0.0.1&lt;br /&gt;
 domain domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; /etc/init.d/networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== v12 Precise Pangolin ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&lt;br /&gt;
dns-nameservers 192.168.1.20 8.8.8.8&lt;br /&gt;
dns-domain localdomain.com&lt;br /&gt;
dns-search localdomain.com anotherdomain.com&lt;br /&gt;
        &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; service networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network interface config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* Confirm DNS config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;less /etc/resolv.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Persistent Route ===&lt;br /&gt;
To add a persistent route to an interface, add using the following syntax (example sends traffic to 172.32.1.0/24 via eth1 to 192.168.1.100&lt;br /&gt;
&lt;br /&gt;
 up route add -net 172.32.1.0/24 gw 192.168.1.100 dev eth1&lt;br /&gt;
&lt;br /&gt;
=== Additional IPs / Multihome ===&lt;br /&gt;
To add additional IP addresses to an interface, create sub-interfaces as below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto eth0:1&lt;br /&gt;
auto eth0:2 &lt;br /&gt;
&lt;br /&gt;
# Sub 1&lt;br /&gt;
iface eth0:1 inet static&lt;br /&gt;
    address 192.168.1.160&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
# Sub 2&lt;br /&gt;
iface eth0:2 inet static&lt;br /&gt;
    address 192.168.1.161&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;RTNETLINK answers: File exists&#039;&#039;&#039; - Note that you can&#039;t use the same default gateway twice, doing so will cause this error&lt;br /&gt;
&lt;br /&gt;
== Change IP Address (v18 onwards) ==&lt;br /&gt;
Ubuntu now uses [https://netplan.io Netplan], do not use the &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; config file, use either &amp;lt;code&amp;gt;/etc/netplan/01-netcfg.yaml&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;/etc/netplan/50-cloud-init.yaml&amp;lt;/code&amp;gt;. Formatting is very important with YAML files, indents especially.&lt;br /&gt;
&lt;br /&gt;
# Find the interface name (eg &amp;lt;code&amp;gt;ens2&amp;lt;/code&amp;gt;)&lt;br /&gt;
#* &amp;lt;code&amp;gt; ip link &amp;lt;/code&amp;gt;&lt;br /&gt;
# Edit the &amp;lt;code&amp;gt;/etc/netplan/01-netcfg.yaml&amp;lt;/code&amp;gt; config file as show below&lt;br /&gt;
# Apply the changes&lt;br /&gt;
#* &amp;lt;code&amp;gt; netplan apply&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
network:&lt;br /&gt;
  version: 2&lt;br /&gt;
  renderer: networkd&lt;br /&gt;
  ethernets:&lt;br /&gt;
    ens2:&lt;br /&gt;
      dhcp4: no&lt;br /&gt;
      addresses:&lt;br /&gt;
        - 192.168.1.50/24&lt;br /&gt;
      gateway4: 192.168.1.1&lt;br /&gt;
      nameservers:&lt;br /&gt;
          addresses: [192.168.1.1,8.8.8.8]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Persistent Route ===&lt;br /&gt;
To add a persistent route to an interface, add using the following syntax (example sends traffic to 172.32.1.0/24 via eth1 to 192.168.2.100) to add the &amp;lt;code&amp;gt;routes&amp;lt;/code&amp;gt; config to the interface the traffic should go through.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    ens2:&lt;br /&gt;
      addresses:&lt;br /&gt;
        - 192.168.2.50/24&lt;br /&gt;
      dhcp4: no&lt;br /&gt;
      routes:&lt;br /&gt;
        - to: 172.32.1.0/24&lt;br /&gt;
          via: 192.168.2.100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Update the OS == &lt;br /&gt;
# Run the following command to update the apt package database&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
# To install any updates&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
#* If updates are being held back (eg linux image), then use &amp;lt;code&amp;gt; aptitude safe-upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
# If running in VMware VM, [[VM Tools_Install_(Ubuntu)|install VM Tools]]&lt;br /&gt;
&lt;br /&gt;
=== Remove Old Version ===&lt;br /&gt;
Old kernel images will tend to linger in &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; and source code will remain in &amp;lt;code&amp;gt;/user/src&amp;lt;/code&amp;gt;.  These can be safely removed so long as you&#039;re completely certain which you are using (normally the latest)&lt;br /&gt;
# Get the versions currently installed&lt;br /&gt;
#* &amp;lt;code&amp;gt;dpkg --get-selections | grep linux-image&amp;lt;/code&amp;gt;&lt;br /&gt;
# Remove unwanted versions (don&#039;t remove the current or base/unversioned image)&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;apt-get purge linux-image-3.2.0-32-virtual &amp;lt;/code&amp;gt;&lt;br /&gt;
#* If you&#039;ve got lots to remove its easier to do lots in one go&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; apt-get purge linux-image-3.2.0-51-virtual linux-image-3.2.0-52-virtual &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove old source, just delete manually,&lt;br /&gt;
* EG &amp;lt;code&amp;gt; rm -fr /usr/src/linux-headers-3.2.0-51 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NTP ==&lt;br /&gt;
&#039;&#039;Not required if your server doesn&#039;t really need bang on accurate time&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Out of the box your server will sync every time its restarted and drift a bit in-between.  There is an additional resource demand in running the NTP daemon so unless you need to, there&#039;s no need to install the full blown NTP daemon.&lt;br /&gt;
&lt;br /&gt;
I tend to have one or two servers updating from remote (public) servers, and then all others updating from those.&lt;br /&gt;
&lt;br /&gt;
# Install the service&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update the NTP config file, &amp;lt;code&amp;gt; /etc/ntp.conf &amp;lt;/code&amp;gt; (Example below is for a server updating from public European servers - see http://www.pool.ntp.org/)&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 0.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 1.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 2.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 3.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the NTP service&lt;br /&gt;
#* &amp;lt;code&amp;gt; systemctl restart ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Verify using the following commands&lt;br /&gt;
#* &amp;lt;code&amp;gt; ntpq -np &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; date &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Ubuntu]]&lt;br /&gt;
[[Category:Virtual Machine]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2736</id>
		<title>Installation (Ubuntu)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2736"/>
		<updated>2020-10-08T07:42:18Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Change IP Address (v18 onwards) */ Added Persistent Route&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Whilst this page was written with the installation of a Ubuntu Server 10.04 LTS in mind, it can also be used for Ubuntu 12.&lt;br /&gt;
&lt;br /&gt;
== Prepare Virtual Machine ==&lt;br /&gt;
# Create a virtual machine with the following options (use Custom)&lt;br /&gt;
#* Guest OS: Linux &amp;gt; Ubuntu 64bit&lt;br /&gt;
#* CPU: 1&lt;br /&gt;
#* Memory: 512 MB&lt;br /&gt;
#* Disk: 36GB&lt;br /&gt;
# Then add a second 36GB disk on a separate physical datastore (if you intend to use software RAID)&lt;br /&gt;
# Attach Ubuntu install ISO to the CD-ROM&lt;br /&gt;
&lt;br /&gt;
Note that the specs above should be altered to suit your purposes.  Whilst there is no need to use a 64 bit OS as opposed to 32 bit if you don&#039;t need to address lots of memory, it is standard these days. &lt;br /&gt;
&lt;br /&gt;
== OS Installation ==&lt;br /&gt;
Installing Ubuntu Server (LTS) is relatively painless, its generally a case of following the default or sensible choices for your locale.  However, below are step-by-step instructions, which you probably won&#039;t require, but may help if you&#039;re not familiar with the terminology.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re completely new make sure you read through the instructions 1st, so that you&#039;re prepared for the information you&#039;ll need to provide.&lt;br /&gt;
&lt;br /&gt;
# Select language for installer&lt;br /&gt;
# Select &#039;&#039;&#039;Install Ubuntu Server&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Choose Language&#039;&#039;&#039; screens &lt;br /&gt;
## Select language for server (and remainder of the installer)&lt;br /&gt;
## Select location&lt;br /&gt;
# &#039;&#039;&#039;Ubuntu Installer Main Menu&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; for questions to determine appropriate keyboard, or &#039;&#039;No&#039;&#039; to just select a keyboard layout&lt;br /&gt;
# &#039;&#039;&#039;Configure the network&#039;&#039;&#039; screen&lt;br /&gt;
## Enter the hostname for the server (not a FQDN, so &amp;lt;code&amp;gt;hostname&amp;lt;/code&amp;gt; rather than &amp;lt;code&amp;gt;hostname.domain.com&amp;lt;/code&amp;gt;)&lt;br /&gt;
# &#039;&#039;&#039;Configure the clock&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to accept the suggested timezone, or &#039;&#039;No&#039;&#039; to alter&lt;br /&gt;
# &#039;&#039;&#039;Partition disks&#039;&#039;&#039; screens&lt;br /&gt;
#* If you want to install the server onto software [[Acronyms#R|RAID]]&#039;ed disks see [[#Install on Software RAID|Install on Software RAID]]&lt;br /&gt;
## Select &#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&lt;br /&gt;
## Select the disk to partition and install the OS onto&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks and configure LVM&#039;&#039;&lt;br /&gt;
## Accept the full amount to partition&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Set up users and passwords&#039;&#039;&#039; screens&lt;br /&gt;
## Enter your name&lt;br /&gt;
## Enter your username (that you will use to login with)&lt;br /&gt;
## Enter your password&lt;br /&gt;
##* If you use a weak password (eg less that 8 characters) you&#039;ll be asked to confirm this is OK once you&#039;ve verified it&lt;br /&gt;
## Re-enter (verify) your password&lt;br /&gt;
## Select &#039;&#039;No&#039;&#039; to not &#039;&#039;Encrypt your home drive&#039;&#039;&lt;br /&gt;
##* If you are really worried about your dat being compromised you should consider encrypting the whole drive during its partitioning&lt;br /&gt;
# &#039;&#039;&#039;Configure the package manager&#039;&#039;&#039; screen&lt;br /&gt;
## Enter proxy server details if required for server to access the internet for updates&lt;br /&gt;
# &#039;&#039;&#039;Select and install software&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;No automatic updates&#039;&#039; if you want to control how updates are applied yourself, otherwise select &#039;&#039;Install security updates automatically&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Software selection&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;&#039;OpenSSH Server&#039;&#039;&#039; (press [Space] when item is highlighted), this allows you to Putty/SSH to the server&lt;br /&gt;
## Select any other required software, eg&lt;br /&gt;
##* DNS Server - Only required if you want your server to be a DNS server; or in order to configure split DNS, which is required for an exchange server install&lt;br /&gt;
##* LAMP Server - Only required for Apache webserver (with MySQL and PHP)&lt;br /&gt;
# &#039;&#039;&#039;Configuring grub-pc&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Install the GRUB boot loader to the master boot record&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Finish the installation&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Continue&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Install on Software RAID ===&lt;br /&gt;
On the &#039;&#039;&#039;Partition Disks&#039;&#039;&#039; screens use the following to setup software RAID during OS installation.&lt;br /&gt;
&lt;br /&gt;
* If setting up software RAID follow the steps below, otherwise just select &#039;&#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&#039;&lt;br /&gt;
# Select &#039;&#039;&#039;&amp;quot;Manual&#039;&#039;&#039;&lt;br /&gt;
# Then create a partition...&lt;br /&gt;
## Select the first disk (&#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;) and on the next screen, &#039;&#039;&#039;Yes&#039;&#039;&#039;, to &#039;&#039;&#039;Create new empty partition table on this device?&#039;&#039;&#039;&lt;br /&gt;
## Select the FREE SPACE, then &#039;&#039;&#039;Create a new Partition&#039;&#039;&#039;, and use all but the last 2GB of space, &lt;br /&gt;
## And then select type of &#039;&#039;&#039;Primary&#039;&#039;&#039;, and create at &#039;&#039;&#039;Beginning&#039;&#039;&#039;&lt;br /&gt;
## Change &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, and change the &#039;&#039;&#039;&#039;&#039;Bootable flag&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;Yes&#039;&#039;&#039;, the select &#039;&#039;&#039;Done setting up this partition&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above on the remaining FREE SPACE on &#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;, to create another primary &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, but &#039;&#039;&#039;&#039;not&#039;&#039; bootable&#039;&#039;&#039;&lt;br /&gt;
# Select the second disk, &amp;lt;code&amp;gt;sdb&amp;lt;/code&amp;gt;, and repeat the steps taken for &amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt; to create two identical partitions&lt;br /&gt;
# On the same screen, select the &#039;&#039;&#039;Configure Software RAID&#039;&#039;&#039; option (at the top), and then confirm through the next screen&lt;br /&gt;
# Create a RAID pack/multidisk...&lt;br /&gt;
## Select &#039;&#039;&#039;Create MD device&#039;&#039;&#039;, then select &#039;&#039;&#039;RAID1&#039;&#039;&#039; (ie a mirror), then confirm 2 &#039;&#039;Active devices&#039;&#039;, and 0 &#039;&#039;Spare devices&#039;&#039;&lt;br /&gt;
## Select both &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda1&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb1&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions, and then select &#039;&#039;&#039;Finish&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above to create a RAID volume using &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda2&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb2&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions&lt;br /&gt;
# Now select the RAID device #0 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Ext3...&#039;&#039;&#039;&lt;br /&gt;
# Change the &#039;&#039;&#039;&#039;&#039;Mount point&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;/&#039;&#039;&#039;, then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039;&lt;br /&gt;
# Now select the RAID device #1 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Swap area&#039;&#039;&#039;&lt;br /&gt;
# Then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039; then finally &#039;&#039;&#039;Finish partitioning and write changes to disk&#039;&#039;&#039;, and confirm to &#039;&#039;&#039;Write the changes to disks&#039;&#039;&#039;&lt;br /&gt;
# Accept the &amp;quot;The kernel was unable to re-read...system will need to restart&amp;quot; complaints for each RAID multidisk, after which the install will continue (note there&#039;s a little more to do post install to ensure you can boot using the second disk should the first fail).&lt;br /&gt;
&lt;br /&gt;
Much of this page was originally borrowed heavily from the following pages - they are well worth a read! &lt;br /&gt;
* http://www.howtoforge.com/perfect-server-ubuntu8.04-lts&lt;br /&gt;
* http://www.howtoforge.com/how-to-install-ubuntu8.04-with-software-raid1&lt;br /&gt;
&lt;br /&gt;
== Post OS Install Config ==&lt;br /&gt;
=== Enable Root ===&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd root &amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
For Ubuntu 18...&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd&amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
=== Finish Software RAID config ===&lt;br /&gt;
&#039;&#039;&#039; Only if configured during install &#039;&#039;&#039;&lt;br /&gt;
# Start-up grub (by entering &amp;lt;code&amp;gt; grub &amp;lt;/code&amp;gt; and enter the following commands (seems to work better via SSH than direct console)...&lt;br /&gt;
#* &amp;lt;code&amp;gt; device (hd1) /dev/sdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; root (hd1,0) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; setup (hd1) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; quit &amp;lt;/code&amp;gt;&lt;br /&gt;
# Then edit the &amp;lt;code&amp;gt; /boot/grub/menu.lst &amp;lt;/code&amp;gt; config file.  Go to the end of the file where the boot options are, and create a copy of the first option and edit the following lines&lt;br /&gt;
#* &amp;lt;code&amp;gt; title &amp;lt;/code&amp;gt; Add &amp;quot;Primary disk fail&amp;quot; or something similar to end&lt;br /&gt;
#* &amp;lt;code&amp;gt; root &amp;lt;/code&amp;gt; Change &amp;lt;code&amp;gt; hd0 &amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt; hd1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# To check the RAID setup of your drives use&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md0 &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md1 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Change IP Address (Pre v18) ==&lt;br /&gt;
=== v8 Hardy Heron / v10 Lucid Lynx ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        network 192.168.1.0&lt;br /&gt;
        broadcast 192.168.1.255&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Check that DNS resolution is setup correctly in &amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt;.  Add additional DNS nameservers as required, as found in in order of preference.  You can also add the domain of the server (&amp;lt;code&amp;gt;domain&amp;lt;/code&amp;gt;), and add domain suffix searches (&amp;lt;code&amp;gt;search&amp;lt;/code&amp;gt;), both are optional.  For example...&lt;br /&gt;
 nameserver 192.168.1.20&lt;br /&gt;
 nameserver 127.0.0.1&lt;br /&gt;
 domain domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; /etc/init.d/networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== v12 Precise Pangolin ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&lt;br /&gt;
dns-nameservers 192.168.1.20 8.8.8.8&lt;br /&gt;
dns-domain localdomain.com&lt;br /&gt;
dns-search localdomain.com anotherdomain.com&lt;br /&gt;
        &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; service networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network interface config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* Confirm DNS config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;less /etc/resolv.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Persistent Route ===&lt;br /&gt;
To add a persistent route to an interface, add using the following syntax (example sends traffic to 172.32.1.0/24 via eth1 to 192.168.1.100&lt;br /&gt;
&lt;br /&gt;
 up route add -net 172.32.1.0/24 gw 192.168.1.100 dev eth1&lt;br /&gt;
&lt;br /&gt;
=== Additional IPs / Multihome ===&lt;br /&gt;
To add additional IP addresses to an interface, create sub-interfaces as below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto eth0:1&lt;br /&gt;
auto eth0:2 &lt;br /&gt;
&lt;br /&gt;
# Sub 1&lt;br /&gt;
iface eth0:1 inet static&lt;br /&gt;
    address 192.168.1.160&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
# Sub 2&lt;br /&gt;
iface eth0:2 inet static&lt;br /&gt;
    address 192.168.1.161&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;RTNETLINK answers: File exists&#039;&#039;&#039; - Note that you can&#039;t use the same default gateway twice, doing so will cause this error&lt;br /&gt;
&lt;br /&gt;
== Change IP Address (v18 onwards) ==&lt;br /&gt;
Ubuntu now uses [https://netplan.io Netplan], do not use the &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; config file, use either &amp;lt;code&amp;gt;/etc/netplan/01-netcfg.yaml&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;/etc/netplan/50-cloud-init.yaml&amp;lt;/code&amp;gt;. Formatting is very important with YAML files, indents especially.&lt;br /&gt;
&lt;br /&gt;
# Find the interface name (eg &amp;lt;code&amp;gt;ens2&amp;lt;/code&amp;gt;)&lt;br /&gt;
#* &amp;lt;code&amp;gt; ip link &amp;lt;/code&amp;gt;&lt;br /&gt;
# Edit the &amp;lt;code&amp;gt;/etc/netplan/01-netcfg.yaml&amp;lt;/code&amp;gt; config file as show below&lt;br /&gt;
# Apply the changes&lt;br /&gt;
#* &amp;lt;code&amp;gt; netplan apply&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
network:&lt;br /&gt;
  version: 2&lt;br /&gt;
  renderer: networkd&lt;br /&gt;
  ethernets:&lt;br /&gt;
    ens2:&lt;br /&gt;
      dhcp4: no&lt;br /&gt;
      addresses:&lt;br /&gt;
        - 192.168.1.50/24&lt;br /&gt;
      gateway4: 192.168.1.1&lt;br /&gt;
      nameservers:&lt;br /&gt;
          addresses: [192.168.1.1,8.8.8.8]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Persistent Route ===&lt;br /&gt;
To add a persistent route to an interface, add using the following syntax (example sends traffic to 172.32.1.0/24 via eth1 to 192.168.2.100) to add the &amp;lt;code&amp;gt;routes&amp;lt;/code&amp;gt; config to the interface the traffic should go through.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    ens2:&lt;br /&gt;
      addresses:&lt;br /&gt;
        - 192.168.2.50/24&lt;br /&gt;
      dhcp4: no&lt;br /&gt;
      routes:&lt;br /&gt;
        - to: 172.32.1.0/24&lt;br /&gt;
          via: 192.168.2.100&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Update the OS == &lt;br /&gt;
# Run the following command to update the apt package database&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
# To install any updates&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
#* If updates are being held back (eg linux image), then use &amp;lt;code&amp;gt; aptitude safe-upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
# If running in VMware VM, [[VM Tools_Install_(Ubuntu)|install VM Tools]]&lt;br /&gt;
&lt;br /&gt;
=== Remove Old Version ===&lt;br /&gt;
Old kernel images will tend to linger in &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; and source code will remain in &amp;lt;code&amp;gt;/user/src&amp;lt;/code&amp;gt;.  These can be safely removed so long as you&#039;re completely certain which you are using (normally the latest)&lt;br /&gt;
# Get the versions currently installed&lt;br /&gt;
#* &amp;lt;code&amp;gt;dpkg --get-selections | grep linux-image&amp;lt;/code&amp;gt;&lt;br /&gt;
# Remove unwanted versions (don&#039;t remove the current or base/unversioned image)&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;apt-get purge linux-image-3.2.0-32-virtual &amp;lt;/code&amp;gt;&lt;br /&gt;
#* If you&#039;ve got lots to remove its easier to do lots in one go&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; apt-get purge linux-image-3.2.0-51-virtual linux-image-3.2.0-52-virtual &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove old source, just delete manually,&lt;br /&gt;
* EG &amp;lt;code&amp;gt; rm -fr /usr/src/linux-headers-3.2.0-51 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NTP ==&lt;br /&gt;
&#039;&#039;Not required if your server doesn&#039;t really need bang on accurate time&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Out of the box your server will sync every time its restarted and drift a bit in-between.  There is an additional resource demand in running the NTP daemon so unless you need to, there&#039;s no need to install the full blown NTP daemon.&lt;br /&gt;
&lt;br /&gt;
I tend to have one or two servers updating from remote (public) servers, and then all others updating from those.&lt;br /&gt;
&lt;br /&gt;
# Install the service&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update the NTP config file, &amp;lt;code&amp;gt; /etc/ntp.conf &amp;lt;/code&amp;gt; (Example below is for a server updating from public European servers - see http://www.pool.ntp.org/)&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 0.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 1.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 2.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 3.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the NTP service&lt;br /&gt;
#* &amp;lt;code&amp;gt; systemctl restart ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Verify using the following commands&lt;br /&gt;
#* &amp;lt;code&amp;gt; ntpq -np &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; date &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Ubuntu]]&lt;br /&gt;
[[Category:Virtual Machine]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2735</id>
		<title>Installation (Ubuntu)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2735"/>
		<updated>2020-09-09T09:11:48Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Remove Old Version */ Typo fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Whilst this page was written with the installation of a Ubuntu Server 10.04 LTS in mind, it can also be used for Ubuntu 12.&lt;br /&gt;
&lt;br /&gt;
== Prepare Virtual Machine ==&lt;br /&gt;
# Create a virtual machine with the following options (use Custom)&lt;br /&gt;
#* Guest OS: Linux &amp;gt; Ubuntu 64bit&lt;br /&gt;
#* CPU: 1&lt;br /&gt;
#* Memory: 512 MB&lt;br /&gt;
#* Disk: 36GB&lt;br /&gt;
# Then add a second 36GB disk on a separate physical datastore (if you intend to use software RAID)&lt;br /&gt;
# Attach Ubuntu install ISO to the CD-ROM&lt;br /&gt;
&lt;br /&gt;
Note that the specs above should be altered to suit your purposes.  Whilst there is no need to use a 64 bit OS as opposed to 32 bit if you don&#039;t need to address lots of memory, it is standard these days. &lt;br /&gt;
&lt;br /&gt;
== OS Installation ==&lt;br /&gt;
Installing Ubuntu Server (LTS) is relatively painless, its generally a case of following the default or sensible choices for your locale.  However, below are step-by-step instructions, which you probably won&#039;t require, but may help if you&#039;re not familiar with the terminology.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re completely new make sure you read through the instructions 1st, so that you&#039;re prepared for the information you&#039;ll need to provide.&lt;br /&gt;
&lt;br /&gt;
# Select language for installer&lt;br /&gt;
# Select &#039;&#039;&#039;Install Ubuntu Server&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Choose Language&#039;&#039;&#039; screens &lt;br /&gt;
## Select language for server (and remainder of the installer)&lt;br /&gt;
## Select location&lt;br /&gt;
# &#039;&#039;&#039;Ubuntu Installer Main Menu&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; for questions to determine appropriate keyboard, or &#039;&#039;No&#039;&#039; to just select a keyboard layout&lt;br /&gt;
# &#039;&#039;&#039;Configure the network&#039;&#039;&#039; screen&lt;br /&gt;
## Enter the hostname for the server (not a FQDN, so &amp;lt;code&amp;gt;hostname&amp;lt;/code&amp;gt; rather than &amp;lt;code&amp;gt;hostname.domain.com&amp;lt;/code&amp;gt;)&lt;br /&gt;
# &#039;&#039;&#039;Configure the clock&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to accept the suggested timezone, or &#039;&#039;No&#039;&#039; to alter&lt;br /&gt;
# &#039;&#039;&#039;Partition disks&#039;&#039;&#039; screens&lt;br /&gt;
#* If you want to install the server onto software [[Acronyms#R|RAID]]&#039;ed disks see [[#Install on Software RAID|Install on Software RAID]]&lt;br /&gt;
## Select &#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&lt;br /&gt;
## Select the disk to partition and install the OS onto&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks and configure LVM&#039;&#039;&lt;br /&gt;
## Accept the full amount to partition&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Set up users and passwords&#039;&#039;&#039; screens&lt;br /&gt;
## Enter your name&lt;br /&gt;
## Enter your username (that you will use to login with)&lt;br /&gt;
## Enter your password&lt;br /&gt;
##* If you use a weak password (eg less that 8 characters) you&#039;ll be asked to confirm this is OK once you&#039;ve verified it&lt;br /&gt;
## Re-enter (verify) your password&lt;br /&gt;
## Select &#039;&#039;No&#039;&#039; to not &#039;&#039;Encrypt your home drive&#039;&#039;&lt;br /&gt;
##* If you are really worried about your dat being compromised you should consider encrypting the whole drive during its partitioning&lt;br /&gt;
# &#039;&#039;&#039;Configure the package manager&#039;&#039;&#039; screen&lt;br /&gt;
## Enter proxy server details if required for server to access the internet for updates&lt;br /&gt;
# &#039;&#039;&#039;Select and install software&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;No automatic updates&#039;&#039; if you want to control how updates are applied yourself, otherwise select &#039;&#039;Install security updates automatically&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Software selection&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;&#039;OpenSSH Server&#039;&#039;&#039; (press [Space] when item is highlighted), this allows you to Putty/SSH to the server&lt;br /&gt;
## Select any other required software, eg&lt;br /&gt;
##* DNS Server - Only required if you want your server to be a DNS server; or in order to configure split DNS, which is required for an exchange server install&lt;br /&gt;
##* LAMP Server - Only required for Apache webserver (with MySQL and PHP)&lt;br /&gt;
# &#039;&#039;&#039;Configuring grub-pc&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Install the GRUB boot loader to the master boot record&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Finish the installation&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Continue&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Install on Software RAID ===&lt;br /&gt;
On the &#039;&#039;&#039;Partition Disks&#039;&#039;&#039; screens use the following to setup software RAID during OS installation.&lt;br /&gt;
&lt;br /&gt;
* If setting up software RAID follow the steps below, otherwise just select &#039;&#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&#039;&lt;br /&gt;
# Select &#039;&#039;&#039;&amp;quot;Manual&#039;&#039;&#039;&lt;br /&gt;
# Then create a partition...&lt;br /&gt;
## Select the first disk (&#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;) and on the next screen, &#039;&#039;&#039;Yes&#039;&#039;&#039;, to &#039;&#039;&#039;Create new empty partition table on this device?&#039;&#039;&#039;&lt;br /&gt;
## Select the FREE SPACE, then &#039;&#039;&#039;Create a new Partition&#039;&#039;&#039;, and use all but the last 2GB of space, &lt;br /&gt;
## And then select type of &#039;&#039;&#039;Primary&#039;&#039;&#039;, and create at &#039;&#039;&#039;Beginning&#039;&#039;&#039;&lt;br /&gt;
## Change &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, and change the &#039;&#039;&#039;&#039;&#039;Bootable flag&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;Yes&#039;&#039;&#039;, the select &#039;&#039;&#039;Done setting up this partition&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above on the remaining FREE SPACE on &#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;, to create another primary &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, but &#039;&#039;&#039;&#039;not&#039;&#039; bootable&#039;&#039;&#039;&lt;br /&gt;
# Select the second disk, &amp;lt;code&amp;gt;sdb&amp;lt;/code&amp;gt;, and repeat the steps taken for &amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt; to create two identical partitions&lt;br /&gt;
# On the same screen, select the &#039;&#039;&#039;Configure Software RAID&#039;&#039;&#039; option (at the top), and then confirm through the next screen&lt;br /&gt;
# Create a RAID pack/multidisk...&lt;br /&gt;
## Select &#039;&#039;&#039;Create MD device&#039;&#039;&#039;, then select &#039;&#039;&#039;RAID1&#039;&#039;&#039; (ie a mirror), then confirm 2 &#039;&#039;Active devices&#039;&#039;, and 0 &#039;&#039;Spare devices&#039;&#039;&lt;br /&gt;
## Select both &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda1&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb1&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions, and then select &#039;&#039;&#039;Finish&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above to create a RAID volume using &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda2&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb2&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions&lt;br /&gt;
# Now select the RAID device #0 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Ext3...&#039;&#039;&#039;&lt;br /&gt;
# Change the &#039;&#039;&#039;&#039;&#039;Mount point&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;/&#039;&#039;&#039;, then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039;&lt;br /&gt;
# Now select the RAID device #1 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Swap area&#039;&#039;&#039;&lt;br /&gt;
# Then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039; then finally &#039;&#039;&#039;Finish partitioning and write changes to disk&#039;&#039;&#039;, and confirm to &#039;&#039;&#039;Write the changes to disks&#039;&#039;&#039;&lt;br /&gt;
# Accept the &amp;quot;The kernel was unable to re-read...system will need to restart&amp;quot; complaints for each RAID multidisk, after which the install will continue (note there&#039;s a little more to do post install to ensure you can boot using the second disk should the first fail).&lt;br /&gt;
&lt;br /&gt;
Much of this page was originally borrowed heavily from the following pages - they are well worth a read! &lt;br /&gt;
* http://www.howtoforge.com/perfect-server-ubuntu8.04-lts&lt;br /&gt;
* http://www.howtoforge.com/how-to-install-ubuntu8.04-with-software-raid1&lt;br /&gt;
&lt;br /&gt;
== Post OS Install Config ==&lt;br /&gt;
=== Enable Root ===&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd root &amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
For Ubuntu 18...&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd&amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
=== Finish Software RAID config ===&lt;br /&gt;
&#039;&#039;&#039; Only if configured during install &#039;&#039;&#039;&lt;br /&gt;
# Start-up grub (by entering &amp;lt;code&amp;gt; grub &amp;lt;/code&amp;gt; and enter the following commands (seems to work better via SSH than direct console)...&lt;br /&gt;
#* &amp;lt;code&amp;gt; device (hd1) /dev/sdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; root (hd1,0) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; setup (hd1) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; quit &amp;lt;/code&amp;gt;&lt;br /&gt;
# Then edit the &amp;lt;code&amp;gt; /boot/grub/menu.lst &amp;lt;/code&amp;gt; config file.  Go to the end of the file where the boot options are, and create a copy of the first option and edit the following lines&lt;br /&gt;
#* &amp;lt;code&amp;gt; title &amp;lt;/code&amp;gt; Add &amp;quot;Primary disk fail&amp;quot; or something similar to end&lt;br /&gt;
#* &amp;lt;code&amp;gt; root &amp;lt;/code&amp;gt; Change &amp;lt;code&amp;gt; hd0 &amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt; hd1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# To check the RAID setup of your drives use&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md0 &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md1 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Change IP Address (Pre v18) ==&lt;br /&gt;
=== v8 Hardy Heron / v10 Lucid Lynx ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        network 192.168.1.0&lt;br /&gt;
        broadcast 192.168.1.255&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Check that DNS resolution is setup correctly in &amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt;.  Add additional DNS nameservers as required, as found in in order of preference.  You can also add the domain of the server (&amp;lt;code&amp;gt;domain&amp;lt;/code&amp;gt;), and add domain suffix searches (&amp;lt;code&amp;gt;search&amp;lt;/code&amp;gt;), both are optional.  For example...&lt;br /&gt;
 nameserver 192.168.1.20&lt;br /&gt;
 nameserver 127.0.0.1&lt;br /&gt;
 domain domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; /etc/init.d/networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== v12 Precise Pangolin ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&lt;br /&gt;
dns-nameservers 192.168.1.20 8.8.8.8&lt;br /&gt;
dns-domain localdomain.com&lt;br /&gt;
dns-search localdomain.com anotherdomain.com&lt;br /&gt;
        &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; service networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network interface config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* Confirm DNS config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;less /etc/resolv.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Persistent Route ===&lt;br /&gt;
To add a persistent route to an interface, add using the following syntax (example sends traffic to 172.32.1.0/24 via eth1 to 192.168.1.100&lt;br /&gt;
&lt;br /&gt;
 up route add -net 172.32.1.0/24 gw 192.168.1.100 dev eth1&lt;br /&gt;
&lt;br /&gt;
=== Additional IPs / Multihome ===&lt;br /&gt;
To add additional IP addresses to an interface, create sub-interfaces as below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto eth0:1&lt;br /&gt;
auto eth0:2 &lt;br /&gt;
&lt;br /&gt;
# Sub 1&lt;br /&gt;
iface eth0:1 inet static&lt;br /&gt;
    address 192.168.1.160&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
# Sub 2&lt;br /&gt;
iface eth0:2 inet static&lt;br /&gt;
    address 192.168.1.161&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;RTNETLINK answers: File exists&#039;&#039;&#039; - Note that you can&#039;t use the same default gateway twice, doing so will cause this error&lt;br /&gt;
&lt;br /&gt;
== Change IP Address (v18 onwards) ==&lt;br /&gt;
Ubuntu now uses [https://netplan.io Netplan], do not use the &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; config file.&lt;br /&gt;
&lt;br /&gt;
# Find the interface name (eg &amp;lt;code&amp;gt;ens2&amp;lt;/code&amp;gt;)&lt;br /&gt;
#* &amp;lt;code&amp;gt; ip link &amp;lt;/code&amp;gt;&lt;br /&gt;
# Edit the &amp;lt;code&amp;gt;/etc/netplan/01-netcfg.yaml&amp;lt;/code&amp;gt; config file as show below&lt;br /&gt;
# Apply the changes&lt;br /&gt;
#* &amp;lt;code&amp;gt; netplan apply&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
network:&lt;br /&gt;
  version: 2&lt;br /&gt;
  renderer: networkd&lt;br /&gt;
  ethernets:&lt;br /&gt;
    ens2:&lt;br /&gt;
      dhcp4: no&lt;br /&gt;
      addresses:&lt;br /&gt;
        - 192.168.1.50/24&lt;br /&gt;
      gateway4: 192.168.1.1&lt;br /&gt;
      nameservers:&lt;br /&gt;
          addresses: [192.168.1.1,8.8.8.8]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Update the OS == &lt;br /&gt;
# Run the following command to update the apt package database&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
# To install any updates&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
#* If updates are being held back (eg linux image), then use &amp;lt;code&amp;gt; aptitude safe-upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
# If running in VMware VM, [[VM Tools_Install_(Ubuntu)|install VM Tools]]&lt;br /&gt;
&lt;br /&gt;
=== Remove Old Version ===&lt;br /&gt;
Old kernel images will tend to linger in &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; and source code will remain in &amp;lt;code&amp;gt;/user/src&amp;lt;/code&amp;gt;.  These can be safely removed so long as you&#039;re completely certain which you are using (normally the latest)&lt;br /&gt;
# Get the versions currently installed&lt;br /&gt;
#* &amp;lt;code&amp;gt;dpkg --get-selections | grep linux-image&amp;lt;/code&amp;gt;&lt;br /&gt;
# Remove unwanted versions (don&#039;t remove the current or base/unversioned image)&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;apt-get purge linux-image-3.2.0-32-virtual &amp;lt;/code&amp;gt;&lt;br /&gt;
#* If you&#039;ve got lots to remove its easier to do lots in one go&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; apt-get purge linux-image-3.2.0-51-virtual linux-image-3.2.0-52-virtual &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove old source, just delete manually,&lt;br /&gt;
* EG &amp;lt;code&amp;gt; rm -fr /usr/src/linux-headers-3.2.0-51 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NTP ==&lt;br /&gt;
&#039;&#039;Not required if your server doesn&#039;t really need bang on accurate time&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Out of the box your server will sync every time its restarted and drift a bit in-between.  There is an additional resource demand in running the NTP daemon so unless you need to, there&#039;s no need to install the full blown NTP daemon.&lt;br /&gt;
&lt;br /&gt;
I tend to have one or two servers updating from remote (public) servers, and then all others updating from those.&lt;br /&gt;
&lt;br /&gt;
# Install the service&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update the NTP config file, &amp;lt;code&amp;gt; /etc/ntp.conf &amp;lt;/code&amp;gt; (Example below is for a server updating from public European servers - see http://www.pool.ntp.org/)&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 0.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 1.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 2.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 3.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the NTP service&lt;br /&gt;
#* &amp;lt;code&amp;gt; systemctl restart ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Verify using the following commands&lt;br /&gt;
#* &amp;lt;code&amp;gt; ntpq -np &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; date &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Ubuntu]]&lt;br /&gt;
[[Category:Virtual Machine]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2734</id>
		<title>Installation (Ubuntu)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2734"/>
		<updated>2020-09-09T09:11:25Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Change IP Address (v18 onwards) */ Yet another typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Whilst this page was written with the installation of a Ubuntu Server 10.04 LTS in mind, it can also be used for Ubuntu 12.&lt;br /&gt;
&lt;br /&gt;
== Prepare Virtual Machine ==&lt;br /&gt;
# Create a virtual machine with the following options (use Custom)&lt;br /&gt;
#* Guest OS: Linux &amp;gt; Ubuntu 64bit&lt;br /&gt;
#* CPU: 1&lt;br /&gt;
#* Memory: 512 MB&lt;br /&gt;
#* Disk: 36GB&lt;br /&gt;
# Then add a second 36GB disk on a separate physical datastore (if you intend to use software RAID)&lt;br /&gt;
# Attach Ubuntu install ISO to the CD-ROM&lt;br /&gt;
&lt;br /&gt;
Note that the specs above should be altered to suit your purposes.  Whilst there is no need to use a 64 bit OS as opposed to 32 bit if you don&#039;t need to address lots of memory, it is standard these days. &lt;br /&gt;
&lt;br /&gt;
== OS Installation ==&lt;br /&gt;
Installing Ubuntu Server (LTS) is relatively painless, its generally a case of following the default or sensible choices for your locale.  However, below are step-by-step instructions, which you probably won&#039;t require, but may help if you&#039;re not familiar with the terminology.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re completely new make sure you read through the instructions 1st, so that you&#039;re prepared for the information you&#039;ll need to provide.&lt;br /&gt;
&lt;br /&gt;
# Select language for installer&lt;br /&gt;
# Select &#039;&#039;&#039;Install Ubuntu Server&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Choose Language&#039;&#039;&#039; screens &lt;br /&gt;
## Select language for server (and remainder of the installer)&lt;br /&gt;
## Select location&lt;br /&gt;
# &#039;&#039;&#039;Ubuntu Installer Main Menu&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; for questions to determine appropriate keyboard, or &#039;&#039;No&#039;&#039; to just select a keyboard layout&lt;br /&gt;
# &#039;&#039;&#039;Configure the network&#039;&#039;&#039; screen&lt;br /&gt;
## Enter the hostname for the server (not a FQDN, so &amp;lt;code&amp;gt;hostname&amp;lt;/code&amp;gt; rather than &amp;lt;code&amp;gt;hostname.domain.com&amp;lt;/code&amp;gt;)&lt;br /&gt;
# &#039;&#039;&#039;Configure the clock&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to accept the suggested timezone, or &#039;&#039;No&#039;&#039; to alter&lt;br /&gt;
# &#039;&#039;&#039;Partition disks&#039;&#039;&#039; screens&lt;br /&gt;
#* If you want to install the server onto software [[Acronyms#R|RAID]]&#039;ed disks see [[#Install on Software RAID|Install on Software RAID]]&lt;br /&gt;
## Select &#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&lt;br /&gt;
## Select the disk to partition and install the OS onto&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks and configure LVM&#039;&#039;&lt;br /&gt;
## Accept the full amount to partition&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Set up users and passwords&#039;&#039;&#039; screens&lt;br /&gt;
## Enter your name&lt;br /&gt;
## Enter your username (that you will use to login with)&lt;br /&gt;
## Enter your password&lt;br /&gt;
##* If you use a weak password (eg less that 8 characters) you&#039;ll be asked to confirm this is OK once you&#039;ve verified it&lt;br /&gt;
## Re-enter (verify) your password&lt;br /&gt;
## Select &#039;&#039;No&#039;&#039; to not &#039;&#039;Encrypt your home drive&#039;&#039;&lt;br /&gt;
##* If you are really worried about your dat being compromised you should consider encrypting the whole drive during its partitioning&lt;br /&gt;
# &#039;&#039;&#039;Configure the package manager&#039;&#039;&#039; screen&lt;br /&gt;
## Enter proxy server details if required for server to access the internet for updates&lt;br /&gt;
# &#039;&#039;&#039;Select and install software&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;No automatic updates&#039;&#039; if you want to control how updates are applied yourself, otherwise select &#039;&#039;Install security updates automatically&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Software selection&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;&#039;OpenSSH Server&#039;&#039;&#039; (press [Space] when item is highlighted), this allows you to Putty/SSH to the server&lt;br /&gt;
## Select any other required software, eg&lt;br /&gt;
##* DNS Server - Only required if you want your server to be a DNS server; or in order to configure split DNS, which is required for an exchange server install&lt;br /&gt;
##* LAMP Server - Only required for Apache webserver (with MySQL and PHP)&lt;br /&gt;
# &#039;&#039;&#039;Configuring grub-pc&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Install the GRUB boot loader to the master boot record&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Finish the installation&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Continue&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Install on Software RAID ===&lt;br /&gt;
On the &#039;&#039;&#039;Partition Disks&#039;&#039;&#039; screens use the following to setup software RAID during OS installation.&lt;br /&gt;
&lt;br /&gt;
* If setting up software RAID follow the steps below, otherwise just select &#039;&#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&#039;&lt;br /&gt;
# Select &#039;&#039;&#039;&amp;quot;Manual&#039;&#039;&#039;&lt;br /&gt;
# Then create a partition...&lt;br /&gt;
## Select the first disk (&#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;) and on the next screen, &#039;&#039;&#039;Yes&#039;&#039;&#039;, to &#039;&#039;&#039;Create new empty partition table on this device?&#039;&#039;&#039;&lt;br /&gt;
## Select the FREE SPACE, then &#039;&#039;&#039;Create a new Partition&#039;&#039;&#039;, and use all but the last 2GB of space, &lt;br /&gt;
## And then select type of &#039;&#039;&#039;Primary&#039;&#039;&#039;, and create at &#039;&#039;&#039;Beginning&#039;&#039;&#039;&lt;br /&gt;
## Change &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, and change the &#039;&#039;&#039;&#039;&#039;Bootable flag&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;Yes&#039;&#039;&#039;, the select &#039;&#039;&#039;Done setting up this partition&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above on the remaining FREE SPACE on &#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;, to create another primary &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, but &#039;&#039;&#039;&#039;not&#039;&#039; bootable&#039;&#039;&#039;&lt;br /&gt;
# Select the second disk, &amp;lt;code&amp;gt;sdb&amp;lt;/code&amp;gt;, and repeat the steps taken for &amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt; to create two identical partitions&lt;br /&gt;
# On the same screen, select the &#039;&#039;&#039;Configure Software RAID&#039;&#039;&#039; option (at the top), and then confirm through the next screen&lt;br /&gt;
# Create a RAID pack/multidisk...&lt;br /&gt;
## Select &#039;&#039;&#039;Create MD device&#039;&#039;&#039;, then select &#039;&#039;&#039;RAID1&#039;&#039;&#039; (ie a mirror), then confirm 2 &#039;&#039;Active devices&#039;&#039;, and 0 &#039;&#039;Spare devices&#039;&#039;&lt;br /&gt;
## Select both &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda1&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb1&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions, and then select &#039;&#039;&#039;Finish&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above to create a RAID volume using &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda2&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb2&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions&lt;br /&gt;
# Now select the RAID device #0 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Ext3...&#039;&#039;&#039;&lt;br /&gt;
# Change the &#039;&#039;&#039;&#039;&#039;Mount point&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;/&#039;&#039;&#039;, then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039;&lt;br /&gt;
# Now select the RAID device #1 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Swap area&#039;&#039;&#039;&lt;br /&gt;
# Then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039; then finally &#039;&#039;&#039;Finish partitioning and write changes to disk&#039;&#039;&#039;, and confirm to &#039;&#039;&#039;Write the changes to disks&#039;&#039;&#039;&lt;br /&gt;
# Accept the &amp;quot;The kernel was unable to re-read...system will need to restart&amp;quot; complaints for each RAID multidisk, after which the install will continue (note there&#039;s a little more to do post install to ensure you can boot using the second disk should the first fail).&lt;br /&gt;
&lt;br /&gt;
Much of this page was originally borrowed heavily from the following pages - they are well worth a read! &lt;br /&gt;
* http://www.howtoforge.com/perfect-server-ubuntu8.04-lts&lt;br /&gt;
* http://www.howtoforge.com/how-to-install-ubuntu8.04-with-software-raid1&lt;br /&gt;
&lt;br /&gt;
== Post OS Install Config ==&lt;br /&gt;
=== Enable Root ===&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd root &amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
For Ubuntu 18...&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd&amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
=== Finish Software RAID config ===&lt;br /&gt;
&#039;&#039;&#039; Only if configured during install &#039;&#039;&#039;&lt;br /&gt;
# Start-up grub (by entering &amp;lt;code&amp;gt; grub &amp;lt;/code&amp;gt; and enter the following commands (seems to work better via SSH than direct console)...&lt;br /&gt;
#* &amp;lt;code&amp;gt; device (hd1) /dev/sdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; root (hd1,0) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; setup (hd1) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; quit &amp;lt;/code&amp;gt;&lt;br /&gt;
# Then edit the &amp;lt;code&amp;gt; /boot/grub/menu.lst &amp;lt;/code&amp;gt; config file.  Go to the end of the file where the boot options are, and create a copy of the first option and edit the following lines&lt;br /&gt;
#* &amp;lt;code&amp;gt; title &amp;lt;/code&amp;gt; Add &amp;quot;Primary disk fail&amp;quot; or something similar to end&lt;br /&gt;
#* &amp;lt;code&amp;gt; root &amp;lt;/code&amp;gt; Change &amp;lt;code&amp;gt; hd0 &amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt; hd1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# To check the RAID setup of your drives use&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md0 &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md1 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Change IP Address (Pre v18) ==&lt;br /&gt;
=== v8 Hardy Heron / v10 Lucid Lynx ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        network 192.168.1.0&lt;br /&gt;
        broadcast 192.168.1.255&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Check that DNS resolution is setup correctly in &amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt;.  Add additional DNS nameservers as required, as found in in order of preference.  You can also add the domain of the server (&amp;lt;code&amp;gt;domain&amp;lt;/code&amp;gt;), and add domain suffix searches (&amp;lt;code&amp;gt;search&amp;lt;/code&amp;gt;), both are optional.  For example...&lt;br /&gt;
 nameserver 192.168.1.20&lt;br /&gt;
 nameserver 127.0.0.1&lt;br /&gt;
 domain domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; /etc/init.d/networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== v12 Precise Pangolin ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&lt;br /&gt;
dns-nameservers 192.168.1.20 8.8.8.8&lt;br /&gt;
dns-domain localdomain.com&lt;br /&gt;
dns-search localdomain.com anotherdomain.com&lt;br /&gt;
        &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; service networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network interface config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* Confirm DNS config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;less /etc/resolv.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Persistent Route ===&lt;br /&gt;
To add a persistent route to an interface, add using the following syntax (example sends traffic to 172.32.1.0/24 via eth1 to 192.168.1.100&lt;br /&gt;
&lt;br /&gt;
 up route add -net 172.32.1.0/24 gw 192.168.1.100 dev eth1&lt;br /&gt;
&lt;br /&gt;
=== Additional IPs / Multihome ===&lt;br /&gt;
To add additional IP addresses to an interface, create sub-interfaces as below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto eth0:1&lt;br /&gt;
auto eth0:2 &lt;br /&gt;
&lt;br /&gt;
# Sub 1&lt;br /&gt;
iface eth0:1 inet static&lt;br /&gt;
    address 192.168.1.160&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
# Sub 2&lt;br /&gt;
iface eth0:2 inet static&lt;br /&gt;
    address 192.168.1.161&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;RTNETLINK answers: File exists&#039;&#039;&#039; - Note that you can&#039;t use the same default gateway twice, doing so will cause this error&lt;br /&gt;
&lt;br /&gt;
== Change IP Address (v18 onwards) ==&lt;br /&gt;
Ubuntu now uses [https://netplan.io Netplan], do not use the &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; config file.&lt;br /&gt;
&lt;br /&gt;
# Find the interface name (eg &amp;lt;code&amp;gt;ens2&amp;lt;/code&amp;gt;)&lt;br /&gt;
#* &amp;lt;code&amp;gt; ip link &amp;lt;/code&amp;gt;&lt;br /&gt;
# Edit the &amp;lt;code&amp;gt;/etc/netplan/01-netcfg.yaml&amp;lt;/code&amp;gt; config file as show below&lt;br /&gt;
# Apply the changes&lt;br /&gt;
#* &amp;lt;code&amp;gt; netplan apply&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
network:&lt;br /&gt;
  version: 2&lt;br /&gt;
  renderer: networkd&lt;br /&gt;
  ethernets:&lt;br /&gt;
    ens2:&lt;br /&gt;
      dhcp4: no&lt;br /&gt;
      addresses:&lt;br /&gt;
        - 192.168.1.50/24&lt;br /&gt;
      gateway4: 192.168.1.1&lt;br /&gt;
      nameservers:&lt;br /&gt;
          addresses: [192.168.1.1,8.8.8.8]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Update the OS == &lt;br /&gt;
# Run the following command to update the apt package database&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
# To install any updates&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
#* If updates are being held back (eg linux image), then use &amp;lt;code&amp;gt; aptitude safe-upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
# If running in VMware VM, [[VM Tools_Install_(Ubuntu)|install VM Tools]]&lt;br /&gt;
&lt;br /&gt;
=== Remove Old Version ===&lt;br /&gt;
Old kernel images will tend to linger in &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; and source code will remain in &amp;lt;code&amp;gt;/user/src&amp;lt;/code&amp;gt;.  These can be safely removed so long as you&#039;re completely certain which you are using (normally the latest)&lt;br /&gt;
# Get the versions currently installed&lt;br /&gt;
#* &amp;lt;code&amp;gt;dpkg --get-selections | grep linux-image&amp;lt;/code&amp;gt;&lt;br /&gt;
# Remove unwanted versions (don&#039;t remove the current or base/unversioned image)&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;apt-get purge linux-image-3.2.0-32-virtual &amp;lt;code&amp;gt;&lt;br /&gt;
#* If you&#039;ve got lots to remove its easier to do lots in one go&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; apt-get purge linux-image-3.2.0-51-virtual linux-image-3.2.0-52-virtual &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove old source, just delete manually,&lt;br /&gt;
* EG &amp;lt;code&amp;gt; rm -fr /usr/src/linux-headers-3.2.0-51 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NTP ==&lt;br /&gt;
&#039;&#039;Not required if your server doesn&#039;t really need bang on accurate time&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Out of the box your server will sync every time its restarted and drift a bit in-between.  There is an additional resource demand in running the NTP daemon so unless you need to, there&#039;s no need to install the full blown NTP daemon.&lt;br /&gt;
&lt;br /&gt;
I tend to have one or two servers updating from remote (public) servers, and then all others updating from those.&lt;br /&gt;
&lt;br /&gt;
# Install the service&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update the NTP config file, &amp;lt;code&amp;gt; /etc/ntp.conf &amp;lt;/code&amp;gt; (Example below is for a server updating from public European servers - see http://www.pool.ntp.org/)&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 0.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 1.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 2.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 3.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the NTP service&lt;br /&gt;
#* &amp;lt;code&amp;gt; systemctl restart ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Verify using the following commands&lt;br /&gt;
#* &amp;lt;code&amp;gt; ntpq -np &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; date &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Ubuntu]]&lt;br /&gt;
[[Category:Virtual Machine]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2733</id>
		<title>Installation (Ubuntu)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2733"/>
		<updated>2020-09-09T09:09:02Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Change IP Address (v18 onwards) */ Another typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Whilst this page was written with the installation of a Ubuntu Server 10.04 LTS in mind, it can also be used for Ubuntu 12.&lt;br /&gt;
&lt;br /&gt;
== Prepare Virtual Machine ==&lt;br /&gt;
# Create a virtual machine with the following options (use Custom)&lt;br /&gt;
#* Guest OS: Linux &amp;gt; Ubuntu 64bit&lt;br /&gt;
#* CPU: 1&lt;br /&gt;
#* Memory: 512 MB&lt;br /&gt;
#* Disk: 36GB&lt;br /&gt;
# Then add a second 36GB disk on a separate physical datastore (if you intend to use software RAID)&lt;br /&gt;
# Attach Ubuntu install ISO to the CD-ROM&lt;br /&gt;
&lt;br /&gt;
Note that the specs above should be altered to suit your purposes.  Whilst there is no need to use a 64 bit OS as opposed to 32 bit if you don&#039;t need to address lots of memory, it is standard these days. &lt;br /&gt;
&lt;br /&gt;
== OS Installation ==&lt;br /&gt;
Installing Ubuntu Server (LTS) is relatively painless, its generally a case of following the default or sensible choices for your locale.  However, below are step-by-step instructions, which you probably won&#039;t require, but may help if you&#039;re not familiar with the terminology.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re completely new make sure you read through the instructions 1st, so that you&#039;re prepared for the information you&#039;ll need to provide.&lt;br /&gt;
&lt;br /&gt;
# Select language for installer&lt;br /&gt;
# Select &#039;&#039;&#039;Install Ubuntu Server&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Choose Language&#039;&#039;&#039; screens &lt;br /&gt;
## Select language for server (and remainder of the installer)&lt;br /&gt;
## Select location&lt;br /&gt;
# &#039;&#039;&#039;Ubuntu Installer Main Menu&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; for questions to determine appropriate keyboard, or &#039;&#039;No&#039;&#039; to just select a keyboard layout&lt;br /&gt;
# &#039;&#039;&#039;Configure the network&#039;&#039;&#039; screen&lt;br /&gt;
## Enter the hostname for the server (not a FQDN, so &amp;lt;code&amp;gt;hostname&amp;lt;/code&amp;gt; rather than &amp;lt;code&amp;gt;hostname.domain.com&amp;lt;/code&amp;gt;)&lt;br /&gt;
# &#039;&#039;&#039;Configure the clock&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to accept the suggested timezone, or &#039;&#039;No&#039;&#039; to alter&lt;br /&gt;
# &#039;&#039;&#039;Partition disks&#039;&#039;&#039; screens&lt;br /&gt;
#* If you want to install the server onto software [[Acronyms#R|RAID]]&#039;ed disks see [[#Install on Software RAID|Install on Software RAID]]&lt;br /&gt;
## Select &#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&lt;br /&gt;
## Select the disk to partition and install the OS onto&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks and configure LVM&#039;&#039;&lt;br /&gt;
## Accept the full amount to partition&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Set up users and passwords&#039;&#039;&#039; screens&lt;br /&gt;
## Enter your name&lt;br /&gt;
## Enter your username (that you will use to login with)&lt;br /&gt;
## Enter your password&lt;br /&gt;
##* If you use a weak password (eg less that 8 characters) you&#039;ll be asked to confirm this is OK once you&#039;ve verified it&lt;br /&gt;
## Re-enter (verify) your password&lt;br /&gt;
## Select &#039;&#039;No&#039;&#039; to not &#039;&#039;Encrypt your home drive&#039;&#039;&lt;br /&gt;
##* If you are really worried about your dat being compromised you should consider encrypting the whole drive during its partitioning&lt;br /&gt;
# &#039;&#039;&#039;Configure the package manager&#039;&#039;&#039; screen&lt;br /&gt;
## Enter proxy server details if required for server to access the internet for updates&lt;br /&gt;
# &#039;&#039;&#039;Select and install software&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;No automatic updates&#039;&#039; if you want to control how updates are applied yourself, otherwise select &#039;&#039;Install security updates automatically&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Software selection&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;&#039;OpenSSH Server&#039;&#039;&#039; (press [Space] when item is highlighted), this allows you to Putty/SSH to the server&lt;br /&gt;
## Select any other required software, eg&lt;br /&gt;
##* DNS Server - Only required if you want your server to be a DNS server; or in order to configure split DNS, which is required for an exchange server install&lt;br /&gt;
##* LAMP Server - Only required for Apache webserver (with MySQL and PHP)&lt;br /&gt;
# &#039;&#039;&#039;Configuring grub-pc&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Install the GRUB boot loader to the master boot record&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Finish the installation&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Continue&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Install on Software RAID ===&lt;br /&gt;
On the &#039;&#039;&#039;Partition Disks&#039;&#039;&#039; screens use the following to setup software RAID during OS installation.&lt;br /&gt;
&lt;br /&gt;
* If setting up software RAID follow the steps below, otherwise just select &#039;&#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&#039;&lt;br /&gt;
# Select &#039;&#039;&#039;&amp;quot;Manual&#039;&#039;&#039;&lt;br /&gt;
# Then create a partition...&lt;br /&gt;
## Select the first disk (&#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;) and on the next screen, &#039;&#039;&#039;Yes&#039;&#039;&#039;, to &#039;&#039;&#039;Create new empty partition table on this device?&#039;&#039;&#039;&lt;br /&gt;
## Select the FREE SPACE, then &#039;&#039;&#039;Create a new Partition&#039;&#039;&#039;, and use all but the last 2GB of space, &lt;br /&gt;
## And then select type of &#039;&#039;&#039;Primary&#039;&#039;&#039;, and create at &#039;&#039;&#039;Beginning&#039;&#039;&#039;&lt;br /&gt;
## Change &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, and change the &#039;&#039;&#039;&#039;&#039;Bootable flag&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;Yes&#039;&#039;&#039;, the select &#039;&#039;&#039;Done setting up this partition&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above on the remaining FREE SPACE on &#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;, to create another primary &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, but &#039;&#039;&#039;&#039;not&#039;&#039; bootable&#039;&#039;&#039;&lt;br /&gt;
# Select the second disk, &amp;lt;code&amp;gt;sdb&amp;lt;/code&amp;gt;, and repeat the steps taken for &amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt; to create two identical partitions&lt;br /&gt;
# On the same screen, select the &#039;&#039;&#039;Configure Software RAID&#039;&#039;&#039; option (at the top), and then confirm through the next screen&lt;br /&gt;
# Create a RAID pack/multidisk...&lt;br /&gt;
## Select &#039;&#039;&#039;Create MD device&#039;&#039;&#039;, then select &#039;&#039;&#039;RAID1&#039;&#039;&#039; (ie a mirror), then confirm 2 &#039;&#039;Active devices&#039;&#039;, and 0 &#039;&#039;Spare devices&#039;&#039;&lt;br /&gt;
## Select both &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda1&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb1&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions, and then select &#039;&#039;&#039;Finish&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above to create a RAID volume using &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda2&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb2&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions&lt;br /&gt;
# Now select the RAID device #0 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Ext3...&#039;&#039;&#039;&lt;br /&gt;
# Change the &#039;&#039;&#039;&#039;&#039;Mount point&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;/&#039;&#039;&#039;, then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039;&lt;br /&gt;
# Now select the RAID device #1 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Swap area&#039;&#039;&#039;&lt;br /&gt;
# Then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039; then finally &#039;&#039;&#039;Finish partitioning and write changes to disk&#039;&#039;&#039;, and confirm to &#039;&#039;&#039;Write the changes to disks&#039;&#039;&#039;&lt;br /&gt;
# Accept the &amp;quot;The kernel was unable to re-read...system will need to restart&amp;quot; complaints for each RAID multidisk, after which the install will continue (note there&#039;s a little more to do post install to ensure you can boot using the second disk should the first fail).&lt;br /&gt;
&lt;br /&gt;
Much of this page was originally borrowed heavily from the following pages - they are well worth a read! &lt;br /&gt;
* http://www.howtoforge.com/perfect-server-ubuntu8.04-lts&lt;br /&gt;
* http://www.howtoforge.com/how-to-install-ubuntu8.04-with-software-raid1&lt;br /&gt;
&lt;br /&gt;
== Post OS Install Config ==&lt;br /&gt;
=== Enable Root ===&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd root &amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
For Ubuntu 18...&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd&amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
=== Finish Software RAID config ===&lt;br /&gt;
&#039;&#039;&#039; Only if configured during install &#039;&#039;&#039;&lt;br /&gt;
# Start-up grub (by entering &amp;lt;code&amp;gt; grub &amp;lt;/code&amp;gt; and enter the following commands (seems to work better via SSH than direct console)...&lt;br /&gt;
#* &amp;lt;code&amp;gt; device (hd1) /dev/sdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; root (hd1,0) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; setup (hd1) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; quit &amp;lt;/code&amp;gt;&lt;br /&gt;
# Then edit the &amp;lt;code&amp;gt; /boot/grub/menu.lst &amp;lt;/code&amp;gt; config file.  Go to the end of the file where the boot options are, and create a copy of the first option and edit the following lines&lt;br /&gt;
#* &amp;lt;code&amp;gt; title &amp;lt;/code&amp;gt; Add &amp;quot;Primary disk fail&amp;quot; or something similar to end&lt;br /&gt;
#* &amp;lt;code&amp;gt; root &amp;lt;/code&amp;gt; Change &amp;lt;code&amp;gt; hd0 &amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt; hd1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# To check the RAID setup of your drives use&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md0 &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md1 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Change IP Address (Pre v18) ==&lt;br /&gt;
=== v8 Hardy Heron / v10 Lucid Lynx ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        network 192.168.1.0&lt;br /&gt;
        broadcast 192.168.1.255&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Check that DNS resolution is setup correctly in &amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt;.  Add additional DNS nameservers as required, as found in in order of preference.  You can also add the domain of the server (&amp;lt;code&amp;gt;domain&amp;lt;/code&amp;gt;), and add domain suffix searches (&amp;lt;code&amp;gt;search&amp;lt;/code&amp;gt;), both are optional.  For example...&lt;br /&gt;
 nameserver 192.168.1.20&lt;br /&gt;
 nameserver 127.0.0.1&lt;br /&gt;
 domain domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; /etc/init.d/networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== v12 Precise Pangolin ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&lt;br /&gt;
dns-nameservers 192.168.1.20 8.8.8.8&lt;br /&gt;
dns-domain localdomain.com&lt;br /&gt;
dns-search localdomain.com anotherdomain.com&lt;br /&gt;
        &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; service networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network interface config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* Confirm DNS config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;less /etc/resolv.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Persistent Route ===&lt;br /&gt;
To add a persistent route to an interface, add using the following syntax (example sends traffic to 172.32.1.0/24 via eth1 to 192.168.1.100&lt;br /&gt;
&lt;br /&gt;
 up route add -net 172.32.1.0/24 gw 192.168.1.100 dev eth1&lt;br /&gt;
&lt;br /&gt;
=== Additional IPs / Multihome ===&lt;br /&gt;
To add additional IP addresses to an interface, create sub-interfaces as below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto eth0:1&lt;br /&gt;
auto eth0:2 &lt;br /&gt;
&lt;br /&gt;
# Sub 1&lt;br /&gt;
iface eth0:1 inet static&lt;br /&gt;
    address 192.168.1.160&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
# Sub 2&lt;br /&gt;
iface eth0:2 inet static&lt;br /&gt;
    address 192.168.1.161&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;RTNETLINK answers: File exists&#039;&#039;&#039; - Note that you can&#039;t use the same default gateway twice, doing so will cause this error&lt;br /&gt;
&lt;br /&gt;
== Change IP Address (v18 onwards) ==&lt;br /&gt;
Ubuntu now uses [https://netplan.io Netplan], do not use the &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; config file.&lt;br /&gt;
&lt;br /&gt;
# Find the interface name (eg &amp;lt;code&amp;gt;ens2&amp;lt;/code&amp;gt;)&lt;br /&gt;
#* &amp;lt;code&amp;gt; ip link &amp;lt;/code&amp;gt;&lt;br /&gt;
# Edit the &amp;lt;code&amp;gt;/etc/netplan/01-netcfg.yaml&amp;lt;code&amp;gt; config file as show below&lt;br /&gt;
# Apply the changes&lt;br /&gt;
#* &amp;lt;code&amp;gt; netplan apply&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
network:&lt;br /&gt;
  version: 2&lt;br /&gt;
  renderer: networkd&lt;br /&gt;
  ethernets:&lt;br /&gt;
    ens2:&lt;br /&gt;
      dhcp4: no&lt;br /&gt;
      addresses:&lt;br /&gt;
        - 192.168.1.50/24&lt;br /&gt;
      gateway4: 192.168.1.1&lt;br /&gt;
      nameservers:&lt;br /&gt;
          addresses: [192.168.1.1,8.8.8.8]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Update the OS == &lt;br /&gt;
# Run the following command to update the apt package database&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
# To install any updates&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
#* If updates are being held back (eg linux image), then use &amp;lt;code&amp;gt; aptitude safe-upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
# If running in VMware VM, [[VM Tools_Install_(Ubuntu)|install VM Tools]]&lt;br /&gt;
&lt;br /&gt;
=== Remove Old Version ===&lt;br /&gt;
Old kernel images will tend to linger in &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; and source code will remain in &amp;lt;code&amp;gt;/user/src&amp;lt;/code&amp;gt;.  These can be safely removed so long as you&#039;re completely certain which you are using (normally the latest)&lt;br /&gt;
# Get the versions currently installed&lt;br /&gt;
#* &amp;lt;code&amp;gt;dpkg --get-selections | grep linux-image&amp;lt;/code&amp;gt;&lt;br /&gt;
# Remove unwanted versions (don&#039;t remove the current or base/unversioned image)&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;apt-get purge linux-image-3.2.0-32-virtual &amp;lt;code&amp;gt;&lt;br /&gt;
#* If you&#039;ve got lots to remove its easier to do lots in one go&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; apt-get purge linux-image-3.2.0-51-virtual linux-image-3.2.0-52-virtual &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove old source, just delete manually,&lt;br /&gt;
* EG &amp;lt;code&amp;gt; rm -fr /usr/src/linux-headers-3.2.0-51 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NTP ==&lt;br /&gt;
&#039;&#039;Not required if your server doesn&#039;t really need bang on accurate time&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Out of the box your server will sync every time its restarted and drift a bit in-between.  There is an additional resource demand in running the NTP daemon so unless you need to, there&#039;s no need to install the full blown NTP daemon.&lt;br /&gt;
&lt;br /&gt;
I tend to have one or two servers updating from remote (public) servers, and then all others updating from those.&lt;br /&gt;
&lt;br /&gt;
# Install the service&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update the NTP config file, &amp;lt;code&amp;gt; /etc/ntp.conf &amp;lt;/code&amp;gt; (Example below is for a server updating from public European servers - see http://www.pool.ntp.org/)&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 0.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 1.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 2.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 3.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the NTP service&lt;br /&gt;
#* &amp;lt;code&amp;gt; systemctl restart ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Verify using the following commands&lt;br /&gt;
#* &amp;lt;code&amp;gt; ntpq -np &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; date &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Ubuntu]]&lt;br /&gt;
[[Category:Virtual Machine]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2732</id>
		<title>Installation (Ubuntu)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2732"/>
		<updated>2020-09-09T09:08:48Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Change IP Address (v18 onwards) */ Typo fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Whilst this page was written with the installation of a Ubuntu Server 10.04 LTS in mind, it can also be used for Ubuntu 12.&lt;br /&gt;
&lt;br /&gt;
== Prepare Virtual Machine ==&lt;br /&gt;
# Create a virtual machine with the following options (use Custom)&lt;br /&gt;
#* Guest OS: Linux &amp;gt; Ubuntu 64bit&lt;br /&gt;
#* CPU: 1&lt;br /&gt;
#* Memory: 512 MB&lt;br /&gt;
#* Disk: 36GB&lt;br /&gt;
# Then add a second 36GB disk on a separate physical datastore (if you intend to use software RAID)&lt;br /&gt;
# Attach Ubuntu install ISO to the CD-ROM&lt;br /&gt;
&lt;br /&gt;
Note that the specs above should be altered to suit your purposes.  Whilst there is no need to use a 64 bit OS as opposed to 32 bit if you don&#039;t need to address lots of memory, it is standard these days. &lt;br /&gt;
&lt;br /&gt;
== OS Installation ==&lt;br /&gt;
Installing Ubuntu Server (LTS) is relatively painless, its generally a case of following the default or sensible choices for your locale.  However, below are step-by-step instructions, which you probably won&#039;t require, but may help if you&#039;re not familiar with the terminology.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re completely new make sure you read through the instructions 1st, so that you&#039;re prepared for the information you&#039;ll need to provide.&lt;br /&gt;
&lt;br /&gt;
# Select language for installer&lt;br /&gt;
# Select &#039;&#039;&#039;Install Ubuntu Server&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Choose Language&#039;&#039;&#039; screens &lt;br /&gt;
## Select language for server (and remainder of the installer)&lt;br /&gt;
## Select location&lt;br /&gt;
# &#039;&#039;&#039;Ubuntu Installer Main Menu&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; for questions to determine appropriate keyboard, or &#039;&#039;No&#039;&#039; to just select a keyboard layout&lt;br /&gt;
# &#039;&#039;&#039;Configure the network&#039;&#039;&#039; screen&lt;br /&gt;
## Enter the hostname for the server (not a FQDN, so &amp;lt;code&amp;gt;hostname&amp;lt;/code&amp;gt; rather than &amp;lt;code&amp;gt;hostname.domain.com&amp;lt;/code&amp;gt;)&lt;br /&gt;
# &#039;&#039;&#039;Configure the clock&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to accept the suggested timezone, or &#039;&#039;No&#039;&#039; to alter&lt;br /&gt;
# &#039;&#039;&#039;Partition disks&#039;&#039;&#039; screens&lt;br /&gt;
#* If you want to install the server onto software [[Acronyms#R|RAID]]&#039;ed disks see [[#Install on Software RAID|Install on Software RAID]]&lt;br /&gt;
## Select &#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&lt;br /&gt;
## Select the disk to partition and install the OS onto&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks and configure LVM&#039;&#039;&lt;br /&gt;
## Accept the full amount to partition&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Set up users and passwords&#039;&#039;&#039; screens&lt;br /&gt;
## Enter your name&lt;br /&gt;
## Enter your username (that you will use to login with)&lt;br /&gt;
## Enter your password&lt;br /&gt;
##* If you use a weak password (eg less that 8 characters) you&#039;ll be asked to confirm this is OK once you&#039;ve verified it&lt;br /&gt;
## Re-enter (verify) your password&lt;br /&gt;
## Select &#039;&#039;No&#039;&#039; to not &#039;&#039;Encrypt your home drive&#039;&#039;&lt;br /&gt;
##* If you are really worried about your dat being compromised you should consider encrypting the whole drive during its partitioning&lt;br /&gt;
# &#039;&#039;&#039;Configure the package manager&#039;&#039;&#039; screen&lt;br /&gt;
## Enter proxy server details if required for server to access the internet for updates&lt;br /&gt;
# &#039;&#039;&#039;Select and install software&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;No automatic updates&#039;&#039; if you want to control how updates are applied yourself, otherwise select &#039;&#039;Install security updates automatically&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Software selection&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;&#039;OpenSSH Server&#039;&#039;&#039; (press [Space] when item is highlighted), this allows you to Putty/SSH to the server&lt;br /&gt;
## Select any other required software, eg&lt;br /&gt;
##* DNS Server - Only required if you want your server to be a DNS server; or in order to configure split DNS, which is required for an exchange server install&lt;br /&gt;
##* LAMP Server - Only required for Apache webserver (with MySQL and PHP)&lt;br /&gt;
# &#039;&#039;&#039;Configuring grub-pc&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Install the GRUB boot loader to the master boot record&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Finish the installation&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Continue&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Install on Software RAID ===&lt;br /&gt;
On the &#039;&#039;&#039;Partition Disks&#039;&#039;&#039; screens use the following to setup software RAID during OS installation.&lt;br /&gt;
&lt;br /&gt;
* If setting up software RAID follow the steps below, otherwise just select &#039;&#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&#039;&lt;br /&gt;
# Select &#039;&#039;&#039;&amp;quot;Manual&#039;&#039;&#039;&lt;br /&gt;
# Then create a partition...&lt;br /&gt;
## Select the first disk (&#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;) and on the next screen, &#039;&#039;&#039;Yes&#039;&#039;&#039;, to &#039;&#039;&#039;Create new empty partition table on this device?&#039;&#039;&#039;&lt;br /&gt;
## Select the FREE SPACE, then &#039;&#039;&#039;Create a new Partition&#039;&#039;&#039;, and use all but the last 2GB of space, &lt;br /&gt;
## And then select type of &#039;&#039;&#039;Primary&#039;&#039;&#039;, and create at &#039;&#039;&#039;Beginning&#039;&#039;&#039;&lt;br /&gt;
## Change &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, and change the &#039;&#039;&#039;&#039;&#039;Bootable flag&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;Yes&#039;&#039;&#039;, the select &#039;&#039;&#039;Done setting up this partition&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above on the remaining FREE SPACE on &#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;, to create another primary &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, but &#039;&#039;&#039;&#039;not&#039;&#039; bootable&#039;&#039;&#039;&lt;br /&gt;
# Select the second disk, &amp;lt;code&amp;gt;sdb&amp;lt;/code&amp;gt;, and repeat the steps taken for &amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt; to create two identical partitions&lt;br /&gt;
# On the same screen, select the &#039;&#039;&#039;Configure Software RAID&#039;&#039;&#039; option (at the top), and then confirm through the next screen&lt;br /&gt;
# Create a RAID pack/multidisk...&lt;br /&gt;
## Select &#039;&#039;&#039;Create MD device&#039;&#039;&#039;, then select &#039;&#039;&#039;RAID1&#039;&#039;&#039; (ie a mirror), then confirm 2 &#039;&#039;Active devices&#039;&#039;, and 0 &#039;&#039;Spare devices&#039;&#039;&lt;br /&gt;
## Select both &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda1&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb1&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions, and then select &#039;&#039;&#039;Finish&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above to create a RAID volume using &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda2&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb2&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions&lt;br /&gt;
# Now select the RAID device #0 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Ext3...&#039;&#039;&#039;&lt;br /&gt;
# Change the &#039;&#039;&#039;&#039;&#039;Mount point&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;/&#039;&#039;&#039;, then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039;&lt;br /&gt;
# Now select the RAID device #1 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Swap area&#039;&#039;&#039;&lt;br /&gt;
# Then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039; then finally &#039;&#039;&#039;Finish partitioning and write changes to disk&#039;&#039;&#039;, and confirm to &#039;&#039;&#039;Write the changes to disks&#039;&#039;&#039;&lt;br /&gt;
# Accept the &amp;quot;The kernel was unable to re-read...system will need to restart&amp;quot; complaints for each RAID multidisk, after which the install will continue (note there&#039;s a little more to do post install to ensure you can boot using the second disk should the first fail).&lt;br /&gt;
&lt;br /&gt;
Much of this page was originally borrowed heavily from the following pages - they are well worth a read! &lt;br /&gt;
* http://www.howtoforge.com/perfect-server-ubuntu8.04-lts&lt;br /&gt;
* http://www.howtoforge.com/how-to-install-ubuntu8.04-with-software-raid1&lt;br /&gt;
&lt;br /&gt;
== Post OS Install Config ==&lt;br /&gt;
=== Enable Root ===&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd root &amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
For Ubuntu 18...&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd&amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
=== Finish Software RAID config ===&lt;br /&gt;
&#039;&#039;&#039; Only if configured during install &#039;&#039;&#039;&lt;br /&gt;
# Start-up grub (by entering &amp;lt;code&amp;gt; grub &amp;lt;/code&amp;gt; and enter the following commands (seems to work better via SSH than direct console)...&lt;br /&gt;
#* &amp;lt;code&amp;gt; device (hd1) /dev/sdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; root (hd1,0) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; setup (hd1) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; quit &amp;lt;/code&amp;gt;&lt;br /&gt;
# Then edit the &amp;lt;code&amp;gt; /boot/grub/menu.lst &amp;lt;/code&amp;gt; config file.  Go to the end of the file where the boot options are, and create a copy of the first option and edit the following lines&lt;br /&gt;
#* &amp;lt;code&amp;gt; title &amp;lt;/code&amp;gt; Add &amp;quot;Primary disk fail&amp;quot; or something similar to end&lt;br /&gt;
#* &amp;lt;code&amp;gt; root &amp;lt;/code&amp;gt; Change &amp;lt;code&amp;gt; hd0 &amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt; hd1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# To check the RAID setup of your drives use&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md0 &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md1 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Change IP Address (Pre v18) ==&lt;br /&gt;
=== v8 Hardy Heron / v10 Lucid Lynx ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        network 192.168.1.0&lt;br /&gt;
        broadcast 192.168.1.255&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Check that DNS resolution is setup correctly in &amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt;.  Add additional DNS nameservers as required, as found in in order of preference.  You can also add the domain of the server (&amp;lt;code&amp;gt;domain&amp;lt;/code&amp;gt;), and add domain suffix searches (&amp;lt;code&amp;gt;search&amp;lt;/code&amp;gt;), both are optional.  For example...&lt;br /&gt;
 nameserver 192.168.1.20&lt;br /&gt;
 nameserver 127.0.0.1&lt;br /&gt;
 domain domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; /etc/init.d/networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== v12 Precise Pangolin ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&lt;br /&gt;
dns-nameservers 192.168.1.20 8.8.8.8&lt;br /&gt;
dns-domain localdomain.com&lt;br /&gt;
dns-search localdomain.com anotherdomain.com&lt;br /&gt;
        &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; service networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network interface config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* Confirm DNS config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;less /etc/resolv.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Persistent Route ===&lt;br /&gt;
To add a persistent route to an interface, add using the following syntax (example sends traffic to 172.32.1.0/24 via eth1 to 192.168.1.100&lt;br /&gt;
&lt;br /&gt;
 up route add -net 172.32.1.0/24 gw 192.168.1.100 dev eth1&lt;br /&gt;
&lt;br /&gt;
=== Additional IPs / Multihome ===&lt;br /&gt;
To add additional IP addresses to an interface, create sub-interfaces as below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto eth0:1&lt;br /&gt;
auto eth0:2 &lt;br /&gt;
&lt;br /&gt;
# Sub 1&lt;br /&gt;
iface eth0:1 inet static&lt;br /&gt;
    address 192.168.1.160&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
# Sub 2&lt;br /&gt;
iface eth0:2 inet static&lt;br /&gt;
    address 192.168.1.161&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;RTNETLINK answers: File exists&#039;&#039;&#039; - Note that you can&#039;t use the same default gateway twice, doing so will cause this error&lt;br /&gt;
&lt;br /&gt;
== Change IP Address (v18 onwards) ==&lt;br /&gt;
Ubuntu now uses [https://netplan.io Netplan], do not use the &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; config file.&lt;br /&gt;
&lt;br /&gt;
# Find the interface name (eg &amp;lt;code&amp;gt;ens2&amp;lt;/code&amp;gt;)&lt;br /&gt;
#* &amp;lt;code&amp;gt; ip link &amp;lt;/code&amp;gt;&lt;br /&gt;
# Edit the &amp;lt;code&amp;gt;/etc/netplan/01-netcfg.yaml&amp;lt;code&amp;gt; config file as show below&lt;br /&gt;
# Apply the changes&lt;br /&gt;
#* &amp;lt;code&amp;gt; netplan apply&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
network:&lt;br /&gt;
  version: 2&lt;br /&gt;
  renderer: networkd&lt;br /&gt;
  ethernets:&lt;br /&gt;
    ens2:&lt;br /&gt;
      dhcp4: no&lt;br /&gt;
      addresses:&lt;br /&gt;
        - 192.168.1.50/24&lt;br /&gt;
      gateway4: 192.168.1.1&lt;br /&gt;
      nameservers:&lt;br /&gt;
          addresses: [192.168.1.1,8.8.8.8]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Update the OS == &lt;br /&gt;
# Run the following command to update the apt package database&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
# To install any updates&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
#* If updates are being held back (eg linux image), then use &amp;lt;code&amp;gt; aptitude safe-upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
# If running in VMware VM, [[VM Tools_Install_(Ubuntu)|install VM Tools]]&lt;br /&gt;
&lt;br /&gt;
=== Remove Old Version ===&lt;br /&gt;
Old kernel images will tend to linger in &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; and source code will remain in &amp;lt;code&amp;gt;/user/src&amp;lt;/code&amp;gt;.  These can be safely removed so long as you&#039;re completely certain which you are using (normally the latest)&lt;br /&gt;
# Get the versions currently installed&lt;br /&gt;
#* &amp;lt;code&amp;gt;dpkg --get-selections | grep linux-image&amp;lt;/code&amp;gt;&lt;br /&gt;
# Remove unwanted versions (don&#039;t remove the current or base/unversioned image)&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;apt-get purge linux-image-3.2.0-32-virtual &amp;lt;code&amp;gt;&lt;br /&gt;
#* If you&#039;ve got lots to remove its easier to do lots in one go&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; apt-get purge linux-image-3.2.0-51-virtual linux-image-3.2.0-52-virtual &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove old source, just delete manually,&lt;br /&gt;
* EG &amp;lt;code&amp;gt; rm -fr /usr/src/linux-headers-3.2.0-51 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NTP ==&lt;br /&gt;
&#039;&#039;Not required if your server doesn&#039;t really need bang on accurate time&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Out of the box your server will sync every time its restarted and drift a bit in-between.  There is an additional resource demand in running the NTP daemon so unless you need to, there&#039;s no need to install the full blown NTP daemon.&lt;br /&gt;
&lt;br /&gt;
I tend to have one or two servers updating from remote (public) servers, and then all others updating from those.&lt;br /&gt;
&lt;br /&gt;
# Install the service&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update the NTP config file, &amp;lt;code&amp;gt; /etc/ntp.conf &amp;lt;/code&amp;gt; (Example below is for a server updating from public European servers - see http://www.pool.ntp.org/)&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 0.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 1.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 2.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 3.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the NTP service&lt;br /&gt;
#* &amp;lt;code&amp;gt; systemctl restart ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Verify using the following commands&lt;br /&gt;
#* &amp;lt;code&amp;gt; ntpq -np &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; date &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Ubuntu]]&lt;br /&gt;
[[Category:Virtual Machine]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2731</id>
		<title>Installation (Ubuntu)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2731"/>
		<updated>2020-09-09T09:07:32Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: Added Change IP Address (v18 onwards)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Whilst this page was written with the installation of a Ubuntu Server 10.04 LTS in mind, it can also be used for Ubuntu 12.&lt;br /&gt;
&lt;br /&gt;
== Prepare Virtual Machine ==&lt;br /&gt;
# Create a virtual machine with the following options (use Custom)&lt;br /&gt;
#* Guest OS: Linux &amp;gt; Ubuntu 64bit&lt;br /&gt;
#* CPU: 1&lt;br /&gt;
#* Memory: 512 MB&lt;br /&gt;
#* Disk: 36GB&lt;br /&gt;
# Then add a second 36GB disk on a separate physical datastore (if you intend to use software RAID)&lt;br /&gt;
# Attach Ubuntu install ISO to the CD-ROM&lt;br /&gt;
&lt;br /&gt;
Note that the specs above should be altered to suit your purposes.  Whilst there is no need to use a 64 bit OS as opposed to 32 bit if you don&#039;t need to address lots of memory, it is standard these days. &lt;br /&gt;
&lt;br /&gt;
== OS Installation ==&lt;br /&gt;
Installing Ubuntu Server (LTS) is relatively painless, its generally a case of following the default or sensible choices for your locale.  However, below are step-by-step instructions, which you probably won&#039;t require, but may help if you&#039;re not familiar with the terminology.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re completely new make sure you read through the instructions 1st, so that you&#039;re prepared for the information you&#039;ll need to provide.&lt;br /&gt;
&lt;br /&gt;
# Select language for installer&lt;br /&gt;
# Select &#039;&#039;&#039;Install Ubuntu Server&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Choose Language&#039;&#039;&#039; screens &lt;br /&gt;
## Select language for server (and remainder of the installer)&lt;br /&gt;
## Select location&lt;br /&gt;
# &#039;&#039;&#039;Ubuntu Installer Main Menu&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; for questions to determine appropriate keyboard, or &#039;&#039;No&#039;&#039; to just select a keyboard layout&lt;br /&gt;
# &#039;&#039;&#039;Configure the network&#039;&#039;&#039; screen&lt;br /&gt;
## Enter the hostname for the server (not a FQDN, so &amp;lt;code&amp;gt;hostname&amp;lt;/code&amp;gt; rather than &amp;lt;code&amp;gt;hostname.domain.com&amp;lt;/code&amp;gt;)&lt;br /&gt;
# &#039;&#039;&#039;Configure the clock&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to accept the suggested timezone, or &#039;&#039;No&#039;&#039; to alter&lt;br /&gt;
# &#039;&#039;&#039;Partition disks&#039;&#039;&#039; screens&lt;br /&gt;
#* If you want to install the server onto software [[Acronyms#R|RAID]]&#039;ed disks see [[#Install on Software RAID|Install on Software RAID]]&lt;br /&gt;
## Select &#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&lt;br /&gt;
## Select the disk to partition and install the OS onto&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks and configure LVM&#039;&#039;&lt;br /&gt;
## Accept the full amount to partition&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Set up users and passwords&#039;&#039;&#039; screens&lt;br /&gt;
## Enter your name&lt;br /&gt;
## Enter your username (that you will use to login with)&lt;br /&gt;
## Enter your password&lt;br /&gt;
##* If you use a weak password (eg less that 8 characters) you&#039;ll be asked to confirm this is OK once you&#039;ve verified it&lt;br /&gt;
## Re-enter (verify) your password&lt;br /&gt;
## Select &#039;&#039;No&#039;&#039; to not &#039;&#039;Encrypt your home drive&#039;&#039;&lt;br /&gt;
##* If you are really worried about your dat being compromised you should consider encrypting the whole drive during its partitioning&lt;br /&gt;
# &#039;&#039;&#039;Configure the package manager&#039;&#039;&#039; screen&lt;br /&gt;
## Enter proxy server details if required for server to access the internet for updates&lt;br /&gt;
# &#039;&#039;&#039;Select and install software&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;No automatic updates&#039;&#039; if you want to control how updates are applied yourself, otherwise select &#039;&#039;Install security updates automatically&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Software selection&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;&#039;OpenSSH Server&#039;&#039;&#039; (press [Space] when item is highlighted), this allows you to Putty/SSH to the server&lt;br /&gt;
## Select any other required software, eg&lt;br /&gt;
##* DNS Server - Only required if you want your server to be a DNS server; or in order to configure split DNS, which is required for an exchange server install&lt;br /&gt;
##* LAMP Server - Only required for Apache webserver (with MySQL and PHP)&lt;br /&gt;
# &#039;&#039;&#039;Configuring grub-pc&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Install the GRUB boot loader to the master boot record&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Finish the installation&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Continue&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Install on Software RAID ===&lt;br /&gt;
On the &#039;&#039;&#039;Partition Disks&#039;&#039;&#039; screens use the following to setup software RAID during OS installation.&lt;br /&gt;
&lt;br /&gt;
* If setting up software RAID follow the steps below, otherwise just select &#039;&#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&#039;&lt;br /&gt;
# Select &#039;&#039;&#039;&amp;quot;Manual&#039;&#039;&#039;&lt;br /&gt;
# Then create a partition...&lt;br /&gt;
## Select the first disk (&#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;) and on the next screen, &#039;&#039;&#039;Yes&#039;&#039;&#039;, to &#039;&#039;&#039;Create new empty partition table on this device?&#039;&#039;&#039;&lt;br /&gt;
## Select the FREE SPACE, then &#039;&#039;&#039;Create a new Partition&#039;&#039;&#039;, and use all but the last 2GB of space, &lt;br /&gt;
## And then select type of &#039;&#039;&#039;Primary&#039;&#039;&#039;, and create at &#039;&#039;&#039;Beginning&#039;&#039;&#039;&lt;br /&gt;
## Change &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, and change the &#039;&#039;&#039;&#039;&#039;Bootable flag&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;Yes&#039;&#039;&#039;, the select &#039;&#039;&#039;Done setting up this partition&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above on the remaining FREE SPACE on &#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;, to create another primary &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, but &#039;&#039;&#039;&#039;not&#039;&#039; bootable&#039;&#039;&#039;&lt;br /&gt;
# Select the second disk, &amp;lt;code&amp;gt;sdb&amp;lt;/code&amp;gt;, and repeat the steps taken for &amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt; to create two identical partitions&lt;br /&gt;
# On the same screen, select the &#039;&#039;&#039;Configure Software RAID&#039;&#039;&#039; option (at the top), and then confirm through the next screen&lt;br /&gt;
# Create a RAID pack/multidisk...&lt;br /&gt;
## Select &#039;&#039;&#039;Create MD device&#039;&#039;&#039;, then select &#039;&#039;&#039;RAID1&#039;&#039;&#039; (ie a mirror), then confirm 2 &#039;&#039;Active devices&#039;&#039;, and 0 &#039;&#039;Spare devices&#039;&#039;&lt;br /&gt;
## Select both &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda1&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb1&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions, and then select &#039;&#039;&#039;Finish&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above to create a RAID volume using &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda2&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb2&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions&lt;br /&gt;
# Now select the RAID device #0 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Ext3...&#039;&#039;&#039;&lt;br /&gt;
# Change the &#039;&#039;&#039;&#039;&#039;Mount point&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;/&#039;&#039;&#039;, then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039;&lt;br /&gt;
# Now select the RAID device #1 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Swap area&#039;&#039;&#039;&lt;br /&gt;
# Then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039; then finally &#039;&#039;&#039;Finish partitioning and write changes to disk&#039;&#039;&#039;, and confirm to &#039;&#039;&#039;Write the changes to disks&#039;&#039;&#039;&lt;br /&gt;
# Accept the &amp;quot;The kernel was unable to re-read...system will need to restart&amp;quot; complaints for each RAID multidisk, after which the install will continue (note there&#039;s a little more to do post install to ensure you can boot using the second disk should the first fail).&lt;br /&gt;
&lt;br /&gt;
Much of this page was originally borrowed heavily from the following pages - they are well worth a read! &lt;br /&gt;
* http://www.howtoforge.com/perfect-server-ubuntu8.04-lts&lt;br /&gt;
* http://www.howtoforge.com/how-to-install-ubuntu8.04-with-software-raid1&lt;br /&gt;
&lt;br /&gt;
== Post OS Install Config ==&lt;br /&gt;
=== Enable Root ===&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd root &amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
For Ubuntu 18...&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd&amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
=== Finish Software RAID config ===&lt;br /&gt;
&#039;&#039;&#039; Only if configured during install &#039;&#039;&#039;&lt;br /&gt;
# Start-up grub (by entering &amp;lt;code&amp;gt; grub &amp;lt;/code&amp;gt; and enter the following commands (seems to work better via SSH than direct console)...&lt;br /&gt;
#* &amp;lt;code&amp;gt; device (hd1) /dev/sdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; root (hd1,0) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; setup (hd1) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; quit &amp;lt;/code&amp;gt;&lt;br /&gt;
# Then edit the &amp;lt;code&amp;gt; /boot/grub/menu.lst &amp;lt;/code&amp;gt; config file.  Go to the end of the file where the boot options are, and create a copy of the first option and edit the following lines&lt;br /&gt;
#* &amp;lt;code&amp;gt; title &amp;lt;/code&amp;gt; Add &amp;quot;Primary disk fail&amp;quot; or something similar to end&lt;br /&gt;
#* &amp;lt;code&amp;gt; root &amp;lt;/code&amp;gt; Change &amp;lt;code&amp;gt; hd0 &amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt; hd1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# To check the RAID setup of your drives use&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md0 &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md1 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Change IP Address (Pre v18) ==&lt;br /&gt;
=== v8 Hardy Heron / v10 Lucid Lynx ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        network 192.168.1.0&lt;br /&gt;
        broadcast 192.168.1.255&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Check that DNS resolution is setup correctly in &amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt;.  Add additional DNS nameservers as required, as found in in order of preference.  You can also add the domain of the server (&amp;lt;code&amp;gt;domain&amp;lt;/code&amp;gt;), and add domain suffix searches (&amp;lt;code&amp;gt;search&amp;lt;/code&amp;gt;), both are optional.  For example...&lt;br /&gt;
 nameserver 192.168.1.20&lt;br /&gt;
 nameserver 127.0.0.1&lt;br /&gt;
 domain domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; /etc/init.d/networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== v12 Precise Pangolin ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&lt;br /&gt;
dns-nameservers 192.168.1.20 8.8.8.8&lt;br /&gt;
dns-domain localdomain.com&lt;br /&gt;
dns-search localdomain.com anotherdomain.com&lt;br /&gt;
        &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; service networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network interface config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* Confirm DNS config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;less /etc/resolv.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Persistent Route ===&lt;br /&gt;
To add a persistent route to an interface, add using the following syntax (example sends traffic to 172.32.1.0/24 via eth1 to 192.168.1.100&lt;br /&gt;
&lt;br /&gt;
 up route add -net 172.32.1.0/24 gw 192.168.1.100 dev eth1&lt;br /&gt;
&lt;br /&gt;
=== Additional IPs / Multihome ===&lt;br /&gt;
To add additional IP addresses to an interface, create sub-interfaces as below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto eth0:1&lt;br /&gt;
auto eth0:2 &lt;br /&gt;
&lt;br /&gt;
# Sub 1&lt;br /&gt;
iface eth0:1 inet static&lt;br /&gt;
    address 192.168.1.160&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
# Sub 2&lt;br /&gt;
iface eth0:2 inet static&lt;br /&gt;
    address 192.168.1.161&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;RTNETLINK answers: File exists&#039;&#039;&#039; - Note that you can&#039;t use the same default gateway twice, doing so will cause this error&lt;br /&gt;
&lt;br /&gt;
== Change IP Address (v18 onwards) ==&lt;br /&gt;
Ubuntu now uses [[Netplan|https://netplan.io/]], do not use the &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; config file.&lt;br /&gt;
&lt;br /&gt;
# Find the interface name (eg &amp;lt;code&amp;gt;ens2&amp;lt;/code&amp;gt;)&lt;br /&gt;
#* &amp;lt;code&amp;gt; ip link &amp;lt;/code&amp;gt;&lt;br /&gt;
# Edit the &amp;lt;code&amp;gt;/etc/netplan/01-netcfg.yaml&amp;lt;code&amp;gt; config file as show below&lt;br /&gt;
# Apply the changes&lt;br /&gt;
#* &amp;lt;code&amp;gt; netplan apply&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
network:&lt;br /&gt;
  version: 2&lt;br /&gt;
  renderer: networkd&lt;br /&gt;
  ethernets:&lt;br /&gt;
    ens2:&lt;br /&gt;
      dhcp4: no&lt;br /&gt;
      addresses:&lt;br /&gt;
        - 192.168.1.50/24&lt;br /&gt;
      gateway4: 192.168.1.1&lt;br /&gt;
      nameservers:&lt;br /&gt;
          addresses: [192.168.1.1,8.8.8.8]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Update the OS == &lt;br /&gt;
# Run the following command to update the apt package database&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
# To install any updates&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
#* If updates are being held back (eg linux image), then use &amp;lt;code&amp;gt; aptitude safe-upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
# If running in VMware VM, [[VM Tools_Install_(Ubuntu)|install VM Tools]]&lt;br /&gt;
&lt;br /&gt;
=== Remove Old Version ===&lt;br /&gt;
Old kernel images will tend to linger in &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; and source code will remain in &amp;lt;code&amp;gt;/user/src&amp;lt;/code&amp;gt;.  These can be safely removed so long as you&#039;re completely certain which you are using (normally the latest)&lt;br /&gt;
# Get the versions currently installed&lt;br /&gt;
#* &amp;lt;code&amp;gt;dpkg --get-selections | grep linux-image&amp;lt;/code&amp;gt;&lt;br /&gt;
# Remove unwanted versions (don&#039;t remove the current or base/unversioned image)&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;apt-get purge linux-image-3.2.0-32-virtual &amp;lt;code&amp;gt;&lt;br /&gt;
#* If you&#039;ve got lots to remove its easier to do lots in one go&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; apt-get purge linux-image-3.2.0-51-virtual linux-image-3.2.0-52-virtual &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove old source, just delete manually,&lt;br /&gt;
* EG &amp;lt;code&amp;gt; rm -fr /usr/src/linux-headers-3.2.0-51 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NTP ==&lt;br /&gt;
&#039;&#039;Not required if your server doesn&#039;t really need bang on accurate time&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Out of the box your server will sync every time its restarted and drift a bit in-between.  There is an additional resource demand in running the NTP daemon so unless you need to, there&#039;s no need to install the full blown NTP daemon.&lt;br /&gt;
&lt;br /&gt;
I tend to have one or two servers updating from remote (public) servers, and then all others updating from those.&lt;br /&gt;
&lt;br /&gt;
# Install the service&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update the NTP config file, &amp;lt;code&amp;gt; /etc/ntp.conf &amp;lt;/code&amp;gt; (Example below is for a server updating from public European servers - see http://www.pool.ntp.org/)&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 0.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 1.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 2.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 3.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the NTP service&lt;br /&gt;
#* &amp;lt;code&amp;gt; systemctl restart ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Verify using the following commands&lt;br /&gt;
#* &amp;lt;code&amp;gt; ntpq -np &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; date &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Ubuntu]]&lt;br /&gt;
[[Category:Virtual Machine]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2730</id>
		<title>Installation (Ubuntu)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2730"/>
		<updated>2020-09-09T09:01:14Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Change IP Address */ Changed section name&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Whilst this page was written with the installation of a Ubuntu Server 10.04 LTS in mind, it can also be used for Ubuntu 12.&lt;br /&gt;
&lt;br /&gt;
== Prepare Virtual Machine ==&lt;br /&gt;
# Create a virtual machine with the following options (use Custom)&lt;br /&gt;
#* Guest OS: Linux &amp;gt; Ubuntu 64bit&lt;br /&gt;
#* CPU: 1&lt;br /&gt;
#* Memory: 512 MB&lt;br /&gt;
#* Disk: 36GB&lt;br /&gt;
# Then add a second 36GB disk on a separate physical datastore (if you intend to use software RAID)&lt;br /&gt;
# Attach Ubuntu install ISO to the CD-ROM&lt;br /&gt;
&lt;br /&gt;
Note that the specs above should be altered to suit your purposes.  Whilst there is no need to use a 64 bit OS as opposed to 32 bit if you don&#039;t need to address lots of memory, it is standard these days. &lt;br /&gt;
&lt;br /&gt;
== OS Installation ==&lt;br /&gt;
Installing Ubuntu Server (LTS) is relatively painless, its generally a case of following the default or sensible choices for your locale.  However, below are step-by-step instructions, which you probably won&#039;t require, but may help if you&#039;re not familiar with the terminology.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re completely new make sure you read through the instructions 1st, so that you&#039;re prepared for the information you&#039;ll need to provide.&lt;br /&gt;
&lt;br /&gt;
# Select language for installer&lt;br /&gt;
# Select &#039;&#039;&#039;Install Ubuntu Server&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Choose Language&#039;&#039;&#039; screens &lt;br /&gt;
## Select language for server (and remainder of the installer)&lt;br /&gt;
## Select location&lt;br /&gt;
# &#039;&#039;&#039;Ubuntu Installer Main Menu&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; for questions to determine appropriate keyboard, or &#039;&#039;No&#039;&#039; to just select a keyboard layout&lt;br /&gt;
# &#039;&#039;&#039;Configure the network&#039;&#039;&#039; screen&lt;br /&gt;
## Enter the hostname for the server (not a FQDN, so &amp;lt;code&amp;gt;hostname&amp;lt;/code&amp;gt; rather than &amp;lt;code&amp;gt;hostname.domain.com&amp;lt;/code&amp;gt;)&lt;br /&gt;
# &#039;&#039;&#039;Configure the clock&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to accept the suggested timezone, or &#039;&#039;No&#039;&#039; to alter&lt;br /&gt;
# &#039;&#039;&#039;Partition disks&#039;&#039;&#039; screens&lt;br /&gt;
#* If you want to install the server onto software [[Acronyms#R|RAID]]&#039;ed disks see [[#Install on Software RAID|Install on Software RAID]]&lt;br /&gt;
## Select &#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&lt;br /&gt;
## Select the disk to partition and install the OS onto&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks and configure LVM&#039;&#039;&lt;br /&gt;
## Accept the full amount to partition&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Set up users and passwords&#039;&#039;&#039; screens&lt;br /&gt;
## Enter your name&lt;br /&gt;
## Enter your username (that you will use to login with)&lt;br /&gt;
## Enter your password&lt;br /&gt;
##* If you use a weak password (eg less that 8 characters) you&#039;ll be asked to confirm this is OK once you&#039;ve verified it&lt;br /&gt;
## Re-enter (verify) your password&lt;br /&gt;
## Select &#039;&#039;No&#039;&#039; to not &#039;&#039;Encrypt your home drive&#039;&#039;&lt;br /&gt;
##* If you are really worried about your dat being compromised you should consider encrypting the whole drive during its partitioning&lt;br /&gt;
# &#039;&#039;&#039;Configure the package manager&#039;&#039;&#039; screen&lt;br /&gt;
## Enter proxy server details if required for server to access the internet for updates&lt;br /&gt;
# &#039;&#039;&#039;Select and install software&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;No automatic updates&#039;&#039; if you want to control how updates are applied yourself, otherwise select &#039;&#039;Install security updates automatically&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Software selection&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;&#039;OpenSSH Server&#039;&#039;&#039; (press [Space] when item is highlighted), this allows you to Putty/SSH to the server&lt;br /&gt;
## Select any other required software, eg&lt;br /&gt;
##* DNS Server - Only required if you want your server to be a DNS server; or in order to configure split DNS, which is required for an exchange server install&lt;br /&gt;
##* LAMP Server - Only required for Apache webserver (with MySQL and PHP)&lt;br /&gt;
# &#039;&#039;&#039;Configuring grub-pc&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Install the GRUB boot loader to the master boot record&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Finish the installation&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Continue&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Install on Software RAID ===&lt;br /&gt;
On the &#039;&#039;&#039;Partition Disks&#039;&#039;&#039; screens use the following to setup software RAID during OS installation.&lt;br /&gt;
&lt;br /&gt;
* If setting up software RAID follow the steps below, otherwise just select &#039;&#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&#039;&lt;br /&gt;
# Select &#039;&#039;&#039;&amp;quot;Manual&#039;&#039;&#039;&lt;br /&gt;
# Then create a partition...&lt;br /&gt;
## Select the first disk (&#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;) and on the next screen, &#039;&#039;&#039;Yes&#039;&#039;&#039;, to &#039;&#039;&#039;Create new empty partition table on this device?&#039;&#039;&#039;&lt;br /&gt;
## Select the FREE SPACE, then &#039;&#039;&#039;Create a new Partition&#039;&#039;&#039;, and use all but the last 2GB of space, &lt;br /&gt;
## And then select type of &#039;&#039;&#039;Primary&#039;&#039;&#039;, and create at &#039;&#039;&#039;Beginning&#039;&#039;&#039;&lt;br /&gt;
## Change &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, and change the &#039;&#039;&#039;&#039;&#039;Bootable flag&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;Yes&#039;&#039;&#039;, the select &#039;&#039;&#039;Done setting up this partition&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above on the remaining FREE SPACE on &#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;, to create another primary &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, but &#039;&#039;&#039;&#039;not&#039;&#039; bootable&#039;&#039;&#039;&lt;br /&gt;
# Select the second disk, &amp;lt;code&amp;gt;sdb&amp;lt;/code&amp;gt;, and repeat the steps taken for &amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt; to create two identical partitions&lt;br /&gt;
# On the same screen, select the &#039;&#039;&#039;Configure Software RAID&#039;&#039;&#039; option (at the top), and then confirm through the next screen&lt;br /&gt;
# Create a RAID pack/multidisk...&lt;br /&gt;
## Select &#039;&#039;&#039;Create MD device&#039;&#039;&#039;, then select &#039;&#039;&#039;RAID1&#039;&#039;&#039; (ie a mirror), then confirm 2 &#039;&#039;Active devices&#039;&#039;, and 0 &#039;&#039;Spare devices&#039;&#039;&lt;br /&gt;
## Select both &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda1&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb1&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions, and then select &#039;&#039;&#039;Finish&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above to create a RAID volume using &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda2&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb2&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions&lt;br /&gt;
# Now select the RAID device #0 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Ext3...&#039;&#039;&#039;&lt;br /&gt;
# Change the &#039;&#039;&#039;&#039;&#039;Mount point&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;/&#039;&#039;&#039;, then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039;&lt;br /&gt;
# Now select the RAID device #1 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Swap area&#039;&#039;&#039;&lt;br /&gt;
# Then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039; then finally &#039;&#039;&#039;Finish partitioning and write changes to disk&#039;&#039;&#039;, and confirm to &#039;&#039;&#039;Write the changes to disks&#039;&#039;&#039;&lt;br /&gt;
# Accept the &amp;quot;The kernel was unable to re-read...system will need to restart&amp;quot; complaints for each RAID multidisk, after which the install will continue (note there&#039;s a little more to do post install to ensure you can boot using the second disk should the first fail).&lt;br /&gt;
&lt;br /&gt;
Much of this page was originally borrowed heavily from the following pages - they are well worth a read! &lt;br /&gt;
* http://www.howtoforge.com/perfect-server-ubuntu8.04-lts&lt;br /&gt;
* http://www.howtoforge.com/how-to-install-ubuntu8.04-with-software-raid1&lt;br /&gt;
&lt;br /&gt;
== Post OS Install Config ==&lt;br /&gt;
=== Enable Root ===&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd root &amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
For Ubuntu 18...&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd&amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
=== Finish Software RAID config ===&lt;br /&gt;
&#039;&#039;&#039; Only if configured during install &#039;&#039;&#039;&lt;br /&gt;
# Start-up grub (by entering &amp;lt;code&amp;gt; grub &amp;lt;/code&amp;gt; and enter the following commands (seems to work better via SSH than direct console)...&lt;br /&gt;
#* &amp;lt;code&amp;gt; device (hd1) /dev/sdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; root (hd1,0) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; setup (hd1) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; quit &amp;lt;/code&amp;gt;&lt;br /&gt;
# Then edit the &amp;lt;code&amp;gt; /boot/grub/menu.lst &amp;lt;/code&amp;gt; config file.  Go to the end of the file where the boot options are, and create a copy of the first option and edit the following lines&lt;br /&gt;
#* &amp;lt;code&amp;gt; title &amp;lt;/code&amp;gt; Add &amp;quot;Primary disk fail&amp;quot; or something similar to end&lt;br /&gt;
#* &amp;lt;code&amp;gt; root &amp;lt;/code&amp;gt; Change &amp;lt;code&amp;gt; hd0 &amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt; hd1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# To check the RAID setup of your drives use&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md0 &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md1 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Change IP Address (Pre v18) ==&lt;br /&gt;
=== v8 Hardy Heron / v10 Lucid Lynx ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        network 192.168.1.0&lt;br /&gt;
        broadcast 192.168.1.255&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Check that DNS resolution is setup correctly in &amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt;.  Add additional DNS nameservers as required, as found in in order of preference.  You can also add the domain of the server (&amp;lt;code&amp;gt;domain&amp;lt;/code&amp;gt;), and add domain suffix searches (&amp;lt;code&amp;gt;search&amp;lt;/code&amp;gt;), both are optional.  For example...&lt;br /&gt;
 nameserver 192.168.1.20&lt;br /&gt;
 nameserver 127.0.0.1&lt;br /&gt;
 domain domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; /etc/init.d/networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== v12 Precise Pangolin ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&lt;br /&gt;
dns-nameservers 192.168.1.20 8.8.8.8&lt;br /&gt;
dns-domain localdomain.com&lt;br /&gt;
dns-search localdomain.com anotherdomain.com&lt;br /&gt;
        &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; service networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network interface config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* Confirm DNS config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;less /etc/resolv.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Persistent Route ===&lt;br /&gt;
To add a persistent route to an interface, add using the following syntax (example sends traffic to 172.32.1.0/24 via eth1 to 192.168.1.100&lt;br /&gt;
&lt;br /&gt;
 up route add -net 172.32.1.0/24 gw 192.168.1.100 dev eth1&lt;br /&gt;
&lt;br /&gt;
=== Additional IPs / Multihome ===&lt;br /&gt;
To add additional IP addresses to an interface, create sub-interfaces as below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto eth0:1&lt;br /&gt;
auto eth0:2 &lt;br /&gt;
&lt;br /&gt;
# Sub 1&lt;br /&gt;
iface eth0:1 inet static&lt;br /&gt;
    address 192.168.1.160&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
# Sub 2&lt;br /&gt;
iface eth0:2 inet static&lt;br /&gt;
    address 192.168.1.161&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;RTNETLINK answers: File exists&#039;&#039;&#039; - Note that you can&#039;t use the same default gateway twice, doing so will cause this error&lt;br /&gt;
&lt;br /&gt;
== Update the OS == &lt;br /&gt;
# Run the following command to update the apt package database&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
# To install any updates&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
#* If updates are being held back (eg linux image), then use &amp;lt;code&amp;gt; aptitude safe-upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
# If running in VMware VM, [[VM Tools_Install_(Ubuntu)|install VM Tools]]&lt;br /&gt;
&lt;br /&gt;
=== Remove Old Version ===&lt;br /&gt;
Old kernel images will tend to linger in &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; and source code will remain in &amp;lt;code&amp;gt;/user/src&amp;lt;/code&amp;gt;.  These can be safely removed so long as you&#039;re completely certain which you are using (normally the latest)&lt;br /&gt;
# Get the versions currently installed&lt;br /&gt;
#* &amp;lt;code&amp;gt;dpkg --get-selections | grep linux-image&amp;lt;/code&amp;gt;&lt;br /&gt;
# Remove unwanted versions (don&#039;t remove the current or base/unversioned image)&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;apt-get purge linux-image-3.2.0-32-virtual &amp;lt;code&amp;gt;&lt;br /&gt;
#* If you&#039;ve got lots to remove its easier to do lots in one go&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; apt-get purge linux-image-3.2.0-51-virtual linux-image-3.2.0-52-virtual &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove old source, just delete manually,&lt;br /&gt;
* EG &amp;lt;code&amp;gt; rm -fr /usr/src/linux-headers-3.2.0-51 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NTP ==&lt;br /&gt;
&#039;&#039;Not required if your server doesn&#039;t really need bang on accurate time&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Out of the box your server will sync every time its restarted and drift a bit in-between.  There is an additional resource demand in running the NTP daemon so unless you need to, there&#039;s no need to install the full blown NTP daemon.&lt;br /&gt;
&lt;br /&gt;
I tend to have one or two servers updating from remote (public) servers, and then all others updating from those.&lt;br /&gt;
&lt;br /&gt;
# Install the service&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update the NTP config file, &amp;lt;code&amp;gt; /etc/ntp.conf &amp;lt;/code&amp;gt; (Example below is for a server updating from public European servers - see http://www.pool.ntp.org/)&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 0.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 1.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 2.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 3.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the NTP service&lt;br /&gt;
#* &amp;lt;code&amp;gt; systemctl restart ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Verify using the following commands&lt;br /&gt;
#* &amp;lt;code&amp;gt; ntpq -np &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; date &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Ubuntu]]&lt;br /&gt;
[[Category:Virtual Machine]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2729</id>
		<title>Virtual Machine (KVM)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2729"/>
		<updated>2020-08-17T12:47:29Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Create Workstation (GUI) */ Added note on cancelling he command&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Note that VMs are known as &#039;&#039;&#039;domains&#039;&#039;&#039; in the KVM world.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
This guide assumes you have a basic working environment, run the &amp;lt;code&amp;gt;kvm-ok&amp;lt;/code&amp;gt; command to sanity check...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@kvm-host:# kvm-ok&lt;br /&gt;
INFO: /dev/kvm exists&lt;br /&gt;
KVM acceleration can be used&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install Media ===&lt;br /&gt;
You need to have a local copy of the appropriate ISO.  If you have the ISO file already, upload to your KVM server, alternatively download from the site using &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Ubuntu Desktop LTS&#039;&#039;&#039; - http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso&lt;br /&gt;
&lt;br /&gt;
== Create Virtual Machine ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter                    !! Example                     !! Usage&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;            || VM-Name                     || Name of virtual machine (typically this should match the intended hostname of the VM)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;     || &amp;quot;Test VM to be used for X&amp;quot;  || Description of virtual machine&#039;s purpose etc&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-type&amp;lt;/code&amp;gt;         || Linux                       || OS family, can be  Linux, Solaris, Unix or Windows&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-variant&amp;lt;/code&amp;gt;      || ubuntu16.04                 || Distribution type for the above (run &amp;lt;code&amp;gt;osinfo-query os&amp;lt;/code&amp;gt; to view what is available)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ram&amp;lt;/code&amp;gt;             || 2048                        || vRAM in GB&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;disk path&amp;lt;/code&amp;gt;       || /vm-store/images/VM-Name.img,bus=virtio,size=50 || Virtual disk path, using virtio bus and with a 50GB disk&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;graphics&amp;lt;/code&amp;gt;        || none                        || If noneset, VM will be created with a serial display output (as opposed to VNC window)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cdrom&amp;lt;/code&amp;gt;           || /home/user/cdrom.iso        || Path to installation ISO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;network&amp;lt;/code&amp;gt;         || bridge:br0                  || Network connection details&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Create Server (no GUI) ===&lt;br /&gt;
Update paths to reflect where install ISO, and where VM disk files are intended to be.  &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--extra-args &amp;quot;console=ttyS0&amp;quot;&amp;lt;/code&amp;gt; option allows a local console to be accessed from the host machine (to allow OS install etc before the VM is on a network), though note that it can&#039;t be used with &amp;lt;code&amp;gt;--cdrom&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;--location&amp;lt;/code&amp;gt; has been used instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name server-name \&lt;br /&gt;
--ram 1024 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics none \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/server-name.img,size=20,bus=virtio \&lt;br /&gt;
--extra-args &amp;quot;console=ttyS0&amp;quot; \&lt;br /&gt;
--location /mnt/md0/kvm/iso/ubuntu-16.04.3-server-amd64.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should be presented with the console of the VM as it installs, however if you lose connection etc, connect to the console of the server using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;.  Make sure you set a static IP and install SSH during setup (select &#039;&#039;&#039;OpenSSH server&#039;&#039;&#039; during &#039;&#039;Software selection&#039;&#039; section). Once installation is completed, SSH to the server and setup normal console access (as the instructions in the section below).  Its highly recommended that you follow the steps below to ensure that Console access is available via the KVM host if needed.&lt;br /&gt;
&lt;br /&gt;
==== Console Access ====&lt;br /&gt;
# Update the &amp;lt;code&amp;gt;/etc/default/grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Add &amp;lt;code&amp;gt;console=ttyS0&amp;lt;/code&amp;gt; to the config line &amp;lt;code&amp;gt;GRUB_CMDLINE_LINUX_DEFAULT&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;quiet splash console=ttyS0&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update grub&lt;br /&gt;
#* &amp;lt;code&amp;gt;update-grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the guest machine&lt;br /&gt;
&lt;br /&gt;
Connect using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;, you may need to hit Return once to show the logon prompt.&lt;br /&gt;
&lt;br /&gt;
=== Create Workstation (GUI) ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name ubuntu-desktop \&lt;br /&gt;
--ram 2048 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--cdrom=/mnt/md0/kvm/iso/ubuntu-16.04.3-desktop-amd64.iso \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics vnc,listen=0.0.0.0 \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/ubuntu-desktop.img,size=40,bus=virtio&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the command has got as far as &amp;lt;code&amp;gt;Waiting for installation to complete.&amp;lt;/code&amp;gt; you need to connect to the VNC console session, to find the port number to connect on query the config from &#039;&#039;another&#039;&#039; SSH session connected to the host (typically VNC uses ports starting from 5900 upwards).  Cancelling the command causes the VM/domain to power off, which you won&#039;t want to happen until you&#039;ve completed setup of the VM.&lt;br /&gt;
  virsh dumpxml ubuntu-desktop | grep vnc&lt;br /&gt;
&lt;br /&gt;
== Move Virtual Machine ==&lt;br /&gt;
If you want to move your domain/VM to another KVM host and don&#039;t have shared storage you can manually copy the data and VM config across to another host and import it.&lt;br /&gt;
&lt;br /&gt;
# Shutdown the virtual machine&lt;br /&gt;
#* Preferably from the OS so it gets a graceful shutdown, alternatively stop the VM from KVM&lt;br /&gt;
# Export the config&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh dumpxl &amp;lt;VMname&amp;gt; &amp;gt; /tmp/VMName.xml&amp;lt;/code&amp;gt;&lt;br /&gt;
# Copy the VM disk file(s) and config XML to their new host&lt;br /&gt;
#* Disk file(s) should go the location from which your VM&#039;s will run from&lt;br /&gt;
# Update the config, if necessary...&lt;br /&gt;
#* Disk file path - If the VM disks are in a different path on the new server up date the path in the XML file, look for &amp;lt;code&amp;gt;source file=&amp;lt;/code&amp;gt;&lt;br /&gt;
#* CPU type - If the physical CPU type is different on the new host, you may need to update the VM config to allow for this, update the &amp;lt;code&amp;gt;cpu mode&amp;lt;/code&amp;gt; config to match the capabilities of the destination host, or just set to &amp;lt;code&amp;gt;&amp;lt;cpu mode=&#039;host-passthrough&#039;/&amp;gt;&amp;lt;/code&amp;gt;.  See https://www.berrange.com/posts/2018/06/29/cpu-model-configuration-for-qemu-kvm-on-x86-hosts/ for more info.&lt;br /&gt;
# Import the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh define /path/to/VMName.xml &amp;lt;/code&amp;gt;&lt;br /&gt;
# Start the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh start &amp;lt;VMName&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add Disk ==&lt;br /&gt;
# Create new disk image file&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; qemu-img create -f qcow2 /var/lib/libvirt/images/vm-name-disk1.img 20G &amp;lt;/code&amp;gt;&lt;br /&gt;
# Attach disk image to virtual machine&lt;br /&gt;
#* Use &amp;lt;code&amp;gt;df&amp;lt;/code&amp;gt; in the VM to determine next disk label, eg &amp;lt;code&amp;gt;vdb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; qemu-img create -f qcow2 /var/lib/libvirt/images/vm-name-disk1.img 20G -o preallocation=full &amp;lt;/code&amp;gt;&lt;br /&gt;
#** To create a thin provisioned file use the following (however you may find the disk the OS sees is small (~200K), if so, use the command above)&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; virsh attach-disk vm-name /var/lib/libvirt/images/vm-name-disk1.img vdb --cache none &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update file owner and group to match other disk images&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;  chown libvirt-qemu /var/lib/libvirt/images/vm-name-disk1.img &amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;  chgrp libvirt-qemu /var/lib/libvirt/images/vm-name-disk1.img &amp;lt;/code&amp;gt;&lt;br /&gt;
# Attach disk&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh attach-disk --domain vm-name /var/lib/libvirt/images/vm-name-disk1.img --target vdb --persistent --config --live &amp;lt;/code&amp;gt;&lt;br /&gt;
# In the VM, format the disk using defaults..&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; fdisk /dev/vdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Command: n &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Partition type: p, &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Partition number: &amp;lt;default&amp;gt;, &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;First sector: &amp;lt;default&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Last sector: &amp;lt;default&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Command: w &amp;lt;/code&amp;gt;&lt;br /&gt;
# Format new partition&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mkfs.ext4 /dev/vdb1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# Create mount directory&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mkdir /vdb1/ &amp;lt;/code&amp;gt;&lt;br /&gt;
# Mount the the disk&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mount /dev/vdb1 /vdb1/ &amp;lt;/code&amp;gt;&lt;br /&gt;
# Add an appropriate entry to fstab so the disk gets mounted on next boot&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; /dev/vdb1    /vdb1    ext4     defaults    0 0 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other Config ==&lt;br /&gt;
=== Auto Start ===&lt;br /&gt;
To ensure that a VM domain starts with the host server issue the following commands (replace &amp;lt;code&amp;gt;vm-name&amp;lt;/code&amp;gt; with the name of your VM&lt;br /&gt;
 virsh autostart vm-name&lt;br /&gt;
&lt;br /&gt;
To disable issue&lt;br /&gt;
 virsh autostart vm-name --disable&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:KVM]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2728</id>
		<title>Virtual Machine (KVM)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2728"/>
		<updated>2020-08-17T12:37:24Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Create Workstation (GUI) */ Added listen=0.0.0.0 to graphics so VNC listens on more than just loopback&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Note that VMs are known as &#039;&#039;&#039;domains&#039;&#039;&#039; in the KVM world.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
This guide assumes you have a basic working environment, run the &amp;lt;code&amp;gt;kvm-ok&amp;lt;/code&amp;gt; command to sanity check...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@kvm-host:# kvm-ok&lt;br /&gt;
INFO: /dev/kvm exists&lt;br /&gt;
KVM acceleration can be used&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install Media ===&lt;br /&gt;
You need to have a local copy of the appropriate ISO.  If you have the ISO file already, upload to your KVM server, alternatively download from the site using &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Ubuntu Desktop LTS&#039;&#039;&#039; - http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso&lt;br /&gt;
&lt;br /&gt;
== Create Virtual Machine ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter                    !! Example                     !! Usage&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;            || VM-Name                     || Name of virtual machine (typically this should match the intended hostname of the VM)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;     || &amp;quot;Test VM to be used for X&amp;quot;  || Description of virtual machine&#039;s purpose etc&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-type&amp;lt;/code&amp;gt;         || Linux                       || OS family, can be  Linux, Solaris, Unix or Windows&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-variant&amp;lt;/code&amp;gt;      || ubuntu16.04                 || Distribution type for the above (run &amp;lt;code&amp;gt;osinfo-query os&amp;lt;/code&amp;gt; to view what is available)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ram&amp;lt;/code&amp;gt;             || 2048                        || vRAM in GB&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;disk path&amp;lt;/code&amp;gt;       || /vm-store/images/VM-Name.img,bus=virtio,size=50 || Virtual disk path, using virtio bus and with a 50GB disk&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;graphics&amp;lt;/code&amp;gt;        || none                        || If noneset, VM will be created with a serial display output (as opposed to VNC window)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cdrom&amp;lt;/code&amp;gt;           || /home/user/cdrom.iso        || Path to installation ISO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;network&amp;lt;/code&amp;gt;         || bridge:br0                  || Network connection details&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Create Server (no GUI) ===&lt;br /&gt;
Update paths to reflect where install ISO, and where VM disk files are intended to be.  &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--extra-args &amp;quot;console=ttyS0&amp;quot;&amp;lt;/code&amp;gt; option allows a local console to be accessed from the host machine (to allow OS install etc before the VM is on a network), though note that it can&#039;t be used with &amp;lt;code&amp;gt;--cdrom&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;--location&amp;lt;/code&amp;gt; has been used instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name server-name \&lt;br /&gt;
--ram 1024 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics none \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/server-name.img,size=20,bus=virtio \&lt;br /&gt;
--extra-args &amp;quot;console=ttyS0&amp;quot; \&lt;br /&gt;
--location /mnt/md0/kvm/iso/ubuntu-16.04.3-server-amd64.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should be presented with the console of the VM as it installs, however if you lose connection etc, connect to the console of the server using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;.  Make sure you set a static IP and install SSH during setup (select &#039;&#039;&#039;OpenSSH server&#039;&#039;&#039; during &#039;&#039;Software selection&#039;&#039; section). Once installation is completed, SSH to the server and setup normal console access (as the instructions in the section below).  Its highly recommended that you follow the steps below to ensure that Console access is available via the KVM host if needed.&lt;br /&gt;
&lt;br /&gt;
==== Console Access ====&lt;br /&gt;
# Update the &amp;lt;code&amp;gt;/etc/default/grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Add &amp;lt;code&amp;gt;console=ttyS0&amp;lt;/code&amp;gt; to the config line &amp;lt;code&amp;gt;GRUB_CMDLINE_LINUX_DEFAULT&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;quiet splash console=ttyS0&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update grub&lt;br /&gt;
#* &amp;lt;code&amp;gt;update-grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the guest machine&lt;br /&gt;
&lt;br /&gt;
Connect using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;, you may need to hit Return once to show the logon prompt.&lt;br /&gt;
&lt;br /&gt;
=== Create Workstation (GUI) ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name ubuntu-desktop \&lt;br /&gt;
--ram 2048 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--cdrom=/mnt/md0/kvm/iso/ubuntu-16.04.3-desktop-amd64.iso \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics vnc,listen=0.0.0.0 \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/ubuntu-desktop.img,size=40,bus=virtio&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the command has got as far as &amp;lt;code&amp;gt;Waiting for installation to complete.&amp;lt;/code&amp;gt; you need to connect to the VNC console session, to find the port number to connect on query the config from anothet SSH session connected to the host (typically VNC uses ports starting from 5900 upwards).&lt;br /&gt;
  virsh dumpxml ubuntu-desktop | grep vnc&lt;br /&gt;
&lt;br /&gt;
== Move Virtual Machine ==&lt;br /&gt;
If you want to move your domain/VM to another KVM host and don&#039;t have shared storage you can manually copy the data and VM config across to another host and import it.&lt;br /&gt;
&lt;br /&gt;
# Shutdown the virtual machine&lt;br /&gt;
#* Preferably from the OS so it gets a graceful shutdown, alternatively stop the VM from KVM&lt;br /&gt;
# Export the config&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh dumpxl &amp;lt;VMname&amp;gt; &amp;gt; /tmp/VMName.xml&amp;lt;/code&amp;gt;&lt;br /&gt;
# Copy the VM disk file(s) and config XML to their new host&lt;br /&gt;
#* Disk file(s) should go the location from which your VM&#039;s will run from&lt;br /&gt;
# Update the config, if necessary...&lt;br /&gt;
#* Disk file path - If the VM disks are in a different path on the new server up date the path in the XML file, look for &amp;lt;code&amp;gt;source file=&amp;lt;/code&amp;gt;&lt;br /&gt;
#* CPU type - If the physical CPU type is different on the new host, you may need to update the VM config to allow for this, update the &amp;lt;code&amp;gt;cpu mode&amp;lt;/code&amp;gt; config to match the capabilities of the destination host, or just set to &amp;lt;code&amp;gt;&amp;lt;cpu mode=&#039;host-passthrough&#039;/&amp;gt;&amp;lt;/code&amp;gt;.  See https://www.berrange.com/posts/2018/06/29/cpu-model-configuration-for-qemu-kvm-on-x86-hosts/ for more info.&lt;br /&gt;
# Import the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh define /path/to/VMName.xml &amp;lt;/code&amp;gt;&lt;br /&gt;
# Start the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh start &amp;lt;VMName&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add Disk ==&lt;br /&gt;
# Create new disk image file&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; qemu-img create -f qcow2 /var/lib/libvirt/images/vm-name-disk1.img 20G &amp;lt;/code&amp;gt;&lt;br /&gt;
# Attach disk image to virtual machine&lt;br /&gt;
#* Use &amp;lt;code&amp;gt;df&amp;lt;/code&amp;gt; in the VM to determine next disk label, eg &amp;lt;code&amp;gt;vdb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; qemu-img create -f qcow2 /var/lib/libvirt/images/vm-name-disk1.img 20G -o preallocation=full &amp;lt;/code&amp;gt;&lt;br /&gt;
#** To create a thin provisioned file use the following (however you may find the disk the OS sees is small (~200K), if so, use the command above)&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; virsh attach-disk vm-name /var/lib/libvirt/images/vm-name-disk1.img vdb --cache none &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update file owner and group to match other disk images&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;  chown libvirt-qemu /var/lib/libvirt/images/vm-name-disk1.img &amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;  chgrp libvirt-qemu /var/lib/libvirt/images/vm-name-disk1.img &amp;lt;/code&amp;gt;&lt;br /&gt;
# Attach disk&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh attach-disk --domain vm-name /var/lib/libvirt/images/vm-name-disk1.img --target vdb --persistent --config --live &amp;lt;/code&amp;gt;&lt;br /&gt;
# In the VM, format the disk using defaults..&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; fdisk /dev/vdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Command: n &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Partition type: p, &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Partition number: &amp;lt;default&amp;gt;, &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;First sector: &amp;lt;default&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Last sector: &amp;lt;default&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Command: w &amp;lt;/code&amp;gt;&lt;br /&gt;
# Format new partition&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mkfs.ext4 /dev/vdb1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# Create mount directory&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mkdir /vdb1/ &amp;lt;/code&amp;gt;&lt;br /&gt;
# Mount the the disk&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mount /dev/vdb1 /vdb1/ &amp;lt;/code&amp;gt;&lt;br /&gt;
# Add an appropriate entry to fstab so the disk gets mounted on next boot&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; /dev/vdb1    /vdb1    ext4     defaults    0 0 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other Config ==&lt;br /&gt;
=== Auto Start ===&lt;br /&gt;
To ensure that a VM domain starts with the host server issue the following commands (replace &amp;lt;code&amp;gt;vm-name&amp;lt;/code&amp;gt; with the name of your VM&lt;br /&gt;
 virsh autostart vm-name&lt;br /&gt;
&lt;br /&gt;
To disable issue&lt;br /&gt;
 virsh autostart vm-name --disable&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:KVM]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2727</id>
		<title>Virtual Machine (KVM)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2727"/>
		<updated>2020-07-27T14:33:46Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Add Disk */ Typo fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Note that VMs are known as &#039;&#039;&#039;domains&#039;&#039;&#039; in the KVM world.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
This guide assumes you have a basic working environment, run the &amp;lt;code&amp;gt;kvm-ok&amp;lt;/code&amp;gt; command to sanity check...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@kvm-host:# kvm-ok&lt;br /&gt;
INFO: /dev/kvm exists&lt;br /&gt;
KVM acceleration can be used&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install Media ===&lt;br /&gt;
You need to have a local copy of the appropriate ISO.  If you have the ISO file already, upload to your KVM server, alternatively download from the site using &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Ubuntu Desktop LTS&#039;&#039;&#039; - http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso&lt;br /&gt;
&lt;br /&gt;
== Create Virtual Machine ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter                    !! Example                     !! Usage&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;            || VM-Name                     || Name of virtual machine (typically this should match the intended hostname of the VM)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;     || &amp;quot;Test VM to be used for X&amp;quot;  || Description of virtual machine&#039;s purpose etc&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-type&amp;lt;/code&amp;gt;         || Linux                       || OS family, can be  Linux, Solaris, Unix or Windows&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-variant&amp;lt;/code&amp;gt;      || ubuntu16.04                 || Distribution type for the above (run &amp;lt;code&amp;gt;osinfo-query os&amp;lt;/code&amp;gt; to view what is available)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ram&amp;lt;/code&amp;gt;             || 2048                        || vRAM in GB&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;disk path&amp;lt;/code&amp;gt;       || /vm-store/images/VM-Name.img,bus=virtio,size=50 || Virtual disk path, using virtio bus and with a 50GB disk&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;graphics&amp;lt;/code&amp;gt;        || none                        || If noneset, VM will be created with a serial display output (as opposed to VNC window)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cdrom&amp;lt;/code&amp;gt;           || /home/user/cdrom.iso        || Path to installation ISO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;network&amp;lt;/code&amp;gt;         || bridge:br0                  || Network connection details&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Create Server (no GUI) ===&lt;br /&gt;
Update paths to reflect where install ISO, and where VM disk files are intended to be.  &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--extra-args &amp;quot;console=ttyS0&amp;quot;&amp;lt;/code&amp;gt; option allows a local console to be accessed from the host machine (to allow OS install etc before the VM is on a network), though note that it can&#039;t be used with &amp;lt;code&amp;gt;--cdrom&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;--location&amp;lt;/code&amp;gt; has been used instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name server-name \&lt;br /&gt;
--ram 1024 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics none \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/server-name.img,size=20,bus=virtio \&lt;br /&gt;
--extra-args &amp;quot;console=ttyS0&amp;quot; \&lt;br /&gt;
--location /mnt/md0/kvm/iso/ubuntu-16.04.3-server-amd64.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should be presented with the console of the VM as it installs, however if you lose connection etc, connect to the console of the server using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;.  Make sure you set a static IP and install SSH during setup (select &#039;&#039;&#039;OpenSSH server&#039;&#039;&#039; during &#039;&#039;Software selection&#039;&#039; section). Once installation is completed, SSH to the server and setup normal console access (as the instructions in the section below).  Its highly recommended that you follow the steps below to ensure that Console access is available via the KVM host if needed.&lt;br /&gt;
&lt;br /&gt;
==== Console Access ====&lt;br /&gt;
# Update the &amp;lt;code&amp;gt;/etc/default/grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Add &amp;lt;code&amp;gt;console=ttyS0&amp;lt;/code&amp;gt; to the config line &amp;lt;code&amp;gt;GRUB_CMDLINE_LINUX_DEFAULT&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;quiet splash console=ttyS0&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update grub&lt;br /&gt;
#* &amp;lt;code&amp;gt;update-grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the guest machine&lt;br /&gt;
&lt;br /&gt;
Connect using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;, you may need to hit Return once to show the logon prompt.&lt;br /&gt;
&lt;br /&gt;
=== Create Workstation (GUI) ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name ubuntu-desktop \&lt;br /&gt;
--ram 2048 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--cdrom=/mnt/md0/kvm/iso/ubuntu-16.04.3-desktop-amd64.iso \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics vnc \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/ubuntu-desktop.img,size=40,bus=virtio&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the command has got as far as &amp;lt;code&amp;gt;Waiting for installation to complete.&amp;lt;/code&amp;gt; you need to connect to the VNC console session, to find the port number to connect on query the config from anothet SSH session connected to the host (typically VNC uses ports starting from 5900 upwards).&lt;br /&gt;
  virsh dumpxml ubuntu-desktop | grep vnc&lt;br /&gt;
&lt;br /&gt;
== Move Virtual Machine ==&lt;br /&gt;
If you want to move your domain/VM to another KVM host and don&#039;t have shared storage you can manually copy the data and VM config across to another host and import it.&lt;br /&gt;
&lt;br /&gt;
# Shutdown the virtual machine&lt;br /&gt;
#* Preferably from the OS so it gets a graceful shutdown, alternatively stop the VM from KVM&lt;br /&gt;
# Export the config&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh dumpxl &amp;lt;VMname&amp;gt; &amp;gt; /tmp/VMName.xml&amp;lt;/code&amp;gt;&lt;br /&gt;
# Copy the VM disk file(s) and config XML to their new host&lt;br /&gt;
#* Disk file(s) should go the location from which your VM&#039;s will run from&lt;br /&gt;
# Update the config, if necessary...&lt;br /&gt;
#* Disk file path - If the VM disks are in a different path on the new server up date the path in the XML file, look for &amp;lt;code&amp;gt;source file=&amp;lt;/code&amp;gt;&lt;br /&gt;
#* CPU type - If the physical CPU type is different on the new host, you may need to update the VM config to allow for this, update the &amp;lt;code&amp;gt;cpu mode&amp;lt;/code&amp;gt; config to match the capabilities of the destination host, or just set to &amp;lt;code&amp;gt;&amp;lt;cpu mode=&#039;host-passthrough&#039;/&amp;gt;&amp;lt;/code&amp;gt;.  See https://www.berrange.com/posts/2018/06/29/cpu-model-configuration-for-qemu-kvm-on-x86-hosts/ for more info.&lt;br /&gt;
# Import the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh define /path/to/VMName.xml &amp;lt;/code&amp;gt;&lt;br /&gt;
# Start the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh start &amp;lt;VMName&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add Disk ==&lt;br /&gt;
# Create new disk image file&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; qemu-img create -f qcow2 /var/lib/libvirt/images/vm-name-disk1.img 20G &amp;lt;/code&amp;gt;&lt;br /&gt;
# Attach disk image to virtual machine&lt;br /&gt;
#* Use &amp;lt;code&amp;gt;df&amp;lt;/code&amp;gt; in the VM to determine next disk label, eg &amp;lt;code&amp;gt;vdb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; qemu-img create -f qcow2 /var/lib/libvirt/images/vm-name-disk1.img 20G -o preallocation=full &amp;lt;/code&amp;gt;&lt;br /&gt;
#** To create a thin provisioned file use the following (however you may find the disk the OS sees is small (~200K), if so, use the command above)&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; virsh attach-disk vm-name /var/lib/libvirt/images/vm-name-disk1.img vdb --cache none &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update file owner and group to match other disk images&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;  chown libvirt-qemu /var/lib/libvirt/images/vm-name-disk1.img &amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;  chgrp libvirt-qemu /var/lib/libvirt/images/vm-name-disk1.img &amp;lt;/code&amp;gt;&lt;br /&gt;
# Attach disk&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh attach-disk --domain vm-name /var/lib/libvirt/images/vm-name-disk1.img --target vdb --persistent --config --live &amp;lt;/code&amp;gt;&lt;br /&gt;
# In the VM, format the disk using defaults..&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; fdisk /dev/vdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Command: n &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Partition type: p, &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Partition number: &amp;lt;default&amp;gt;, &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;First sector: &amp;lt;default&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Last sector: &amp;lt;default&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Command: w &amp;lt;/code&amp;gt;&lt;br /&gt;
# Format new partition&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mkfs.ext4 /dev/vdb1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# Create mount directory&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mkdir /vdb1/ &amp;lt;/code&amp;gt;&lt;br /&gt;
# Mount the the disk&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mount /dev/vdb1 /vdb1/ &amp;lt;/code&amp;gt;&lt;br /&gt;
# Add an appropriate entry to fstab so the disk gets mounted on next boot&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; /dev/vdb1    /vdb1    ext4     defaults    0 0 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other Config ==&lt;br /&gt;
=== Auto Start ===&lt;br /&gt;
To ensure that a VM domain starts with the host server issue the following commands (replace &amp;lt;code&amp;gt;vm-name&amp;lt;/code&amp;gt; with the name of your VM&lt;br /&gt;
 virsh autostart vm-name&lt;br /&gt;
&lt;br /&gt;
To disable issue&lt;br /&gt;
 virsh autostart vm-name --disable&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:KVM]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2726</id>
		<title>Virtual Machine (KVM)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2726"/>
		<updated>2020-07-26T20:47:23Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: Added Add Disk&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Note that VMs are known as &#039;&#039;&#039;domains&#039;&#039;&#039; in the KVM world.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
This guide assumes you have a basic working environment, run the &amp;lt;code&amp;gt;kvm-ok&amp;lt;/code&amp;gt; command to sanity check...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@kvm-host:# kvm-ok&lt;br /&gt;
INFO: /dev/kvm exists&lt;br /&gt;
KVM acceleration can be used&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install Media ===&lt;br /&gt;
You need to have a local copy of the appropriate ISO.  If you have the ISO file already, upload to your KVM server, alternatively download from the site using &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Ubuntu Desktop LTS&#039;&#039;&#039; - http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso&lt;br /&gt;
&lt;br /&gt;
== Create Virtual Machine ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter                    !! Example                     !! Usage&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;            || VM-Name                     || Name of virtual machine (typically this should match the intended hostname of the VM)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;     || &amp;quot;Test VM to be used for X&amp;quot;  || Description of virtual machine&#039;s purpose etc&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-type&amp;lt;/code&amp;gt;         || Linux                       || OS family, can be  Linux, Solaris, Unix or Windows&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-variant&amp;lt;/code&amp;gt;      || ubuntu16.04                 || Distribution type for the above (run &amp;lt;code&amp;gt;osinfo-query os&amp;lt;/code&amp;gt; to view what is available)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ram&amp;lt;/code&amp;gt;             || 2048                        || vRAM in GB&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;disk path&amp;lt;/code&amp;gt;       || /vm-store/images/VM-Name.img,bus=virtio,size=50 || Virtual disk path, using virtio bus and with a 50GB disk&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;graphics&amp;lt;/code&amp;gt;        || none                        || If noneset, VM will be created with a serial display output (as opposed to VNC window)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cdrom&amp;lt;/code&amp;gt;           || /home/user/cdrom.iso        || Path to installation ISO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;network&amp;lt;/code&amp;gt;         || bridge:br0                  || Network connection details&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Create Server (no GUI) ===&lt;br /&gt;
Update paths to reflect where install ISO, and where VM disk files are intended to be.  &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--extra-args &amp;quot;console=ttyS0&amp;quot;&amp;lt;/code&amp;gt; option allows a local console to be accessed from the host machine (to allow OS install etc before the VM is on a network), though note that it can&#039;t be used with &amp;lt;code&amp;gt;--cdrom&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;--location&amp;lt;/code&amp;gt; has been used instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name server-name \&lt;br /&gt;
--ram 1024 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics none \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/server-name.img,size=20,bus=virtio \&lt;br /&gt;
--extra-args &amp;quot;console=ttyS0&amp;quot; \&lt;br /&gt;
--location /mnt/md0/kvm/iso/ubuntu-16.04.3-server-amd64.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should be presented with the console of the VM as it installs, however if you lose connection etc, connect to the console of the server using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;.  Make sure you set a static IP and install SSH during setup (select &#039;&#039;&#039;OpenSSH server&#039;&#039;&#039; during &#039;&#039;Software selection&#039;&#039; section). Once installation is completed, SSH to the server and setup normal console access (as the instructions in the section below).  Its highly recommended that you follow the steps below to ensure that Console access is available via the KVM host if needed.&lt;br /&gt;
&lt;br /&gt;
==== Console Access ====&lt;br /&gt;
# Update the &amp;lt;code&amp;gt;/etc/default/grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Add &amp;lt;code&amp;gt;console=ttyS0&amp;lt;/code&amp;gt; to the config line &amp;lt;code&amp;gt;GRUB_CMDLINE_LINUX_DEFAULT&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;quiet splash console=ttyS0&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update grub&lt;br /&gt;
#* &amp;lt;code&amp;gt;update-grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the guest machine&lt;br /&gt;
&lt;br /&gt;
Connect using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;, you may need to hit Return once to show the logon prompt.&lt;br /&gt;
&lt;br /&gt;
=== Create Workstation (GUI) ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name ubuntu-desktop \&lt;br /&gt;
--ram 2048 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--cdrom=/mnt/md0/kvm/iso/ubuntu-16.04.3-desktop-amd64.iso \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics vnc \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/ubuntu-desktop.img,size=40,bus=virtio&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the command has got as far as &amp;lt;code&amp;gt;Waiting for installation to complete.&amp;lt;/code&amp;gt; you need to connect to the VNC console session, to find the port number to connect on query the config from anothet SSH session connected to the host (typically VNC uses ports starting from 5900 upwards).&lt;br /&gt;
  virsh dumpxml ubuntu-desktop | grep vnc&lt;br /&gt;
&lt;br /&gt;
== Move Virtual Machine ==&lt;br /&gt;
If you want to move your domain/VM to another KVM host and don&#039;t have shared storage you can manually copy the data and VM config across to another host and import it.&lt;br /&gt;
&lt;br /&gt;
# Shutdown the virtual machine&lt;br /&gt;
#* Preferably from the OS so it gets a graceful shutdown, alternatively stop the VM from KVM&lt;br /&gt;
# Export the config&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh dumpxl &amp;lt;VMname&amp;gt; &amp;gt; /tmp/VMName.xml&amp;lt;/code&amp;gt;&lt;br /&gt;
# Copy the VM disk file(s) and config XML to their new host&lt;br /&gt;
#* Disk file(s) should go the location from which your VM&#039;s will run from&lt;br /&gt;
# Update the config, if necessary...&lt;br /&gt;
#* Disk file path - If the VM disks are in a different path on the new server up date the path in the XML file, look for &amp;lt;code&amp;gt;source file=&amp;lt;/code&amp;gt;&lt;br /&gt;
#* CPU type - If the physical CPU type is different on the new host, you may need to update the VM config to allow for this, update the &amp;lt;code&amp;gt;cpu mode&amp;lt;/code&amp;gt; config to match the capabilities of the destination host, or just set to &amp;lt;code&amp;gt;&amp;lt;cpu mode=&#039;host-passthrough&#039;/&amp;gt;&amp;lt;/code&amp;gt;.  See https://www.berrange.com/posts/2018/06/29/cpu-model-configuration-for-qemu-kvm-on-x86-hosts/ for more info.&lt;br /&gt;
# Import the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh define /path/to/VMName.xml &amp;lt;/code&amp;gt;&lt;br /&gt;
# Start the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh start &amp;lt;VMName&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add Disk ==&lt;br /&gt;
# Create new disk image file&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; qemu-img create -f qcow2 /var/lib/libvirt/images/elk-disk1.img 20G &amp;lt;/code&amp;gt;&lt;br /&gt;
# Attach disk image to virtual machine&lt;br /&gt;
#* Use &amp;lt;code&amp;gt;df&amp;lt;/code&amp;gt; in the VM to determine next disk label, eg &amp;lt;code&amp;gt;vdb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; qemu-img create -f qcow2 /var/lib/libvirt/images/elk-disk1.img 20G -o preallocation=full &amp;lt;/code&amp;gt;&lt;br /&gt;
#** To create a thin provisioned file use the following (however you may find the disk the OS sees is small (~200K), if so, use the command above)&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; virsh attach-disk elk /var/lib/libvirt/images/elk-disk1.img vdb --cache none &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update file owner and group to match other disk images&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;  chown libvirt-qemu /var/lib/libvirt/images/elk-disk1.img &amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;  chgrp libvirt-qemu /var/lib/libvirt/images/elk-disk1.img &amp;lt;/code&amp;gt;&lt;br /&gt;
# Attach disk&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh attach-disk --domain elk /var/lib/libvirt/images/elk-disk1.img --target vdb --persistent --config --live &amp;lt;/code&amp;gt;&lt;br /&gt;
# In the VM, format the disk using defaults..&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; fdisk /dev/vdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Command: n &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Partition type: p, &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Partition number: &amp;lt;default&amp;gt;, &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;First sector: &amp;lt;default&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Last sector: &amp;lt;default&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
#** EG &amp;lt;code&amp;gt;Command: w &amp;lt;/code&amp;gt;&lt;br /&gt;
# Format new partition&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mkfs.ext4 /dev/vdb1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# Create mount directory&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mkdir /vdb1/ &amp;lt;/code&amp;gt;&lt;br /&gt;
# Mount the the disk&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mount /dev/vdb1 /vdb1/ &amp;lt;/code&amp;gt;&lt;br /&gt;
# Add an appropriate entry to fstab so the disk gets mounted on next boot&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; /dev/vdb1    /vdb1    ext4     defaults    0 0 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other Config ==&lt;br /&gt;
=== Auto Start ===&lt;br /&gt;
To ensure that a VM domain starts with the host server issue the following commands (replace &amp;lt;code&amp;gt;vm-name&amp;lt;/code&amp;gt; with the name of your VM&lt;br /&gt;
 virsh autostart vm-name&lt;br /&gt;
&lt;br /&gt;
To disable issue&lt;br /&gt;
 virsh autostart vm-name --disable&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:KVM]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Configuration_(Ubuntu)&amp;diff=2725</id>
		<title>Configuration (Ubuntu)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Configuration_(Ubuntu)&amp;diff=2725"/>
		<updated>2020-07-26T19:30:07Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Setup (Post v12 Ubunutu) */ Updated restart command&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Packages =&lt;br /&gt;
{|class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
! Command                              !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; dpkg --get-selections &amp;lt;/code&amp;gt; || Show installed packages&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; dpkg -L php5-gd &amp;lt;/code&amp;gt;       || Show file locations of &amp;lt;code&amp;gt; php5-gd &amp;lt;/code&amp;gt; package&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;        || Update the package database&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; apt-get install &amp;lt;package&amp;gt; &amp;lt;/code&amp;gt;  || Install the &amp;lt;code&amp;gt; &amp;lt;package&amp;gt; &amp;lt;/code&amp;gt; package&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; apt-get remove &amp;lt;package&amp;gt; &amp;lt;/code&amp;gt;  || Uninstall the &amp;lt;code&amp;gt; &amp;lt;package&amp;gt; &amp;lt;/code&amp;gt; package&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; apt-get autoremove &amp;lt;package&amp;gt; &amp;lt;/code&amp;gt;  || Uninstall the &amp;lt;code&amp;gt; &amp;lt;package&amp;gt; &amp;lt;/code&amp;gt; package and any other packages installed as dependencies which are no longer required&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; apt-get upgrade &amp;lt;/code&amp;gt;       || Upgrade installed system and packages with latest levels in package database&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; aptitude safe-upgrade &amp;lt;/code&amp;gt; || Upgrade installed system and packages with latest levels in package database (including linux image and libraries, not always possible with &amp;lt;code&amp;gt;apt-get upgrade&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; aptitude hold &#039;&amp;lt;package&amp;gt;&#039; &amp;lt;/code&amp;gt; || Prevents a package from being upgraded&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; tasksel install &amp;lt;task&amp;gt; &amp;lt;/code&amp;gt; || Installs a collection of packages as a single task, eg lamp-server&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; tasksel --list-task &amp;lt;/code&amp;gt;   || Show list of available tasks&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
See also [[Troubleshooting_(Ubuntu)#Packages|Troubleshooting]]&lt;br /&gt;
&lt;br /&gt;
See below for specific help on installing the following packages&lt;br /&gt;
* [[#SNMP|SNMP]]&lt;br /&gt;
* [[#Install Module|Perl Modules]]&lt;br /&gt;
&lt;br /&gt;
= Firewall =&lt;br /&gt;
&#039;&#039;&#039;See also [[Troubleshooting_(Ubuntu)#Firewall|Troubleshooting &amp;gt; Firewall]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Ubuntu comes with UFW (Uncomplicated Firewall), which is a config tool used to modify the standard inbuilt Netfilter.  If preferred, &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt; can still be used, both &amp;lt;code&amp;gt;ufw&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt; are essentially config tools for Netfilter.&lt;br /&gt;
&lt;br /&gt;
Changes are applied immediately. Once you&#039;ve added your first rule there&#039;s an implied deny all.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
! Command                               !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ufw enable &amp;lt;/code&amp;gt;             || Enables the firewall&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ufw status &amp;lt;/code&amp;gt;             || Shows the firewall status and existing filters&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ufw status numbered &amp;lt;/code&amp;gt;    || Shows the firewall status and numbered existing filters (easier to delete)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ufw allow from 192.168.1.10 &amp;lt;/code&amp;gt; || Allow all traffic from 192.168.1.10&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ufw allow http &amp;lt;/code&amp;gt;         || Allow http from any IP&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ufw allow proto tcp from 192.168.1.10 to any port 22 &amp;lt;/code&amp;gt; || Allow TCP 22 (SSH) from 192.168.1.10&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ufw allow proto udp from any to any port 123 &amp;lt;/code&amp;gt; || Allow UDP 123 (NTP) from any host&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ufw delete 2 &amp;lt;/code&amp;gt;           || Delete rule 2&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
So, for example, to create a couple of rules and enable...&lt;br /&gt;
 ufw allow proto tcp from 192.168.10.0/24 to any port 22&lt;br /&gt;
 ufw allow proto tcp to any port 443&lt;br /&gt;
 ufw enable&lt;br /&gt;
&lt;br /&gt;
Be aware that &#039;&#039;&#039;rules are processed in order&#039;&#039;&#039;, despite the fact that there is no easy way to alter the order of your rules using &amp;lt;code&amp;gt;ufw&amp;lt;/code&amp;gt; or insert rules above existing ones.  Therefore you need to think about the order of your rules carefully.&lt;br /&gt;
&lt;br /&gt;
See [[TCP UDP Ports]] for further info on common ports.&lt;br /&gt;
&lt;br /&gt;
=== Deny a Specific Host ===&lt;br /&gt;
If you want to deny a specific host (because its spamming or hacking you for example) you need to ensure that the deny rule is one of the first processed.  Otherwise the host might still be able to access on port 80 (if you&#039;re running a web server and have a general allow rule for http traffic).  To do so you need to insert a deny rule at the top of your rule-set, &lt;br /&gt;
&lt;br /&gt;
To deny all traffic from 46.118.117.13...&lt;br /&gt;
&amp;lt;pre&amp;gt; ufw insert 1 deny from 46.118.117.13 to any &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively you can edit the UFW config file direct, but the denied hosts will &#039;&#039;not&#039;&#039; appear when showing the firewall status, which will cause you problems later down the line...&lt;br /&gt;
# Edit &amp;lt;code&amp;gt;/etc/ufw/before.rules&amp;lt;/code&amp;gt;&lt;br /&gt;
# Create a new section under the &amp;lt;code&amp;gt; # drop INVALID packets &amp;lt;/code&amp;gt; section (near the top of the file)&lt;br /&gt;
# Add deny rules as required&lt;br /&gt;
#* &amp;lt;code&amp;gt; # Block IP&#039;s&amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; -A ufw-before-input -s 46.118.117.13 -j DROP&amp;lt;/code&amp;gt;&lt;br /&gt;
# Repeat the last line for as many IP&#039;s as you need to block (CIDR style notation can be used for ranges, eg 46.118.117.0/24)&lt;br /&gt;
# Reload the firewall to apply the new config&lt;br /&gt;
#* &amp;lt;code&amp;gt; ufw reload &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= SNMP =&lt;br /&gt;
Note that the way in which the SNMP daemon/agent needs to be configured varies between OS version.&lt;br /&gt;
&lt;br /&gt;
== Setup (Pre v10 Ubuntu) ==&lt;br /&gt;
# Run the following command to update the package database&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
# Run the following command to install SNMP&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install snmpd &amp;lt;/code&amp;gt;&lt;br /&gt;
# Create config file with contents as shown below&lt;br /&gt;
#* &amp;lt;code&amp;gt; vi /etc/snmp/snmpd.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
# Edit SNMPD config to allow remote polls&lt;br /&gt;
#* &amp;lt;code&amp;gt; vi /etc/default/snmpd &amp;lt;/code&amp;gt;&lt;br /&gt;
# Remove &amp;lt;code&amp;gt; 127.0.0.1 &amp;lt;/code&amp;gt; from line below&lt;br /&gt;
#* &amp;lt;code&amp;gt; &amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt;snmpd options (use syslog, close stdin/out/err). &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; SNMPDOPTS=&#039;-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart SNMP&lt;br /&gt;
#* &amp;lt;code&amp;gt; /etc/init.d/snmpd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
# Test with the following, replacing &amp;lt;hostname&amp;gt; with server&#039;s hostname&lt;br /&gt;
#* &amp;lt;code&amp;gt; snmpwalk -v 1 -c public -O e &amp;lt;hostname&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 rocommunity public&lt;br /&gt;
 syslocation &amp;quot;CR DC&amp;quot;&lt;br /&gt;
 syscontact info@sandfordit.com&lt;br /&gt;
&lt;br /&gt;
== Setup (v10/v12 Ubuntu) ==&lt;br /&gt;
# Run the following command to update the package database&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
# Run the following command to install SNMP&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install snmpd &amp;lt;/code&amp;gt;&lt;br /&gt;
# Create config file with contents as shown below the procedure&lt;br /&gt;
#* &amp;lt;code&amp;gt; vi /etc/snmp/snmpd.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
# Edit SNMPD config to allow remote polls&lt;br /&gt;
#* &amp;lt;code&amp;gt; vi /etc/default/snmpd &amp;lt;/code&amp;gt;&lt;br /&gt;
# Remove &amp;lt;code&amp;gt; 127.0.0.1 &amp;lt;/code&amp;gt; from line below&lt;br /&gt;
#* &amp;lt;code&amp;gt; &amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt;snmpd options (use syslog, close stdin/out/err). &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; SNMPDOPTS=&#039;-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart SNMP&lt;br /&gt;
#* &amp;lt;code&amp;gt; /etc/init.d/snmpd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
# Test with the following, replacing &amp;lt;hostname&amp;gt; with server&#039;s hostname (must be run from a machine with snmp installed, not just snmpd)&lt;br /&gt;
#* &amp;lt;code&amp;gt; snmpwalk -v 1 -c public &amp;lt;hostname&amp;gt; system &amp;lt;hostname&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 ####&lt;br /&gt;
 # First, map the community name (COMMUNITY) into a security name&lt;br /&gt;
 # (local and mynetwork, depending on where the request is coming&lt;br /&gt;
 # from):&lt;br /&gt;
 &lt;br /&gt;
 #       sec.name  source          community&lt;br /&gt;
 #com2sec paranoid  default         public	&#039;&#039;&#039;&amp;lt;- Comment&#039;&#039;&#039;&lt;br /&gt;
 com2sec readonly  default         public	&#039;&#039;&#039;&amp;lt;- Uncomment&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;... then later ...&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 syslocation &amp;quot;CR DC&amp;quot;&lt;br /&gt;
 syscontact info@sandfordit.com&lt;br /&gt;
&lt;br /&gt;
== Setup (Post v12 Ubunutu) ==&lt;br /&gt;
# Run the following command to update the package database&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
# Run the following command to install SNMP&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install snmpd &amp;lt;/code&amp;gt;&lt;br /&gt;
# Replace existing config file with contents as shown below the procedure&lt;br /&gt;
#* &amp;lt;code&amp;gt; vi /etc/snmp/snmpd.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
# Throttle down logging verbosity (otherwise log is spammed with &amp;lt;code&amp;gt;Connection from UDP&amp;lt;/code&amp;gt; messages&lt;br /&gt;
#* &amp;lt;code&amp;gt; vi /etc/default/snmpd &amp;lt;/code&amp;gt;&lt;br /&gt;
#* Set the option &amp;lt;code&amp;gt;-LS0-5d&amp;lt;/code&amp;gt; so the config line starts...&lt;br /&gt;
#* &amp;lt;code&amp;gt;SNMPDOPTS=&#039;-LS0-5d -Lf /dev/null &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart SNMP&lt;br /&gt;
#* &amp;lt;code&amp;gt; systemctl restart snmpd &amp;lt;/code&amp;gt;&lt;br /&gt;
# Test with the following, replacing &amp;lt;hostname&amp;gt; with server&#039;s hostname (must be run from a machine with snmp installed, not just snmpd)&lt;br /&gt;
#* &amp;lt;code&amp;gt; snmpwalk -v 1 -c public &amp;lt;hostname&amp;gt; system &amp;lt;hostname&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 #  Allows SNMP Get&#039;s from IP &lt;br /&gt;
 rocommunity    dont-leave-as-public     192.168.123.10&lt;br /&gt;
 sysLocation    CR DC&lt;br /&gt;
 sysContact     info@sandfordit.com&lt;br /&gt;
&lt;br /&gt;
= Hostname Change =&lt;br /&gt;
Procedure below guides you through the files etc that need updating in order to change a machine&#039;s hostname.  Note that if you get probs SSH&#039;ing to the server afterwards see [[#Server_Hostname_Change|Server Hostname Change]]&lt;br /&gt;
&lt;br /&gt;
# Update the following files&lt;br /&gt;
#* &amp;lt;code&amp;gt; /etc/hosts &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; /etc/hostname  &amp;lt;/code&amp;gt;&lt;br /&gt;
# Set the hostname (not FQDN)&lt;br /&gt;
#* &amp;lt;code&amp;gt; hostname &amp;lt;servername&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Reboot&lt;br /&gt;
&lt;br /&gt;
= Allow Remote SSH Login Without Password Prompt =&lt;br /&gt;
In order to be able to access a remote server via an SSH session without needing to suppy a password, the remote server needs to trust the user on the local server.  In order to do this, the public key for the user needs to be imported to the remote server.  This is particularly useful when trying to script using ssh, scp, rsync, etc where you need to interract with a remote server.&lt;br /&gt;
&lt;br /&gt;
You need to be clear on which user will access the remote the server, if your script is run as root, then its the root user that needs to have its public key exported.&lt;br /&gt;
&lt;br /&gt;
Similarly, on the remote server you need to ensure that that the user that has the public key key imported into, has the rights to perform whatever it is that you want to achieve.  This &#039;&#039;shouldn&#039;t&#039;&#039; be the root user (to do so you&#039;d need to allow &amp;lt;code&amp;gt;PermitRootLogin &amp;lt;/code&amp;gt; in the remote server&#039;s SSH config, which is a security no-no).&lt;br /&gt;
&lt;br /&gt;
# On the local server, create a public/private rsa key pair while logged in as the user that will access the remote server&lt;br /&gt;
#* &amp;lt;code&amp;gt; ssh-keygen -t rsa &amp;lt;/code&amp;gt; (leave passphrase blank)&lt;br /&gt;
#** This creates a public key in &amp;lt;code&amp;gt; ~/.ssh/id_rsa.pub &amp;lt;/code&amp;gt;&lt;br /&gt;
# Copy the public key to the user on the remote server&lt;br /&gt;
#* &amp;lt;code&amp;gt; ssh-copy-id -i user@remote-svr &amp;lt;/code&amp;gt;&lt;br /&gt;
#** The &amp;lt;code&amp;gt; user &amp;lt;/code&amp;gt; is the user account on the remote server that the local server will be trusted by and run as.&lt;br /&gt;
# Test the login as suggested by &amp;lt;code&amp;gt; ssh-copy-id &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; ssh user@remote-svr &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Perl =&lt;br /&gt;
== Install Module ==&lt;br /&gt;
Installing a perl module isn&#039;t tricky, but there is a certain knack to it, see below...&lt;br /&gt;
&lt;br /&gt;
# Get the module&#039;s package name (eg for Net::XWhois)&lt;br /&gt;
#* &amp;lt;code&amp;gt; sudo apt-cache search perl net::xwhois &amp;lt;/code&amp;gt;&lt;br /&gt;
# Then install the package&lt;br /&gt;
#* &amp;lt;code&amp;gt; sudo apt-get install libnet-xwhois-perl &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Check Module(s) Installed ==&lt;br /&gt;
To check for a specific module use (checking for &amp;lt;code&amp;gt;Net::XWhois&amp;lt;/code&amp;gt;)&lt;br /&gt;
 perl -MNet::XWhois -e &amp;quot;print \&amp;quot;Module installed.\\n\&amp;quot;;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To list all installed modules&lt;br /&gt;
 perl -MFile::Find=find -MFile::Spec::Functions -Tlwe \&lt;br /&gt;
 &#039;find { wanted =&amp;gt; sub { print canonpath $_ if /\.pm\z/ }, no_chdir =&amp;gt; 1 }, @INC&#039;&lt;br /&gt;
&lt;br /&gt;
Source: http://www.linuxquestions.org/questions/linux-general-1/how-to-list-all-installed-perl-modules-216603/&lt;br /&gt;
&lt;br /&gt;
= Python =&lt;br /&gt;
Python v2 comes pre-installed, however if you want to run newer Python 3 scripts, this will need to be installed alongside.&lt;br /&gt;
&lt;br /&gt;
# Install the package&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install python3 &amp;lt;/code&amp;gt;&lt;br /&gt;
#** Note that more than one version of Python 3 may be available, cancel the install are retry with specific version if required, eg &amp;lt;code&amp;gt; apt-get install python3.1 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enter the Python 3 interpreter, run &amp;lt;code&amp;gt; phython3 &amp;lt;/code&amp;gt;, to make sure you get the right environment for a script use the following shebang&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#! /usr/bin/env python3&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Syslog =&lt;br /&gt;
== Server ==&lt;br /&gt;
To setup your server as a central syslog receiver, edit the &amp;lt;code&amp;gt;/etc/resyslog.conf&amp;lt;/code&amp;gt;, and deleted the comment outs for the following &lt;br /&gt;
&amp;lt;pre&amp;gt;# Provides UDP syslog reception&lt;br /&gt;
$ModLoad imudp&lt;br /&gt;
$UDPServerRun 514&lt;br /&gt;
&lt;br /&gt;
# Provides TCP syslog reception&lt;br /&gt;
$ModLoad imtcp&lt;br /&gt;
$InputTCPServerRun 514&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following section so that received syslog messages get put into a folder for each host its received from...&lt;br /&gt;
 $template PerHostLog,&amp;quot;/var/log/%HOSTNAME%/messages&amp;quot;&lt;br /&gt;
 *.* -?PerHostLog&lt;br /&gt;
&lt;br /&gt;
Then restart the syslog service to apply...&lt;br /&gt;
 service rsyslog restart&lt;br /&gt;
&lt;br /&gt;
== To MySQL Database ==&lt;br /&gt;
This procedure achieves three things...&lt;br /&gt;
# Allows remote hosts to use the local server as a syslog destination&lt;br /&gt;
# Directs syslogs to MySQL database on the server&lt;br /&gt;
# Allows viewing of syslogged events through [http://loganalyzer.adiscon.com/ LogAnalyser] web front end&lt;br /&gt;
...it is assumed that you already have a local MySQL and Apache server running!&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Set-up your server to send syslog messages to a MySQL database&#039;&#039;&#039;&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install rsyslog-mysql &amp;lt;/code&amp;gt;&lt;br /&gt;
#* Enter the root password to your MySQL instance when prompted&lt;br /&gt;
# &#039;&#039;&#039;Update the &amp;lt;code&amp;gt; rsyslog &amp;lt;/code&amp;gt; config (&amp;lt;code&amp;gt;/etc/rsyslog.conf&amp;lt;/code&amp;gt;) to receive syslog data, and to route messages through a queue&#039;&#039;&#039;&lt;br /&gt;
## Uncoment the following..&lt;br /&gt;
##* &amp;lt;code&amp;gt;$ModLoad ommysql  # load the output driver (use ompgsql for PostgreSQL)&amp;lt;/code&amp;gt;&lt;br /&gt;
##* &amp;lt;code&amp;gt;$ModLoad imudp    # network reception&amp;lt;/code&amp;gt;&lt;br /&gt;
##* &amp;lt;code&amp;gt;$UDPServerRun 514 # start a udp server at port 514&amp;lt;/code&amp;gt;&lt;br /&gt;
## Add the following...&lt;br /&gt;
##* &amp;lt;code&amp;gt;$WorkDirectory /rsyslog/work # default location for work (spool) files&amp;lt;/code&amp;gt;&lt;br /&gt;
##* &amp;lt;code&amp;gt;$ActionQueueType LinkedList # use asynchronous processing&amp;lt;/code&amp;gt;&lt;br /&gt;
##* &amp;lt;code&amp;gt;$ActionQueueFileName dbq    # set file name, also enables disk mode&amp;lt;/code&amp;gt;&lt;br /&gt;
##* &amp;lt;code&amp;gt;$ActionResumeRetryCount -1  # infinite retries on insert failure&amp;lt;/code&amp;gt;&lt;br /&gt;
## Restart the service&lt;br /&gt;
##* &amp;lt;code&amp;gt; service rsyslog restart &amp;lt;/code&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Install LogAnalyser&#039;&#039;&#039;&lt;br /&gt;
## Download latest build from http://loganalyzer.adiscon.com/downloads&lt;br /&gt;
##* EG &amp;lt;code&amp;gt;wget http://download.adiscon.com/loganalyzer/loganalyzer-3.5.0.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
## Uncompress&lt;br /&gt;
##* EG &amp;lt;code&amp;gt;tar xf loganalyzer-3.5.0.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
## Move the contents or &amp;lt;code&amp;gt;/src&amp;lt;/code&amp;gt; to webserver&lt;br /&gt;
##* EG &amp;lt;code&amp;gt; mkdir /var/www/syslog &amp;lt;/code&amp;gt;&lt;br /&gt;
##* EG &amp;lt;code&amp;gt; mv /src/* /var/www/syslog/ &amp;lt;/code&amp;gt;&lt;br /&gt;
## Move utility scripts to same folder&lt;br /&gt;
##* EG &amp;lt;code&amp;gt; mv /contrib/* /var/www/syslog/ &amp;lt;/code&amp;gt;&lt;br /&gt;
## Make them both executable,&lt;br /&gt;
##* EG &amp;lt;code&amp;gt; chmod +x /var/www/syslog/*.sh &amp;lt;/code&amp;gt;&lt;br /&gt;
## Run the config script in the directory&lt;br /&gt;
##* EG &amp;lt;code&amp;gt; /var/www/syslog# ./configure.sh &amp;lt;/code&amp;gt;&lt;br /&gt;
## Browse to webpage&lt;br /&gt;
##* EG http://your-www-svr/syslog/index.php&lt;br /&gt;
## Ignore the error, and follow the link to install (configure) &lt;br /&gt;
## Accept defaults until step 7, where you change the following&lt;br /&gt;
##* Name of the Source - &#039;&#039;your name for the local syslog db&#039;&#039;&lt;br /&gt;
##* Source Type - MySQL Native&lt;br /&gt;
##* Database Name - Syslog&lt;br /&gt;
##* Database Tablename - SystemEvents&lt;br /&gt;
##* Database User - rsyslog	&lt;br /&gt;
##* Database Password - rsyslog&lt;br /&gt;
## Config completed!&lt;br /&gt;
&lt;br /&gt;
= Random Settings =&lt;br /&gt;
== System Locale ==&lt;br /&gt;
To change the local &#039;&#039;&#039;time-zone&#039;&#039;&#039; use...&lt;br /&gt;
* &amp;lt;code&amp;gt; dpkg-reconfigure tzdata &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To change the keyboard layout in use...&lt;br /&gt;
* &amp;lt;code&amp;gt; dpkg-reconfigure console-data &amp;lt;/code&amp;gt;&lt;br /&gt;
...if &amp;lt;code&amp;gt; console-data &amp;lt;/code&amp;gt; isn&#039;t installed, use...&lt;br /&gt;
* &amp;lt;code&amp;gt; apt-get install console-data &amp;lt;/code&amp;gt;&lt;br /&gt;
...and reboot to apply&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;\tmp&amp;lt;/code&amp;gt; Boot Time Clean-up ==&lt;br /&gt;
The files in &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; get deleted if their last modification time is more than &amp;lt;code&amp;gt;TMPTIME&amp;lt;/code&amp;gt; days ago.&lt;br /&gt;
&lt;br /&gt;
# Edit &amp;lt;code&amp;gt; /etc/default/rcS &amp;lt;/code&amp;gt;&lt;br /&gt;
# Change &amp;lt;code&amp;gt;TMPTI80aM80E&amp;lt;/code&amp;gt; value to specify no of days&lt;br /&gt;
#* Use &amp;lt;code&amp;gt; 0 &amp;lt;/code&amp;gt; so that files are removed regardless of age.&lt;br /&gt;
#* Use &amp;lt;code&amp;gt; -1 &amp;lt;/code&amp;gt; so that no files are removed.&lt;br /&gt;
&lt;br /&gt;
== Proxy Server ==&lt;br /&gt;
Proxy settings need to be added as environment variables, which can be added to to your profile file so as to be always be applied&lt;br /&gt;
&lt;br /&gt;
# Edit &amp;lt;code&amp;gt; /etc/profile &amp;lt;/code&amp;gt;&lt;br /&gt;
# Append to the bottom (edit as required)&lt;br /&gt;
#* &amp;lt;code&amp;gt; export http_proxy=http://username:pass@proxyserver:port/ &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; export ftp_proxy=http://username:pass@proxyserver:port/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that some applications will ignore the environment variables, and will need to be set specifically for those apps.&lt;br /&gt;
&lt;br /&gt;
[[Category:Ubuntu]]&lt;br /&gt;
[[Category:SNMP]]&lt;br /&gt;
[[Category:Configuration]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2724</id>
		<title>Installation (Ubuntu)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Installation_(Ubuntu)&amp;diff=2724"/>
		<updated>2020-07-26T19:24:12Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* NTP */ Updated restart command&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Whilst this page was written with the installation of a Ubuntu Server 10.04 LTS in mind, it can also be used for Ubuntu 12.&lt;br /&gt;
&lt;br /&gt;
== Prepare Virtual Machine ==&lt;br /&gt;
# Create a virtual machine with the following options (use Custom)&lt;br /&gt;
#* Guest OS: Linux &amp;gt; Ubuntu 64bit&lt;br /&gt;
#* CPU: 1&lt;br /&gt;
#* Memory: 512 MB&lt;br /&gt;
#* Disk: 36GB&lt;br /&gt;
# Then add a second 36GB disk on a separate physical datastore (if you intend to use software RAID)&lt;br /&gt;
# Attach Ubuntu install ISO to the CD-ROM&lt;br /&gt;
&lt;br /&gt;
Note that the specs above should be altered to suit your purposes.  Whilst there is no need to use a 64 bit OS as opposed to 32 bit if you don&#039;t need to address lots of memory, it is standard these days. &lt;br /&gt;
&lt;br /&gt;
== OS Installation ==&lt;br /&gt;
Installing Ubuntu Server (LTS) is relatively painless, its generally a case of following the default or sensible choices for your locale.  However, below are step-by-step instructions, which you probably won&#039;t require, but may help if you&#039;re not familiar with the terminology.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re completely new make sure you read through the instructions 1st, so that you&#039;re prepared for the information you&#039;ll need to provide.&lt;br /&gt;
&lt;br /&gt;
# Select language for installer&lt;br /&gt;
# Select &#039;&#039;&#039;Install Ubuntu Server&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Choose Language&#039;&#039;&#039; screens &lt;br /&gt;
## Select language for server (and remainder of the installer)&lt;br /&gt;
## Select location&lt;br /&gt;
# &#039;&#039;&#039;Ubuntu Installer Main Menu&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; for questions to determine appropriate keyboard, or &#039;&#039;No&#039;&#039; to just select a keyboard layout&lt;br /&gt;
# &#039;&#039;&#039;Configure the network&#039;&#039;&#039; screen&lt;br /&gt;
## Enter the hostname for the server (not a FQDN, so &amp;lt;code&amp;gt;hostname&amp;lt;/code&amp;gt; rather than &amp;lt;code&amp;gt;hostname.domain.com&amp;lt;/code&amp;gt;)&lt;br /&gt;
# &#039;&#039;&#039;Configure the clock&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to accept the suggested timezone, or &#039;&#039;No&#039;&#039; to alter&lt;br /&gt;
# &#039;&#039;&#039;Partition disks&#039;&#039;&#039; screens&lt;br /&gt;
#* If you want to install the server onto software [[Acronyms#R|RAID]]&#039;ed disks see [[#Install on Software RAID|Install on Software RAID]]&lt;br /&gt;
## Select &#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&lt;br /&gt;
## Select the disk to partition and install the OS onto&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks and configure LVM&#039;&#039;&lt;br /&gt;
## Accept the full amount to partition&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Write the changes to disks&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Set up users and passwords&#039;&#039;&#039; screens&lt;br /&gt;
## Enter your name&lt;br /&gt;
## Enter your username (that you will use to login with)&lt;br /&gt;
## Enter your password&lt;br /&gt;
##* If you use a weak password (eg less that 8 characters) you&#039;ll be asked to confirm this is OK once you&#039;ve verified it&lt;br /&gt;
## Re-enter (verify) your password&lt;br /&gt;
## Select &#039;&#039;No&#039;&#039; to not &#039;&#039;Encrypt your home drive&#039;&#039;&lt;br /&gt;
##* If you are really worried about your dat being compromised you should consider encrypting the whole drive during its partitioning&lt;br /&gt;
# &#039;&#039;&#039;Configure the package manager&#039;&#039;&#039; screen&lt;br /&gt;
## Enter proxy server details if required for server to access the internet for updates&lt;br /&gt;
# &#039;&#039;&#039;Select and install software&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;No automatic updates&#039;&#039; if you want to control how updates are applied yourself, otherwise select &#039;&#039;Install security updates automatically&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Software selection&#039;&#039;&#039; screens&lt;br /&gt;
## Select &#039;&#039;&#039;OpenSSH Server&#039;&#039;&#039; (press [Space] when item is highlighted), this allows you to Putty/SSH to the server&lt;br /&gt;
## Select any other required software, eg&lt;br /&gt;
##* DNS Server - Only required if you want your server to be a DNS server; or in order to configure split DNS, which is required for an exchange server install&lt;br /&gt;
##* LAMP Server - Only required for Apache webserver (with MySQL and PHP)&lt;br /&gt;
# &#039;&#039;&#039;Configuring grub-pc&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Yes&#039;&#039; to &#039;&#039;Install the GRUB boot loader to the master boot record&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Finish the installation&#039;&#039;&#039; screen&lt;br /&gt;
## Select &#039;&#039;Continue&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Install on Software RAID ===&lt;br /&gt;
On the &#039;&#039;&#039;Partition Disks&#039;&#039;&#039; screens use the following to setup software RAID during OS installation.&lt;br /&gt;
&lt;br /&gt;
* If setting up software RAID follow the steps below, otherwise just select &#039;&#039;&#039;Guided - use entire disk and set up LVM&#039;&#039;&#039;&lt;br /&gt;
# Select &#039;&#039;&#039;&amp;quot;Manual&#039;&#039;&#039;&lt;br /&gt;
# Then create a partition...&lt;br /&gt;
## Select the first disk (&#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;) and on the next screen, &#039;&#039;&#039;Yes&#039;&#039;&#039;, to &#039;&#039;&#039;Create new empty partition table on this device?&#039;&#039;&#039;&lt;br /&gt;
## Select the FREE SPACE, then &#039;&#039;&#039;Create a new Partition&#039;&#039;&#039;, and use all but the last 2GB of space, &lt;br /&gt;
## And then select type of &#039;&#039;&#039;Primary&#039;&#039;&#039;, and create at &#039;&#039;&#039;Beginning&#039;&#039;&#039;&lt;br /&gt;
## Change &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, and change the &#039;&#039;&#039;&#039;&#039;Bootable flag&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;Yes&#039;&#039;&#039;, the select &#039;&#039;&#039;Done setting up this partition&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above on the remaining FREE SPACE on &#039;&#039;&#039;&amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt;&#039;&#039;&#039;, to create another primary &#039;&#039;&#039;physical volume for RAID&#039;&#039;&#039;, but &#039;&#039;&#039;&#039;not&#039;&#039; bootable&#039;&#039;&#039;&lt;br /&gt;
# Select the second disk, &amp;lt;code&amp;gt;sdb&amp;lt;/code&amp;gt;, and repeat the steps taken for &amp;lt;code&amp;gt;sda&amp;lt;/code&amp;gt; to create two identical partitions&lt;br /&gt;
# On the same screen, select the &#039;&#039;&#039;Configure Software RAID&#039;&#039;&#039; option (at the top), and then confirm through the next screen&lt;br /&gt;
# Create a RAID pack/multidisk...&lt;br /&gt;
## Select &#039;&#039;&#039;Create MD device&#039;&#039;&#039;, then select &#039;&#039;&#039;RAID1&#039;&#039;&#039; (ie a mirror), then confirm 2 &#039;&#039;Active devices&#039;&#039;, and 0 &#039;&#039;Spare devices&#039;&#039;&lt;br /&gt;
## Select both &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda1&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb1&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions, and then select &#039;&#039;&#039;Finish&#039;&#039;&#039;&lt;br /&gt;
# Repeat the above to create a RAID volume using &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sda2&amp;lt;/code&amp;gt;&#039;&#039;&#039; and &#039;&#039;&#039;&amp;lt;code&amp;gt;/dev/sdb2&amp;lt;/code&amp;gt;&#039;&#039;&#039; partitions&lt;br /&gt;
# Now select the RAID device #0 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Ext3...&#039;&#039;&#039;&lt;br /&gt;
# Change the &#039;&#039;&#039;&#039;&#039;Mount point&#039;&#039;&#039;&#039;&#039; to &#039;&#039;&#039;/&#039;&#039;&#039;, then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039;&lt;br /&gt;
# Now select the RAID device #1 partition (select the #1 just under RAID1 device line), and change the &#039;&#039;&#039;&#039;&#039;Use as&#039;&#039;&#039;&#039;&#039; and select &#039;&#039;&#039;Swap area&#039;&#039;&#039;&lt;br /&gt;
# Then select &#039;&#039;&#039;Done configuring this partition&#039;&#039;&#039; then finally &#039;&#039;&#039;Finish partitioning and write changes to disk&#039;&#039;&#039;, and confirm to &#039;&#039;&#039;Write the changes to disks&#039;&#039;&#039;&lt;br /&gt;
# Accept the &amp;quot;The kernel was unable to re-read...system will need to restart&amp;quot; complaints for each RAID multidisk, after which the install will continue (note there&#039;s a little more to do post install to ensure you can boot using the second disk should the first fail).&lt;br /&gt;
&lt;br /&gt;
Much of this page was originally borrowed heavily from the following pages - they are well worth a read! &lt;br /&gt;
* http://www.howtoforge.com/perfect-server-ubuntu8.04-lts&lt;br /&gt;
* http://www.howtoforge.com/how-to-install-ubuntu8.04-with-software-raid1&lt;br /&gt;
&lt;br /&gt;
== Post OS Install Config ==&lt;br /&gt;
=== Enable Root ===&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd root &amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
For Ubuntu 18...&lt;br /&gt;
# Use the command &amp;lt;code&amp;gt; sudo passwd&amp;lt;/code&amp;gt;&lt;br /&gt;
# Enter your user password&lt;br /&gt;
# Enter a strong password for the root account&lt;br /&gt;
&lt;br /&gt;
=== Finish Software RAID config ===&lt;br /&gt;
&#039;&#039;&#039; Only if configured during install &#039;&#039;&#039;&lt;br /&gt;
# Start-up grub (by entering &amp;lt;code&amp;gt; grub &amp;lt;/code&amp;gt; and enter the following commands (seems to work better via SSH than direct console)...&lt;br /&gt;
#* &amp;lt;code&amp;gt; device (hd1) /dev/sdb &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; root (hd1,0) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; setup (hd1) &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; quit &amp;lt;/code&amp;gt;&lt;br /&gt;
# Then edit the &amp;lt;code&amp;gt; /boot/grub/menu.lst &amp;lt;/code&amp;gt; config file.  Go to the end of the file where the boot options are, and create a copy of the first option and edit the following lines&lt;br /&gt;
#* &amp;lt;code&amp;gt; title &amp;lt;/code&amp;gt; Add &amp;quot;Primary disk fail&amp;quot; or something similar to end&lt;br /&gt;
#* &amp;lt;code&amp;gt; root &amp;lt;/code&amp;gt; Change &amp;lt;code&amp;gt; hd0 &amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt; hd1 &amp;lt;/code&amp;gt;&lt;br /&gt;
# To check the RAID setup of your drives use&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md0 &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; mdadm --misc -D /dev/md1 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Change IP Address ==&lt;br /&gt;
=== v8 Hardy Heron / v10 Lucid Lynx ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        network 192.168.1.0&lt;br /&gt;
        broadcast 192.168.1.255&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Check that DNS resolution is setup correctly in &amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt;.  Add additional DNS nameservers as required, as found in in order of preference.  You can also add the domain of the server (&amp;lt;code&amp;gt;domain&amp;lt;/code&amp;gt;), and add domain suffix searches (&amp;lt;code&amp;gt;search&amp;lt;/code&amp;gt;), both are optional.  For example...&lt;br /&gt;
 nameserver 192.168.1.20&lt;br /&gt;
 nameserver 127.0.0.1&lt;br /&gt;
 domain domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
 search domain.com&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; /etc/init.d/networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== v12 Precise Pangolin ===&lt;br /&gt;
* Edit the &amp;lt;code&amp;gt; /etc/network/interfaces &amp;lt;/code&amp;gt; file in the following fashion to set static address details&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The primary network interface&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet static&lt;br /&gt;
        address 192.168.1.150&lt;br /&gt;
        netmask 255.255.255.0&lt;br /&gt;
        gateway 192.168.1.1&lt;br /&gt;
&lt;br /&gt;
dns-nameservers 192.168.1.20 8.8.8.8&lt;br /&gt;
dns-domain localdomain.com&lt;br /&gt;
dns-search localdomain.com anotherdomain.com&lt;br /&gt;
        &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then check the local hosts file &amp;lt;code&amp;gt;/etc/hosts&amp;lt;/code&amp;gt;, so that the IP v4 part looks like this (so the host can resolve itself)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
127.0.0.1       localhost&lt;br /&gt;
192.168.1.150   hostname.domain.com   hostname&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then restart networking&lt;br /&gt;
** &amp;lt;code&amp;gt; service networking restart &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Confirm network interface config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;ifconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
* Confirm DNS config is as expected with&lt;br /&gt;
** &amp;lt;code&amp;gt;less /etc/resolv.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Persistent Route ===&lt;br /&gt;
To add a persistent route to an interface, add using the following syntax (example sends traffic to 172.32.1.0/24 via eth1 to 192.168.1.100&lt;br /&gt;
&lt;br /&gt;
 up route add -net 172.32.1.0/24 gw 192.168.1.100 dev eth1&lt;br /&gt;
&lt;br /&gt;
=== Additional IPs / Multihome ===&lt;br /&gt;
To add additional IP addresses to an interface, create sub-interfaces as below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto eth0:1&lt;br /&gt;
auto eth0:2 &lt;br /&gt;
&lt;br /&gt;
# Sub 1&lt;br /&gt;
iface eth0:1 inet static&lt;br /&gt;
    address 192.168.1.160&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
# Sub 2&lt;br /&gt;
iface eth0:2 inet static&lt;br /&gt;
    address 192.168.1.161&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;RTNETLINK answers: File exists&#039;&#039;&#039; - Note that you can&#039;t use the same default gateway twice, doing so will cause this error&lt;br /&gt;
&lt;br /&gt;
== Update the OS == &lt;br /&gt;
# Run the following command to update the apt package database&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
# To install any updates&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get upgrade &amp;lt;/code&amp;gt;&lt;br /&gt;
#* If updates are being held back (eg linux image), then use &amp;lt;code&amp;gt; aptitude safe-upgrade&amp;lt;/code&amp;gt;&lt;br /&gt;
# If running in VMware VM, [[VM Tools_Install_(Ubuntu)|install VM Tools]]&lt;br /&gt;
&lt;br /&gt;
=== Remove Old Version ===&lt;br /&gt;
Old kernel images will tend to linger in &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; and source code will remain in &amp;lt;code&amp;gt;/user/src&amp;lt;/code&amp;gt;.  These can be safely removed so long as you&#039;re completely certain which you are using (normally the latest)&lt;br /&gt;
# Get the versions currently installed&lt;br /&gt;
#* &amp;lt;code&amp;gt;dpkg --get-selections | grep linux-image&amp;lt;/code&amp;gt;&lt;br /&gt;
# Remove unwanted versions (don&#039;t remove the current or base/unversioned image)&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;apt-get purge linux-image-3.2.0-32-virtual &amp;lt;code&amp;gt;&lt;br /&gt;
#* If you&#039;ve got lots to remove its easier to do lots in one go&lt;br /&gt;
#** EG &amp;lt;code&amp;gt; apt-get purge linux-image-3.2.0-51-virtual linux-image-3.2.0-52-virtual &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove old source, just delete manually,&lt;br /&gt;
* EG &amp;lt;code&amp;gt; rm -fr /usr/src/linux-headers-3.2.0-51 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NTP ==&lt;br /&gt;
&#039;&#039;Not required if your server doesn&#039;t really need bang on accurate time&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Out of the box your server will sync every time its restarted and drift a bit in-between.  There is an additional resource demand in running the NTP daemon so unless you need to, there&#039;s no need to install the full blown NTP daemon.&lt;br /&gt;
&lt;br /&gt;
I tend to have one or two servers updating from remote (public) servers, and then all others updating from those.&lt;br /&gt;
&lt;br /&gt;
# Install the service&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update the NTP config file, &amp;lt;code&amp;gt; /etc/ntp.conf &amp;lt;/code&amp;gt; (Example below is for a server updating from public European servers - see http://www.pool.ntp.org/)&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 0.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 1.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 2.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; server 3.europe.pool.ntp.org &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the NTP service&lt;br /&gt;
#* &amp;lt;code&amp;gt; systemctl restart ntp &amp;lt;/code&amp;gt;&lt;br /&gt;
# Verify using the following commands&lt;br /&gt;
#* &amp;lt;code&amp;gt; ntpq -np &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; date &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Ubuntu]]&lt;br /&gt;
[[Category:Virtual Machine]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Performance_Tuning_(MySQL)&amp;diff=2723</id>
		<title>Performance Tuning (MySQL)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Performance_Tuning_(MySQL)&amp;diff=2723"/>
		<updated>2020-07-06T18:15:59Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: Initial creation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OS Changes ==&lt;br /&gt;
=== OS Swapiness ===&lt;br /&gt;
Adjusts OS&#039;s tendency to swap memory to disk.  The OS will swap memory to disk when the % usage of RAM is reached, so for 60%, the OS will start swapping when there is 60% of available RAM remaining.&lt;br /&gt;
&lt;br /&gt;
* To change permanently&lt;br /&gt;
*# Edit &amp;lt;code&amp;gt;/etc/sysctl.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
*# Update &amp;lt;code&amp;gt;vm.swappiness = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
*# &#039;&#039;&#039;Reboot&#039;&#039;&#039; to apply&lt;br /&gt;
* To change on the fly&lt;br /&gt;
** &amp;lt;code&amp;gt; sysctl vm.swappiness=10 &amp;lt;/code&amp;gt;&lt;br /&gt;
* To check current&lt;br /&gt;
** &amp;lt;code&amp;gt; cat /proc/sys/vm/swappiness &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Disk IO Scheduler ===&lt;br /&gt;
Adjusts the disk IO queuing algorithm in use.  Deadline is recommended for MySQL.&lt;br /&gt;
&lt;br /&gt;
* To change permanently (requires reboot)&lt;br /&gt;
*# Edit the &amp;lt;code&amp;gt; /etc/grub.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
*# Append &amp;lt;code&amp;gt;elevator=deadline&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt; kernel &amp;lt;/code&amp;gt; line (see example below)&lt;br /&gt;
* To change &amp;lt;code&amp;gt; sda &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; sdb &amp;lt;/code&amp;gt; devices on the fly&lt;br /&gt;
*# &amp;lt;code&amp;gt; echo deadline &amp;gt; /sys/block/sda/queue/scheduler &amp;lt;/code&amp;gt;&lt;br /&gt;
*# &amp;lt;code&amp;gt; echo deadline &amp;gt; /sys/block/sdb/queue/scheduler &amp;lt;/code&amp;gt;&lt;br /&gt;
* To check current&lt;br /&gt;
** &amp;lt;code&amp;gt;cat /sys/block/sda/queue/scheduler&amp;lt;/code&amp;gt;&lt;br /&gt;
** Current scheduler is surrounded by &amp;lt;code&amp;gt;[ ... ]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 title Red Hat Enterprise Linux Server (2.6.18-8.el5)&lt;br /&gt;
 	root (hd0,0) &lt;br /&gt;
 	kernel /vmlinuz-2.6.18-8.el5 ro root=/dev/sda2 elevator=deadline&lt;br /&gt;
 	initrd /initrd-2.6.18-8.el5.img&lt;br /&gt;
&lt;br /&gt;
=== Disable Last Access Timestamps ===&lt;br /&gt;
Stops the filesystem tracking the last time a file was accessed.&lt;br /&gt;
&lt;br /&gt;
* To change&lt;br /&gt;
*# Edit &amp;lt;code&amp;gt; /etc/fstab &amp;lt;/code&amp;gt;&lt;br /&gt;
*# Add &amp;lt;code&amp;gt;noatime&amp;lt;/code&amp;gt; option to relevant filesystems (see example below&lt;br /&gt;
*# &#039;&#039;&#039;Reboot&#039;&#039;&#039; to apply&lt;br /&gt;
* To check current&lt;br /&gt;
** Run &amp;lt;code&amp;gt; mount &amp;lt;/code&amp;gt; command&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/dev/mapper/VolGroup00-LogVol01 /                       ext4    noatime,defaults        1 1&lt;br /&gt;
UUID=264a246c-1823-4ef5-87f2-1a976d272a74 /boot                   ext4    defaults        1 2&lt;br /&gt;
/dev/mapper/VolGroup00-LogVol02 /home                   ext4    noatime,defaults        1 2&lt;br /&gt;
/dev/mapper/VolGroup00-LogVol04 /tmp                    ext4    noatime,defaults        1 2&lt;br /&gt;
/dev/mapper/VolGroup00-LogVol03 /usr                    ext4    noatime,defaults        1 2&lt;br /&gt;
/dev/mapper/VolGroup00-LogVol05 /var                    ext4    noatime,defaults        1 2&lt;br /&gt;
/dev/mapper/VolGroup00-LogVol00 swap                    swap    defaults        0 0&lt;br /&gt;
tmpfs                   /dev/shm                tmpfs   defaults        0 0&lt;br /&gt;
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0&lt;br /&gt;
sysfs                   /sys                    sysfs   defaults        0 0&lt;br /&gt;
proc                    /proc                   proc    defaults        0 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== MySQL Server Changes ==&lt;br /&gt;
The MySQL config file is normally found at &amp;lt;code&amp;gt;/etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
=== InnoDB Buffer Size ===&lt;br /&gt;
Amount of memory that can be used by InnoDB to store data and indexes, should be as high as possible whilst leaving enough for other system processes (EG 12GB for a 16GB system)&lt;br /&gt;
&lt;br /&gt;
 innodb_buffer_pool_size                 = 10G&lt;br /&gt;
&lt;br /&gt;
Requires restart to apply.&lt;br /&gt;
 &lt;br /&gt;
=== InnoDB Buffer Pools ===&lt;br /&gt;
Number of pools to split the buffer space into.  Should equal the number of CPUs.&lt;br /&gt;
&lt;br /&gt;
 innodb_buffer_pool_instances            = 4&lt;br /&gt;
&lt;br /&gt;
Requires restart to apply.&lt;br /&gt;
&lt;br /&gt;
=== InnoDB Redo Log Size ===&lt;br /&gt;
Needs to be sufficiently large enough to allow good write performance.&lt;br /&gt;
 &lt;br /&gt;
 innodb_log_file_size                    = 64M&lt;br /&gt;
&lt;br /&gt;
To apply change...&lt;br /&gt;
# Update config file&lt;br /&gt;
# Shutdown MySQL&lt;br /&gt;
#* &amp;lt;code&amp;gt; service mysql stop &amp;lt;/code&amp;gt;&lt;br /&gt;
# Delete the old logfiles&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; mv /var/lib/mysql/ib_logfile* /var/tmp/. &amp;lt;/code&amp;gt;&lt;br /&gt;
# Start MySQL&lt;br /&gt;
#* &amp;lt;code&amp;gt; service mysql start &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== InnoDB Statistics ===&lt;br /&gt;
Setting this option to OFF is recommended to avoid that some queries on the information_schema database become very slow.&lt;br /&gt;
&lt;br /&gt;
 innodb_stats_on_metadata                = off&lt;br /&gt;
&lt;br /&gt;
=== Sync Binary Log ===&lt;br /&gt;
Forces writes to the binary log to be written to disk immediately (can&#039;t be write-cached by OS).&lt;br /&gt;
&lt;br /&gt;
 sync_binlog     = 1&lt;br /&gt;
&lt;br /&gt;
=== Query Cache  ===&lt;br /&gt;
Disable the query cache completely, this entire cache is governed by a single mutex which hurts performance, in later versions of MySQL is it disabled by default.&lt;br /&gt;
&lt;br /&gt;
 query_cache_limit = 0&lt;br /&gt;
 query_cache_size = 0&lt;br /&gt;
&lt;br /&gt;
=== Maximum Connections ===&lt;br /&gt;
Maximum number of concurrent client connections&lt;br /&gt;
&lt;br /&gt;
 max_connections = 400&lt;br /&gt;
&lt;br /&gt;
Requires restart to apply.&lt;br /&gt;
&lt;br /&gt;
=== Disable DNS Resolution ===&lt;br /&gt;
&lt;br /&gt;
 skip-name-resolve&lt;br /&gt;
&lt;br /&gt;
Requires restart to apply.&lt;br /&gt;
&lt;br /&gt;
[[Category:MySQL]]&lt;br /&gt;
[[Category:Linux]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Configuration_(Ubuntu)&amp;diff=2722</id>
		<title>Configuration (Ubuntu)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Configuration_(Ubuntu)&amp;diff=2722"/>
		<updated>2020-06-11T09:02:49Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Deny a Specific Host */ Updated with insert rule&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Packages =&lt;br /&gt;
{|class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
! Command                              !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; dpkg --get-selections &amp;lt;/code&amp;gt; || Show installed packages&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; dpkg -L php5-gd &amp;lt;/code&amp;gt;       || Show file locations of &amp;lt;code&amp;gt; php5-gd &amp;lt;/code&amp;gt; package&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;        || Update the package database&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; apt-get install &amp;lt;package&amp;gt; &amp;lt;/code&amp;gt;  || Install the &amp;lt;code&amp;gt; &amp;lt;package&amp;gt; &amp;lt;/code&amp;gt; package&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; apt-get remove &amp;lt;package&amp;gt; &amp;lt;/code&amp;gt;  || Uninstall the &amp;lt;code&amp;gt; &amp;lt;package&amp;gt; &amp;lt;/code&amp;gt; package&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; apt-get autoremove &amp;lt;package&amp;gt; &amp;lt;/code&amp;gt;  || Uninstall the &amp;lt;code&amp;gt; &amp;lt;package&amp;gt; &amp;lt;/code&amp;gt; package and any other packages installed as dependencies which are no longer required&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; apt-get upgrade &amp;lt;/code&amp;gt;       || Upgrade installed system and packages with latest levels in package database&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; aptitude safe-upgrade &amp;lt;/code&amp;gt; || Upgrade installed system and packages with latest levels in package database (including linux image and libraries, not always possible with &amp;lt;code&amp;gt;apt-get upgrade&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; aptitude hold &#039;&amp;lt;package&amp;gt;&#039; &amp;lt;/code&amp;gt; || Prevents a package from being upgraded&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; tasksel install &amp;lt;task&amp;gt; &amp;lt;/code&amp;gt; || Installs a collection of packages as a single task, eg lamp-server&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; tasksel --list-task &amp;lt;/code&amp;gt;   || Show list of available tasks&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
See also [[Troubleshooting_(Ubuntu)#Packages|Troubleshooting]]&lt;br /&gt;
&lt;br /&gt;
See below for specific help on installing the following packages&lt;br /&gt;
* [[#SNMP|SNMP]]&lt;br /&gt;
* [[#Install Module|Perl Modules]]&lt;br /&gt;
&lt;br /&gt;
= Firewall =&lt;br /&gt;
&#039;&#039;&#039;See also [[Troubleshooting_(Ubuntu)#Firewall|Troubleshooting &amp;gt; Firewall]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Ubuntu comes with UFW (Uncomplicated Firewall), which is a config tool used to modify the standard inbuilt Netfilter.  If preferred, &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt; can still be used, both &amp;lt;code&amp;gt;ufw&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt; are essentially config tools for Netfilter.&lt;br /&gt;
&lt;br /&gt;
Changes are applied immediately. Once you&#039;ve added your first rule there&#039;s an implied deny all.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
! Command                               !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ufw enable &amp;lt;/code&amp;gt;             || Enables the firewall&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ufw status &amp;lt;/code&amp;gt;             || Shows the firewall status and existing filters&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ufw status numbered &amp;lt;/code&amp;gt;    || Shows the firewall status and numbered existing filters (easier to delete)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ufw allow from 192.168.1.10 &amp;lt;/code&amp;gt; || Allow all traffic from 192.168.1.10&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ufw allow http &amp;lt;/code&amp;gt;         || Allow http from any IP&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ufw allow proto tcp from 192.168.1.10 to any port 22 &amp;lt;/code&amp;gt; || Allow TCP 22 (SSH) from 192.168.1.10&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ufw allow proto udp from any to any port 123 &amp;lt;/code&amp;gt; || Allow UDP 123 (NTP) from any host&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ufw delete 2 &amp;lt;/code&amp;gt;           || Delete rule 2&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
So, for example, to create a couple of rules and enable...&lt;br /&gt;
 ufw allow proto tcp from 192.168.10.0/24 to any port 22&lt;br /&gt;
 ufw allow proto tcp to any port 443&lt;br /&gt;
 ufw enable&lt;br /&gt;
&lt;br /&gt;
Be aware that &#039;&#039;&#039;rules are processed in order&#039;&#039;&#039;, despite the fact that there is no easy way to alter the order of your rules using &amp;lt;code&amp;gt;ufw&amp;lt;/code&amp;gt; or insert rules above existing ones.  Therefore you need to think about the order of your rules carefully.&lt;br /&gt;
&lt;br /&gt;
See [[TCP UDP Ports]] for further info on common ports.&lt;br /&gt;
&lt;br /&gt;
=== Deny a Specific Host ===&lt;br /&gt;
If you want to deny a specific host (because its spamming or hacking you for example) you need to ensure that the deny rule is one of the first processed.  Otherwise the host might still be able to access on port 80 (if you&#039;re running a web server and have a general allow rule for http traffic).  To do so you need to insert a deny rule at the top of your rule-set, &lt;br /&gt;
&lt;br /&gt;
To deny all traffic from 46.118.117.13...&lt;br /&gt;
&amp;lt;pre&amp;gt; ufw insert 1 deny from 46.118.117.13 to any &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively you can edit the UFW config file direct, but the denied hosts will &#039;&#039;not&#039;&#039; appear when showing the firewall status, which will cause you problems later down the line...&lt;br /&gt;
# Edit &amp;lt;code&amp;gt;/etc/ufw/before.rules&amp;lt;/code&amp;gt;&lt;br /&gt;
# Create a new section under the &amp;lt;code&amp;gt; # drop INVALID packets &amp;lt;/code&amp;gt; section (near the top of the file)&lt;br /&gt;
# Add deny rules as required&lt;br /&gt;
#* &amp;lt;code&amp;gt; # Block IP&#039;s&amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; -A ufw-before-input -s 46.118.117.13 -j DROP&amp;lt;/code&amp;gt;&lt;br /&gt;
# Repeat the last line for as many IP&#039;s as you need to block (CIDR style notation can be used for ranges, eg 46.118.117.0/24)&lt;br /&gt;
# Reload the firewall to apply the new config&lt;br /&gt;
#* &amp;lt;code&amp;gt; ufw reload &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= SNMP =&lt;br /&gt;
Note that the way in which the SNMP daemon/agent needs to be configured varies between OS version.&lt;br /&gt;
&lt;br /&gt;
== Setup (Pre v10 Ubuntu) ==&lt;br /&gt;
# Run the following command to update the package database&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
# Run the following command to install SNMP&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install snmpd &amp;lt;/code&amp;gt;&lt;br /&gt;
# Create config file with contents as shown below&lt;br /&gt;
#* &amp;lt;code&amp;gt; vi /etc/snmp/snmpd.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
# Edit SNMPD config to allow remote polls&lt;br /&gt;
#* &amp;lt;code&amp;gt; vi /etc/default/snmpd &amp;lt;/code&amp;gt;&lt;br /&gt;
# Remove &amp;lt;code&amp;gt; 127.0.0.1 &amp;lt;/code&amp;gt; from line below&lt;br /&gt;
#* &amp;lt;code&amp;gt; &amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt;snmpd options (use syslog, close stdin/out/err). &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; SNMPDOPTS=&#039;-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart SNMP&lt;br /&gt;
#* &amp;lt;code&amp;gt; /etc/init.d/snmpd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
# Test with the following, replacing &amp;lt;hostname&amp;gt; with server&#039;s hostname&lt;br /&gt;
#* &amp;lt;code&amp;gt; snmpwalk -v 1 -c public -O e &amp;lt;hostname&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 rocommunity public&lt;br /&gt;
 syslocation &amp;quot;CR DC&amp;quot;&lt;br /&gt;
 syscontact info@sandfordit.com&lt;br /&gt;
&lt;br /&gt;
== Setup (v10/v12 Ubuntu) ==&lt;br /&gt;
# Run the following command to update the package database&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
# Run the following command to install SNMP&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install snmpd &amp;lt;/code&amp;gt;&lt;br /&gt;
# Create config file with contents as shown below the procedure&lt;br /&gt;
#* &amp;lt;code&amp;gt; vi /etc/snmp/snmpd.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
# Edit SNMPD config to allow remote polls&lt;br /&gt;
#* &amp;lt;code&amp;gt; vi /etc/default/snmpd &amp;lt;/code&amp;gt;&lt;br /&gt;
# Remove &amp;lt;code&amp;gt; 127.0.0.1 &amp;lt;/code&amp;gt; from line below&lt;br /&gt;
#* &amp;lt;code&amp;gt; &amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt;snmpd options (use syslog, close stdin/out/err). &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; SNMPDOPTS=&#039;-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart SNMP&lt;br /&gt;
#* &amp;lt;code&amp;gt; /etc/init.d/snmpd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
# Test with the following, replacing &amp;lt;hostname&amp;gt; with server&#039;s hostname (must be run from a machine with snmp installed, not just snmpd)&lt;br /&gt;
#* &amp;lt;code&amp;gt; snmpwalk -v 1 -c public &amp;lt;hostname&amp;gt; system &amp;lt;hostname&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 ####&lt;br /&gt;
 # First, map the community name (COMMUNITY) into a security name&lt;br /&gt;
 # (local and mynetwork, depending on where the request is coming&lt;br /&gt;
 # from):&lt;br /&gt;
 &lt;br /&gt;
 #       sec.name  source          community&lt;br /&gt;
 #com2sec paranoid  default         public	&#039;&#039;&#039;&amp;lt;- Comment&#039;&#039;&#039;&lt;br /&gt;
 com2sec readonly  default         public	&#039;&#039;&#039;&amp;lt;- Uncomment&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;... then later ...&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 syslocation &amp;quot;CR DC&amp;quot;&lt;br /&gt;
 syscontact info@sandfordit.com&lt;br /&gt;
&lt;br /&gt;
== Setup (Post v12 Ubunutu) ==&lt;br /&gt;
# Run the following command to update the package database&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
# Run the following command to install SNMP&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install snmpd &amp;lt;/code&amp;gt;&lt;br /&gt;
# Replace existing config file with contents as shown below the procedure&lt;br /&gt;
#* &amp;lt;code&amp;gt; vi /etc/snmp/snmpd.conf &amp;lt;/code&amp;gt;&lt;br /&gt;
# Throttle down logging verbosity (otherwise log is spammed with &amp;lt;code&amp;gt;Connection from UDP&amp;lt;/code&amp;gt; messages&lt;br /&gt;
#* &amp;lt;code&amp;gt; vi /etc/default/snmpd &amp;lt;/code&amp;gt;&lt;br /&gt;
#* Set the option &amp;lt;code&amp;gt;-LS0-5d&amp;lt;/code&amp;gt; so the config line starts...&lt;br /&gt;
#* &amp;lt;code&amp;gt;SNMPDOPTS=&#039;-LS0-5d -Lf /dev/null &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart SNMP&lt;br /&gt;
#* &amp;lt;code&amp;gt; /etc/init.d/snmpd restart &amp;lt;/code&amp;gt;&lt;br /&gt;
# Test with the following, replacing &amp;lt;hostname&amp;gt; with server&#039;s hostname (must be run from a machine with snmp installed, not just snmpd)&lt;br /&gt;
#* &amp;lt;code&amp;gt; snmpwalk -v 1 -c public &amp;lt;hostname&amp;gt; system &amp;lt;hostname&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 #  Allows SNMP Get&#039;s from IP &lt;br /&gt;
 rocommunity    dont-leave-as-public     192.168.123.10&lt;br /&gt;
 sysLocation    CR DC&lt;br /&gt;
 sysContact     info@sandfordit.com&lt;br /&gt;
&lt;br /&gt;
= Hostname Change =&lt;br /&gt;
Procedure below guides you through the files etc that need updating in order to change a machine&#039;s hostname.  Note that if you get probs SSH&#039;ing to the server afterwards see [[#Server_Hostname_Change|Server Hostname Change]]&lt;br /&gt;
&lt;br /&gt;
# Update the following files&lt;br /&gt;
#* &amp;lt;code&amp;gt; /etc/hosts &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; /etc/hostname  &amp;lt;/code&amp;gt;&lt;br /&gt;
# Set the hostname (not FQDN)&lt;br /&gt;
#* &amp;lt;code&amp;gt; hostname &amp;lt;servername&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Reboot&lt;br /&gt;
&lt;br /&gt;
= Allow Remote SSH Login Without Password Prompt =&lt;br /&gt;
In order to be able to access a remote server via an SSH session without needing to suppy a password, the remote server needs to trust the user on the local server.  In order to do this, the public key for the user needs to be imported to the remote server.  This is particularly useful when trying to script using ssh, scp, rsync, etc where you need to interract with a remote server.&lt;br /&gt;
&lt;br /&gt;
You need to be clear on which user will access the remote the server, if your script is run as root, then its the root user that needs to have its public key exported.&lt;br /&gt;
&lt;br /&gt;
Similarly, on the remote server you need to ensure that that the user that has the public key key imported into, has the rights to perform whatever it is that you want to achieve.  This &#039;&#039;shouldn&#039;t&#039;&#039; be the root user (to do so you&#039;d need to allow &amp;lt;code&amp;gt;PermitRootLogin &amp;lt;/code&amp;gt; in the remote server&#039;s SSH config, which is a security no-no).&lt;br /&gt;
&lt;br /&gt;
# On the local server, create a public/private rsa key pair while logged in as the user that will access the remote server&lt;br /&gt;
#* &amp;lt;code&amp;gt; ssh-keygen -t rsa &amp;lt;/code&amp;gt; (leave passphrase blank)&lt;br /&gt;
#** This creates a public key in &amp;lt;code&amp;gt; ~/.ssh/id_rsa.pub &amp;lt;/code&amp;gt;&lt;br /&gt;
# Copy the public key to the user on the remote server&lt;br /&gt;
#* &amp;lt;code&amp;gt; ssh-copy-id -i user@remote-svr &amp;lt;/code&amp;gt;&lt;br /&gt;
#** The &amp;lt;code&amp;gt; user &amp;lt;/code&amp;gt; is the user account on the remote server that the local server will be trusted by and run as.&lt;br /&gt;
# Test the login as suggested by &amp;lt;code&amp;gt; ssh-copy-id &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; ssh user@remote-svr &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Perl =&lt;br /&gt;
== Install Module ==&lt;br /&gt;
Installing a perl module isn&#039;t tricky, but there is a certain knack to it, see below...&lt;br /&gt;
&lt;br /&gt;
# Get the module&#039;s package name (eg for Net::XWhois)&lt;br /&gt;
#* &amp;lt;code&amp;gt; sudo apt-cache search perl net::xwhois &amp;lt;/code&amp;gt;&lt;br /&gt;
# Then install the package&lt;br /&gt;
#* &amp;lt;code&amp;gt; sudo apt-get install libnet-xwhois-perl &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Check Module(s) Installed ==&lt;br /&gt;
To check for a specific module use (checking for &amp;lt;code&amp;gt;Net::XWhois&amp;lt;/code&amp;gt;)&lt;br /&gt;
 perl -MNet::XWhois -e &amp;quot;print \&amp;quot;Module installed.\\n\&amp;quot;;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To list all installed modules&lt;br /&gt;
 perl -MFile::Find=find -MFile::Spec::Functions -Tlwe \&lt;br /&gt;
 &#039;find { wanted =&amp;gt; sub { print canonpath $_ if /\.pm\z/ }, no_chdir =&amp;gt; 1 }, @INC&#039;&lt;br /&gt;
&lt;br /&gt;
Source: http://www.linuxquestions.org/questions/linux-general-1/how-to-list-all-installed-perl-modules-216603/&lt;br /&gt;
&lt;br /&gt;
= Python =&lt;br /&gt;
Python v2 comes pre-installed, however if you want to run newer Python 3 scripts, this will need to be installed alongside.&lt;br /&gt;
&lt;br /&gt;
# Install the package&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install python3 &amp;lt;/code&amp;gt;&lt;br /&gt;
#** Note that more than one version of Python 3 may be available, cancel the install are retry with specific version if required, eg &amp;lt;code&amp;gt; apt-get install python3.1 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enter the Python 3 interpreter, run &amp;lt;code&amp;gt; phython3 &amp;lt;/code&amp;gt;, to make sure you get the right environment for a script use the following shebang&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#! /usr/bin/env python3&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Syslog =&lt;br /&gt;
== Server ==&lt;br /&gt;
To setup your server as a central syslog receiver, edit the &amp;lt;code&amp;gt;/etc/resyslog.conf&amp;lt;/code&amp;gt;, and deleted the comment outs for the following &lt;br /&gt;
&amp;lt;pre&amp;gt;# Provides UDP syslog reception&lt;br /&gt;
$ModLoad imudp&lt;br /&gt;
$UDPServerRun 514&lt;br /&gt;
&lt;br /&gt;
# Provides TCP syslog reception&lt;br /&gt;
$ModLoad imtcp&lt;br /&gt;
$InputTCPServerRun 514&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following section so that received syslog messages get put into a folder for each host its received from...&lt;br /&gt;
 $template PerHostLog,&amp;quot;/var/log/%HOSTNAME%/messages&amp;quot;&lt;br /&gt;
 *.* -?PerHostLog&lt;br /&gt;
&lt;br /&gt;
Then restart the syslog service to apply...&lt;br /&gt;
 service rsyslog restart&lt;br /&gt;
&lt;br /&gt;
== To MySQL Database ==&lt;br /&gt;
This procedure achieves three things...&lt;br /&gt;
# Allows remote hosts to use the local server as a syslog destination&lt;br /&gt;
# Directs syslogs to MySQL database on the server&lt;br /&gt;
# Allows viewing of syslogged events through [http://loganalyzer.adiscon.com/ LogAnalyser] web front end&lt;br /&gt;
...it is assumed that you already have a local MySQL and Apache server running!&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Set-up your server to send syslog messages to a MySQL database&#039;&#039;&#039;&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get install rsyslog-mysql &amp;lt;/code&amp;gt;&lt;br /&gt;
#* Enter the root password to your MySQL instance when prompted&lt;br /&gt;
# &#039;&#039;&#039;Update the &amp;lt;code&amp;gt; rsyslog &amp;lt;/code&amp;gt; config (&amp;lt;code&amp;gt;/etc/rsyslog.conf&amp;lt;/code&amp;gt;) to receive syslog data, and to route messages through a queue&#039;&#039;&#039;&lt;br /&gt;
## Uncoment the following..&lt;br /&gt;
##* &amp;lt;code&amp;gt;$ModLoad ommysql  # load the output driver (use ompgsql for PostgreSQL)&amp;lt;/code&amp;gt;&lt;br /&gt;
##* &amp;lt;code&amp;gt;$ModLoad imudp    # network reception&amp;lt;/code&amp;gt;&lt;br /&gt;
##* &amp;lt;code&amp;gt;$UDPServerRun 514 # start a udp server at port 514&amp;lt;/code&amp;gt;&lt;br /&gt;
## Add the following...&lt;br /&gt;
##* &amp;lt;code&amp;gt;$WorkDirectory /rsyslog/work # default location for work (spool) files&amp;lt;/code&amp;gt;&lt;br /&gt;
##* &amp;lt;code&amp;gt;$ActionQueueType LinkedList # use asynchronous processing&amp;lt;/code&amp;gt;&lt;br /&gt;
##* &amp;lt;code&amp;gt;$ActionQueueFileName dbq    # set file name, also enables disk mode&amp;lt;/code&amp;gt;&lt;br /&gt;
##* &amp;lt;code&amp;gt;$ActionResumeRetryCount -1  # infinite retries on insert failure&amp;lt;/code&amp;gt;&lt;br /&gt;
## Restart the service&lt;br /&gt;
##* &amp;lt;code&amp;gt; service rsyslog restart &amp;lt;/code&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Install LogAnalyser&#039;&#039;&#039;&lt;br /&gt;
## Download latest build from http://loganalyzer.adiscon.com/downloads&lt;br /&gt;
##* EG &amp;lt;code&amp;gt;wget http://download.adiscon.com/loganalyzer/loganalyzer-3.5.0.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
## Uncompress&lt;br /&gt;
##* EG &amp;lt;code&amp;gt;tar xf loganalyzer-3.5.0.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
## Move the contents or &amp;lt;code&amp;gt;/src&amp;lt;/code&amp;gt; to webserver&lt;br /&gt;
##* EG &amp;lt;code&amp;gt; mkdir /var/www/syslog &amp;lt;/code&amp;gt;&lt;br /&gt;
##* EG &amp;lt;code&amp;gt; mv /src/* /var/www/syslog/ &amp;lt;/code&amp;gt;&lt;br /&gt;
## Move utility scripts to same folder&lt;br /&gt;
##* EG &amp;lt;code&amp;gt; mv /contrib/* /var/www/syslog/ &amp;lt;/code&amp;gt;&lt;br /&gt;
## Make them both executable,&lt;br /&gt;
##* EG &amp;lt;code&amp;gt; chmod +x /var/www/syslog/*.sh &amp;lt;/code&amp;gt;&lt;br /&gt;
## Run the config script in the directory&lt;br /&gt;
##* EG &amp;lt;code&amp;gt; /var/www/syslog# ./configure.sh &amp;lt;/code&amp;gt;&lt;br /&gt;
## Browse to webpage&lt;br /&gt;
##* EG http://your-www-svr/syslog/index.php&lt;br /&gt;
## Ignore the error, and follow the link to install (configure) &lt;br /&gt;
## Accept defaults until step 7, where you change the following&lt;br /&gt;
##* Name of the Source - &#039;&#039;your name for the local syslog db&#039;&#039;&lt;br /&gt;
##* Source Type - MySQL Native&lt;br /&gt;
##* Database Name - Syslog&lt;br /&gt;
##* Database Tablename - SystemEvents&lt;br /&gt;
##* Database User - rsyslog	&lt;br /&gt;
##* Database Password - rsyslog&lt;br /&gt;
## Config completed!&lt;br /&gt;
&lt;br /&gt;
= Random Settings =&lt;br /&gt;
== System Locale ==&lt;br /&gt;
To change the local &#039;&#039;&#039;time-zone&#039;&#039;&#039; use...&lt;br /&gt;
* &amp;lt;code&amp;gt; dpkg-reconfigure tzdata &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To change the keyboard layout in use...&lt;br /&gt;
* &amp;lt;code&amp;gt; dpkg-reconfigure console-data &amp;lt;/code&amp;gt;&lt;br /&gt;
...if &amp;lt;code&amp;gt; console-data &amp;lt;/code&amp;gt; isn&#039;t installed, use...&lt;br /&gt;
* &amp;lt;code&amp;gt; apt-get install console-data &amp;lt;/code&amp;gt;&lt;br /&gt;
...and reboot to apply&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;\tmp&amp;lt;/code&amp;gt; Boot Time Clean-up ==&lt;br /&gt;
The files in &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; get deleted if their last modification time is more than &amp;lt;code&amp;gt;TMPTIME&amp;lt;/code&amp;gt; days ago.&lt;br /&gt;
&lt;br /&gt;
# Edit &amp;lt;code&amp;gt; /etc/default/rcS &amp;lt;/code&amp;gt;&lt;br /&gt;
# Change &amp;lt;code&amp;gt;TMPTI80aM80E&amp;lt;/code&amp;gt; value to specify no of days&lt;br /&gt;
#* Use &amp;lt;code&amp;gt; 0 &amp;lt;/code&amp;gt; so that files are removed regardless of age.&lt;br /&gt;
#* Use &amp;lt;code&amp;gt; -1 &amp;lt;/code&amp;gt; so that no files are removed.&lt;br /&gt;
&lt;br /&gt;
== Proxy Server ==&lt;br /&gt;
Proxy settings need to be added as environment variables, which can be added to to your profile file so as to be always be applied&lt;br /&gt;
&lt;br /&gt;
# Edit &amp;lt;code&amp;gt; /etc/profile &amp;lt;/code&amp;gt;&lt;br /&gt;
# Append to the bottom (edit as required)&lt;br /&gt;
#* &amp;lt;code&amp;gt; export http_proxy=http://username:pass@proxyserver:port/ &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; export ftp_proxy=http://username:pass@proxyserver:port/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that some applications will ignore the environment variables, and will need to be set specifically for those apps.&lt;br /&gt;
&lt;br /&gt;
[[Category:Ubuntu]]&lt;br /&gt;
[[Category:SNMP]]&lt;br /&gt;
[[Category:Configuration]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2721</id>
		<title>Virtual Machine (KVM)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2721"/>
		<updated>2020-04-13T09:28:55Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Move Virtual Machine */ Updated CPU type / mode info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Note that VMs are known as &#039;&#039;&#039;domains&#039;&#039;&#039; in the KVM world.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
This guide assumes you have a basic working environment, run the &amp;lt;code&amp;gt;kvm-ok&amp;lt;/code&amp;gt; command to sanity check...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@kvm-host:# kvm-ok&lt;br /&gt;
INFO: /dev/kvm exists&lt;br /&gt;
KVM acceleration can be used&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install Media ===&lt;br /&gt;
You need to have a local copy of the appropriate ISO.  If you have the ISO file already, upload to your KVM server, alternatively download from the site using &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Ubuntu Desktop LTS&#039;&#039;&#039; - http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso&lt;br /&gt;
&lt;br /&gt;
== Create Virtual Machine ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter                    !! Example                     !! Usage&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;            || VM-Name                     || Name of virtual machine (typically this should match the intended hostname of the VM)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;     || &amp;quot;Test VM to be used for X&amp;quot;  || Description of virtual machine&#039;s purpose etc&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-type&amp;lt;/code&amp;gt;         || Linux                       || OS family, can be  Linux, Solaris, Unix or Windows&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-variant&amp;lt;/code&amp;gt;      || ubuntu16.04                 || Distribution type for the above (run &amp;lt;code&amp;gt;osinfo-query os&amp;lt;/code&amp;gt; to view what is available)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ram&amp;lt;/code&amp;gt;             || 2048                        || vRAM in GB&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;disk path&amp;lt;/code&amp;gt;       || /vm-store/images/VM-Name.img,bus=virtio,size=50 || Virtual disk path, using virtio bus and with a 50GB disk&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;graphics&amp;lt;/code&amp;gt;        || none                        || If noneset, VM will be created with a serial display output (as opposed to VNC window)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cdrom&amp;lt;/code&amp;gt;           || /home/user/cdrom.iso        || Path to installation ISO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;network&amp;lt;/code&amp;gt;         || bridge:br0                  || Network connection details&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Create Server (no GUI) ===&lt;br /&gt;
Update paths to reflect where install ISO, and where VM disk files are intended to be.  &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--extra-args &amp;quot;console=ttyS0&amp;quot;&amp;lt;/code&amp;gt; option allows a local console to be accessed from the host machine (to allow OS install etc before the VM is on a network), though note that it can&#039;t be used with &amp;lt;code&amp;gt;--cdrom&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;--location&amp;lt;/code&amp;gt; has been used instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name server-name \&lt;br /&gt;
--ram 1024 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics none \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/server-name.img,size=20,bus=virtio \&lt;br /&gt;
--extra-args &amp;quot;console=ttyS0&amp;quot; \&lt;br /&gt;
--location /mnt/md0/kvm/iso/ubuntu-16.04.3-server-amd64.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should be presented with the console of the VM as it installs, however if you lose connection etc, connect to the console of the server using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;.  Make sure you set a static IP and install SSH during setup (select &#039;&#039;&#039;OpenSSH server&#039;&#039;&#039; during &#039;&#039;Software selection&#039;&#039; section). Once installation is completed, SSH to the server and setup normal console access (as the instructions in the section below).  Its highly recommended that you follow the steps below to ensure that Console access is available via the KVM host if needed.&lt;br /&gt;
&lt;br /&gt;
==== Console Access ====&lt;br /&gt;
# Update the &amp;lt;code&amp;gt;/etc/default/grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Add &amp;lt;code&amp;gt;console=ttyS0&amp;lt;/code&amp;gt; to the config line &amp;lt;code&amp;gt;GRUB_CMDLINE_LINUX_DEFAULT&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;quiet splash console=ttyS0&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update grub&lt;br /&gt;
#* &amp;lt;code&amp;gt;update-grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the guest machine&lt;br /&gt;
&lt;br /&gt;
Connect using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;, you may need to hit Return once to show the logon prompt.&lt;br /&gt;
&lt;br /&gt;
=== Create Workstation (GUI) ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name ubuntu-desktop \&lt;br /&gt;
--ram 2048 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--cdrom=/mnt/md0/kvm/iso/ubuntu-16.04.3-desktop-amd64.iso \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics vnc \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/ubuntu-desktop.img,size=40,bus=virtio&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the command has got as far as &amp;lt;code&amp;gt;Waiting for installation to complete.&amp;lt;/code&amp;gt; you need to connect to the VNC console session, to find the port number to connect on query the config from anothet SSH session connected to the host (typically VNC uses ports starting from 5900 upwards).&lt;br /&gt;
  virsh dumpxml ubuntu-desktop | grep vnc&lt;br /&gt;
&lt;br /&gt;
== Move Virtual Machine ==&lt;br /&gt;
If you want to move your domain/VM to another KVM host and don&#039;t have shared storage you can manually copy the data and VM config across to another host and import it.&lt;br /&gt;
&lt;br /&gt;
# Shutdown the virtual machine&lt;br /&gt;
#* Preferably from the OS so it gets a graceful shutdown, alternatively stop the VM from KVM&lt;br /&gt;
# Export the config&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh dumpxl &amp;lt;VMname&amp;gt; &amp;gt; /tmp/VMName.xml&amp;lt;/code&amp;gt;&lt;br /&gt;
# Copy the VM disk file(s) and config XML to their new host&lt;br /&gt;
#* Disk file(s) should go the location from which your VM&#039;s will run from&lt;br /&gt;
# Update the config, if necessary...&lt;br /&gt;
#* Disk file path - If the VM disks are in a different path on the new server up date the path in the XML file, look for &amp;lt;code&amp;gt;source file=&amp;lt;/code&amp;gt;&lt;br /&gt;
#* CPU type - If the physical CPU type is different on the new host, you may need to update the VM config to allow for this, update the &amp;lt;code&amp;gt;cpu mode&amp;lt;/code&amp;gt; config to match the capabilities of the destination host, or just set to &amp;lt;code&amp;gt;&amp;lt;cpu mode=&#039;host-passthrough&#039;/&amp;gt;&amp;lt;/code&amp;gt;.  See https://www.berrange.com/posts/2018/06/29/cpu-model-configuration-for-qemu-kvm-on-x86-hosts/ for more info.&lt;br /&gt;
# Import the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh define /path/to/VMName.xml &amp;lt;/code&amp;gt;&lt;br /&gt;
# Start the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh start &amp;lt;VMName&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other Config ==&lt;br /&gt;
=== Auto Start ===&lt;br /&gt;
To ensure that a VM domain starts with the host server issue the following commands (replace &amp;lt;code&amp;gt;vm-name&amp;lt;/code&amp;gt; with the name of your VM&lt;br /&gt;
 virsh autostart vm-name&lt;br /&gt;
&lt;br /&gt;
To disable issue&lt;br /&gt;
 virsh autostart vm-name --disable&lt;br /&gt;
 &lt;br /&gt;
[[Category:KVM]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2720</id>
		<title>Virtual Machine (KVM)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2720"/>
		<updated>2020-04-12T19:43:44Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: Added Move Virtual Machine&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Note that VMs are known as &#039;&#039;&#039;domains&#039;&#039;&#039; in the KVM world.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
This guide assumes you have a basic working environment, run the &amp;lt;code&amp;gt;kvm-ok&amp;lt;/code&amp;gt; command to sanity check...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@kvm-host:# kvm-ok&lt;br /&gt;
INFO: /dev/kvm exists&lt;br /&gt;
KVM acceleration can be used&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install Media ===&lt;br /&gt;
You need to have a local copy of the appropriate ISO.  If you have the ISO file already, upload to your KVM server, alternatively download from the site using &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Ubuntu Desktop LTS&#039;&#039;&#039; - http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso&lt;br /&gt;
&lt;br /&gt;
== Create Virtual Machine ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter                    !! Example                     !! Usage&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;            || VM-Name                     || Name of virtual machine (typically this should match the intended hostname of the VM)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;     || &amp;quot;Test VM to be used for X&amp;quot;  || Description of virtual machine&#039;s purpose etc&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-type&amp;lt;/code&amp;gt;         || Linux                       || OS family, can be  Linux, Solaris, Unix or Windows&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-variant&amp;lt;/code&amp;gt;      || ubuntu16.04                 || Distribution type for the above (run &amp;lt;code&amp;gt;osinfo-query os&amp;lt;/code&amp;gt; to view what is available)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ram&amp;lt;/code&amp;gt;             || 2048                        || vRAM in GB&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;disk path&amp;lt;/code&amp;gt;       || /vm-store/images/VM-Name.img,bus=virtio,size=50 || Virtual disk path, using virtio bus and with a 50GB disk&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;graphics&amp;lt;/code&amp;gt;        || none                        || If noneset, VM will be created with a serial display output (as opposed to VNC window)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cdrom&amp;lt;/code&amp;gt;           || /home/user/cdrom.iso        || Path to installation ISO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;network&amp;lt;/code&amp;gt;         || bridge:br0                  || Network connection details&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Create Server (no GUI) ===&lt;br /&gt;
Update paths to reflect where install ISO, and where VM disk files are intended to be.  &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--extra-args &amp;quot;console=ttyS0&amp;quot;&amp;lt;/code&amp;gt; option allows a local console to be accessed from the host machine (to allow OS install etc before the VM is on a network), though note that it can&#039;t be used with &amp;lt;code&amp;gt;--cdrom&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;--location&amp;lt;/code&amp;gt; has been used instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name server-name \&lt;br /&gt;
--ram 1024 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics none \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/server-name.img,size=20,bus=virtio \&lt;br /&gt;
--extra-args &amp;quot;console=ttyS0&amp;quot; \&lt;br /&gt;
--location /mnt/md0/kvm/iso/ubuntu-16.04.3-server-amd64.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should be presented with the console of the VM as it installs, however if you lose connection etc, connect to the console of the server using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;.  Make sure you set a static IP and install SSH during setup (select &#039;&#039;&#039;OpenSSH server&#039;&#039;&#039; during &#039;&#039;Software selection&#039;&#039; section). Once installation is completed, SSH to the server and setup normal console access (as the instructions in the section below).  Its highly recommended that you follow the steps below to ensure that Console access is available via the KVM host if needed.&lt;br /&gt;
&lt;br /&gt;
==== Console Access ====&lt;br /&gt;
# Update the &amp;lt;code&amp;gt;/etc/default/grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Add &amp;lt;code&amp;gt;console=ttyS0&amp;lt;/code&amp;gt; to the config line &amp;lt;code&amp;gt;GRUB_CMDLINE_LINUX_DEFAULT&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;quiet splash console=ttyS0&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update grub&lt;br /&gt;
#* &amp;lt;code&amp;gt;update-grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the guest machine&lt;br /&gt;
&lt;br /&gt;
Connect using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;, you may need to hit Return once to show the logon prompt.&lt;br /&gt;
&lt;br /&gt;
=== Create Workstation (GUI) ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name ubuntu-desktop \&lt;br /&gt;
--ram 2048 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--cdrom=/mnt/md0/kvm/iso/ubuntu-16.04.3-desktop-amd64.iso \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics vnc \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/ubuntu-desktop.img,size=40,bus=virtio&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the command has got as far as &amp;lt;code&amp;gt;Waiting for installation to complete.&amp;lt;/code&amp;gt; you need to connect to the VNC console session, to find the port number to connect on query the config from anothet SSH session connected to the host (typically VNC uses ports starting from 5900 upwards).&lt;br /&gt;
  virsh dumpxml ubuntu-desktop | grep vnc&lt;br /&gt;
&lt;br /&gt;
== Move Virtual Machine ==&lt;br /&gt;
If you want to move your domain/VM to another KVM host and don&#039;t have shared storage you can manually copy the data and VM config across to another host and import it.&lt;br /&gt;
&lt;br /&gt;
# Shutdown the virtual machine&lt;br /&gt;
#* Preferably from the OS so it gets a graceful shutdown, alternatively stop the VM from KVM&lt;br /&gt;
# Export the config&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh dumpxl &amp;lt;VMname&amp;gt; &amp;gt; /tmp/VMName.xml&amp;lt;/code&amp;gt;&lt;br /&gt;
# Copy the VM disk file(s) and config XML to their new host&lt;br /&gt;
#* Disk file(s) should go the location from which your VM&#039;s will run from&lt;br /&gt;
# Update the config, if necessary...&lt;br /&gt;
#* Disk file path - If the VM disks are in a different path on the new server up date the path in the XML file, look for &amp;lt;code&amp;gt;source file=&amp;lt;/code&amp;gt;&lt;br /&gt;
#* CPU type - If the physical CPU type is different on the new host, you may need to update the VM config to allow for this, update the &amp;lt;code&amp;gt;cpu mode&amp;lt;/code&amp;gt; config to match the capabilities of the destination host (see https://www.berrange.com/posts/2018/06/29/cpu-model-configuration-for-qemu-kvm-on-x86-hosts/ for more info)&lt;br /&gt;
# Import the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh define /path/to/VMName.xml &amp;lt;/code&amp;gt;&lt;br /&gt;
# Start the VM&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; virsh start &amp;lt;VMName&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Other Config ==&lt;br /&gt;
=== Auto Start ===&lt;br /&gt;
To ensure that a VM domain starts with the host server issue the following commands (replace &amp;lt;code&amp;gt;vm-name&amp;lt;/code&amp;gt; with the name of your VM&lt;br /&gt;
 virsh autostart vm-name&lt;br /&gt;
&lt;br /&gt;
To disable issue&lt;br /&gt;
 virsh autostart vm-name --disable&lt;br /&gt;
 &lt;br /&gt;
[[Category:KVM]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Installation_(KVM)&amp;diff=2719</id>
		<title>Installation (KVM)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Installation_(KVM)&amp;diff=2719"/>
		<updated>2020-04-10T18:27:20Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Networking */ Added Ubuntu 18 instructions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Prerequisites ==&lt;br /&gt;
This guide assumes you have a working Ubuntu Server with one physical NIC that will used for networking to the host server, and also for a bridged network for guest virtual machines.&lt;br /&gt;
&lt;br /&gt;
Ensure your server has CPU&#039;s that support hardware virtualisation, you should get one output of flags per CPU (which will include either &amp;lt;code&amp;gt;svm&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;vmx&amp;lt;/code&amp;gt;).  If you don&#039;t, reboot the server into BIOS and see if there is an option to enable CPU Virtualisation features or VT, if you don&#039;t your hardware may too old to support virtualisation.  If your hardware is recent, it should, so consult your vendors documentation (either for the server, or for the server&#039;s motherboard).&lt;br /&gt;
  egrep &#039;(vmx|svm)&#039; /proc/cpuinfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ensure your server can run KVM hardware acceleration.  Install &amp;lt;code&amp;gt;cpu-checker&amp;lt;/code&amp;gt; and run as follows...&lt;br /&gt;
  apt install cpu-checker&lt;br /&gt;
  kvm-ok&lt;br /&gt;
...which should return...&lt;br /&gt;
 INFO: /dev/kvm exists&lt;br /&gt;
 KVM acceleration can be used&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Install using the following command&lt;br /&gt;
 apt install qemu qemu-kvm libvirt-bin bridge-utils virt-manager&lt;br /&gt;
&lt;br /&gt;
Once completed, ensure libvirtd is running&lt;br /&gt;
 systemctl status libvirtd&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
By default, you&#039;ll end up with a new &amp;lt;code&amp;gt;virbr0&amp;lt;/code&amp;gt; interface, on which all virtual machines will be deployed to.  These will not be accessible to the outside world, which is sometimes fine for a private lab environment, but otherwise fairly useless.  In order to all your VMs to be accessible, you need to create a new bridge interface, and move your server&#039;s IP address onto that.  Once done, VMs can also be provisioned onto the same interface, and will be as accessible as your KVM server. &lt;br /&gt;
&lt;br /&gt;
=== Ubuntu 18.04 ===&lt;br /&gt;
Network config is achieved via Netplan, for an existing config such as show...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@kvm-svr:~# cat /etc/netplan/50-cloud-init.yaml.orig&lt;br /&gt;
# This file is generated from information provided by the datasource.  Changes&lt;br /&gt;
# to it will not persist across an instance reboot.  To disable cloud-init&#039;s&lt;br /&gt;
# network configuration capabilities, write a file&lt;br /&gt;
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:&lt;br /&gt;
# network: {config: disabled}&lt;br /&gt;
network:&lt;br /&gt;
    ethernets:&lt;br /&gt;
        eno1:&lt;br /&gt;
            addresses:&lt;br /&gt;
            - 192.168.1.50/24&lt;br /&gt;
            gateway4: 192.168.10.1&lt;br /&gt;
            nameservers:&lt;br /&gt;
                addresses:&lt;br /&gt;
                - 192.168.1.1&lt;br /&gt;
                - 8.8.8.8&lt;br /&gt;
                - 8.8.4.4&lt;br /&gt;
                search:&lt;br /&gt;
                - vwiki.co.uk&lt;br /&gt;
    version: 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...add a new bridge network and move most of the config over...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@media-svr:~# cat /etc/netplan/50-cloud-init.yaml&lt;br /&gt;
# This file is generated from information provided by the datasource.  Changes&lt;br /&gt;
# to it will not persist across an instance reboot.  To disable cloud-init&#039;s&lt;br /&gt;
# network configuration capabilities, write a file&lt;br /&gt;
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:&lt;br /&gt;
# network: {config: disabled}&lt;br /&gt;
network:&lt;br /&gt;
    version: 2&lt;br /&gt;
    ethernets:&lt;br /&gt;
        eno1:&lt;br /&gt;
            dhcp4: no&lt;br /&gt;
            dhcp6: no&lt;br /&gt;
    bridges:&lt;br /&gt;
        br0:&lt;br /&gt;
            interfaces:&lt;br /&gt;
            - eno1&lt;br /&gt;
            dhcp4: no&lt;br /&gt;
            addresses:&lt;br /&gt;
            - 192.168.1.50/24&lt;br /&gt;
            gateway4: 192.168.1.1&lt;br /&gt;
            nameservers:&lt;br /&gt;
                addresses:&lt;br /&gt;
                - 192.168.1.1&lt;br /&gt;
                - 8.8.8.8&lt;br /&gt;
                - 8.8.4.4&lt;br /&gt;
                search:&lt;br /&gt;
                - vwiki.co.uk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
...and apply using...&lt;br /&gt;
 netplan apply&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
=== Allow VNC Console Access ===&lt;br /&gt;
By default virtual machine consoles are bound to 127.0.0.1 on the host KVM server.  So you can&#039;t connect from a remote machine using VNC to see the VM&#039;s console (unless you tunnel through SSH).  Bind to 0.0.0.0 to make remote console access.  Note that the VM configuration also needs to be changed to listen on 0.0.0.0.&lt;br /&gt;
&lt;br /&gt;
# Edit &amp;lt;code&amp;gt;/etc/libvirt/qemu.conf &amp;lt;/code&amp;gt; and uncomment the following line&lt;br /&gt;
#* &amp;lt;code&amp;gt; vnc_listen = &amp;quot;0.0.0.0&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart libvirtd&lt;br /&gt;
#* &amp;lt;code&amp;gt;service libvirtd restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:KVM]]&lt;br /&gt;
[[Category:Ubuntu]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Installation_(KVM)&amp;diff=2718</id>
		<title>Installation (KVM)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Installation_(KVM)&amp;diff=2718"/>
		<updated>2020-04-10T18:09:09Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Installation */ Updated&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Prerequisites ==&lt;br /&gt;
This guide assumes you have a working Ubuntu Server with one physical NIC that will used for networking to the host server, and also for a bridged network for guest virtual machines.&lt;br /&gt;
&lt;br /&gt;
Ensure your server has CPU&#039;s that support hardware virtualisation, you should get one output of flags per CPU (which will include either &amp;lt;code&amp;gt;svm&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;vmx&amp;lt;/code&amp;gt;).  If you don&#039;t, reboot the server into BIOS and see if there is an option to enable CPU Virtualisation features or VT, if you don&#039;t your hardware may too old to support virtualisation.  If your hardware is recent, it should, so consult your vendors documentation (either for the server, or for the server&#039;s motherboard).&lt;br /&gt;
  egrep &#039;(vmx|svm)&#039; /proc/cpuinfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ensure your server can run KVM hardware acceleration.  Install &amp;lt;code&amp;gt;cpu-checker&amp;lt;/code&amp;gt; and run as follows...&lt;br /&gt;
  apt install cpu-checker&lt;br /&gt;
  kvm-ok&lt;br /&gt;
...which should return...&lt;br /&gt;
 INFO: /dev/kvm exists&lt;br /&gt;
 KVM acceleration can be used&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Install using the following command&lt;br /&gt;
 apt install qemu qemu-kvm libvirt-bin bridge-utils virt-manager&lt;br /&gt;
&lt;br /&gt;
Once completed, ensure libvirtd is running&lt;br /&gt;
 systemctl status libvirtd&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
=== Allow VNC Console Access ===&lt;br /&gt;
By default virtual machine consoles are bound to 127.0.0.1 on the host KVM server.  So you can&#039;t connect from a remote machine using VNC to see the VM&#039;s console (unless you tunnel through SSH).  Bind to 0.0.0.0 to make remote console access.  Note that the VM configuration also needs to be changed to listen on 0.0.0.0.&lt;br /&gt;
&lt;br /&gt;
# Edit &amp;lt;code&amp;gt;/etc/libvirt/qemu.conf &amp;lt;/code&amp;gt; and uncomment the following line&lt;br /&gt;
#* &amp;lt;code&amp;gt; vnc_listen = &amp;quot;0.0.0.0&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart libvirtd&lt;br /&gt;
#* &amp;lt;code&amp;gt;service libvirtd restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:KVM]]&lt;br /&gt;
[[Category:Ubuntu]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Installation_(KVM)&amp;diff=2717</id>
		<title>Installation (KVM)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Installation_(KVM)&amp;diff=2717"/>
		<updated>2020-04-10T18:06:24Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Installation */ Updated&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Prerequisites ==&lt;br /&gt;
This guide assumes you have a working Ubuntu Server with one physical NIC that will used for networking to the host server, and also for a bridged network for guest virtual machines.&lt;br /&gt;
&lt;br /&gt;
Ensure your server has CPU&#039;s that support hardware virtualisation, you should get one output of flags per CPU (which will include either &amp;lt;code&amp;gt;svm&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;vmx&amp;lt;/code&amp;gt;).  If you don&#039;t, reboot the server into BIOS and see if there is an option to enable CPU Virtualisation features or VT, if you don&#039;t your hardware may too old to support virtualisation.  If your hardware is recent, it should, so consult your vendors documentation (either for the server, or for the server&#039;s motherboard).&lt;br /&gt;
  egrep &#039;(vmx|svm)&#039; /proc/cpuinfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ensure your server can run KVM hardware acceleration.  Install &amp;lt;code&amp;gt;cpu-checker&amp;lt;/code&amp;gt; and run as follows...&lt;br /&gt;
  apt install cpu-checker&lt;br /&gt;
  kvm-ok&lt;br /&gt;
...which should return...&lt;br /&gt;
 INFO: /dev/kvm exists&lt;br /&gt;
 KVM acceleration can be used&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Install using the following command&lt;br /&gt;
 apt install qemu qemu-kvm libvirt-bin bridge-utils virt-manager&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
=== Allow VNC Console Access ===&lt;br /&gt;
By default virtual machine consoles are bound to 127.0.0.1 on the host KVM server.  So you can&#039;t connect from a remote machine using VNC to see the VM&#039;s console (unless you tunnel through SSH).  Bind to 0.0.0.0 to make remote console access.  Note that the VM configuration also needs to be changed to listen on 0.0.0.0.&lt;br /&gt;
&lt;br /&gt;
# Edit &amp;lt;code&amp;gt;/etc/libvirt/qemu.conf &amp;lt;/code&amp;gt; and uncomment the following line&lt;br /&gt;
#* &amp;lt;code&amp;gt; vnc_listen = &amp;quot;0.0.0.0&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart libvirtd&lt;br /&gt;
#* &amp;lt;code&amp;gt;service libvirtd restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:KVM]]&lt;br /&gt;
[[Category:Ubuntu]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Installation_(KVM)&amp;diff=2716</id>
		<title>Installation (KVM)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Installation_(KVM)&amp;diff=2716"/>
		<updated>2020-04-10T18:05:30Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Prerequisites */ Updated&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Prerequisites ==&lt;br /&gt;
This guide assumes you have a working Ubuntu Server with one physical NIC that will used for networking to the host server, and also for a bridged network for guest virtual machines.&lt;br /&gt;
&lt;br /&gt;
Ensure your server has CPU&#039;s that support hardware virtualisation, you should get one output of flags per CPU (which will include either &amp;lt;code&amp;gt;svm&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;vmx&amp;lt;/code&amp;gt;).  If you don&#039;t, reboot the server into BIOS and see if there is an option to enable CPU Virtualisation features or VT, if you don&#039;t your hardware may too old to support virtualisation.  If your hardware is recent, it should, so consult your vendors documentation (either for the server, or for the server&#039;s motherboard).&lt;br /&gt;
  egrep &#039;(vmx|svm)&#039; /proc/cpuinfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ensure your server can run KVM hardware acceleration.  Install &amp;lt;code&amp;gt;cpu-checker&amp;lt;/code&amp;gt; and run as follows...&lt;br /&gt;
  apt install cpu-checker&lt;br /&gt;
  kvm-ok&lt;br /&gt;
...which should return...&lt;br /&gt;
 INFO: /dev/kvm exists&lt;br /&gt;
 KVM acceleration can be used&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Install using the following command&lt;br /&gt;
 apt-get install qemu-kvm libvirt-bin virtinst bridge-utils cpu-checker&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
=== Allow VNC Console Access ===&lt;br /&gt;
By default virtual machine consoles are bound to 127.0.0.1 on the host KVM server.  So you can&#039;t connect from a remote machine using VNC to see the VM&#039;s console (unless you tunnel through SSH).  Bind to 0.0.0.0 to make remote console access.  Note that the VM configuration also needs to be changed to listen on 0.0.0.0.&lt;br /&gt;
&lt;br /&gt;
# Edit &amp;lt;code&amp;gt;/etc/libvirt/qemu.conf &amp;lt;/code&amp;gt; and uncomment the following line&lt;br /&gt;
#* &amp;lt;code&amp;gt; vnc_listen = &amp;quot;0.0.0.0&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart libvirtd&lt;br /&gt;
#* &amp;lt;code&amp;gt;service libvirtd restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:KVM]]&lt;br /&gt;
[[Category:Ubuntu]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Installation_(PowerShell_Core)&amp;diff=2715</id>
		<title>Installation (PowerShell Core)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Installation_(PowerShell_Core)&amp;diff=2715"/>
		<updated>2020-03-09T10:53:18Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Procedure */ Added &amp;quot;Ubuntu 18 / Correct Culture&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Allows you to run PowerShell Core from a Linux or macOS host or even AWS Lambda .NET Core 2.1 runtime (as well on a Windows machine).  Note that it is a significantly cut down environment from what you&#039;d expect when running within a Windows OS.  Part of the power of Windows PowerShell is that it makes anything that&#039;s exposed through the full .NET Framework is available to PowerShell, but much of this is specific to Windows.  PowerShell Core is dependant on .NET Core, which is stripped down so that it can run on more platforms.  This does cause some gotchas, for example cryptography is not available in .NET Core, therefore you can&#039;t create secure strings (which you&#039;d normally use for handling passwords).&lt;br /&gt;
&lt;br /&gt;
== Procedure == &lt;br /&gt;
=== Linux ===&lt;br /&gt;
These instructions are for Ubuntu 16.04 LTS, but can be adapted for other versions as indicated, for other distributions see https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6 for further info.  The procedure below has been tested on both Ubuntu 14.04 and 16.04.  However, be aware that if need to use a locale/culture other than en_US, you may find that the below won&#039;t install PowerShell with correct culture - see [[#Ubuntu 18 / Correct Culture|Ubuntu 18 / Correct Culture]] below.&lt;br /&gt;
&lt;br /&gt;
# Register Microsoft repository GPG key&lt;br /&gt;
#* &amp;lt;code&amp;gt; curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - &amp;lt;/code&amp;gt;&lt;br /&gt;
# Add the Microsoft repository to aptitude sources (change the MS URL to fix your OS version)&lt;br /&gt;
#* &amp;lt;code&amp;gt; curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update list of available packages&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt update &amp;lt;/code&amp;gt;&lt;br /&gt;
# Install PowerShell Core&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt install powershell &amp;lt;/code&amp;gt;&lt;br /&gt;
# Launch PowerShell&lt;br /&gt;
#* &amp;lt;code&amp;gt; pwsh &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ubuntu 18 / Correct Culture ===&lt;br /&gt;
You need to have the OS locale correct before you install PowerShell, as long as this is correct you should end up with the right version.  The procedure below assumes &#039;&#039;&#039;en_GB&#039;&#039;&#039;, use the correct code for you.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Check / correct locale&#039;&#039;&#039;&lt;br /&gt;
# Check Ubuntu is using the correct culture &lt;br /&gt;
#* &amp;lt;code&amp;gt; locale &amp;lt;/code&amp;gt;&lt;br /&gt;
# If your locale is not displayed, if not check what is currently available&lt;br /&gt;
#* &amp;lt;code&amp;gt; locale -a &amp;lt;/code&amp;gt;&lt;br /&gt;
# If your locale is not displayed, generate it&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; locale-gen en_GB.UTF-8 &amp;lt;/code&amp;gt;&lt;br /&gt;
# To set Ubuntu to use the correct locale use the following command&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; update-locale LANG=en_GB.UTF-8 &amp;lt;/code&amp;gt;&lt;br /&gt;
# Reboot for the change to take effect&lt;br /&gt;
#* &amp;lt;code&amp;gt; reboot &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install PowerShell&#039;&#039;&#039;&lt;br /&gt;
# Install snap&lt;br /&gt;
#* &amp;lt;code&amp;gt;snap install powershell --classic&amp;lt;/code&amp;gt;&lt;br /&gt;
# Go into PowerShell CLI and check culture&lt;br /&gt;
#* &amp;lt;code&amp;gt; powershell &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; Get-Culture &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
Can be installed side by side with Windows PowerShell.&lt;br /&gt;
&lt;br /&gt;
# Download latest win-x64.msi package from https://github.com/PowerShell/PowerShell/releases&lt;br /&gt;
# Install downloaded package&lt;br /&gt;
&lt;br /&gt;
[[Category:PowerShell Core]]&lt;br /&gt;
[[Category:Linux]]&lt;br /&gt;
[[Category:Ubuntu]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=MS_SQL&amp;diff=2714</id>
		<title>MS SQL</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=MS_SQL&amp;diff=2714"/>
		<updated>2019-09-22T13:42:18Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Commands and Maintenance */ Added &amp;quot;Show database recovery modes&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Installation ==&lt;br /&gt;
=== SQL 2008 Standard ===&lt;br /&gt;
Instructions below made from MS SQL 2008 Standard install ISO.  These notes were created when installing a SQL server for use with [[:Category:vCentre|VMware vCentre]], therefore may contain some specifics for that usage, see the following if you&#039;re installing for vSphere 5, it has much greater detail..&lt;br /&gt;
* http://lonesysadmin.net/2011/10/06/how-to-install-microsoft-sql-server-2008-r2-for-vmware-vcenter-5/&lt;br /&gt;
&lt;br /&gt;
If installing in a [[Acronyms#V|VM]], perform a snapshot 1st in case you make a mistake and want to reattempt from scratch.&lt;br /&gt;
&lt;br /&gt;
# Create a local user account for MS SQL&amp;lt;ref name=&amp;quot;SQL-User&amp;quot; /&amp;gt;, eg SQL-DB, with a nice long password with only the following options checked&lt;br /&gt;
#* &#039;&#039;User not allowed to change password&#039;&#039;&lt;br /&gt;
#* &#039;&#039;Password never expires&#039;&#039;&lt;br /&gt;
# Run the setup.exe from the root of the ISO (or allow to autorun)&lt;br /&gt;
# The installer may need to install .NET and upgrade Windows Installer&lt;br /&gt;
## Click &#039;&#039;&#039;OK&#039;&#039;&#039; if so to allow&lt;br /&gt;
## Accept the .NET Framework EULA&lt;br /&gt;
## On completion on .NET Framework install, click &#039;&#039;&#039;Exit&#039;&#039;&#039; to proceed&lt;br /&gt;
# Click on &#039;&#039;&#039;Installation&#039;&#039;&#039; to bring up the install options&lt;br /&gt;
# Click on &#039;&#039;&#039;New SQL Server stand-alone...&#039;&#039;&#039; to launch the install wizard&lt;br /&gt;
# Assuming the &#039;&#039;Setup Support Rules&#039;&#039; check succeeds, click &#039;&#039;&#039;OK&#039;&#039;&#039; to proceed&lt;br /&gt;
#* Fix any issues found in order to be able to proceed further&lt;br /&gt;
# If required, enter a valid product key, then click &#039;&#039;&#039;Next&#039;&#039;&#039; to proceed&lt;br /&gt;
# Accept the EULA, then click &#039;&#039;&#039;Next&#039;&#039;&#039; to proceed&lt;br /&gt;
# Click &#039;&#039;&#039;Install&#039;&#039;&#039; in order to install the Setup Support Files&lt;br /&gt;
# Assuming the &#039;&#039;Setup Support Rules&#039;&#039; check succeeds, click &#039;&#039;&#039;Next&#039;&#039;&#039; to proceed&lt;br /&gt;
#* Fix any issues found in order to be able to proceed further, warnings don&#039;t prevent installation, but should be read to understand why they have occurred&lt;br /&gt;
# On the Feature Selection page, select the following features, and change the install paths if required, then click &#039;&#039;&#039;Next&#039;&#039;&#039; to continue&lt;br /&gt;
#* &#039;&#039;Instance Features | Database Engine Services&#039;&#039;&lt;br /&gt;
#* &#039;&#039;Shared Features | Client Tools Connectivity&#039;&#039;&lt;br /&gt;
#* &#039;&#039;Shared Features | Integration Services&#039;&#039;&lt;br /&gt;
#* &#039;&#039;Shared Features | Management Tools – Basic&#039;&#039;&lt;br /&gt;
#* &#039;&#039;Shared Features | Management Tools – Complete&#039;&#039;&lt;br /&gt;
# On the Instance Configuration page, change the Instance root directory if you want to store the database somewhere else, click &#039;&#039;&#039;Next&#039;&#039;&#039; to proceed&lt;br /&gt;
# Click &#039;&#039;&#039;Next&#039;&#039;&#039; past the &#039;&#039;Disk Space Requirements&#039;&#039; page&lt;br /&gt;
# On the &#039;&#039;Server Configuration&#039;&#039; page, change the following then click &#039;&#039;&#039;Next&#039;&#039;&#039; to proceed&lt;br /&gt;
## Select &#039;&#039;Use the same account for all SQL Server services&#039;&#039; and enter the local account created earlier (eg for SQL-DB)&lt;br /&gt;
## Change &#039;&#039;SQL Server Agent&#039;&#039; service startup type to &#039;&#039;Automatic&#039;&#039;&lt;br /&gt;
# On the &#039;&#039;Database Engine Configuration&#039;&#039; page, change the following then click &#039;&#039;&#039;Next&#039;&#039;&#039; to proceed&lt;br /&gt;
#* Change to &#039;&#039;Mixed Mode&#039;&#039;, and enter a nice long password for the SQL root account&lt;br /&gt;
#* Add SQL administrators (at minimum I&#039;d suggest the machine&#039;s local admin and yourself)&lt;br /&gt;
# Click &#039;&#039;&#039;Next&#039;&#039;&#039; to proceed past the next few pages, and then &#039;&#039;&#039;Install&#039;&#039;&lt;br /&gt;
# Install should complete successfully, then click &#039;&#039;&#039;Next&#039;&#039;&#039;, and then &#039;&#039;&#039;Close&#039;&#039;&#039; to complete.&lt;br /&gt;
# Install the latest SQL service pack, then run Windows Update manually to ensure the install is fully patched&lt;br /&gt;
# Even if not asked to, reboot the machine, then log back in and ensure all SQL services have started correctly&lt;br /&gt;
# Limit memory available to SQL (optional)&lt;br /&gt;
## Start &#039;&#039;SQL Server Management Studio&#039;&#039; and login as one of the SQL administrators you added earlier&lt;br /&gt;
## Right-click over the SQL server and select &#039;&#039;&#039;Properties&#039;&#039;&#039;&lt;br /&gt;
## Go to &#039;&#039;Memory&#039;&#039; and set &#039;&#039;Maximum server memory (in MB)&#039;&#039; to something sensible &amp;lt;ref name=&amp;quot;SQL-Mem&amp;quot; /&amp;gt;&lt;br /&gt;
##* SQL will grab as much physical RAM as possible in order to cache and improve performance, therefore you need to limit what it can grab so that the OS, and any other applications will have enough space to run without paging&lt;br /&gt;
# Allow &#039;&#039;Local Launch&#039;&#039; (optional, but said to fix some scheduling and spurious event log error issues)&lt;br /&gt;
## Go into &#039;&#039;Component Services&#039;&#039; (Start | Administrative Tools | Component Services)&lt;br /&gt;
## Find, right-click and select &#039;&#039;Properties&#039;&#039; over &#039;&#039;Component Services&#039;&#039; | &#039;&#039;Computers&#039;&#039; | &#039;&#039;My Computer&#039;&#039; | &#039;&#039;DCOM Config&#039;&#039; | &#039;&#039;MsDtsServer100&#039;&#039;&lt;br /&gt;
## Go to the &#039;&#039;Security&#039;&#039; tab and within the &#039;&#039;Launch and Activation Permission&#039;&#039; section, click &#039;&#039;&#039;Edit&#039;&#039;&#039;&lt;br /&gt;
## &#039;&#039;&#039;Add&#039;&#039;&#039; the local SQL user (eg SQL-DB), and ensure &#039;&#039;Local Launch&#039;&#039; is checked&lt;br /&gt;
## Click &#039;&#039;&#039;OK&#039;&#039;&#039; as required to apply and exit&lt;br /&gt;
&lt;br /&gt;
Additional notes...&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;SQL-User&amp;quot;&amp;gt;If you&#039;re creating a SQL server for a front-end service, then its usual to use domain service accounts to run SQL under.  However, if you&#039;re creating a SQL server back-end infrastructure purposes (such as [[:Category:vCentre|vCentre]]) which should be able to run as stand-alone services without dependence on services such as [[Acronyms#D|DNS]] or Active Directory servers then you &#039;&#039;must&#039;&#039; use a local account.  Back-end core infrastructure should be as isolated as possible from other systems, so that when failures or disasters occur, impact is localised and you don&#039;t end up with the chicken and egg or deadlock situation where you can&#039;t bring one service up, because it depends on another, which can&#039;t be brought up because...[etc].&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;SQL-Mem&amp;quot;&amp;gt;If installing SQL on the same machine as [[:Category:vCentre|vCentre]], give SQL 25-50% of available RAM. For example, I&#039;d use around 300 MB for a small lab/test environment of 1 or 2 ESX&#039;s, whereas if managing 40 ESX&#039;s with 1000 VM&#039;s you&#039;d need around 2 GB.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Standard Maintenance Plans ==&lt;br /&gt;
=== Daily Maintenance Plan ===&lt;br /&gt;
# &#039;&#039;&#039;History Cleanup Task&#039;&#039;&#039;&lt;br /&gt;
#* Delete all historical data (backup/restore, SQL Server Agent and Maintenance plan histories)&lt;br /&gt;
#* Older than 2 weeks&lt;br /&gt;
# &#039;&#039;&#039;Back Up Database Task&#039;&#039;&#039;&lt;br /&gt;
#* Backup type: Full&lt;br /&gt;
#* Databases: All databases&lt;br /&gt;
#* Backup will expire: Leave unticked&lt;br /&gt;
#* Create a backup file for every database: Update as appropriate&lt;br /&gt;
# &#039;&#039;&#039;Reorganise Index Task&#039;&#039;&#039;&lt;br /&gt;
#* All user databases&lt;br /&gt;
#* Compact large objects&lt;br /&gt;
# &#039;&#039;&#039;Update Statistics Task&#039;&#039;&#039;&lt;br /&gt;
#* All user databases&lt;br /&gt;
#* Update: All existing statistics&lt;br /&gt;
#* Scan type: Full scan&lt;br /&gt;
# &#039;&#039;&#039;Maintenance Cleanup Task&#039;&#039;&#039;&lt;br /&gt;
#* Delete files of the following type: Backup files&lt;br /&gt;
#* File extension: &amp;lt;code&amp;gt;bak&amp;lt;/code&amp;gt;&lt;br /&gt;
#* File age:  Select as appropriate&lt;br /&gt;
&lt;br /&gt;
Be aware rhat the &#039;&#039;&#039;Reorganise Index Task&#039;&#039;&#039; can cause lots of activity to be generated in the transaction log, therefore if your recovery mode is &#039;&#039;Full&#039;&#039; (rather than &#039;&#039;Simple&#039;&#039;), the transaction log can grow large very quickly.  If performing on a database that&#039;s been running for some time this can be an issue.  Consider setting the recovery mode to &#039;&#039;Simple&#039;&#039; for the first run, or perform at a time when if your transaction log fills you can recover without too much disruption to applications using the database.&lt;br /&gt;
&lt;br /&gt;
=== Hourly Transaction Log Backup ===&lt;br /&gt;
# &#039;&#039;&#039;Back Up Database Task&#039;&#039;&#039;&lt;br /&gt;
#* Backup type: Transaction Log&lt;br /&gt;
#* Databases: All user databases&lt;br /&gt;
# &#039;&#039;&#039;Maintenance Cleanup Task&#039;&#039;&#039;&lt;br /&gt;
#* Delete files of the following type: Backup files&lt;br /&gt;
#* File extension: &amp;lt;code&amp;gt;trn&amp;lt;/code&amp;gt;&lt;br /&gt;
#* File age:  Select as appropriate&lt;br /&gt;
&lt;br /&gt;
== Gain Sysadmin Rights ==&lt;br /&gt;
In order to gain sysadmin control over a SQL instance you need to have local administrator access over the server, and be able to shut the SQL service down.  You should only need to do this if nobody has sysadmin rights, and trying to add gain sysadmin rights or perform other tasks fails with errors similar to...&lt;br /&gt;
* &#039;&#039;&#039;User does not have permission to perform this action. (Microsoft SQL Server, Error: 15247)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If your running in a virtual machine, take a snapshot 1st for piece of mind...!&lt;br /&gt;
# Login to the server as a local admin (any account with local admin rights)&lt;br /&gt;
# Stop the SQL Server service and any other SQL services&lt;br /&gt;
#* If the database is running as a named instance the name will appear in brackets in the service name - note the instance name&lt;br /&gt;
# Ensure that any &#039;&#039;Microsoft SQL Server Management Studio&#039;&#039; instances are closed&lt;br /&gt;
# Start the SQL instance in single-user mode&lt;br /&gt;
## Open a command prompt in the &amp;lt;code&amp;gt;Binn&amp;lt;/code&amp;gt; folder of the instance&lt;br /&gt;
##* EG &amp;lt;code&amp;gt; C:\Program Files\Microsoft SQL Server\MSSQL10.DB\MSSQL\Binn &amp;lt;/code&amp;gt;&lt;br /&gt;
## If running as a named instance noted above use (replace &amp;lt;code&amp;gt;&amp;lt;Instance&amp;gt;&amp;lt;/code&amp;gt;)...&lt;br /&gt;
##* &amp;lt;code&amp;gt;sqlservr.exe -s&amp;lt;Instance&amp;gt; -m -c&amp;lt;/code&amp;gt;&lt;br /&gt;
## Otherwise use...&lt;br /&gt;
##* &amp;lt;code&amp;gt;sqlservr.exe -s&amp;lt;Instance&amp;gt; -m -c&amp;lt;/code&amp;gt;&lt;br /&gt;
## In amongst other messages you should see the following to state that the DB is up and ready&lt;br /&gt;
##* &amp;lt;code&amp;gt;SQL Server is now ready for client connections. This is an informational message; no user action is required.&amp;lt;/code&amp;gt;&lt;br /&gt;
# Connect to the SQL instance (see [[#Unable_to_Connect_in_Single_User_Mode|below]] for probs)&lt;br /&gt;
## Open another command prompt in the &amp;lt;code&amp;gt;Binn&amp;lt;/code&amp;gt; folder of the instance&lt;br /&gt;
## If running as a named instance noted above use (replace &amp;lt;code&amp;gt;&amp;lt;ComputerName&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;Instance&amp;gt;&amp;lt;/code&amp;gt;)...&lt;br /&gt;
##* &amp;lt;code&amp;gt;sqlcmd -S&amp;lt;ComputerName&amp;gt;\&amp;lt;Instance&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
## Otherwise use (replace &amp;lt;code&amp;gt;&amp;lt;ComputerName&amp;gt;&amp;lt;/code&amp;gt;)...&lt;br /&gt;
##* &amp;lt;code&amp;gt;sqlcmd -S&amp;lt;ComputerName&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
# Add the required accounts into the sysadmin role (replace &amp;lt;code&amp;gt;&amp;lt;Login&amp;gt;&amp;lt;/code&amp;gt; with Windows account&lt;br /&gt;
## &amp;lt;code&amp;gt; sp_addsrvrolemember &#039;&amp;lt;Login&amp;gt;&#039;, &#039;sysadmin&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
##* EG &amp;lt;code&amp;gt; sp_addsrvrolemember &#039;DOMAIN\user&#039;, &#039;sysadmin&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
## &amp;lt;code&amp;gt;GO&amp;lt;/code&amp;gt;&lt;br /&gt;
## Repeat the above two steps as required&lt;br /&gt;
# Restart the server&lt;br /&gt;
&lt;br /&gt;
Source - http://support.microsoft.com/kb/937682&lt;br /&gt;
&lt;br /&gt;
=== Unable to Connect in Single User Mode ===&lt;br /&gt;
When trying to connect to a SQL server instance in single user mode you received an error similar to...&lt;br /&gt;
* &#039;&#039;&#039;Login failed for user &#039;DOMAIN\user&#039;. Reason: Server is in single user mode. Only one administrator can connect at this time.&lt;br /&gt;
&lt;br /&gt;
This is caused by another user (or piece of software) having already looged into the SQL instance. Ensure that...&lt;br /&gt;
* Any applications that use the SQL instance are not trying to connect (disconnect the SQL server from the network if required)&lt;br /&gt;
* No SQL services are running&lt;br /&gt;
* No &#039;&#039;Microsoft SQL Server Management Studio&#039;&#039; instances are running (including via RDP, check for &amp;lt;code&amp;gt;Ssms.exe&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;Ssms.exe *32&amp;lt;/code&amp;gt; in &#039;&#039;Task Manager&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Commands and Maintenance ==&lt;br /&gt;
For performance issues, see http://www.sqlskills.com/blogs/paul/wait-statistics-or-please-tell-me-where-it-hurts/&lt;br /&gt;
&lt;br /&gt;
Crib sheet of some very basic stuff, the syntax isn&#039;t exactly the same, but see also [[MySQL]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
SELECT * FROM MASTER..SYSDATABASES					       /* Show databases */&lt;br /&gt;
EXEC sp_databases;                                                             /* Show databases */&lt;br /&gt;
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE &#039;%&#039;	       /* Show tables */&lt;br /&gt;
SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE=&#039;BASE TABLE&#039; /* Show base tables only (not views etc) */&lt;br /&gt;
EXECUTE sp_who2;                                                               /* Show current processes */&lt;br /&gt;
SELECT name,log_reuse_wait_desc FROM sys.databases;                            /* Show why transaction log can&#039;t grow */&lt;br /&gt;
SELECT name,recovery_model_desc FROM sys.databases ORDER BY name               /* Show database recovery modes */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Backup ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
BACKUP DATABASE DatabaseName TO DISK=&#039;E:\bak\DatabaseName.bak&#039;;                /* Full database backup */&lt;br /&gt;
BACKUP LOG DatabaseName TO DISK=&#039;E:\bak\DatabaseName.trn&#039;;                     /* Transaction log backup */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Database Sizes ===&lt;br /&gt;
Use the following in order to find the sizes of databases on your server.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
    DB_NAME(db.database_id) DatabaseName,&lt;br /&gt;
    ((CAST(mfrows.RowSize AS FLOAT)*8) + (CAST(mflog.LogSize AS FLOAT)*8))/1024 TotalSizeMB,&lt;br /&gt;
    (CAST(mfrows.RowSize AS FLOAT)*8)/1024 RowSizeMB,&lt;br /&gt;
    (CAST(mflog.LogSize AS FLOAT)*8)/1024 LogSizeMB,&lt;br /&gt;
    (CAST(mfstream.StreamSize AS FLOAT)*8)/1024 StreamSizeMB,&lt;br /&gt;
    (CAST(mftext.TextIndexSize AS FLOAT)*8)/1024 TextIndexSizeMB&lt;br /&gt;
FROM sys.databases db&lt;br /&gt;
    LEFT JOIN (SELECT database_id, SUM(size) RowSize FROM sys.master_files WHERE type = 0 GROUP BY database_id, type) mfrows ON mfrows.database_id = db.database_id&lt;br /&gt;
    LEFT JOIN (SELECT database_id, SUM(size) LogSize FROM sys.master_files WHERE type = 1 GROUP BY database_id, type) mflog ON mflog.database_id = db.database_id&lt;br /&gt;
    LEFT JOIN (SELECT database_id, SUM(size) StreamSize FROM sys.master_files WHERE type = 2 GROUP BY database_id, type) mfstream ON mfstream.database_id = db.database_id&lt;br /&gt;
    LEFT JOIN (SELECT database_id, SUM(size) TextIndexSize FROM sys.master_files WHERE type = 4 GROUP BY database_id, type) mftext ON mftext.database_id = db.database_id&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Source: http://stackoverflow.com/questions/5945360/sql-server-2008-how-to-query-all-databases-sizes&lt;br /&gt;
&lt;br /&gt;
=== Table Sizes ===&lt;br /&gt;
Replace &#039;&#039;&#039;DatabaseName&#039;&#039;&#039; in the query below&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
USE &amp;lt;DataBaseName&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
    t.NAME AS TableName,&lt;br /&gt;
    i.name as indexName,&lt;br /&gt;
    sum(p.rows) as RowCounts,&lt;br /&gt;
    sum(a.total_pages) as TotalPages, &lt;br /&gt;
    sum(a.used_pages) as UsedPages, &lt;br /&gt;
    sum(a.data_pages) as DataPages,&lt;br /&gt;
    (sum(a.total_pages) * 8) / 1024 as TotalSpaceMB, &lt;br /&gt;
    (sum(a.used_pages) * 8) / 1024 as UsedSpaceMB, &lt;br /&gt;
    (sum(a.data_pages) * 8) / 1024 as DataSpaceMB&lt;br /&gt;
FROM &lt;br /&gt;
    sys.tables t&lt;br /&gt;
INNER JOIN      &lt;br /&gt;
    sys.indexes i ON t.OBJECT_ID = i.object_id&lt;br /&gt;
INNER JOIN &lt;br /&gt;
    sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id&lt;br /&gt;
INNER JOIN &lt;br /&gt;
    sys.allocation_units a ON p.partition_id = a.container_id&lt;br /&gt;
WHERE &lt;br /&gt;
    t.NAME NOT LIKE &#039;dt%&#039; AND&lt;br /&gt;
    i.OBJECT_ID &amp;gt; 255 AND   &lt;br /&gt;
    i.index_id &amp;lt;= 1&lt;br /&gt;
GROUP BY &lt;br /&gt;
    t.NAME, i.object_id, i.index_id, i.name &lt;br /&gt;
ORDER BY &lt;br /&gt;
    object_name(i.object_id) &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Source: https://stackoverflow.com/questions/2094436/how-to-find-largest-objects-in-a-sql-server-database&lt;br /&gt;
&lt;br /&gt;
=== Memory Usage ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
DECLARE @total_buffer INT;&lt;br /&gt;
&lt;br /&gt;
SELECT @total_buffer = cntr_value&lt;br /&gt;
   FROM sys.dm_os_performance_counters&lt;br /&gt;
   WHERE RTRIM([object_name]) LIKE &#039;%Buffer Manager&#039;&lt;br /&gt;
   AND counter_name = &#039;Total Pages&#039;;&lt;br /&gt;
&lt;br /&gt;
;WITH src AS&lt;br /&gt;
(&lt;br /&gt;
   SELECT&lt;br /&gt;
       database_id, db_buffer_pages = COUNT_BIG(*)&lt;br /&gt;
       FROM sys.dm_os_buffer_descriptors&lt;br /&gt;
       --WHERE database_id BETWEEN 5 AND 32766&lt;br /&gt;
       GROUP BY database_id&lt;br /&gt;
)&lt;br /&gt;
SELECT&lt;br /&gt;
   [db_name] = CASE [database_id] WHEN 32767&lt;br /&gt;
       THEN &#039;Resource DB&#039;&lt;br /&gt;
       ELSE DB_NAME([database_id]) END,&lt;br /&gt;
   db_buffer_pages,&lt;br /&gt;
   db_buffer_MB = db_buffer_pages / 128,&lt;br /&gt;
   db_buffer_percent = CONVERT(DECIMAL(6,3),&lt;br /&gt;
       db_buffer_pages * 100.0 / @total_buffer)&lt;br /&gt;
FROM src&lt;br /&gt;
ORDER BY db_buffer_MB DESC;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Fragmentation ===&lt;br /&gt;
List index fragmentation within a particular database...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
USE database_name;&lt;br /&gt;
SELECT OBJECT_NAME(ind.OBJECT_ID) AS TableName, &lt;br /&gt;
ind.name AS IndexName, indexstats.index_type_desc AS IndexType, &lt;br /&gt;
indexstats.avg_fragmentation_in_percent &lt;br /&gt;
FROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, NULL) indexstats &lt;br /&gt;
INNER JOIN sys.indexes ind ON ind.object_id = indexstats.object_id AND ind.index_id = indexstats.index_id &lt;br /&gt;
WHERE indexstats.avg_fragmentation_in_percent &amp;gt; 50 &lt;br /&gt;
ORDER BY indexstats.avg_fragmentation_in_percent DESC;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Indexes identified as being fragmented can defrag&#039;ed by using either of the following command...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
ALTER INDEX IndexName ON TableName REORGANIZE;                       /* Online */&lt;br /&gt;
ALTER INDEX IndexName ON TableName REBUILD;                          /* Offline */&lt;br /&gt;
ALTER INDEX IndexName ON TableName REBUILD WITH (ONLINE = ON);       /* Online - 2008 Ent and above only */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, if you&#039;ve got lots of indexes to defrag, you can create the REORGANIZE statements...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
SELECT &#039;ALTER INDEX &#039; + ind.name + &#039; ON &#039; + OBJECT_NAME(ind.OBJECT_ID) + &#039; REORGANIZE;&#039; &lt;br /&gt;
FROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, NULL) indexstats &lt;br /&gt;
INNER JOIN sys.indexes ind ON ind.object_id = indexstats.object_id AND ind.index_id = indexstats.index_id &lt;br /&gt;
WHERE indexstats.avg_fragmentation_in_percent &amp;gt; 50;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
...or the REBUILD statements...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
SELECT &#039;ALTER INDEX &#039; + ind.name + &#039; ON &#039; + OBJECT_NAME(ind.OBJECT_ID) + &#039; REBUILD WITH (ONLINE = ON);&#039; &lt;br /&gt;
FROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, NULL) indexstats &lt;br /&gt;
INNER JOIN sys.indexes ind ON ind.object_id = indexstats.object_id AND ind.index_id = indexstats.index_id &lt;br /&gt;
WHERE indexstats.avg_fragmentation_in_percent &amp;gt; 50;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Rebuild All Indexes ====&lt;br /&gt;
Unless you are running SQL Enterprise, this needs to be run when your database is &#039;&#039;&#039;single-user mode&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
USE DatabaseName                            /* Change to database name! */&lt;br /&gt;
 &lt;br /&gt;
DECLARE @TableName varchar(255) &lt;br /&gt;
DECLARE TableCursor CURSOR FOR &lt;br /&gt;
 &lt;br /&gt;
SELECT table_name FROM information_schema.tables &lt;br /&gt;
WHERE table_type = &#039;base table&#039; &lt;br /&gt;
 &lt;br /&gt;
OPEN TableCursor &lt;br /&gt;
  &lt;br /&gt;
FETCH NEXT FROM TableCursor INTO @TableName &lt;br /&gt;
 &lt;br /&gt;
WHILE @@FETCH_STATUS = 0 &lt;br /&gt;
BEGIN &lt;br /&gt;
DBCC DBREINDEX(@TableName,&#039; &#039;,0) &lt;br /&gt;
FETCH NEXT FROM TableCursor INTO @TableName &lt;br /&gt;
END &lt;br /&gt;
 &lt;br /&gt;
CLOSE TableCursor &lt;br /&gt;
 &lt;br /&gt;
DEALLOCATE TableCursor &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To put into Single-User Mode&lt;br /&gt;
# Take database offline&lt;br /&gt;
#* If database won&#039;t stop, look for processes still accessing the database and kill them&lt;br /&gt;
# Put into single-user mode&lt;br /&gt;
# Put database online&lt;br /&gt;
#* You can only run commands from one console window/connection&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
/* Find processes and kill them*/&lt;br /&gt;
exec sp_who2&lt;br /&gt;
kill 32&lt;br /&gt;
&lt;br /&gt;
/* Force offline - change database name */&lt;br /&gt;
USE master&lt;br /&gt;
ALTER DATABASE DatabaseName SET OFFLINE WITH ROLLBACK IMMEDIATE&lt;br /&gt;
&lt;br /&gt;
/* Force into single-user */&lt;br /&gt;
USE master&lt;br /&gt;
ALTER DATABASE DatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE&lt;br /&gt;
&lt;br /&gt;
/* Put back into multi-user */&lt;br /&gt;
USE master&lt;br /&gt;
ALTER DATABASE DatabaseName SET MULTI_USER&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Applications]]&lt;br /&gt;
[[Category:Microsoft]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Getting_Started_(PowerShell)&amp;diff=2713</id>
		<title>Getting Started (PowerShell)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Getting_Started_(PowerShell)&amp;diff=2713"/>
		<updated>2019-05-07T12:55:25Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Scripts */ Add &amp;quot;Scheduled Tasks&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Installation ==&lt;br /&gt;
Subject specific useful links are listed in the sections below, the following provide links to installers and general documentation...&lt;br /&gt;
* &#039;&#039;&#039;Downloads&#039;&#039;&#039;&lt;br /&gt;
** [http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx Windows PowerShell V1]&lt;br /&gt;
** [http://support.microsoft.com/kb/968929 Windows PowerShell V2]&lt;br /&gt;
** [http://www.microsoft.com/en-gb/download/details.aspx?id=34595 Windows PowerShell V3]&lt;br /&gt;
*** Requires .NET v4 to be installed - [http://www.microsoft.com/en-gb/download/details.aspx?id=17718 .NET v4 Standalone]&lt;br /&gt;
** [http://www.microsoft.com/en-gb/download/details.aspx?id=40855 Windows PowerShell V4]&lt;br /&gt;
* Documentation&lt;br /&gt;
** http://powershell.com/cs/ - Good all-round help&lt;br /&gt;
** http://technet.microsoft.com/en-us/library/bb978526.aspx - TechNet!&lt;br /&gt;
&lt;br /&gt;
Whilst &#039;&#039;&#039;Win2008&#039;&#039;&#039; ships with Powershell V2, it isn&#039;t necessarily available, to install...&lt;br /&gt;
# Go to &#039;&#039;&#039;Server Manager&#039;&#039;&#039;&lt;br /&gt;
# Go into &#039;&#039;&#039;Features&#039;&#039;&#039;, then &#039;&#039;&#039;Add Features&#039;&#039;&#039;&lt;br /&gt;
# Tick &#039;&#039;&#039;Windows Powershell&#039;&#039;&#039;, and then &#039;&#039;&#039;Next&#039;&#039;&#039;&lt;br /&gt;
&#039;&#039;Normally a restart isn&#039;t required&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you&#039;re running scripts from a machine that does not have (or has dodgy) internet access, then running PowerShell scripts can mean a very long wait before they start to run.  In which case you need to disable certificate checking (its the checking for certificate revocation that needs to time-out before a script will run)...&lt;br /&gt;
# In &#039;&#039;&#039;Internet Explorer&#039;&#039;&#039;&lt;br /&gt;
# Go to &#039;&#039;&#039;Internet Options&#039;&#039;&#039;, and then &#039;&#039;&#039;Advanced&#039;&#039;&#039;&lt;br /&gt;
# Then under &#039;&#039;&#039;Security&#039;&#039;&#039; uncheck &#039;&#039;Check for publisher&#039;s certificate revocation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== User Profile ===&lt;br /&gt;
Its possible to create a customised profile so that modules, settings etc are available.  This is achieved by running a PowerShell script whenever PowerShell starts&lt;br /&gt;
# Locate your profile path&lt;br /&gt;
#* &amp;lt;source lang=powershell&amp;gt;Write-Host $profile&amp;lt;/source&amp;gt;&lt;br /&gt;
# Create a PowerShell script in the exact path&lt;br /&gt;
&lt;br /&gt;
You could for example log all PowerShell activity to a OneDrive folder...&lt;br /&gt;
&amp;lt;source lang=powershell&amp;gt;&lt;br /&gt;
$today = (Get-Date).ToString(&amp;quot;yyyy-MM-dd&amp;quot;)&lt;br /&gt;
Start-Transcript -Path &amp;quot;$home\OneDrive\Scripts\transcripts\$env:computername-PID$pid-$today.txt&amp;quot; -Append -NoClobber&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Execution Policy ==&lt;br /&gt;
On the first run you need to allow Powershell to scripts to execute, otherwise you&#039;ll get an error that contains the following when trying to run a script...&lt;br /&gt;
* &amp;lt;code&amp;gt; cannot be loaded because the execution of scripts is disabled on this system.&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;You need to run the command below as an administrator&#039;&#039;&#039;, otherwise you&#039;ll get an error like...&lt;br /&gt;
* &amp;lt;code&amp;gt; Set-ExecutionPolicy : Access to the registry key &#039;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell&#039; is denied. &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So if you&#039;re using Windows 7, for example, you&#039;ll need to start the Powershell console as an administrator (right-click &#039;&#039;Run as administrator&#039;&#039;), regardless of whether you&#039;re currently logged in as an admin).  &lt;br /&gt;
&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt; Set-ExecutionPolicy RemoteSigned &amp;lt;/source&amp;gt;&lt;br /&gt;
It is possible to bypass the Execution Policy entirely (though you do so at your own risk, should only be used to run a script you trust where you haven&#039;t the time to fix the underlying problem, and should be reverted afterwards)...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt; Set-ExecutionPolicy Bypass &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If you have no admin rights&#039;&#039;&#039; over the PC you&#039;re using, then can try to use &#039;&#039;Suspend&#039;&#039; option rather than &#039;&#039;Yes&#039;&#039; (sets just for your current session, doesn&#039;t try to write to the registry), this doesn&#039;t work in all cases.  Alternatively you can hack the Environment variable that controls the Execution Policy (again, this isn&#039;t permanent, and may not work in all versions)...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
$env:PSExecutionPolicyPreference = &amp;quot;RemoteSigned&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To see your current execution policy use...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
Get-ExecutionPolicy&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run a script, without tinkering with the Execution Policy first, run from a command prompt&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
powershell.exe -executionpolicy remotesigned .\Example.ps1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installed Version ==&lt;br /&gt;
To check the main installed version use &#039;&#039;&#039;either&#039;&#039;&#039; of the following command lines...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
Get-Host | Select version      &lt;br /&gt;
$host.version&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, if you might have installed something other than the normal RTM or GA release version you&#039;ll need to the registry key &amp;lt;code&amp;gt;HKLM\Software\Microsoft\PowerShell\1&amp;lt;/code&amp;gt;, which will have the following values of interest...&lt;br /&gt;
{|class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value                 !! Data                                 !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; Install &amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;                       || Installed (not version number - Microsoft may have intended this to be a version marker at inception, but it is not used as such)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; PID &amp;lt;/code&amp;gt;     || &amp;lt;code&amp;gt;89383-100-0001260-04309&amp;lt;/code&amp;gt; || RTM (Release to Manufacturing)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; PID &amp;lt;/code&amp;gt;     || &amp;lt;code&amp;gt;89393-100-0001260-00301&amp;lt;/code&amp;gt; || RC2 (Release Candidate 2)&lt;br /&gt;
|}&lt;br /&gt;
For more info on release version acronyms, see [http://en.wikipedia.org/wiki/Software_release_life_cycle Software Release Life Cycle]&lt;br /&gt;
&lt;br /&gt;
== Help Commands ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt;Get-Help &amp;lt;cmd&amp;gt;              # Provides help for CmdLets, use wildcards to broaden results.&lt;br /&gt;
$object | Get-Member       # Provides information about an object (variable)&lt;br /&gt;
$object.gettype()          # Provides variable type info (string, array, etc)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conditional Operators ==&lt;br /&gt;
=== Comparison ===&lt;br /&gt;
{|class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
!  Operator           !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; -eq &amp;lt;/code&amp;gt;  || Equal to (implied case insensitive)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; -ieq &amp;lt;/code&amp;gt; || Equal to (case insensitive)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; -ceq &amp;lt;/code&amp;gt; || Equal to (case sensitive)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; -lt &amp;lt;/code&amp;gt;  || Less than&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; -gt &amp;lt;/code&amp;gt;  || Greater than&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; -ge &amp;lt;/code&amp;gt;  || Greater than or Eqaul to&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; -le &amp;lt;/code&amp;gt;  || Less than or equal to&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; -ne &amp;lt;/code&amp;gt;  || Not equal to&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; -match &amp;lt;/code&amp;gt;  || Match (ie string contains) anywhere within string (can be regex)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; -notmatch &amp;lt;/code&amp;gt;  || Does not match (ie string contains) (can be regex)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; -like &amp;lt;/code&amp;gt;  || Like (ie string is), stricter than match (can be regex)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; -notlike &amp;lt;/code&amp;gt;  || Not like (ie string is not) (can be regex)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Logic ===&lt;br /&gt;
{|class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
!  Operator            !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; -not &amp;lt;/code&amp;gt;  || Not&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; ! &amp;lt;/code&amp;gt;     || Not&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; -and &amp;lt;/code&amp;gt;  || And&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; -or &amp;lt;/code&amp;gt;   || Or&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Useful One-Liners ==&lt;br /&gt;
{|class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
! Command               !! Description &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; Get-Content &amp;lt;file-path&amp;gt; &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; Out-GridView &amp;lt;/code&amp;gt; || Display (log)file in the nice Grid View window   &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; (Get-Location -PSProvider FileSystem).ProviderPath &amp;lt;/code&amp;gt;      || Current working directory  &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; $MyInvocation.MyCommand.Name &amp;lt;/code&amp;gt;                            || Current script or function name (if in a function)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; $host.UI.RawUI.WindowTitle = &amp;quot;Wibble&amp;quot; &amp;lt;/code&amp;gt;                   || Change command shell title (to &#039;&#039;Wibble&#039;&#039;)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== PowerShell Process ==&lt;br /&gt;
To get information about the current running PowerShell session process, use...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
$proc = [System.Diagnostics.Process]::GetCurrentProcess()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
...from which you can get all sorts of performance and other metrics such as total CPU time taken, various memory usage metrics and so forth.  Which can be useful if you have a script that you want to run continuously, but you want to be able to monitor that its behaving (no excessive CPU usage or memory leaking).&lt;br /&gt;
&lt;br /&gt;
The object type returned by the above is exactly the same as is returned by &amp;lt;code&amp;gt;[http://technet.microsoft.com/en-us/library/dd347630.aspx Get-Process]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Process Priority ===&lt;br /&gt;
In order to change the priority of the current PowerShell process, use...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
( [System.Diagnostics.Process]::GetCurrentProcess() ).PriorityClass = &amp;quot;NewPriority&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
...where NewPriority is any of (though I&#039;d recommend limiting to either BelowNormal or AboveNormal)...&lt;br /&gt;
{|class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
! Priority          !! Description &lt;br /&gt;
|- &lt;br /&gt;
! Idle              &lt;br /&gt;
| Only runs when system is idle, which may mean that the process never gets enough execution time to do anything useful.&lt;br /&gt;
|- &lt;br /&gt;
! BelowNormal&lt;br /&gt;
| Ensures that the process will yield to most other processes running on the system (good for background tasks).&lt;br /&gt;
By default, scheduled tasks run as Below Normal (in Win2008, and maybe others)&lt;br /&gt;
|- &lt;br /&gt;
! Normal&lt;br /&gt;
| Default - recommended for most tasks&lt;br /&gt;
|- &lt;br /&gt;
! AboveNormal&lt;br /&gt;
| Ensures that most other processes running on the system will yield to the PowerShell process (good for urgent, high priority tasks).&lt;br /&gt;
|- &lt;br /&gt;
! High&lt;br /&gt;
| Process will try to run immediately.&amp;lt;br&amp;gt;Can lead to a system having constant high CPU and sluggish overall performance. &lt;br /&gt;
|- &lt;br /&gt;
! RealTime&lt;br /&gt;
| Process overrides all other processes (including system tasks).&amp;lt;br&amp;gt;Can lead to an unresponsive, locked out system unless process has been specifically written to run in RealTime mode, or will only run for a very brief period. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you run scripts that can be CPU intensive, and/or run for a long time.  This can lessen the impact on your desktop or server (wherever the script is running).&lt;br /&gt;
&lt;br /&gt;
To check the current priority of your shell or script use...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
( [System.Diagnostics.Process]::GetCurrentProcess() ).PriorityClass&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Scripts ==&lt;br /&gt;
=== Include Files ===&lt;br /&gt;
In order to include another Powershell script in a parent script, use a &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; and then the path to the file (there&#039;s a space between them), eg&lt;br /&gt;
&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
. .\lib\include_file.ps1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script Arguments ===&lt;br /&gt;
In order to be able to parameters to a script the &amp;lt;code&amp;gt;$args&amp;lt;/code&amp;gt; variable can be used.  Each argument is provided within the array in order, eg&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
# 1st param is send yes or no&lt;br /&gt;
# 2nd param is email address&lt;br /&gt;
&lt;br /&gt;
if ($args[0]) {&lt;br /&gt;
    Write-Host &amp;quot;Email sending enabled...!&amp;quot;&lt;br /&gt;
    Write-Host &amp;quot;Will send to&amp;quot; $args[1]&lt;br /&gt;
} else {&lt;br /&gt;
    Write-Host &amp;quot;Email sending disabled.&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So for example...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[PS &amp;gt; ./params.ps1 0&lt;br /&gt;
Email sending disabled.&lt;br /&gt;
[PS &amp;gt; ./params.ps1 1 test@abc.com&lt;br /&gt;
Email sending enabled...!&lt;br /&gt;
Will send to test@abc.com&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Logging ===&lt;br /&gt;
The easiest way to setup logging from with a script is to use the Transcript functionality which will log all output to a transcript file.  Note that &amp;lt;code&amp;gt; Write-Host &amp;lt;/code&amp;gt; only places line feeds at the end of lines, not carriage returns, therefore Notepad will display such output as one long line.  You&#039;ll need to use an editor that can handle lines only terminated by LF&#039;s (WordPad if you can&#039;t install anything, otherwise get something better, eg http://www.scintilla.org/SciTE.html).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
Start-Transcript -Path C:\Users\name\Scripts\script.log -Append -NoClobber&lt;br /&gt;
# script&lt;br /&gt;
Stop-Transcript&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Scheduled Tasks ==&lt;br /&gt;
To run a script as a scheduled task, complete the task config as normal, in the &#039;&#039;Action&#039;&#039; tab populate as follows...&lt;br /&gt;
* &#039;&#039;&#039;Program/Script&#039;&#039;&#039; - PowerShell&lt;br /&gt;
* &#039;&#039;&#039;AddArguments (optional)&#039;&#039;&#039; - As below (not optional!)&lt;br /&gt;
** Basic: &amp;lt;code&amp;gt;script.ps1&amp;lt;/code&amp;gt;&lt;br /&gt;
** Where paths have spaces and your script takes parameters (eg &#039;&#039;&#039;ScriptParam&#039;&#039;&#039;): &amp;lt;code&amp;gt;&amp;quot;&amp;amp; &#039;C:\Path\To Script\script.ps1&#039;&amp;quot; -ScriptParam ScriptParamData&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Start in (optional)&#039;&#039;&#039; - As below (optional, but recommended)&lt;br /&gt;
** &amp;lt;code&amp;gt;C:\Path\To Script&amp;lt;/code&amp;gt;&lt;br /&gt;
** Do not add quotes, even if your path has spaces&lt;br /&gt;
&lt;br /&gt;
== Call External Process ==&lt;br /&gt;
Running an external executable is a bit of a faff, but it can be done...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
$cmd = &amp;quot;rrdtool.exe update $rrd $updates&amp;quot;&lt;br /&gt;
$proc_res = &amp;amp;$executioncontext.InvokeCommand.NewScriptBlock($cmd)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Slow Start-Up ==&lt;br /&gt;
PowerShell isn&#039;t the fastest thing in the world to start, the fact that a basic PowerShell command prompt uses of 50MB of RAM gives some indication that its not lean and mean (but once up and running, and when running efficient script it can be &#039;&#039;very&#039;&#039; fast).  However if its taking minutes rather than seconds to start then there is something going wrong.&lt;br /&gt;
&lt;br /&gt;
Normally this is due to the fact that the machine you&#039;re running from has no (or limited) internet access.  To workaround the problem you need to disable Certificate Revocation Checking...&lt;br /&gt;
&lt;br /&gt;
# In &#039;&#039;&#039;Control Panel&#039;&#039;&#039;, open &#039;&#039;&#039;Internet Options&#039;&#039;&#039;&lt;br /&gt;
# Go to the &#039;&#039;&#039;Advanced&#039;&#039;&#039; tab, and scroll down to the &#039;&#039;&#039;Security&#039;&#039;&#039; section&lt;br /&gt;
# Untick the &#039;&#039;&#039;Check for publisher&#039;s certificate revocation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There is no increased security risk imposed by doing this on a machine with no/limited internet access, as the checks were previously timing-out and being bypassed anyway.&lt;br /&gt;
&lt;br /&gt;
[[Category:PowerShell]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Windows_2008&amp;diff=2712</id>
		<title>Windows 2008</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Windows_2008&amp;diff=2712"/>
		<updated>2019-05-07T11:52:56Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Scheduled Tasks */ Added note to 0x8007010B&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Build ==&lt;br /&gt;
Best practice for VMware VMs (take with a pinch of salt, one man&#039;s best practice can be another man&#039;s gotcha)&lt;br /&gt;
* http://communities.vmware.com/servlet/JiveServlet/downloadBody/12309-102-4-13348/vFiltered-windows2008best%20practices.pdf&lt;br /&gt;
&lt;br /&gt;
=== Disable ASLR ===&lt;br /&gt;
Address space layout randomisation is a feature which involves randomly arranging the positions of key data areas, in order to mitigate memory snapshot image vulnerabilities (which is generally not a problem).  There are suggestions that this can reduce reduce VMware&#039;s page sharing between VM&#039;s, increasing overall physical memory usage.  However, its probably true that whilst memory page locations will be randomised, the VMkernel will still be able to match up identical pages between different OS instances.&lt;br /&gt;
&lt;br /&gt;
 HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\&amp;quot;MoveImages&amp;quot;=dword:00000000&lt;br /&gt;
&lt;br /&gt;
== Procedures ==&lt;br /&gt;
=== Sysprep ===&lt;br /&gt;
# Start sysprep from &amp;lt;code&amp;gt; C:\Windows\System32\sysprep\sysprep.exe &amp;lt;/code&amp;gt;&lt;br /&gt;
# Leave action as &#039;&#039;&#039;Enter System Out-of-Box Experience (OOBE)&#039;&#039;&#039; and tick the poorly spelt &#039;&#039;&#039;Generalize&#039;&#039;&#039; tick-box, then hit &#039;&#039;&#039;OK&#039;&#039;&#039;&lt;br /&gt;
# Sysprep will run and reboot the OS&lt;br /&gt;
#* You&#039;ll need to provide a &#039;&#039;new&#039;&#039; password, and any hostname and IP details will need updating&lt;br /&gt;
&lt;br /&gt;
=== NTP Client ===&lt;br /&gt;
Machines that are part of a domain will synchronise their time with the domain controllers, but standalone machines (or domain controllers) need to be configured to behave as NTP clients.&lt;br /&gt;
 &lt;br /&gt;
The server&#039;s NTP config in the registry hive &#039;&#039;&#039;&amp;lt;code&amp;gt;HKLM\SYSTEM\CurrentControlSet\Services\W32Time&amp;lt;/code&amp;gt;&#039;&#039;&#039; needs to be updated as follows to enable the server&#039;s system clock to update via NTP.  Restart the NTP service to apply.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
! Key                      !! Name                  !! Value              !! Notes&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=2 | Parameters               || Type                  || NTP&lt;br /&gt;
|-&lt;br /&gt;
| NtpServer             || 192.168.206.25,0x1 192.168.206.26,0x1 || Space separated list, each name/IP must have &amp;lt;code&amp;gt;,0x1&amp;lt;/code&amp;gt; appended to the end &lt;br /&gt;
|-&lt;br /&gt;
| TimeProviders \ NtpServer  || Enabled               || 1                || Only required if you wish other servers to be able to poll your server for time&lt;br /&gt;
|-&lt;br /&gt;
| TimeProviders \ NtpClient  || SpecialPollInterval   || 1800             || Secs. Interval between successive NTP polls&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=4 |Config                   || AnnounceFlags         || 5&lt;br /&gt;
|-&lt;br /&gt;
| MaxAllowedPhaseOffset || 30                 || Secs. If clock if off by more, its&#039; abruptly set rather than incremented&lt;br /&gt;
|-&lt;br /&gt;
| MaxPosPhaseCorrection || 5400               || Secs. Maximum positive phase correction allowed (if greater, no change occurs)&lt;br /&gt;
|-&lt;br /&gt;
| MaxNegPhaseCorrection || 5400               || Secs. Maximum negative phase correction allowed (if greater, no change occurs)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Once completed, restart the Win32 Time service&lt;br /&gt;
* &amp;lt;code&amp;gt; net stop w32time &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; net start w32time &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To locate suitable NTP servers to use, see http://www.pool.ntp.org/&lt;br /&gt;
&lt;br /&gt;
See http://support.microsoft.com/kb/816042 for further info on setting the above parameters&lt;br /&gt;
&lt;br /&gt;
== Network Connectivity Status Indicator (NCSI) ==&lt;br /&gt;
NCSI is the feature that causes the &amp;quot;No Internet Access&amp;quot; alert pop-up that can appear over your network connection.&lt;br /&gt;
&lt;br /&gt;
* An HTTP request for http://www.msftncsi.com/ncsi.txt&lt;br /&gt;
** Which returns a single line &amp;lt;code&amp;gt;Microsoft NCSI&amp;lt;/code&amp;gt;&lt;br /&gt;
* A DNS request for dns.msftncsi.com&lt;br /&gt;
** Which is expected to resolve to 131.107.255.255&lt;br /&gt;
&lt;br /&gt;
To disable NCSI checks&lt;br /&gt;
# Start the relevant Group Policy editor (gpmc.msc or GPEdit.msc)&lt;br /&gt;
# Browse through to &#039;&#039;&#039;Internet Communication settings&#039;&#039;&#039;&lt;br /&gt;
#* &#039;&#039;&#039;Computer Configuration &amp;gt; Administrative Templates &amp;gt; System &amp;gt; Internet Communication Management &amp;gt; Internet Communication settings&#039;&#039;&#039;&lt;br /&gt;
# Set &#039;&#039;&#039;Turn off Windows Network Connectivity Status Indicator active tests&#039;&#039;&#039; to &#039;&#039;&#039;Enabled&#039;&#039;&#039;&lt;br /&gt;
# Run &amp;lt;code&amp;gt; gpupdate &amp;lt;/code&amp;gt; to apply&lt;br /&gt;
&lt;br /&gt;
To disable the &amp;quot;No Internet Access&amp;quot; pop-up&lt;br /&gt;
# Start the relevant Group Policy editor (gpmc.msc or GPEdit.msc)&lt;br /&gt;
# Browse through to &#039;&#039;&#039;Network Connections&#039;&#039;&#039;&lt;br /&gt;
#* &#039;&#039;&#039;Computer Configuration &amp;gt; Administrative Templates &amp;gt; Network &amp;gt; Network Connections&#039;&#039;&#039;&lt;br /&gt;
# Set &#039;&#039;&#039;Do not show the “local access only” network icon&#039;&#039;&#039; to &#039;&#039;&#039;Enabled&#039;&#039;&#039;&lt;br /&gt;
# Run &amp;lt;code&amp;gt; gpupdate &amp;lt;/code&amp;gt; to apply&lt;br /&gt;
&lt;br /&gt;
The underlying settings that govern how NCSI operates can be found in the following registry key&lt;br /&gt;
* &amp;lt;code&amp;gt; HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Further reading...&lt;br /&gt;
http://technet.microsoft.com/en-us/library/ee126135%28WS.10%29.aspx&lt;br /&gt;
http://defaultreasoning.wordpress.com/2010/05/14/disable-%E2%80%9Cno-internet-access%E2%80%9D-notification-on-windows-server-2008-r2/&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
=== Default Gateway Loss ===&lt;br /&gt;
Known bug in Windows 2008 SP2 causes the default gateway of a machine to disappear on reboot.  Resolved by resetting the IP stack and re-entering the IP config&lt;br /&gt;
# Record IP details&lt;br /&gt;
#* &amp;lt;code&amp;gt; ipconfig/all &amp;gt; C:\ipconfig.txt &amp;lt;/code&amp;gt;&lt;br /&gt;
# Reset the IP stack&lt;br /&gt;
#* &amp;lt;code&amp;gt; netsh int ip reset &amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart server&lt;br /&gt;
# Re-enter IP config&lt;br /&gt;
# Reboot to confirm its held&lt;br /&gt;
&lt;br /&gt;
There&#039;s a bugfix available from http://support.microsoft.com/kb/973243&lt;br /&gt;
&lt;br /&gt;
=== Scheduled Tasks ===&lt;br /&gt;
More common scheduled task error codes...&lt;br /&gt;
{|class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
! Code        !! Constant                || Cause / meaning&lt;br /&gt;
|-&lt;br /&gt;
| 0x0         ||                         || Success / no error&lt;br /&gt;
|-&lt;br /&gt;
| 0x1         ||                         || Incorrect function called or unknown function called.  Can also be caused by file permission problems.&lt;br /&gt;
|-&lt;br /&gt;
| 0x2         ||                         || File not found&lt;br /&gt;
|- &lt;br /&gt;
| 0xa         ||                         || The environment is incorrect&lt;br /&gt;
|- &lt;br /&gt;
| 0x41300     || SCHED_S_TASK_READY             || Task is ready to run at its next scheduled time&lt;br /&gt;
|-&lt;br /&gt;
| 0x41301     || SCHED_S_TASK_RUNNING           || Task is currently running&lt;br /&gt;
|-&lt;br /&gt;
| 0x41302     || SCHED_S_TASK_DISABLED          || Task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| 0x41303     || SCHED_S_TASK_HAS_NOT_RUN       || Task has not yet run&lt;br /&gt;
|-&lt;br /&gt;
| 0x41304     || SCHED_S_TASK_NO_MORE_RUNS      || No more scheduled runs for the task&lt;br /&gt;
|-&lt;br /&gt;
| 0x41305     || SCHED_S_TASK_NOT_SCHEDULED     || One or more of the config properties needed to run the task on a schedule have not been set&lt;br /&gt;
|-&lt;br /&gt;
| 0x41306     || SCHED_S_TASK_TERMINATED        || Task was terminated by user&lt;br /&gt;
|-&lt;br /&gt;
| 0x41307     || SCHED_S_TASK_NO_VALID_TRIGGERS || Task either has no triggers or the existing triggers are disabled or not set&lt;br /&gt;
|-&lt;br /&gt;
| 0x41308     || SCHED_S_EVENT_TRIGGER          || Event triggers do not have set run times&lt;br /&gt;
|-&lt;br /&gt;
| 0x4131B     || SCHED_S_SOME_TRIGGERS_FAILED   || Task is registered, but not all specified triggers will start the task&lt;br /&gt;
|-&lt;br /&gt;
| 0x4131C     || SCHED_S_BATCH_LOGON_PROBLEM    || Task is registered, but may fail to start. Batch logon privilege needs to be enabled for the task principal.&lt;br /&gt;
|-&lt;br /&gt;
| 0x41325     || SCHED_S_TASK_QUEUED            || Task Scheduler service has asked the task to run&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041309  || SCHED_E_TRIGGER_NOT_FOUND      || Task&#039;s trigger is not found&lt;br /&gt;
|-&lt;br /&gt;
| 0x8004130A  || SCHED_E_TASK_NOT_READY         || One or more of the properties required to run this task have not been set&lt;br /&gt;
|-&lt;br /&gt;
| 0x8004130B  || SCHED_E_TASK_NOT_RUNNING       || There is no running instance of the task&lt;br /&gt;
|-&lt;br /&gt;
| 0x8004130C  || SCHED_E_SERVICE_NOT_INSTALLED  || Task Scheduler service is not installed&lt;br /&gt;
|-&lt;br /&gt;
| 0x8004130D  || SCHED_E_CANNOT_OPEN_TASK       || Task object could not be opened&lt;br /&gt;
|-&lt;br /&gt;
| 0x8004130E  || SCHED_E_INVALID_TASK           || The object is either an invalid task object or is not a task object&lt;br /&gt;
|-&lt;br /&gt;
| 0x8004130F  || SCHED_E_ACCOUNT_INFORMATION_NOT_SET || No account information could be found in the Task Scheduler security database for the task&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041310  || SCHED_E_ACCOUNT_NAME_NOT_FOUND || Unable to establish existence of the account specified&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041311  || SCHED_E_ACCOUNT_DBASE_CORRUPT  || Task Scheduler security database has been reset due to detected corruption&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041312  || SCHED_E_NO_SECURITY_SERVICES   || Task Scheduler security services are available only on Windows NT&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041313  || SCHED_E_UNKNOWN_OBJECT_VERSION || Task object version is unsupported or invalid&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041314  || SCHED_E_UNSUPPORTED_ACCOUNT_OPTION || Task has unsupported/conflicting combination of account settings and run time options&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041315  || SCHED_E_SERVICE_NOT_RUNNING    || Task Scheduler Service is not running&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041316  || SCHED_E_UNEXPECTEDNODE         || Task&#039;s XML contains an unexpected node (corruption?)&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041317  || SCHED_E_NAMESPACE              || Task&#039;s XML contains an element or attribute from an unexpected namespace&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041318  || SCHED_E_INVALIDVALUE           || Task&#039;s XML contains a value which is incorrectly formatted or out of range&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041319  || SCHED_E_MISSINGNODE            || Task&#039;s XML is missing a required element or attribute&lt;br /&gt;
|-&lt;br /&gt;
| 0x8004131A  || SCHED_E_MALFORMEDXML           || Task&#039;s XML is malformed&lt;br /&gt;
|-&lt;br /&gt;
| 0x8004131D  || SCHED_E_TOO_MANY_NODES         || Task&#039;s XML contains too many nodes of the same type&lt;br /&gt;
|-&lt;br /&gt;
| 0x8004131E  || SCHED_E_PAST_END_BOUNDARY      || Task cannot be started after the trigger end boundary&lt;br /&gt;
|-&lt;br /&gt;
| 0x8004131F  || SCHED_E_ALREADY_RUNNING        || An instance of this task is already running&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041320  || SCHED_E_USER_NOT_LOGGED_ON     || Task will not run because the user is not logged on&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041321  || SCHED_E_INVALID_TASK_HASH      || Task image is corrupt or has been tampered with&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041322  || SCHED_E_SERVICE_NOT_AVAILABLE  || Task Scheduler service is not available&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041323  || SCHED_E_SERVICE_TOO_BUSY       || Task Scheduler service is too busy to handle request&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041324  || SCHED_E_TASK_ATTEMPTED         || Task Scheduler service attempted to run the task, but it did not run due to one of the constraints in the task definition&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041326  || SCHED_E_TASK_DISABLED          || Task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041327  || SCHED_E_TASK_NOT_V1_COMPAT     || Task has properties that are not compatible with earlier versions of Windows&lt;br /&gt;
|-&lt;br /&gt;
| 0x80041328  || SCHED_E_START_ON_DEMAND        || Task&#039;s settings do not allow the task to start on demand&lt;br /&gt;
|-&lt;br /&gt;
| 0x8007010B  ||                                || The &#039;&#039;start in&#039;&#039; folder path is invalid.  Note that quotation marks around paths with spaces in are not required, and will cause this error if used.&lt;br /&gt;
|-&lt;br /&gt;
| 0x800704DD  ||                                || The service is not available (is &#039;&#039;Run only when an user is logged on&#039;&#039; checked?)&lt;br /&gt;
|-&lt;br /&gt;
| 0xC000013A  ||                                || The task was terminated, user pressed Ctrl+C&lt;br /&gt;
|-&lt;br /&gt;
| 0xC06D007E  ||                                || Unknown software exception&lt;br /&gt;
|}&lt;br /&gt;
The above was sourced from...&lt;br /&gt;
* http://msdn.microsoft.com/en-us/library/aa383604&lt;br /&gt;
* http://ict.ken.be/scheduled-task-exit-result-and-error-codes.aspx&lt;br /&gt;
&lt;br /&gt;
Other scheduler errors...&lt;br /&gt;
* &#039;&#039;&#039;Error 2147943712&#039;&#039;&#039;&lt;br /&gt;
** You&#039;re trying to save a task that wants to save credentials (maybe because you want the task to run even when the user is logged off), but credential saving has been disabled by a GPO.&lt;br /&gt;
* &#039;&#039;&#039;Error 2147943785&#039;&#039;&#039; &lt;br /&gt;
** Logon failure: the user has not been granted the requested logon type at this computer.  Grant the user &#039;&#039;log on as a batch job&#039;&#039; rights in Local Security Policy, User Rights Assignment&lt;br /&gt;
&lt;br /&gt;
=== Extend Partition Fails ===&lt;br /&gt;
Disk looks to have extended in disk manager, but file manager/windows explorer still show the old size&lt;br /&gt;
# Start &amp;lt;code&amp;gt; diskpart &amp;lt;/code&amp;gt; from a command line&lt;br /&gt;
# List the volumes, then select the appropriate one&lt;br /&gt;
#* &amp;lt;code&amp;gt; list volume &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; select volume 2 &amp;lt;/code&amp;gt;&lt;br /&gt;
# Extend the volume&lt;br /&gt;
#* &amp;lt;code&amp;gt; extend filesystem &amp;lt;/code&amp;gt;&lt;br /&gt;
# If this fails, select the partition and extend&lt;br /&gt;
#* &amp;lt;code&amp;gt; list partition &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; select partition 1 &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; extend filesystem &amp;lt;/code&amp;gt;&lt;br /&gt;
# This can sometimes throw up disk errors, in which case you&#039;ll need to a check disk on the affected partition (if there are open file handles you&#039;ll either need to stop the applications or schedule after a reboot, and reboot)&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; chkdisk d: /f &amp;lt;/code&amp;gt;&lt;br /&gt;
# Then re-attempt the partition extension&lt;br /&gt;
&lt;br /&gt;
=== Re-Add Server to Domain ===&lt;br /&gt;
Sometimes the domain membership of a server becomes broken, needing the server to be re-added to the domain.  In order to perform you need...&lt;br /&gt;
* A domain administrator account&lt;br /&gt;
** Or at least a domain account with permissions to add/remove machines from the domain&lt;br /&gt;
* A local administrator account&lt;br /&gt;
** Or a domain account that has recently logged into the server, that has admin rights over it&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have any account that can be a local administrator of the server, you&#039;ll need to break into your server.  There are utilities on the web that let you boot to a recovery CD/ISO, and overwrite the admin password.  I haven&#039;t used any of these since NT4 days, so can&#039;t comment how capable they are today.&lt;br /&gt;
&lt;br /&gt;
# Log into the server as a local admin&lt;br /&gt;
#* If you don&#039;t have the password, but have logged on previously with a domain account that has admin rights over the server&lt;br /&gt;
#*# Disconnect the server from the network&lt;br /&gt;
#*# Login with the domain account that has admin rights (this forces the server to use locally cached credentials, rather than validating with the domain)&lt;br /&gt;
#*# Reconnect to network&lt;br /&gt;
#*# Change the local admin password to something you&#039;ll remember (you must do this otherwise you&#039;ll lose access once the machine is off the domain!)&lt;br /&gt;
# Go to &#039;&#039;&#039;System Properties&#039;&#039;&#039; and record the name of the current domain&lt;br /&gt;
# Then change the domain membership to &#039;&#039;&#039;Workgroup&#039;&#039;&#039; (provide a dummy workgroup name, &#039;&#039;WORKGROUP&#039;&#039; is the defalt for new machines) &lt;br /&gt;
# Provide a domain account that has rights to remove a server from the domain&lt;br /&gt;
# If successful you should get a pop-up stating &#039;&#039;Welcome to the WORKGROUP workgroup&#039;&#039;, and then a prompt to restart&lt;br /&gt;
# Go back into &#039;&#039;&#039;System Properties&#039;&#039;&#039; and change the domain membership to &#039;&#039;&#039;Domain&#039;&#039;&#039;, supplying the original domain name&lt;br /&gt;
# Provide a domain account that has rights to add a server to the domain&lt;br /&gt;
# If successful you should get a pop-up stating &#039;&#039;Welcome to the &amp;lt;domain&amp;gt; domain&#039;&#039;, and then a prompt to restart&lt;br /&gt;
&lt;br /&gt;
[[Category:Microsoft]]&lt;br /&gt;
[[Category:Windows]]&lt;br /&gt;
[[Category:Windows 2008]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Data_Types_(MySQL)&amp;diff=2711</id>
		<title>Data Types (MySQL)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Data_Types_(MySQL)&amp;diff=2711"/>
		<updated>2019-04-17T14:30:53Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Numbers */ Added Integers header&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Numbers ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; BOOL &amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; BOOLEAN &amp;lt;/code&amp;gt; are synonyms for &amp;lt;code&amp;gt; TINYINT(1) &amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Integers ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
! Type               !! Bytes !! Min    !! Max&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; TINYINT  &amp;lt;/code&amp;gt;           || 1     || -128                  || 127&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; TINYINT UNSIGNED &amp;lt;/code&amp;gt;   || 1     || 0                     || 255&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; SMALLINT &amp;lt;/code&amp;gt;           || 2     || -32768                || 32767&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; SMALLINT UNSIGNED &amp;lt;/code&amp;gt;  || 2     || 0                     || 65535&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; MEDIUMINT &amp;lt;/code&amp;gt;          || 3     || -8388608              || 8388607&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; MEDIUMINT UNSIGNED &amp;lt;/code&amp;gt; || 3     || 0                     || 16777215&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; INT  &amp;lt;/code&amp;gt;               || 4     || -2147483648           || 2147483647&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; INT UNSIGNED &amp;lt;/code&amp;gt;       || 4     || 0                     || 4294967295&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; BIGINT &amp;lt;/code&amp;gt;             || 8     || -9223372036854775808  || 9223372036854775807&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; BIGINT UNSIGNED &amp;lt;/code&amp;gt;    || 8     || 0                     || 18446744073709551615&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For more info see - http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html&lt;br /&gt;
&lt;br /&gt;
== Strings ==&lt;br /&gt;
There&#039;s two main string types&lt;br /&gt;
* &#039;&#039;&#039;&amp;lt;code&amp;gt;VARCHAR&amp;lt;/code&amp;gt;&#039;&#039;&#039; - Variable character length up a prescribed maximum (eg &amp;lt;code&amp;gt;VARCHAR(32)&amp;lt;/code&amp;gt;). Max allowed is 65,535 (though in reality this max width is shared across all columns so is less in practice.&lt;br /&gt;
* &#039;&#039;&#039;&amp;lt;code&amp;gt;CHAR&amp;lt;/code&amp;gt;&#039;&#039;&#039; - Fixed character length up a prescribed maximum (eg &amp;lt;code&amp;gt;CHAR(32)&amp;lt;/code&amp;gt;). Max allowed is 255&lt;br /&gt;
&lt;br /&gt;
== Dates and Times ==&lt;br /&gt;
Date and time values need to specified in the general format of &amp;lt;code&amp;gt;YYYY-MM-DD HH:MM:SS&amp;lt;/code&amp;gt; (date or time components should be omitted if required for the table column.  MySQL is relaxed on the usage of delimiters, so &amp;lt;code&amp;gt;YYYY^MM^DD HH-MM-SS&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;YYYYMMDDHHMMSS&amp;lt;/code&amp;gt; should be fine so long as the overall order of year, month, day, etc is correct and the values are valid.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
! Type                      !! Min                 !! Max                  !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; DATE &amp;lt;/code&amp;gt;       || 1000-01-01          || 9999-12-31&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; TIME &amp;lt;/code&amp;gt;       || -838:59:59          || 838:59:59&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; TIMESTAMP &amp;lt;/code&amp;gt;  || 1970-01-01 00:00:01 || 2038-01-19 03:14:07  || Stored as UTC (converted to during INSERT and from during SELECT)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; DATETIME &amp;lt;/code&amp;gt;   || 1000-01-01 00:00:00 || 9999-12-31 23:59:59 &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; YEAR &amp;lt;/code&amp;gt;       || 1901                || 2155                 ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When querying data for use in PHP scripts, DATETIME values need to be converted into Unix Timestamp, for example...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;mysql&amp;quot;&amp;gt;SELECT UNIX_TIMESTAMP(datetime) AS datetime FROM table;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NULL ==&lt;br /&gt;
NULL means &amp;quot;no data&amp;quot;, it doesn&#039;t mean zero.  Therefore 0 &amp;lt;&amp;gt; NULL in an numerical field, and &amp;quot;NULL&amp;quot; &amp;lt;&amp;gt; NULL in a string field.&lt;br /&gt;
&lt;br /&gt;
To set a field to NULL, use NULL without any quotes eg...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;mysql&amp;quot;&amp;gt;INSERT INTO table (col1, col2) VALUES (&#039;data1&#039;, NULL); &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== IP Addresses ==&lt;br /&gt;
IP addresses are most efficiently stored as an UNSIGNED INT, though obviously this isn&#039;t particularly human readable, but it is beneficial in as much as that if you use a &amp;lt;code&amp;gt; SELECT ... ORDER BY ip &amp;lt;/code&amp;gt; type of statement the IP&#039;s will be correctly sorted&lt;br /&gt;
MySQL will do the conversion between INT and dotted quad using the INET_ATON and INET_NTOA functions. For example;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;mysql&amp;quot;&amp;gt;&lt;br /&gt;
INSERT INTO ips SET ip=INET_ATON(&#039;10.1.2.3&#039;);&lt;br /&gt;
SELECT INET_NTOA(ip) FROM ips;&lt;br /&gt;
SELECT INET_NTOA(ip) FROM ips WHERE INET_NTOA(ip) LIKE &#039;10.1.2.%&#039;;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Alternatively, use &amp;lt;code&amp;gt;VARCHAR(15)&amp;lt;/code&amp;gt; to store as text.&lt;br /&gt;
&lt;br /&gt;
The data returned by &amp;lt;code&amp;gt; INET_NTOA() &amp;lt;/code&amp;gt; is in binary string format, which can occasionally cause problems.  If you&#039;re passing the data into PowerShell, for example, you end up by a &amp;lt;code&amp;gt; [byte] &amp;lt;/code&amp;gt; object that is nigh on impossible to convert to a standard string. To force MySQL to return a string wrap the command in &amp;lt;code&amp;gt;CONVERT(x, CHAR)&amp;lt;/code&amp;gt;, eg &lt;br /&gt;
&amp;lt;source lang=&amp;quot;mysql&amp;quot;&amp;gt;&lt;br /&gt;
SELECT CONVERT(INET_NTOA(ip), CHAR) AS ip FROM ips;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:MySQL]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=User_Management_(MySQL)&amp;diff=2710</id>
		<title>User Management (MySQL)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=User_Management_(MySQL)&amp;diff=2710"/>
		<updated>2019-03-15T08:58:11Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Create Users and Grant/Revoke Privileges */ Updated add new user&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Create Users and Grant/Revoke Privileges ==&lt;br /&gt;
To create a new user you need to specify the username, the location/IP address it will be connecting from (use &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt; for any location), and their password&lt;br /&gt;
&amp;lt;source lang=&amp;quot;mysql&amp;quot;&amp;gt; CREATE USER &#039;&amp;lt;user&amp;gt;&#039;@&#039;localhost&#039; identified by &#039;&amp;lt;password&amp;gt;&#039;;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then give permissions to that user&lt;br /&gt;
&amp;lt;source lang=&amp;quot;mysql&amp;quot;&amp;gt; GRANT ALL ON &amp;lt;dayabase&amp;gt;.* TO &#039;&amp;lt;user&amp;gt;&#039;@&#039;localhost&#039;;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Depending on the version of MySQL running you can do this in one command (note that the &amp;lt;code&amp;gt;WITH GRANT OPTION&amp;lt;/code&amp;gt; allows the user to create more users and/or grant privileges to users).&lt;br /&gt;
&amp;lt;source lang=&amp;quot;mysql&amp;quot;&amp;gt; GRANT ALL PRIVILEGES on &amp;lt;database&amp;gt;.* to &#039;&amp;lt;user&amp;gt;&#039;@&#039;%&#039; identified by &#039;&amp;lt;password&amp;gt;&#039; WITH GRANT OPTION; &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To give no privileges to a new user coming from a specific host;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;mysql&amp;quot;&amp;gt; GRANT USAGE on &amp;lt;database&amp;gt;.* to &#039;&amp;lt;user&amp;gt;&#039;@&#039;&amp;lt;host&amp;gt;&#039; identified by &#039;&amp;lt;password&amp;gt;&#039;; &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To give an existing user read-only access;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;mysql&amp;quot;&amp;gt; GRANT SELECT on &amp;lt;database&amp;gt;.* to &#039;&amp;lt;user&amp;gt;&#039;@&#039;&amp;lt;host&amp;gt;&#039;;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To give an existing user &#039;&#039;web-user&#039;&#039;, read-only access to local database &#039;&#039;webdb&#039;&#039;;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;mysql&amp;quot;&amp;gt; GRANT SELECT ON webdb.* TO &#039;web-user&#039;@&#039;localhost&#039;;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To remove/revoke a privilege from an existing user &#039;&#039;web-user&#039;&#039;;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;mysql&amp;quot;&amp;gt; REVOKE SELECT ON webdb.* FROM &#039;web-user&#039;@&#039;localhost&#039;;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After making any changes to user privilages, you need to flush them to ensure they&#039;re applied...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;mysql&amp;quot;&amp;gt; FLUSH PRIVILEGES; &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Delete Users ==&lt;br /&gt;
To remove an existing user use the following...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;mysql&amp;quot;&amp;gt; DROP USER &#039;&amp;lt;user&amp;gt;&#039;@&#039;&amp;lt;host&amp;gt;&#039;; &amp;lt;/source&amp;gt;&lt;br /&gt;
* You need to specify the full &amp;lt;code&amp;gt;user@host&amp;lt;/code&amp;gt; entry (or MySQL assumes the wild-card host &amp;lt;code&amp;gt;%&amp;lt;/code&amp;gt;)&lt;br /&gt;
* Existing users sessions are not dropped, but will be unable to re-establish&lt;br /&gt;
&lt;br /&gt;
== Display Users ==&lt;br /&gt;
To display all configured users;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;mysql&amp;quot;&amp;gt;&lt;br /&gt;
SELECT CONCAT(&#039;SHOW GRANTS FOR \&#039;&#039;, user ,&#039;\&#039;@\&#039;&#039;, host, &#039;\&#039;;&#039;) FROM mysql.user; &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Then use the displayed lines to see the detail of each user&lt;br /&gt;
&lt;br /&gt;
== Change User Password ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;mysql&amp;quot;&amp;gt;&lt;br /&gt;
SET PASSWORD FOR &#039;user&#039;@&#039;%&#039; = PASSWORD(&#039;newpass&#039;); &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:MySQL]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Percona_NRPE_Install_(MySQL)&amp;diff=2709</id>
		<title>Percona NRPE Install (MySQL)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Percona_NRPE_Install_(MySQL)&amp;diff=2709"/>
		<updated>2019-03-15T08:57:46Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Percona Repository */ Updated&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Instructions on installed the Percona NRPE plugin in order to be able to monitor a MySQL server from Nagios. See the following page for more info - https://www.percona.com/doc/percona-monitoring-plugins/1.1/nagios/index.html&lt;br /&gt;
&lt;br /&gt;
== Ubuntu Install ==&lt;br /&gt;
=== Percona Repository ===&lt;br /&gt;
If you don&#039;t have it available already, you&#039;ll need to add the Percona repository (if it is you should have the following file - &amp;lt;code&amp;gt;/etc/apt/sources.list.d/percona-release.list&amp;lt;/code&amp;gt;&lt;br /&gt;
# Download appropriate pagckage&lt;br /&gt;
#* &amp;lt;code&amp;gt;  wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb &amp;lt;/code&amp;gt;&lt;br /&gt;
# Install package&lt;br /&gt;
#* &amp;lt;code&amp;gt; dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb &amp;lt;/code&amp;gt;&lt;br /&gt;
# Enable the repository&lt;br /&gt;
#* &amp;lt;code&amp;gt;percona-release setup ps80&amp;lt;/code&amp;gt;&lt;br /&gt;
# Update cache&lt;br /&gt;
#* &amp;lt;code&amp;gt; apt-get update &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install Plugins ===&lt;br /&gt;
&amp;lt;code&amp;gt;apt-get install percona-nagios-plugins&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Red Hat Install ==&lt;br /&gt;
Note that the instructions below were written for an older version than is current, please check the Percona site (URL above) for up to date info.&lt;br /&gt;
# Add the Percona repository&lt;br /&gt;
#* &amp;lt;code&amp;gt; yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm &amp;lt;/code&amp;gt;&lt;br /&gt;
# Install the Percona NRPE Nagios plugins &lt;br /&gt;
#* &amp;lt;code&amp;gt;  yum install percona-nagios-plugins percona-toolkit&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Plugin Setup ==&lt;br /&gt;
Change the user/pass used in the example below&lt;br /&gt;
# Append checks to NRPE config file (see below - change user/pass as required)&lt;br /&gt;
#* &amp;lt;code&amp;gt; vi /usr/local/nagios/etc/nrpe.cfg &amp;lt;/code&amp;gt;&lt;br /&gt;
# Check NRPE is set to allow parameters&lt;br /&gt;
#* &amp;lt;code&amp;gt; dont_blame_nrpe=1&amp;lt;/code&amp;gt;&lt;br /&gt;
# Create MySQL user&lt;br /&gt;
#* &amp;lt;code&amp;gt; mysql -u root -p &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; GRANT SELECT, PROCESS, SUPER ON *.* to &#039;nagios&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;nagios123&#039;; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Create credentials config file for checks to use&lt;br /&gt;
#* &amp;lt;code&amp;gt; vi /etc/nagios/mysql.cnf &amp;lt;/code&amp;gt;&lt;br /&gt;
#* Add the following lines&lt;br /&gt;
#* &amp;lt;code&amp;gt; [client] &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; user = nagios &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; password = nagios123 &amp;lt;/code&amp;gt;&lt;br /&gt;
# Change owner and permissions of credentials config file&lt;br /&gt;
#* &amp;lt;code&amp;gt; chown root:nagios /etc/nagios/mysql.cnf &amp;lt;/code&amp;gt;&lt;br /&gt;
#* &amp;lt;code&amp;gt; chmod 640 /etc/nagios/mysql.cnf &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Example MySQL checks&lt;br /&gt;
command[check_mysql_status]=/usr/lib64/nagios/plugins/pmp-check-mysql-status $ARG1$&lt;br /&gt;
command[check_mysql_processlist]=/usr/lib64/nagios/plugins/pmp-check-mysql-processlist&lt;br /&gt;
command[check_mysql_innodb]=/usr/lib64/nagios/plugins/pmp-check-mysql-innodb -C $ARG1$&lt;br /&gt;
command[check_mysql_status_uptime]=/usr/lib64/nagios/plugins/pmp-check-mysql-status x Uptime -C &#039;&amp;lt;&#039; -w $ARG1$ -c $ARG2$&lt;br /&gt;
command[check_mysql_status_connx]=/usr/lib64/nagios/plugins/pmp-check-mysql-status -x Threads_connected -o / -y max_connections -T pct -w $ARG1$ -c $ARG2$&lt;br /&gt;
command[check_mysql_status_threadrun]=/usr/lib64/nagios/plugins/pmp-check-mysql-status -x Threads_running -w $ARG1$ -c $ARG2$&lt;br /&gt;
command[check_mysql_slave_running]=/usr/lib64/nagios/plugins/pmp-check-mysql-replication-running&lt;br /&gt;
command[check_mysql_slave_delay]=/usr/lib64/nagios/plugins/pmp-check-mysql-replication-delay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NRPE Compiled Without Argument Support ==&lt;br /&gt;
Sometime Nagios has been compiled and installed so that it will never accept arguments (regardless of &amp;lt;code&amp;gt;dont_blame_nrpe&amp;lt;/code&amp;gt; config).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /root/nrpe/nrpe-2.13/&lt;br /&gt;
./configure --enable-command-args&lt;br /&gt;
/etc/init.d/nrpe stop&lt;br /&gt;
make&lt;br /&gt;
make install&lt;br /&gt;
/etc/init.d/nrpe start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{#seo:&lt;br /&gt;
|title=Percona MySQL NRPE plugin install&lt;br /&gt;
|keywords=mysql,nrpe,nagios,monitor,percona, plugin&lt;br /&gt;
|description=Instructions on installing the Percona NRPE plugin in order to be able to monitor a MySQL server from Nagios&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:MySQL]]&lt;br /&gt;
[[Category:Nagios]]&lt;br /&gt;
[[Category:NRPE]]&lt;br /&gt;
[[Category:Ubuntu]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2708</id>
		<title>Virtual Machine (KVM)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2708"/>
		<updated>2018-12-23T17:57:09Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: Added Auto Start&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Note that VMs are known as &#039;&#039;&#039;domains&#039;&#039;&#039; in the KVM world.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
This guide assumes you have a basic working environment, run the &amp;lt;code&amp;gt;kvm-ok&amp;lt;/code&amp;gt; command to sanity check...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@kvm-host:# kvm-ok&lt;br /&gt;
INFO: /dev/kvm exists&lt;br /&gt;
KVM acceleration can be used&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install Media ===&lt;br /&gt;
You need to have a local copy of the appropriate ISO.  If you have the ISO file already, upload to your KVM server, alternatively download from the site using &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Ubuntu Desktop LTS&#039;&#039;&#039; - http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso&lt;br /&gt;
&lt;br /&gt;
== Create Virtual Machine ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter                    !! Example                     !! Usage&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;            || VM-Name                     || Name of virtual machine (typically this should match the intended hostname of the VM)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;     || &amp;quot;Test VM to be used for X&amp;quot;  || Description of virtual machine&#039;s purpose etc&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-type&amp;lt;/code&amp;gt;         || Linux                       || OS family, can be  Linux, Solaris, Unix or Windows&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-variant&amp;lt;/code&amp;gt;      || ubuntu16.04                 || Distribution type for the above (run &amp;lt;code&amp;gt;osinfo-query os&amp;lt;/code&amp;gt; to view what is available)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ram&amp;lt;/code&amp;gt;             || 2048                        || vRAM in GB&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;disk path&amp;lt;/code&amp;gt;       || /vm-store/images/VM-Name.img,bus=virtio,size=50 || Virtual disk path, using virtio bus and with a 50GB disk&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;graphics&amp;lt;/code&amp;gt;        || none                        || If noneset, VM will be created with a serial display output (as opposed to VNC window)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cdrom&amp;lt;/code&amp;gt;           || /home/user/cdrom.iso        || Path to installation ISO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;network&amp;lt;/code&amp;gt;         || bridge:br0                  || Network connection details&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Create Server (no GUI) ===&lt;br /&gt;
Update paths to reflect where install ISO, and where VM disk files are intended to be.  &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--extra-args &amp;quot;console=ttyS0&amp;quot;&amp;lt;/code&amp;gt; option allows a local console to be accessed from the host machine (to allow OS install etc before the VM is on a network), though note that it can&#039;t be used with &amp;lt;code&amp;gt;--cdrom&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;--location&amp;lt;/code&amp;gt; has been used instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name server-name \&lt;br /&gt;
--ram 1024 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics none \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/server-name.img,size=20,bus=virtio \&lt;br /&gt;
--extra-args &amp;quot;console=ttyS0&amp;quot; \&lt;br /&gt;
--location /mnt/md0/kvm/iso/ubuntu-16.04.3-server-amd64.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should be presented with the console of the VM as it installs, however if you lose connection etc, connect to the console of the server using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;.  Make sure you set a static IP and install SSH during setup (select &#039;&#039;&#039;OpenSSH server&#039;&#039;&#039; during &#039;&#039;Software selection&#039;&#039; section). Once installation is completed, SSH to the server and setup normal console access (as the instructions in the section below).  Its highly recommended that you follow the steps below to ensure that Console access is available via the KVM host if needed.&lt;br /&gt;
&lt;br /&gt;
==== Console Access ====&lt;br /&gt;
# Update the &amp;lt;code&amp;gt;/etc/default/grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Add &amp;lt;code&amp;gt;console=ttyS0&amp;lt;/code&amp;gt; to the config line &amp;lt;code&amp;gt;GRUB_CMDLINE_LINUX_DEFAULT&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;quiet splash console=ttyS0&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update grub&lt;br /&gt;
#* &amp;lt;code&amp;gt;update-grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the guest machine&lt;br /&gt;
&lt;br /&gt;
Connect using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;, you may need to hit Return once to show the logon prompt.&lt;br /&gt;
&lt;br /&gt;
=== Create Workstation (GUI) ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name ubuntu-desktop \&lt;br /&gt;
--ram 2048 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--cdrom=/mnt/md0/kvm/iso/ubuntu-16.04.3-desktop-amd64.iso \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics vnc \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/ubuntu-desktop.img,size=40,bus=virtio&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the command has got as far as &amp;lt;code&amp;gt;Waiting for installation to complete.&amp;lt;/code&amp;gt; you need to connect to the VNC console session, to find the port number to connect on query the config from anothet SSH session connected to the host (typically VNC uses ports starting from 5900 upwards).&lt;br /&gt;
  virsh dumpxml ubuntu-desktop | grep vnc&lt;br /&gt;
&lt;br /&gt;
== Other Config ==&lt;br /&gt;
=== Auto Start ===&lt;br /&gt;
To ensure that a VM domain starts with the host server issue the following commands (replace &amp;lt;code&amp;gt;vm-name&amp;lt;/code&amp;gt; with the name of your VM&lt;br /&gt;
 virsh autostart vm-name&lt;br /&gt;
&lt;br /&gt;
To disable issue&lt;br /&gt;
 virsh autostart vm-name --disable&lt;br /&gt;
 &lt;br /&gt;
[[Category:KVM]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2707</id>
		<title>Virtual Machine (KVM)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Virtual_Machine_(KVM)&amp;diff=2707"/>
		<updated>2018-12-21T13:52:36Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Create Server (no GUI) */ Edited Console note&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Prerequisites ==&lt;br /&gt;
This guide assumes you have a basic working environment, run the &amp;lt;code&amp;gt;kvm-ok&amp;lt;/code&amp;gt; command to sanity check...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@kvm-host:# kvm-ok&lt;br /&gt;
INFO: /dev/kvm exists&lt;br /&gt;
KVM acceleration can be used&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install Media ===&lt;br /&gt;
You need to have a local copy of the appropriate ISO.  If you have the ISO file already, upload to your KVM server, alternatively download from the site using &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Ubuntu Desktop LTS&#039;&#039;&#039; - http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso&lt;br /&gt;
&lt;br /&gt;
== Create Virtual Machine ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vwikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter                    !! Example                     !! Usage&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;            || VM-Name                     || Name of virtual machine (typically this should match the intended hostname of the VM)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;description&amp;lt;/code&amp;gt;     || &amp;quot;Test VM to be used for X&amp;quot;  || Description of virtual machine&#039;s purpose etc&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-type&amp;lt;/code&amp;gt;         || Linux                       || OS family, can be  Linux, Solaris, Unix or Windows&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;os-variant&amp;lt;/code&amp;gt;      || ubuntu16.04                 || Distribution type for the above (run &amp;lt;code&amp;gt;osinfo-query os&amp;lt;/code&amp;gt; to view what is available)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ram&amp;lt;/code&amp;gt;             || 2048                        || vRAM in GB&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;vcpus&amp;lt;/code&amp;gt;           || 2                           || vCPUs (cores)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;disk path&amp;lt;/code&amp;gt;       || /vm-store/images/VM-Name.img,bus=virtio,size=50 || Virtual disk path, using virtio bus and with a 50GB disk&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;graphics&amp;lt;/code&amp;gt;        || none                        || If noneset, VM will be created with a serial display output (as opposed to VNC window)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cdrom&amp;lt;/code&amp;gt;           || /home/user/cdrom.iso        || Path to installation ISO&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;network&amp;lt;/code&amp;gt;         || bridge:br0                  || Network connection details&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Create Server (no GUI) ===&lt;br /&gt;
Update paths to reflect where install ISO, and where VM disk files are intended to be.  &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--extra-args &amp;quot;console=ttyS0&amp;quot;&amp;lt;/code&amp;gt; option allows a local console to be accessed from the host machine (to allow OS install etc before the VM is on a network), though note that it can&#039;t be used with &amp;lt;code&amp;gt;--cdrom&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;--location&amp;lt;/code&amp;gt; has been used instead.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name server-name \&lt;br /&gt;
--ram 1024 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics none \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/server-name.img,size=20,bus=virtio \&lt;br /&gt;
--extra-args &amp;quot;console=ttyS0&amp;quot; \&lt;br /&gt;
--location /mnt/md0/kvm/iso/ubuntu-16.04.3-server-amd64.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should be presented with the console of the VM as it installs, however if you lose connection etc, connect to the console of the server using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;.  Make sure you set a static IP and install SSH during setup (select &#039;&#039;&#039;OpenSSH server&#039;&#039;&#039; during &#039;&#039;Software selection&#039;&#039; section). Once installation is completed, SSH to the server and setup normal console access (as the instructions in the section below).  Its highly recommended that you follow the steps below to ensure that Console access is available via the KVM host if needed.&lt;br /&gt;
&lt;br /&gt;
==== Console Access ====&lt;br /&gt;
# Update the &amp;lt;code&amp;gt;/etc/default/grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Add &amp;lt;code&amp;gt;console=ttyS0&amp;lt;/code&amp;gt; to the config line &amp;lt;code&amp;gt;GRUB_CMDLINE_LINUX_DEFAULT&amp;lt;/code&amp;gt;&lt;br /&gt;
#* EG &amp;lt;code&amp;gt; GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;quiet splash console=ttyS0&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
# Update grub&lt;br /&gt;
#* &amp;lt;code&amp;gt;update-grub&amp;lt;/code&amp;gt;&lt;br /&gt;
# Restart the guest machine&lt;br /&gt;
&lt;br /&gt;
Connect using &amp;lt;code&amp;gt;virsh console &amp;lt;server-name&amp;gt;&amp;lt;/code&amp;gt;, you may need to hit Return once to show the logon prompt.&lt;br /&gt;
&lt;br /&gt;
=== Create Workstation (GUI) ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install \&lt;br /&gt;
--virt-type=kvm \&lt;br /&gt;
--name ubuntu-desktop \&lt;br /&gt;
--ram 2048 \&lt;br /&gt;
--vcpus=1 \&lt;br /&gt;
--os-variant=ubuntu16.04 \&lt;br /&gt;
--cdrom=/mnt/md0/kvm/iso/ubuntu-16.04.3-desktop-amd64.iso \&lt;br /&gt;
--network=bridge=br0,model=virtio \&lt;br /&gt;
--graphics vnc \&lt;br /&gt;
--disk path=/mnt/md0/kvm/vm/ubuntu-desktop.img,size=40,bus=virtio&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the command has got as far as &amp;lt;code&amp;gt;Waiting for installation to complete.&amp;lt;/code&amp;gt; you need to connect to the VNC console session, to find the port number to connect on query the config from anothet SSH session connected to the host (typically VNC uses ports starting from 5900 upwards).&lt;br /&gt;
  virsh dumpxml ubuntu-desktop | grep vnc&lt;br /&gt;
 &lt;br /&gt;
[[Category:KVM]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Troubleshooting_(Fortigate)&amp;diff=2706</id>
		<title>Troubleshooting (Fortigate)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Troubleshooting_(Fortigate)&amp;diff=2706"/>
		<updated>2018-12-19T12:44:53Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: /* Change Priority */ typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basic Commands ==&lt;br /&gt;
=== Ping / Trace Route ===&lt;br /&gt;
 execute ping 10.10.1.10&lt;br /&gt;
 execute traceroute 10.52.56.20&lt;br /&gt;
&lt;br /&gt;
=== Shutdown / Restart ===&lt;br /&gt;
 execute shutdown&lt;br /&gt;
 execute reboot&lt;br /&gt;
&lt;br /&gt;
=== Process Management ===&lt;br /&gt;
* Show top processes, refresh every 2 secs&lt;br /&gt;
** &amp;lt;code&amp;gt; diagnose sys top 2 &amp;lt;/code&amp;gt;&lt;br /&gt;
* Kill a process&lt;br /&gt;
** &amp;lt;code&amp;gt; diagnose sys kill 9 &amp;lt;PID&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
** Most processes will restart, but use with caution!&lt;br /&gt;
** &amp;lt;code&amp;gt; diagnose sys kill 11 &amp;lt;PID&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;kill 11&amp;lt;/code&amp;gt; supposedly restarts a process&lt;br /&gt;
&lt;br /&gt;
Killing off processes can cause unexpected results, so only perform if service through the firewall is being impacted (you may drop all existing connections through the firewall, or cause all IPsec tunnels to drop, if the process you are killing is responsible for those functions, for example).  Its common for other processes to briefly show high CPU after you&#039;ve killed a CPU hogging process, give it 30 secs or so to calm down.&lt;br /&gt;
&lt;br /&gt;
Some discussion groups mention an issue when killing off &amp;lt;code&amp;gt;cmdbsvr&amp;lt;/code&amp;gt; as it manages the config, and killing caused config corruption.  It can be killed off, but may cause the loss/corruption of any recently edited config.&lt;br /&gt;
&lt;br /&gt;
== VPN ==&lt;br /&gt;
=== IPsec (Site 2  Site) ===&lt;br /&gt;
Show status of a tunnel, using Phase 1 name, &amp;lt;code&amp;gt;sa=0&amp;lt;/code&amp;gt; means no security associations, ie no connection&lt;br /&gt;
 diagnose vpn tunnel list name P1-NAME&lt;br /&gt;
&lt;br /&gt;
Bring a phase 2 up or down&lt;br /&gt;
 diag vpn tunnel up P2-NAME P1-NAME&lt;br /&gt;
 diag vpn tunnel down P2-NAME P1-NAME&lt;br /&gt;
&lt;br /&gt;
Note that the below only debugs Phase 2 problems&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diag debug reset&lt;br /&gt;
diagnose vpn ike log-filter name VPN-NAME&lt;br /&gt;
diagnose debug enable&lt;br /&gt;
diagnose debug application ike -1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;diagnose vpn ike log-filter name VPN-NAME&amp;lt;/code&amp;gt; line is optional, but if there&#039;s more than one VPN in operation the screen will be filled with output.  You need a quick copy and paste into notepad when there&#039;s something interesting whizzing up the screen! Replace &amp;lt;code&amp;gt;VPN-NAME&amp;lt;/code&amp;gt; with the name of the Phase 1.&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;diag debug reset&amp;lt;/code&amp;gt; once complete&lt;br /&gt;
&lt;br /&gt;
=== SSL (User) ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diag debug reset&lt;br /&gt;
diag debug enable&lt;br /&gt;
diag debug application fnbamd -1&lt;br /&gt;
diag debug appl sslvpn -1 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;diag debug reset&amp;lt;/code&amp;gt; once complete&lt;br /&gt;
&lt;br /&gt;
== High Availability ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command                                                  !! Action&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; show system ha &amp;lt;/code&amp;gt;                            || Show HA config&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; get system ha status &amp;lt;/code&amp;gt;                      || Show master/slave status&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; execute ha manage 1 &amp;lt;/code&amp;gt;                       || Change console to master/slave &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; diagnose sys ha dump-by all-vcluster &amp;lt;/code&amp;gt;      || Show HA cluster status&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; diagnose sys ha reset-uptime &amp;lt;/code&amp;gt;              || Reset HA uptime timer - causes failover to standby as that will have the higher uptime&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Console to Slave ===&lt;br /&gt;
Once SSH&#039;ed to the master firewall, its possible to jump onto the slave (to run diag stats, reboot etc)&lt;br /&gt;
# &amp;lt;code&amp;gt; get system ha status &amp;lt;/code&amp;gt;&lt;br /&gt;
#* Gives output as shown below&lt;br /&gt;
# &amp;lt;code&amp;gt; execute ha manage 0 &amp;lt;/code&amp;gt;&lt;br /&gt;
#* Normally 0 or 1, 0 in example below to switch to primary&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Model: 200&lt;br /&gt;
Mode: a-p&lt;br /&gt;
Group: 40&lt;br /&gt;
Debug: 0&lt;br /&gt;
ses_pickup: enable, ses_pickup_delay=disable&lt;br /&gt;
Master: 90 PROD-FW01    FG200C4151018656 1           &lt;br /&gt;
Slave : 50 PROD-FW02    FG200C4151018713 0           &amp;lt;-- ID to use in &amp;quot;execute ha manage&amp;quot;&lt;br /&gt;
number of vcluster: 1&lt;br /&gt;
vcluster 1: work 169.254.0.2&lt;br /&gt;
Master:0 FG200C4151018656&lt;br /&gt;
Slave :1 FG200C4151018713&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Change Heartbeat ports ===&lt;br /&gt;
This needs to be done on both firewalls!  The command sets the ports and their priorities.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
config system ha&lt;br /&gt;
set hbdev &amp;quot;port1&amp;quot; 50 &amp;quot;port2&amp;quot; 60&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Change Priority ===&lt;br /&gt;
By default a FortiGate only fails over during a problem, but you can override so that the higher priority is always active.  Therefore you can force fail-overs&lt;br /&gt;
&lt;br /&gt;
You need to override on both master and slave firewalls...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PROD-FW01 # config system ha&lt;br /&gt;
PROD-FW01 (ha) # set override enable&lt;br /&gt;
PROD-FW01 (ha) # end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Check Master/Slave Config Replication ===&lt;br /&gt;
The configuration should replicate from the master to the slave, to ensure this is running correctly, run the following command and ensure the checksum&#039;s match between the units&lt;br /&gt;
 diagnose sys ha cluster-csum&lt;br /&gt;
&lt;br /&gt;
=== Force Failover ===&lt;br /&gt;
HA will put the unit with longest uptime live, therefore if you reset the timer on the master unit, it will failover to the standby&lt;br /&gt;
&lt;br /&gt;
 diagnose sys ha reset-uptime&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Fortigate]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Troubleshooting_(Fortigate)&amp;diff=2705</id>
		<title>Troubleshooting (Fortigate)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Troubleshooting_(Fortigate)&amp;diff=2705"/>
		<updated>2018-12-19T12:44:27Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: Initial creation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Basic Commands ==&lt;br /&gt;
=== Ping / Trace Route ===&lt;br /&gt;
 execute ping 10.10.1.10&lt;br /&gt;
 execute traceroute 10.52.56.20&lt;br /&gt;
&lt;br /&gt;
=== Shutdown / Restart ===&lt;br /&gt;
 execute shutdown&lt;br /&gt;
 execute reboot&lt;br /&gt;
&lt;br /&gt;
=== Process Management ===&lt;br /&gt;
* Show top processes, refresh every 2 secs&lt;br /&gt;
** &amp;lt;code&amp;gt; diagnose sys top 2 &amp;lt;/code&amp;gt;&lt;br /&gt;
* Kill a process&lt;br /&gt;
** &amp;lt;code&amp;gt; diagnose sys kill 9 &amp;lt;PID&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
** Most processes will restart, but use with caution!&lt;br /&gt;
** &amp;lt;code&amp;gt; diagnose sys kill 11 &amp;lt;PID&amp;gt; &amp;lt;/code&amp;gt;&lt;br /&gt;
*** &amp;lt;code&amp;gt;kill 11&amp;lt;/code&amp;gt; supposedly restarts a process&lt;br /&gt;
&lt;br /&gt;
Killing off processes can cause unexpected results, so only perform if service through the firewall is being impacted (you may drop all existing connections through the firewall, or cause all IPsec tunnels to drop, if the process you are killing is responsible for those functions, for example).  Its common for other processes to briefly show high CPU after you&#039;ve killed a CPU hogging process, give it 30 secs or so to calm down.&lt;br /&gt;
&lt;br /&gt;
Some discussion groups mention an issue when killing off &amp;lt;code&amp;gt;cmdbsvr&amp;lt;/code&amp;gt; as it manages the config, and killing caused config corruption.  It can be killed off, but may cause the loss/corruption of any recently edited config.&lt;br /&gt;
&lt;br /&gt;
== VPN ==&lt;br /&gt;
=== IPsec (Site 2  Site) ===&lt;br /&gt;
Show status of a tunnel, using Phase 1 name, &amp;lt;code&amp;gt;sa=0&amp;lt;/code&amp;gt; means no security associations, ie no connection&lt;br /&gt;
 diagnose vpn tunnel list name P1-NAME&lt;br /&gt;
&lt;br /&gt;
Bring a phase 2 up or down&lt;br /&gt;
 diag vpn tunnel up P2-NAME P1-NAME&lt;br /&gt;
 diag vpn tunnel down P2-NAME P1-NAME&lt;br /&gt;
&lt;br /&gt;
Note that the below only debugs Phase 2 problems&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diag debug reset&lt;br /&gt;
diagnose vpn ike log-filter name VPN-NAME&lt;br /&gt;
diagnose debug enable&lt;br /&gt;
diagnose debug application ike -1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;diagnose vpn ike log-filter name VPN-NAME&amp;lt;/code&amp;gt; line is optional, but if there&#039;s more than one VPN in operation the screen will be filled with output.  You need a quick copy and paste into notepad when there&#039;s something interesting whizzing up the screen! Replace &amp;lt;code&amp;gt;VPN-NAME&amp;lt;/code&amp;gt; with the name of the Phase 1.&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;diag debug reset&amp;lt;/code&amp;gt; once complete&lt;br /&gt;
&lt;br /&gt;
=== SSL (User) ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diag debug reset&lt;br /&gt;
diag debug enable&lt;br /&gt;
diag debug application fnbamd -1&lt;br /&gt;
diag debug appl sslvpn -1 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;code&amp;gt;diag debug reset&amp;lt;/code&amp;gt; once complete&lt;br /&gt;
&lt;br /&gt;
== High Availability ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command                                                  !! Action&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; show system ha &amp;lt;/code&amp;gt;                            || Show HA config&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; get system ha status &amp;lt;/code&amp;gt;                      || Show master/slave status&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; execute ha manage 1 &amp;lt;/code&amp;gt;                       || Change console to master/slave &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; diagnose sys ha dump-by all-vcluster &amp;lt;/code&amp;gt;      || Show HA cluster status&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt; diagnose sys ha reset-uptime &amp;lt;/code&amp;gt;              || Reset HA uptime timer - causes failover to standby as that will have the higher uptime&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Console to Slave ===&lt;br /&gt;
Once SSH&#039;ed to the master firewall, its possible to jump onto the slave (to run diag stats, reboot etc)&lt;br /&gt;
# &amp;lt;code&amp;gt; get system ha status &amp;lt;/code&amp;gt;&lt;br /&gt;
#* Gives output as shown below&lt;br /&gt;
# &amp;lt;code&amp;gt; execute ha manage 0 &amp;lt;/code&amp;gt;&lt;br /&gt;
#* Normally 0 or 1, 0 in example below to switch to primary&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Model: 200&lt;br /&gt;
Mode: a-p&lt;br /&gt;
Group: 40&lt;br /&gt;
Debug: 0&lt;br /&gt;
ses_pickup: enable, ses_pickup_delay=disable&lt;br /&gt;
Master: 90 PROD-FW01    FG200C4151018656 1           &lt;br /&gt;
Slave : 50 PROD-FW02    FG200C4151018713 0           &amp;lt;-- ID to use in &amp;quot;execute ha manage&amp;quot;&lt;br /&gt;
number of vcluster: 1&lt;br /&gt;
vcluster 1: work 169.254.0.2&lt;br /&gt;
Master:0 FG200C4151018656&lt;br /&gt;
Slave :1 FG200C4151018713&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Change Heartbeat ports ===&lt;br /&gt;
This needs to be done on both firewalls!  The command sets the ports and their priorities.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
config system ha&lt;br /&gt;
set hbdev &amp;quot;port1&amp;quot; 50 &amp;quot;port2&amp;quot; 60&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Change Priority ===&lt;br /&gt;
By default a FortiGate only fails over during a problem, but you can override so that the higher priority is always active.  Therefore you can force fail-overs&lt;br /&gt;
&lt;br /&gt;
You need to override on both master and slave firewalls...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CDS-PROD-FW01 # config system ha&lt;br /&gt;
CDS-PROD-FW01 (ha) # set override enable&lt;br /&gt;
CDS-PROD-FW01 (ha) # end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Check Master/Slave Config Replication ===&lt;br /&gt;
The configuration should replicate from the master to the slave, to ensure this is running correctly, run the following command and ensure the checksum&#039;s match between the units&lt;br /&gt;
 diagnose sys ha cluster-csum&lt;br /&gt;
&lt;br /&gt;
=== Force Failover ===&lt;br /&gt;
HA will put the unit with longest uptime live, therefore if you reset the timer on the master unit, it will failover to the standby&lt;br /&gt;
&lt;br /&gt;
 diagnose sys ha reset-uptime&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Fortigate]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Category:Fortigate&amp;diff=2704</id>
		<title>Category:Fortigate</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Category:Fortigate&amp;diff=2704"/>
		<updated>2018-12-19T12:34:45Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: Added category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Firewall]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Category:Vyatta&amp;diff=2703</id>
		<title>Category:Vyatta</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Category:Vyatta&amp;diff=2703"/>
		<updated>2018-12-19T12:34:18Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: Added category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Linux based Open Source firewall router that used to see itself in competition with Cisco, and saw its popularity increase as its usage in the virtual world made for a very flexible firewall/router networking appliance.  More recently Vyatta was acquired by Brocade, and the supported version (Vyatta Subscription Edition) to the Brocade Vyatta 5400 vRouter, the open source version is no longer available, however a fork of Vyatta lives on, [https://vyos.io/ VyOS].&lt;br /&gt;
&lt;br /&gt;
[[Category:Firewall]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Getting_Started_(AWS_PowerShell)&amp;diff=2702</id>
		<title>Getting Started (AWS PowerShell)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Getting_Started_(AWS_PowerShell)&amp;diff=2702"/>
		<updated>2018-11-20T09:17:15Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: Added &amp;quot;Get Instances&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Setup Credentials ==&lt;br /&gt;
PowerShell Core can&#039;t store credentials securely by itself (the encryption used by Windows PowerShell is dependant on Windows DLL&#039;s, the Secure String object is not available in PowerShell Core), therefore AWS provide a method of storing AWS credentials securely for use which replicates how you&#039;d do this in Windows PowerShell whereby credentials are stored in an encrypted file that can only be decrypted by the logged in user.  You need the Access Key ID and Secret for your account.  If you don&#039;t have an &#039;&#039;Access Key ID&#039;&#039;, go to &#039;&#039;&#039;IAM &amp;gt; Users&#039;&#039;&#039; and locate your account and select &#039;&#039;&#039;Create access key&#039;&#039;&#039; (the secret will not be accessible again, make a note of it somewhere secure).&lt;br /&gt;
&lt;br /&gt;
The following command stores your credentials in the default profile, meaning that they will be used for operations where credentials are required, unless you specify a different profile of credentials to use&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;PowerShell&amp;quot;&amp;gt;&lt;br /&gt;
Set-AWSCredential -AccessKey &amp;lt;your-access-key&amp;gt; -SecretKey &amp;lt;your-secret&amp;gt; -StoreAs default&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vwiki-note&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Credentials file is not encrypted in Linux systems&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| When using the &amp;lt;source lang=&amp;quot;PowerShell&amp;quot; inline&amp;gt;Set-AWSCredential&amp;lt;/source&amp;gt; CmdLet on Linux systems the credentials file created is not encrypted (it is on Windows systems).  Therefore you need to ensure you secure the file, ideally store in an encrypted path accessible by only you.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Set Default Region ==&lt;br /&gt;
Most commands need to be run against a specific region.  You can either specify this each time you run CmdLet, or if you predominantly run in one region, its more convenient to set a default region&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;PowerShell&amp;quot;&amp;gt;&lt;br /&gt;
Set-DefaultAWSRegion -Region eu-west-1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other useful region commands...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;PowerShell&amp;quot;&amp;gt;&lt;br /&gt;
Clear-DefaultAWSRegion              # Clear default region&lt;br /&gt;
Get-AWSRegion                       # Get list of regions, including what is default&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Get Instances ==&lt;br /&gt;
Example commands to get instances..&lt;br /&gt;
&amp;lt;source lang=&amp;quot;PowerShell&amp;quot;&amp;gt;&lt;br /&gt;
# Get running instances with Production tag&lt;br /&gt;
$instances = Get-EC2Instance -Filter @(@{Name=&amp;quot;tag:Function&amp;quot;;Values=&amp;quot;Production&amp;quot;};@{Name=&amp;quot;instance-state-name&amp;quot;;Values=&amp;quot;running&amp;quot;}) | Select-Object -ExpandProperty instances &lt;br /&gt;
&lt;br /&gt;
# Get specific instance&lt;br /&gt;
$instance = Get-EC2Instance -Filter @(@{Name=&amp;quot;instance-id&amp;quot;;Values=&amp;quot;i-012345678abcdef01&amp;quot;}) | Select-Object -ExpandProperty instances&lt;br /&gt;
&amp;lt;/source&amp;gt;   &lt;br /&gt;
 &lt;br /&gt;
[[Category: AWS PowerShell]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=Getting_Started_(AWS_PowerShell)&amp;diff=2701</id>
		<title>Getting Started (AWS PowerShell)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=Getting_Started_(AWS_PowerShell)&amp;diff=2701"/>
		<updated>2018-11-20T09:00:08Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: Added &amp;quot;Set Default Region&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Setup Credentials ==&lt;br /&gt;
PowerShell Core can&#039;t store credentials securely by itself (the encryption used by Windows PowerShell is dependant on Windows DLL&#039;s, the Secure String object is not available in PowerShell Core), therefore AWS provide a method of storing AWS credentials securely for use which replicates how you&#039;d do this in Windows PowerShell whereby credentials are stored in an encrypted file that can only be decrypted by the logged in user.  You need the Access Key ID and Secret for your account.  If you don&#039;t have an &#039;&#039;Access Key ID&#039;&#039;, go to &#039;&#039;&#039;IAM &amp;gt; Users&#039;&#039;&#039; and locate your account and select &#039;&#039;&#039;Create access key&#039;&#039;&#039; (the secret will not be accessible again, make a note of it somewhere secure).&lt;br /&gt;
&lt;br /&gt;
The following command stores your credentials in the default profile, meaning that they will be used for operations where credentials are required, unless you specify a different profile of credentials to use&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;PowerShell&amp;quot;&amp;gt;&lt;br /&gt;
Set-AWSCredential -AccessKey &amp;lt;your-access-key&amp;gt; -SecretKey &amp;lt;your-secret&amp;gt; -StoreAs default&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vwiki-note&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Credentials file is not encrypted in Linux systems&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| When using the &amp;lt;source lang=&amp;quot;PowerShell&amp;quot; inline&amp;gt;Set-AWSCredential&amp;lt;/source&amp;gt; CmdLet on Linux systems the credentials file created is not encrypted (it is on Windows systems).  Therefore you need to ensure you secure the file, ideally store in an encrypted path accessible by only you.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Set Default Region ==&lt;br /&gt;
Most commands need to be run against a specific region.  You can either specify this each time you run CmdLet, or if you predominantly run in one region, its more convenient to set a default region&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;PowerShell&amp;quot;&amp;gt;&lt;br /&gt;
Set-DefaultAWSRegion -Region eu-west-1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other useful region commands...&lt;br /&gt;
&amp;lt;source lang=&amp;quot;PowerShell&amp;quot;&amp;gt;&lt;br /&gt;
Clear-DefaultAWSRegion              # Clear default region&lt;br /&gt;
Get-AWSRegion                       # Get list of regions, including what is default&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category: AWS PowerShell]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=NRPE_Installation_(Ubuntu_18.04)&amp;diff=2700</id>
		<title>NRPE Installation (Ubuntu 18.04)</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=NRPE_Installation_(Ubuntu_18.04)&amp;diff=2700"/>
		<updated>2018-11-02T13:59:51Z</updated>

		<summary type="html">&lt;p&gt;Sstrutt: Typo fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The default deployment of Ubuntu 18.04 (Bionic Beaver) does not allow installation of NRPE (package nagios-nrpe-server) without modifying the apt sources.  Trying to install results in the following error&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
me@server:~$ sudo apt install nagios-nrpe-server&lt;br /&gt;
Reading package lists... Done&lt;br /&gt;
Building dependency tree&lt;br /&gt;
Reading state information... Done&lt;br /&gt;
E: Unable to locate package nagios-nrpe-server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to fix you need to add the &amp;lt;code&amp;gt;universe&amp;lt;/code&amp;gt; component to the OS repository source&lt;br /&gt;
# Edit the repository sources file&lt;br /&gt;
#* EG &amp;lt;code&amp;gt;sudo vi /etc/apt/sources.list&amp;lt;/code&amp;gt;&lt;br /&gt;
# Append &amp;lt;code&amp;gt;universe&amp;lt;/code&amp;gt; to the first line (your file should look like the below)&lt;br /&gt;
# Update the local cache&lt;br /&gt;
#* &amp;lt;code&amp;gt; sudo apt update &amp;lt;/code&amp;gt;&lt;br /&gt;
# Install NRPE as normal&lt;br /&gt;
#* &amp;lt;code&amp;gt; udo apt install nagios-nrpe-server &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
me@server:~$  cat /etc/apt/sources.list&lt;br /&gt;
deb http://archive.ubuntu.com/ubuntu bionic main universe&lt;br /&gt;
deb http://archive.ubuntu.com/ubuntu bionic-security main&lt;br /&gt;
deb http://archive.ubuntu.com/ubuntu bionic-updates main&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Ubuntu]]&lt;br /&gt;
[[Category:NRPE]]&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
</feed>