<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Linux - Virtually Everything: Your Guide to Virtualization</title>
    <link>https://virtualg.uk/category/linux/</link>
    <atom:link href="https://virtualg.uk/category/linux/feed/" rel="self" type="application/rss+xml" />
    <description>Linux posts from my lab, including upgrading CentOS 8 to CentOS Stream 8 and getting Puppet 7 Open Source working with VMware.</description>
    <language>en-GB</language>
    <lastBuildDate>Sat, 30 Jan 2021 20:49:48 +0000</lastBuildDate>
    <item>
      <title>Getting started with Puppet 7 Open Source and VMware</title>
      <link>https://virtualg.uk/getting-started-with-puppet-7-open-source-and-vmware/</link>
      <guid isPermaLink="true">https://virtualg.uk/getting-started-with-puppet-7-open-source-and-vmware/</guid>
      <pubDate>Sat, 30 Jan 2021 20:49:48 +0000</pubDate>
      <dc:creator><![CDATA[Graham Barker]]></dc:creator>
      <description><![CDATA[Puppet is a great automation tool for managing all of your Virtual Machines. Puppet Open Source is free and supports the management of most operating systems from Windows, Linux…]]></description>
      <content:encoded><![CDATA[<p>Puppet is a great automation tool for managing all of your Virtual Machines. Puppet Open Source is free and supports the management of most operating systems from Windows, Linux and Mac. This post guides you through the installation and shows how to create a basic configuration to get started with managing your virtual machines. Puppet also has many bolt-ons which enables you to use Puppet with VMware, helping you to automate the management of everything in the datacenter.</p>
<h2 id="Installing_Puppet_Open_Source_Server">Installing Puppet Open Source Server <a class="hash" href="#Installing_Puppet_Open_Source_Server" aria-label="Link to this section"></a></h2>
<h3 id="Prerequisites">Prerequisites <a class="hash" href="#Prerequisites" aria-label="Link to this section"></a></h3>
<p>I'm using a new <a href="https://virtualg.uk/upgrading-centos-8-to-centos-stream-8/">CentOS 8 VM</a> to deploy the puppet server. You can use other operating systems but you'll need to adjust the steps below to suit.</p>
<p>First, ensure you have the following setup on your CentOS server:</p>
<ul>
 	<li>Static IP address</li>
 	<li>Hostname</li>
 	<li>Correct DNS server(s) configured</li>
 	<li>NTP configured</li>
 	<li>Another VM to test puppet with (An agent VM)</li>
</ul>
<h3 id="Install_Puppet_Server">Install Puppet Server <a class="hash" href="#Install_Puppet_Server" aria-label="Link to this section"></a></h3>
<p>For CentOS 8, we need to install the correct repo for <a href="https://puppet.com/docs/puppet/7.3/puppet_index.html" target="_blank" rel="noopener">Puppet 7</a>:</p>
<p><mark>sudo rpm -Uvh https://yum.puppet.com/puppet7-release-el-8.noarch.rpm</mark></p>

<p>Next, install the server software:</p>
<p><mark>sudo yum install -y puppetserver</mark></p>

<figure><img class="alignnone wp-image-3313 size-large" src="https://virtualg.uk/wp-content/uploads/2021/01/VirtualG.uk-Getting-Started-With-Puppet-and-VMware-01.png" alt="" width="1024" height="394" data-full="/wp-content/uploads/2021/01/VirtualG.uk-Getting-Started-With-Puppet-and-VMware-01.png" loading="eager" decoding="async"></figure>

<p>Once puppet is installed, ensure it is configured to start on boot</p>
<p><mark>sudo systemctl enable puppetserver</mark></p>

<p>Run the following to configure the puppet server</p>
<p><mark>source /etc/profile.d/puppet-agent.sh</mark></p>

<p>And start the server</p>
<p><mark>sudo systemctl start puppetserver</mark></p>

<p>You can restart it with the below command if required</p>
<p><mark>sudo systemctl restart puppetserver</mark></p>

<h2 id="Puppet_Agent_Installation">Puppet Agent Installation <a class="hash" href="#Puppet_Agent_Installation" aria-label="Link to this section"></a></h2>
<p>On your test VM, we will now install the puppet agent and connect it to the puppet server.</p>
<p>Setup the puppet repo:</p>
<p><mark>sudo rpm -Uvh https://yum.puppet.com/puppet7-release-el-8.noarch.rpm</mark></p>

<p>Install the puppet agent:</p>
<p><mark>sudo yum install -y puppet-agent</mark></p>

<p>Source the puppet script to configure the system after install:</p>
<p><mark>source /etc/profile.d/puppet-agent.sh</mark></p>

<p>Set the puppet server with the following puppet command:</p>
<p><em>Replace puppet.lab.local with the hostname of your puppet server, ping it first to be sure it resolves to an IP address</em></p>
<p><mark>puppet config set server puppet.lab.local --section main</mark></p>

<p>If you get a "No route to host" error, then ensure the VM can resolve the DNS name you specified above for the puppet server. Also, ensure that port 8140 is open on the puppet server.</p>
<p>You can open TCP port 8140 on the puppet server as follows:</p>
<p><em>Be aware that this might need to be changed, depending on your security requirements and firewall configuration</em></p>
<p><mark>sudo firewall-cmd --zone=public --permanent --add-port=8140/tcp</mark></p>
<p><mark>sudo systemctl restart firewalld</mark></p>

<p>You should get an error stating that you need to sign the SSL certificate for the agent VM.</p>
<p>To sign the certificate, on the puppet server run the following command</p>
<p><em>Replace centos-vm-1.lab.local with your agent VM's name</em></p>
<p><mark>puppetserver ca sign --certname centos-vm-1.lab.local</mark></p>

<p>Looking back on the agent VM, you should see that the SSL certificate has been signed.</p>
<figure><img class="alignnone size-full wp-image-3312" src="https://virtualg.uk/wp-content/uploads/2021/01/VirtualG.uk-GEtting-Started-With-Puppet-and-VMware-00.png" alt="" width="974" height="203" data-full="/wp-content/uploads/2021/01/VirtualG.uk-GEtting-Started-With-Puppet-and-VMware-00.png" loading="lazy" decoding="async"></figure>
<p>If you do not see this, just run the command again:<br>
<mark>puppet config set server puppet.lab.local --section main</mark></p>
<h2 id="Creating_puppet_packages_for_deployment">Creating puppet packages for deployment <a class="hash" href="#Creating_puppet_packages_for_deployment" aria-label="Link to this section"></a></h2>
<p>Here we will create a puppet package and link it to our agent VM. This will demonstrate the power and core features of puppet.</p>
<h3 id="The_chrony_example">The chrony example <a class="hash" href="#The_chrony_example" aria-label="Link to this section"></a></h3>
<p>For this example,we are going to use puppet to ensure that the time is synced up to NTP servers. CentOS 8 uses chrony for this rather than the older ntpd service</p>
<p>Once you have this example working, you can use it as a baseline for other things that you want to manage with puppet.</p>
<h3 id="Ensure_chrony_is_not_installed">Ensure chrony is not installed <a class="hash" href="#Ensure_chrony_is_not_installed" aria-label="Link to this section"></a></h3>
<p>First check that chrony is not installed on the CentOS VM. It probably is, so remove it for the demo.</p>
<p><mark>sudo systemctl status chronyd</mark></p>

<figure><img class="alignnone size-full wp-image-3322" src="https://virtualg.uk/wp-content/uploads/2021/01/VirtualG.uk-GEtting-Started-With-Puppet-and-VMware-04.png" alt="" width="752" height="184" data-full="/wp-content/uploads/2021/01/VirtualG.uk-GEtting-Started-With-Puppet-and-VMware-04.png" loading="lazy" decoding="async"></figure>
<p><mark>sudo dnf remove chrony</mark></p>
<figure><img class="alignnone size-full wp-image-3323" src="https://virtualg.uk/wp-content/uploads/2021/01/VirtualG.uk-GEtting-Started-With-Puppet-and-VMware-05.png" alt="" width="998" height="253" data-full="/wp-content/uploads/2021/01/VirtualG.uk-GEtting-Started-With-Puppet-and-VMware-05.png" loading="lazy" decoding="async"></figure>
<h3 id="A_note_on_environments">A note on environments <a class="hash" href="#A_note_on_environments" aria-label="Link to this section"></a></h3>
<p>You can and should make other environments and store different configurations in different environments.</p>
<p>IMPORTANT: On the agents, for this example to work, ensure you place them in the production environment. If you have created other environments, then reflect that change in the command below:</p>
<p>On your client/agent VMs edit your puppet configuration file as required:</p>
<p><mark>vi /etc/puppetlabs/puppet/puppet.conf</mark></p>
<aside class="note">
<p>[main]<br>
server = puppet.lab.local<br>
certname = centos-vm-1.lab.local<br>
runinterval = 1h<br>
environment = production</p>
</aside>
<h3 id="Puppet_manifest_files">Puppet manifest files <a class="hash" href="#Puppet_manifest_files" aria-label="Link to this section"></a></h3>
<p>With your agents now in the production environment, we can create a config to push to them.</p>
<p>Use vi or another editor to create a file named chrony.pp with the below contents (changing the NTP&nbsp; server pool config as required)</p>
<p>Since we have placed our agent VMs in the production environment, you'll want to save the file in the <strong>production</strong> manifests folder for this example: /etc/puppetlabs/code/environments/production/manifests/chrony.pp</p>
<aside class="note">
<p># Class Definition<br>
class chrony {<br>
# Ensure chrony is installed<br>
package {"chrony":<br>
ensure=&gt; "present",<br>
}</p>
<p># Ensure NTP configuration is correct<br>
file {"/etc/chrony.conf":<br>
ensure=&gt; "present",<br>
content=&gt; "pool 0.uk.pool.ntp.org",<br>
}</p>
<p># Ensure chronyd service is running<br>
service {"chronyd":<br>
ensure=&gt; "running",<br>
}<br>
}</p>
<p># Declare Class<br>
include chrony</p>
</aside>
<p>As you can see, this will:</p>
<ul>
 	<li>Ensure chrony is installed</li>
 	<li>Ensure a chrony configuration file exists</li>
 	<li>Ensure a config entry for the correct pool exists</li>
 	<li>Ensures that the chronyd service is running</li>
</ul>
<p>Save the file</p>
<p>Check for syntax errors with:</p>
<p><mark>puppet parser validate /etc/puppetlabs/code/environments/production/manifests/chrony.pp</mark></p>

<h3 id="Apply_the_configuration_in_noop_mode">Apply the configuration in noop mode <a class="hash" href="#Apply_the_configuration_in_noop_mode" aria-label="Link to this section"></a></h3>
<p>Next, run the puppet command on the agent VM to test what would happen without actually changing anything. You could, of course, use a new "testing" environment, instead of saving the file earlier directly in the "production" environment.</p>
<p>This would be my suggestion if you are going to use puppet in a real-world scenario as you would want to test the configurations before putting them into the production folder.</p>
<p>This command will force the agent VM to get the latest configuration and apply it in NOOP mode, meaning that it will test to see what would happen if you were running it for real</p>
<p>Note that the --test option here, means do it now rather than wait for the schedule to kick in. It has nothing to do with testing, it's just used to force the command tor un now.</p>
<p><mark>puppet agent --test --noop</mark></p>
<p>You will see that our config would have been applied because the status was different for more than one element of the configuration</p>
<p>Now we can run the command for real, to update our clients (agent VMs) with this configuration:</p>
<p><em>You can of course, just wait for the scheduler to run and update automatically (every 30 minutes by default)</em></p>
<p><mark>puppet agent --test</mark></p>
<figure><img class="alignnone size-full wp-image-3328" src="https://virtualg.uk/wp-content/uploads/2021/01/VirtualG.uk-Getting-Started-With-Puppet-and-VMware-08.png" alt="" width="434" height="98" data-full="/wp-content/uploads/2021/01/VirtualG.uk-Getting-Started-With-Puppet-and-VMware-08.png" loading="lazy" decoding="async"></figure>
<p>You should see that it has been applied successfully.</p>
<p>Also, note here that it was applied to the production environment</p>
<p>Now check to see if chrony is installed and running:</p>
<p><mark>sudo systemctl status chronyd</mark></p>
<figure><img class="alignnone size-full wp-image-3329" src="https://virtualg.uk/wp-content/uploads/2021/01/VirtualG.uk-Getting-Started-With-Puppet-and-VMware-09.png" alt="" width="832" height="212" data-full="/wp-content/uploads/2021/01/VirtualG.uk-Getting-Started-With-Puppet-and-VMware-09.png" loading="lazy" decoding="async"></figure>
<p>And that's all we need to do.</p>
<h2 id="Some_other_notes">Some other notes <a class="hash" href="#Some_other_notes" aria-label="Link to this section"></a></h2>
<p>For other manifest configurations, just save them in the correct environment folders and let the built-in puppet scheduler apply them.</p>
<p>Be sure the first save them in a "test" or "staging" environment and run them in a testing mode on an agent before rolling them out to every other server in your network!</p>
<p>If your agent is linked to the "production" puppet environment but you want to test the agent VM against a manifest in a "testing" environment, then on the agent you would run:</p>
<p>puppet agent --test --environment testing --noop</p>
<p>If you omit the --environment option, then the command will run with whatever environment the system is assigned to.</p>
<p>To find the environment that a test is assigned to, you can check and change it in the puppet configuration file on the agent VM as we did above</p>
<p><mark>vi /etc/puppetlabs/puppet/puppet.conf</mark></p>

<p>In the next post, we will explore how to configure VMware to work with Puppet so that we can automatically provision new VMs.</p>
<p><strong>Be sure to <a href="https://virtualg.uk/subscribe/" target="_blank" rel="noopener">subscribe</a> to be alerted of new posts on the blog and for the weekly newsletter&nbsp;</strong></p>]]></content:encoded>
    </item>
    <item>
      <title>Upgrading CentOS 8 to CentOS Stream 8</title>
      <link>https://virtualg.uk/upgrading-centos-8-to-centos-stream-8/</link>
      <guid isPermaLink="true">https://virtualg.uk/upgrading-centos-8-to-centos-stream-8/</guid>
      <pubDate>Sun, 24 Jan 2021 16:09:30 +0000</pubDate>
      <dc:creator><![CDATA[Graham Barker]]></dc:creator>
      <description><![CDATA[You may have recently heard about a major change to CentOS. If not, then take a look at my post about it here. If you are familiar and wish to migrate from CentOS 8 to CentOS…]]></description>
      <content:encoded><![CDATA[<p>You may have recently heard about a major change to CentOS. If not, then take a look at my post about it <a href="https://virtualg.uk/centos-8-stream-vmware-vsphere/" target="_blank" rel="noopener">here</a>.</p>
<p>If you are familiar and wish to migrate from CentOS 8 to CentOS stream 8, then this post goes through the steps.</p>
<h2 id="Pre-migration_steps">Pre-migration steps <a class="hash" href="#Pre-migration_steps" aria-label="Link to this section"></a></h2>
<p>Fortunately, the procedure is incredibly easy but you will need to ensure compatibility of your existing apps and upgrade them to ensure support for them going forwared.</p>
<p>So, before we begin, ensure you have good backups and snapshots of your systems, ensuring a frustration-free roll-back should anything go wrong.</p>
<h2 id="Install_the_release_stream">Install the release stream <a class="hash" href="#Install_the_release_stream" aria-label="Link to this section"></a></h2>
<p>The first command is</p>
<p><mark>sudo dnf install centos-release-stream</mark></p>
<figure><img class="alignnone size-full wp-image-3294" src="https://virtualg.uk/wp-content/uploads/2021/01/centos-stream-upgrade-3-scaled.jpg" alt="" width="1024" height="731" data-full="/wp-content/uploads/2021/01/centos-stream-upgrade-3-scaled.jpg" loading="eager" decoding="async"></figure>
<h2 id="Swap_repos">Swap repos <a class="hash" href="#Swap_repos" aria-label="Link to this section"></a></h2>
<p>To switch your repos from CentOS Linux to Stream, run the following</p>
<p><mark>sudo dnf swap centos-{linux,stream}-repos</mark></p>
<h2 id="Sync_distros">Sync distros <a class="hash" href="#Sync_distros" aria-label="Link to this section"></a></h2>
<p>Finally, run the following to sync up the distros</p>
<p><mark>sudo dnf distro-sync</mark></p>
<figure><img class="alignnone size-full wp-image-3297" src="https://virtualg.uk/wp-content/uploads/2021/01/centos-stream-upgrade-4-1.jpg" alt="" width="484" height="64" data-full="/wp-content/uploads/2021/01/centos-stream-upgrade-4-1.jpg" loading="lazy" decoding="async"></figure>

<p>Review and accept the output to continue</p>
<h2 id="Confirm_CentOS_Stream_8">Confirm CentOS Stream 8 <a class="hash" href="#Confirm_CentOS_Stream_8" aria-label="Link to this section"></a></h2>
<p>To check if you have successfully migrated to CentOS Stream 8, check the /etc/0s-release file.</p>
<p><mark>cat /etc/0s-release</mark></p>
<figure><img class="alignnone size-full wp-image-3296" src="https://virtualg.uk/wp-content/uploads/2021/01/centos-stream-upgrade-6.jpg" alt="" width="874" height="477" data-full="/wp-content/uploads/2021/01/centos-stream-upgrade-6.jpg" loading="lazy" decoding="async"></figure>
<h2 id="Test">Test! <a class="hash" href="#Test" aria-label="Link to this section"></a></h2>
<p>Now test your applications!</p>]]></content:encoded>
    </item>
  </channel>
</rss>
