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

<channel>
	<title>virtualisation &#8211; Tomas&#039; log of stuff</title>
	<atom:link href="https://blog.fjetland.com/tag/virtualisation/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.fjetland.com</link>
	<description>Notes from the sysadmin trenches, on hobby photography, and anything else that comes to mind</description>
	<lastBuildDate>Thu, 26 May 2022 23:52:02 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Setting up Photon OS 4 as a docker host vm on vSphere 7</title>
		<link>https://blog.fjetland.com/2022/05/setting-up-photon-os-4-as-a-docker-host-vm-on-vsphere-7/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=setting-up-photon-os-4-as-a-docker-host-vm-on-vsphere-7</link>
					<comments>https://blog.fjetland.com/2022/05/setting-up-photon-os-4-as-a-docker-host-vm-on-vsphere-7/#comments</comments>
		
		<dc:creator><![CDATA[tomasf]]></dc:creator>
		<pubDate>Fri, 20 May 2022 18:21:17 +0000</pubDate>
				<category><![CDATA[Containers]]></category>
		<category><![CDATA[containers]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[system administration]]></category>
		<category><![CDATA[virtualisation]]></category>
		<category><![CDATA[vpshere]]></category>
		<guid isPermaLink="false">http://blog.fjetland.com/?p=1401</guid>

					<description><![CDATA[Simple walkthrough on getting up and running with Photon OS 4 as a host VM on VMware vSphere 7 to run Docker containers]]></description>
										<content:encoded><![CDATA[
<p>So I needed to set up a <a href="https://www.docker.com/" target="_blank" rel="noopener">Docker</a> environment. The background is explained in <a href="http://blog.fjetland.com/2022/05/contain-your-enthusiasm/" data-type="post" data-id="1396">my previous post</a> if you&#8217;re bored. I wanted something that could run on my small vSphere environment and which would have as little overhead as possible, both in terms of resources and management. So ideally not a full-blown traditional OS like RHEL, etc.</p>



<p>No one will believe me, but I was pretty surprised to find that <a href="https://vmware.github.io/photon/" target="_blank" rel="noopener">VMware&#8217;s Photon OS</a> seemed to be the perfect fit. Of course, we have it as the base of many VMware appliances, and it&#8217;s also commonly used as the OS inside the containers deployed in <a href="https://tanzu.vmware.com/kubernetes-grid/" target="_blank" rel="noopener">Tanzu Kubernetes Grid</a>, such as the supervisor nodes. That it also comes as a standalone OS with the Docker Engine in place and ready to go hadn&#8217;t registered with me before. And, of course, it&#8217;s already optimized to run on a hypervisor with as small a footprint as possible.</p>



<p>This is primarily for my own reference to know what I did when I need to redo this; here&#8217;s the process.</p>



<p>First, go to the <a href="https://github.com/vmware/photon/wiki/Downloading-Photon-OS" target="_blank" rel="noopener">download page</a> and grab the latest version. Since I&#8217;m deploying this on ESXi, I&#8217;m getting the OVA with virtual HW version 13, which VMware describes as a <em>&#8220;Pre-installed minimal environment, customized for VMware hypervisor environments. These customizations include a highly sanitized and optimized kernel to give improved boot and runtime performance for containers and Linux applications.&#8221;</em>. There&#8217;s also an ISO installer and images for other hypervisors and clouds. Some of the stuff here is covered in the <a href="https://vmware.github.io/photon/docs/installation-guide/" target="_blank" rel="noopener">installation docs</a>, but some of it is not. Surprisingly.</p>



<p>Deploy the OVA as you would any other OVF/OVA. There&#8217;s not much to decide on during the deployment, but I make sure to set the disk to thin-provisioned as I&#8217;m starting to run out of space on my SSD datastore.</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="528" src="http://blog.fjetland.com/wp-content/uploads/2022/05/image-1-1024x528.png" alt="" class="wp-image-1408" srcset="https://blog.fjetland.com/wp-content/uploads/2022/05/image-1-1024x528.png 1024w, https://blog.fjetland.com/wp-content/uploads/2022/05/image-1-300x155.png 300w, https://blog.fjetland.com/wp-content/uploads/2022/05/image-1-768x396.png 768w, https://blog.fjetland.com/wp-content/uploads/2022/05/image-1.png 1141w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Once deployed, it&#8217;s set up with 1 vCPU and 2GB RAM. The disk footprint with thin provisioning is an impressive 670MB. I increase this to 2 CPUs and 4GB RAM and fire it up. As instructed, you need to change the root password from &#8220;changeme&#8221; on the first login.</p>



<pre class="wp-block-code"><code>Welcome to Photon 4.0 (x86_64) - Kernel 5.10.83-6.ph4-esx (ttyl)
photon-machine login: root
Password :
You are required to change your password immediately (administrator enforced). 
</code></pre>



<p>The next step is to set a static IP address. Find the name of your Ethernet interface:</p>



<pre class="wp-block-code"><code>root@photon-machine &#91;~]# networkctl
IDX LINK TYPE     OPERATIONAL SETUP
1   lo   loopback carrier     unmanaged
2   ethO ether    routable    configured
2 links 1isted.</code></pre>



<p>Then create a network configuration file and fill out the info for the name of the Ethernet interface:</p>



<pre class="wp-block-code"><code>root@photon-machine &#91;~]# cat &gt; /etc/systemd/network/10-static-en.network &lt;&lt; "EOF"

&gt;&#91;Match]
&gt;Name=eth0

&gt;
&gt;&#91;Network]
&gt;Address=198.51.0.2/24
&gt;Gateway=198.51.0.1
&gt;EOF</code></pre>



<p>Change the permissions of the file</p>



<pre class="wp-block-code"><code>chmod 644 10-static-en.network</code></pre>



<p>And apply the new network config</p>



<pre class="wp-block-code"><code>systemctl restart systemd-networkd</code></pre>



<p>While we&#8217;re at it, we might as well set the hostname to keep things nice and tidy and help identify resources on the network:</p>



<pre class="wp-block-code"><code>hostnamectl set-hostname MyComputerName</code></pre>



<p>Check that your VM has the static IP. Now it&#8217;s time to get it up to date and secure. First, see which packages are available:</p>



<pre class="wp-block-code"><code>tdnf check-update</code></pre>



<p>Or, if you&#8217;re curious about the relevant security advisories:</p>



<pre class="wp-block-code"><code>tdnf updateinfo info</code></pre>



<p>Then run the upgrade command to apply the patches</p>



<pre class="wp-block-code"><code>tdnf upgrade</code></pre>



<p>OK, so the OS is running, connected to the internet and up to date. Let&#8217;s get Docker up and running. I initialize the docker engine:</p>



<pre class="wp-block-code"><code> systemctl start docker</code></pre>



<p>And then make sure it&#8217;ll run on boot:</p>



<pre class="wp-block-code"><code> systemctl enable docker</code></pre>



<p>Let&#8217;s check out what the status is</p>



<pre class="wp-block-code"><code>docker version</code></pre>



<figure class="wp-block-image size-full"><img decoding="async" width="821" height="551" src="http://blog.fjetland.com/wp-content/uploads/2022/05/image-2.png" alt="" class="wp-image-1415" srcset="https://blog.fjetland.com/wp-content/uploads/2022/05/image-2.png 821w, https://blog.fjetland.com/wp-content/uploads/2022/05/image-2-300x201.png 300w, https://blog.fjetland.com/wp-content/uploads/2022/05/image-2-768x515.png 768w" sizes="(max-width: 821px) 100vw, 821px" /></figure>



<p>Looks great! I could start to deploy containers right now. But let&#8217;s get some management functionality up and running to make things easier. I think that&#8217;s suitable for a separate post; <a href="http://blog.fjetland.com/2022/05/adding-easy-container-management-to-photon-os-with-portainer/" data-type="post" data-id="1424">read on here</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.fjetland.com/2022/05/setting-up-photon-os-4-as-a-docker-host-vm-on-vsphere-7/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
