{"id":1704,"date":"2022-12-29T13:55:13","date_gmt":"2022-12-29T18:55:13","guid":{"rendered":"https:\/\/enterpriseadmins.org\/blog\/?p=1704"},"modified":"2025-01-27T18:14:29","modified_gmt":"2025-01-27T23:14:29","slug":"vmware-workstation-lab-photon-os-container-host-and-nfs-server","status":"publish","type":"post","link":"https:\/\/enterpriseadmins.org\/blog\/virtualization\/vmware-workstation-lab-photon-os-container-host-and-nfs-server\/","title":{"rendered":"VMware Workstation lab: Photon OS Container Host and NFS Server"},"content":{"rendered":"\n<p>In a previous post (<a href=\"https:\/\/enterpriseadmins.org\/blog\/virtualization\/nested-vmware-workstation-lab-using-linked-clones\/\">https:\/\/enterpriseadmins.org\/blog\/virtualization\/nested-vmware-workstation-lab-using-linked-clones\/<\/a>) I mentioned a nested &#8216;smash lab&#8217; using VMware Workstation. This post will focus on a Photon OS VM with docker and nfs-server services enabled.<\/p>\n\n\n\n<p>Occasionally there is a service that I may temporarily need in my lab, such as an SMTP server or web server, and those are readily available as docker container images.   Therefore I decided to have a virtual machine available pre-configured for running docker images. After setting this up, I realized that it would also be convenient to have access to an NFS server that could be used as a shared datastore if needed.  There were a couple of container images available for NFS server, but I decided to run NFS directly on this VM instead.  <\/p>\n\n\n\n<p>I started by downloading Photon OS 4.0 Rev2 from&nbsp;<a href=\"https:\/\/packages.vmware.com\/photon\/4.0\/Rev2\/ova\/photon-ova_uefi-4.0-c001795b80.ova\">https:\/\/packages.vmware.com\/photon\/4.0\/Rev2\/ova\/photon-ova_uefi-4.0-c001795b80.ova<\/a> with virtual hardware v13 (UEFI Secure Boot).  There were a few other versions available, but this was the latest available at the time. <\/p>\n\n\n\n<p>Double-clicking the downloaded OVA starts the VMware Workstation import wizard, and prompts for the virtual machine name. I went with <code>lab-dock-14<\/code> since this was going to be running docker and I planned to assign a static IP ending in .14.   I adjusted the VM to use &#8216;VMnet10&#8217; which is the isolated lab network and removed the floppy disk drive.  I also decided to add a 50GB disk on SCSI 1:0 to use as a mount for the NFS server.  Once the settings were how I wanted, I powered on the VM.<\/p>\n\n\n\n<p>The initial login to the OVA uses <code>root\/changeme<\/code> and forces a password change.  I set a password then configured networking by manually typing in the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat &gt; \/etc\/systemd\/network\/10-static-en.network &lt;&lt; \"EOF\"\n\n&#91;Match]\nName=eth0\n\n&#91;Network]\nAddress=172.16.10.14\/24\nGateway=172.16.10.1\nDNS=172.16.10.1\nEOF<\/code><\/pre>\n\n\n\n<p>This defines my static IP address, points the default gateway and DNS to the lab side of the domain controller\/NAT router.  Now I just need to change permissions for the file and restart networking:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod 644 \/etc\/systemd\/network\/10-static-en.network\nsystemctl restart systemd-networkd<\/code><\/pre>\n\n\n\n<p>From this point, I can use <code>ssh root@172.16.10.14<\/code> from my jump server to login to the VM and start using copy\/paste to do the rest of my configuration.  The first step was to make sure all the packages were up to date with <code>tdnf update<\/code>.<\/p>\n\n\n\n<p>I then defined my hostname with the command <code>hostnamectl set-hostname lab-dock-14.example.org<\/code> and made sure this DNS A record was defined in my DNS server.  <\/p>\n\n\n\n<p>Docker is preinstalled on the Photon OS appliance, it just needs started &amp; enabled at boot, so I did that with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start docker\nsystemctl enable docker<\/code><\/pre>\n\n\n\n<p>I wanted to make a <code>\/data<\/code> mount to use as an NFS server and potentially to store container configuration if needed.  I confirmed which device I wanted to use by running <code>fdisk -l<\/code> to list disks and confirmed that <code>\/dev\/sdb<\/code> was the unused 50GB disk I added when configuring the VM.  I ran <code>mkfs -t ext3 \/dev\/sdb<\/code> to put a filesystem on the drive, created a directory with <code>mkdir \/data<\/code>, opened a text editor with <code>vi \/etc\/fstab<\/code> and appended <code>\/dev\/sdb \/data ext3 defaults 0 0<\/code> to the end of the file.  After saving\/exiting that file I typed <code>mount \/data<\/code> and confirmed that the new mount was available with <code>df -h<\/code>.  <\/p>\n\n\n\n<p>With the mount defined, I next needed to make it available via NFS. To do this, I first needed to install nfs-utils with <code>tdnf install nfs-utils<\/code>. I then opened a text editor with <code>vi \/etc\/exports<\/code> and added a single line to the file that says:<\/p>\n\n\n\n<p><code>\/data *(rw,async,no_root_squash,insecure_locks,sec=sys,no_subtree_check)<\/code>. <\/p>\n\n\n\n<p>This says I wanted to make the <code>\/data<\/code> mount available to all hosts over NFS. After saving the file I ran the following commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>exportfs -ra # this should return nothing, assuming the \/etc\/exports file is correct\nsystemctl start nfs-server.service\nsystemctl enable nfs-server.service<\/code><\/pre>\n\n\n\n<p>After doing this I attempted to mount the NFS export as a datastore on my nested ESXi host but was unsuccessful.  After more troubleshooting than I care to admit, I realized that the firewall was enabled on my Photon OS appliance.  For my purposes, I don&#8217;t really need the firewall enabled, so I disabled it and set it not to start automatically with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl stop iptables\nsystemctl disable iptables<\/code><\/pre>\n\n\n\n<p>This solved the problem where I wasn&#8217;t able to mount the datastore.  Depending on your environment it might be worthwhile to define the ports necessary for NFS, but as I was using NFS3 and that was many ports, this wholesale disabling of the firewall was quicker.<\/p>\n\n\n\n<p>Once this was complete, I rebooted to ensure everything came up as expected (IP &amp; hostname correct, Docker &amp; NFS running, etc) and shutdown with <code>shutdown -h now<\/code>.  Once the VM was powered off, I created a new snapshot so this could be used as a <code>parent<\/code> virtual machine for future linked clones.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In a previous post (https:\/\/enterpriseadmins.org\/blog\/virtualization\/nested-vmware-workstation-lab-using-linked-clones\/) I mentioned a nested &#8216;smash lab&#8217; using VMware Workstation. This post will focus on a Photon OS VM with docker and nfs-server services enabled. Occasionally there is a service that I may temporarily need in &hellip; <a href=\"https:\/\/enterpriseadmins.org\/blog\/virtualization\/vmware-workstation-lab-photon-os-container-host-and-nfs-server\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[9,4],"tags":[],"class_list":["post-1704","post","type-post","status-publish","format-standard","hentry","category-lab-infrastructure","category-virtualization"],"_links":{"self":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/1704","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/comments?post=1704"}],"version-history":[{"count":5,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/1704\/revisions"}],"predecessor-version":[{"id":2191,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/1704\/revisions\/2191"}],"wp:attachment":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/media?parent=1704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/categories?post=1704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/tags?post=1704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}