How To Install The Linux OS (or How to Build a Server Running Ubuntu Server 16)

How To Install Linux / How To Install Ubuntu Server 16

Note: The settings in the directions below are for a typical U.S. user who wants a basic Ubuntu server without strong security.  You do not have to follow the directions exactly.  The directions can apply to different installation target mediums (e.g., a physical server or a virtual server).  The directions are great for installing Ubuntu on a virtual instance hosted by Oracle VirtualBox running on a laptop that has Windows Professional 7 (step #1-3).  You may not want to put anything sensitive on such a server.  The directions are almost step-by-step for initial configuration of Ubuntu that would be good for testing things and learning.  It would not take too much deviation from the steps below to have a production-ready Linux server.

Step #1.  The first step is to either

  1. boot a physical server to the CD/DVD-ROM (e.g., an .iso on a DVD that is in the drive), or
  2. boot a physical server to a USB stick (e.g., a USB stick with bootable installation media for Ubuntu should be inserted into the computer before the computer is turned on), or
  3. start Oracle VirtualBox and boot to an .iso file that was downloaded to a Windows desktop and mounted as a drive, with a drive letter.  One example of such an .iso is linked here.  Various applications can allow you to temporarily mount an .iso to a drive letter.

Step #2.  Follow these directions:
    a) Choose the language you want and press enter.  
    b) Choose Install Ubuntu Server and press enter.
    c) Choose "English" and press enter.
    d) Chose "United States" and press enter.
    e) Choose "No" to the question about detecting a keyboard.
    f) Choose "English (US)" and press enter
    g) Choose "English (US)" and press enter
       Don't be surprised if you just see purple for a minute. This next process may take 10 minutes.
    h) Enter a hostname for this server.  Then choose "Continue."
    i) Enter a full name for the user.
    j) Enter a user name.
    k) Enter a password.
    l) For "Encrypt hard drive" choose "No."  (It would be more secure to do it.  I'm suggesting "No" because I believe most people following these directions are using Oracle VirtualBox and want something to run on a laptop reasonably quickly.)
     m) You can change the time zone.  More than likely you should just choose "Yes" and press enter.
    n) For "Partition disks" choose "Guided - use entire disk and set up LVM"  (It would be more secure to choose the option with encrypted LMV.  I'm suggesting a different option because I believe most people following these directions will be installing Ubuntu Desktop on their Oracle VirtualBox.  These users want something to run on a laptop reasonably quickly and will not put sensitive data on their Ubuntu server.)
    o) Choose the default option for the "Select disk to partition."
    p) For the "Write changes to disks..." prompt, choose "Yes" and press enter.
    q) At the "Amount of volume group to use..." change if desired.  Otherwise choose "Next" and press enter.
    r) At the "Write changes to disks?" prompt, choose "Yes" and press enter.
    This portion may take the installer several minutes to complete.
    s) For the "Configure the package manager" leave it blank.  Press tab to highlight "Continue."  Press Enter.
    t) For the prompt about managing upgrades, choose "Install security updates automatically."
   u) For the "Software selection" prompt, leave "standard system utilities" unless you know you want something else.  Then choose "Continue."  The installer may take several minutes to complete this section.
    v) For the "Install the GRUB boot loader..." prompt, choose "Yes" and press "Enter."
   w) When you see "Finish the installation" go to "Devices" in Oracle VirtualBox.  Then go to "Optical Devices" and uncheck the drive letter that had the mounted media.  Then in the Ubuntu menu, choose "Continue."
    x) Now you can use Ubuntu.

How Do You Find What Version of Chef That You Are Using on a Linux Server?

Question:  How Do You Find What Version of Chef That You Are Using On A Linux Server?  If you are not sure if Chef is installed or not on your Linux server, see this article.

Answers (one for Chef client and one for Chef server)
To find the version of Chef client that is installed, run this:

chef-client -v

If the response is "command not found" chef-client is not installed.  If chef-client is installed, the above command will result in a display of the version of chef-client.

To find the version of Chef server that is installed, this command may or may not work:
cat /usr/lib/ruby/vendor_ruby/chef-server/version.rb
# On RHEL 7.3 with Chef 12.11.1, it did not work for us.  But some people found it to work.

This command should work for a modern version of Chef server:
sudo find / -name version-manifest.txt | grep opscode | xargs cat * | grep -i chef-server

What Is Robotic Process Automation (or RPA)?

Question
What is robotic process automation (or RPA)?

Answer
Robotic process automation, or RPA, is the term for automating user interface (UI) operations (mouse clicks and inserting text) with image recognition in a typical graphical user environment.  Some applications have no exposed API.  RPA enables the user to script a series of computer desktop activities to be performed in a scheduled and unattended manner.

RPA is not available for character-based (non-GUI) operating systems such as some distributions of Linux, Unix, and Windows (e.g., Core).

Robotic process automation software is software that enables a human user to create a repeatable sequence of events that involve the usage of graphical user interface applications (through pattern recognition, mouse clicks, and inserted text).  RPA programs can perform unattended screen scraping tasks and data entry.

In our opinion RPA software does not necessarily leverage artificial intelligence (or machine learning).  RPA could easily be integrated with artificial intelligence.  To meet the threshold of robotic process automation, graphical image recognition and UI functions must be present.  Such a process would not necessarily be considered artificially intelligent. If you want to learn more, see this page on Deloitte's website.

How Do You Find If Chef Server or If Chef Client Is Installed on a Linux server?

Question:  How Do You Find If Chef Server Is Installed on a Linux server?

Answer
Run this command:  which chef-server-ctl

If Chef server is installed, the result of the above command will display the location of the Chef binary file.  If Chef server is not installed, the word "no" will be in the results.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Question:  How Do You Find Out If Chef Client Is Installed on a Linux server? 

Answer
Run this command:  chef-client -v

If the response is "command not found" chef-client is not installed.  If chef-client is installed, the above command will result in a display of the version of chef-client.

Continuous Integration vs. Continual Integration

Historically the term "continuous integration" has been the norm in the world of technology.  In this article, Amazon defines it.  As of two days ago, Amazon posted an article using the term "continual integration."  This website helps promote the grammatically correct "continual integration."

What Are OPT Resumes?

Problem scenario:  A recruiter warns that he/she will not accept OPT resumes for a specific solution.  What are OPT resumes?

Solution:  OPT stands for Optional Practical Training.  OPT employment authorization last for 12 months and is related to academic training in the U.S.  To learn more, see this link.  If you are a U.S. citizen like the author of this blog, it is probably of no concern to you (unless you are getting into recruiting or hiring).  A U.S. citizen's resume is not an "OPT."

How Do You Get the Puppet Master Service to Run for The First Time?

Problem scenario
Your newly installed Puppet Master is not working.  The main service will not start.  You try this command:  service puppetserver restart

You see this as the results of the above command:
"Job for puppetserver.service failed because the control process exited with error code. See "systemctl status puppetserver.service" and "journalctl -xe" for details."

You then try this command to see what is wrong (per the error message above):
systemctl status puppetserver.service

It results in this:

? puppetserver.service - LSB: puppetserver
   Loaded: loaded (/etc/init.d/puppetserver; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2017-01-12 19:17:18 EST; 22s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 6434 ExecStart=/etc/init.d/puppetserver start (code=exited, status=1/

How do you fix this problem?

Solution
It is recommended that you have 6 GB of memory for Puppet Enterprise.  For testing purposes the Puppet Master service will run with less than 1 GB. Modify this file /etc/default/puppetserver.

Find this line in /etc/default/puppetserver:

JAVA_ARGS="-Xms2g -Xmx2g -XX:MaxPermSize=256m"

Change it to this (where 256 is the number of MB your server has*):

JAVA_ARGS="-Xms900m -Xmx900m -XX:MaxPermSize=256m"

* Use this command: free -m
In the results of free -m, the value under "total" for "Mem:" is the value of "x" you should use for this computation: 
y = x * .9
The resulting value of y (based on this formula) should be in the JAVA_ARGS statement in the file /etc/default/puppetserver in a certain way:  Replace the "2" in both instances of "Xms2g" (as shown above) with the value of y.  Replace the "g" in these two strings with the letter m.  (The "g" is for gigabytes and the "m" is for megabytes.)  This example involving changing "g" to "m" assumes you have only 1 GB of RAM on the server.  In some instances your JAVA_ARGS stanza in the /etc/default/puppetserver file would have a "g" and not an "m".

If you need assistance adding virtual memory (aka swap space), see this posting.  If you want to upgrade your AWS EC-2 instance, see this posting.  If you want to resize your GCP virtual machine (aka server in Google Cloud), see this posting.

How Do You Solve The Problem When Puppet Agent Returns an Error About “require_relative for main:Object”?

Problem scenario:  On a Linux server you run "puppet agent -t" to apply a manifest on a Puppet Agent.  You receive this error:

"Error: Could not retrieve local facts: undefined method 'require_relative' for main:Object"

What do you do to fix this?

Solution:  Install a compatible version of Puppet agent on the server.  One way to do this is to run this command:

curl -k https://continualintegration:8140/packages/current/install.bash | sudo bash`

#where "continualintegration" is the hostname (or FQDN) of the Puppet Master server.

This way is preferred because the Puppet Agent server gets the installation media from the Puppet Master itself.

How Do You Troubleshoot the Yum Error “[Errno 14] Peer cert cannot be verified or peer cert invalid. Trying other mirror…”?

Problem scenario:  You are running a yum command and get this error:
"[Errno 14]  Peer cert cannot be verified or peer cert invalid.  Trying other mirror..."

Possible Solutions
The SSL certificate is not being verified.  One solution would be to ensure the Linux server you are running the yum command on has the correct SSL cert. 

Another solution would be to modify the /etc/yum.conf file.  Add this entry as the lowest stanza in the [main] section:  sslverify=false

This second solution (immediately above) is not a best practice.  But behind a firewall that blocks Internet access, it is a configuration that some Linux administrators use without too much risk.  Use it with caution if your environment does not have an intrusion detection system and firewall because you do not want to apply Linux patches from an unverified source.  It is inadvisable to use this "sslverify=false" stanza on an important server that has access to the Internet.  This setting on /etc/yum.conf applies to all repos on the server.  The default setting, when this stanza is omitted, on modern RedHat versions has the equivalent effect of having a "sslverify=true" stanza.  The .repo files in /etc/yum.repos.d/ can be granularly managed.  To set a .repo file to false, use this similar stanza with no quotes: "sslverify=0".

How Do You Ensure That a PowerShell Pop-Up Window (mini-GUI) Always Appears in the Front?

Problem scenario:
You have a PowerShell script that launches a pop-up window.  This pop-up appears behind the PowerShell ISE GUI.  Without being in the foreground, the users of this script fail to realize there is a prompt waiting for the user to take action.  You want the pop-up window to be in the front.  You tried things like these options to no avail:

  • New-Object System.Windows.Forms.Form -Property @{TopMost = $true}
  • -ArgumentList([System.Diagnostics.Process]::GetCurrentProcess().MainWindowHandle)
  • form.TopMost = "True"
  • form.TopMost = $true
  • form.TopMost = $True
  • $form.TopLevel = $true
  • set-foregroundWindow(Get-Process PowerShell).Main.WindowHandle
  • $form.BringToFront()
  • set-WindowsFocus
  • [void]$showWindowAsync::ShowWindowAsync((Get-Process -id $pid).MainWindowHandle, 2)  #hide GUI
    [void]$showWindowAsync::ShowWindowAsync((Get-Process -id $pid).MainWindowHandle, 10)  # GUI returns

You could use a form (not a PowerShell Window) with PowerShell code and no special Vexasoft solution, and the above may be unsuccessful in reliably (or ever) making the pop-up window appear in front of the PowerShell ISE application.  Users waste time not knowing that the program is waiting on them. 

The last bullet's two lines of PowerShell code were taken from this external link.  In some instances, the above options will not work reliably.  When the PowerShell window is not minimized there may also be an error about calling a method on a null-valued expression.  When a pop-up is hidden behind the PowerShell window, the interactive experience is delayed unnecessarily.

What should you do so the pop-up GUI is clearly visible (as interactive scripts can stall until options are selected or input is provided)?

Solution 
Minimize the PowerShell ISE application via the follow PowerShell code (where "start-sleep 5" is the line that launches the pop-up):

$shell = New-Object -ComObject "Shell.Application"
$shell.minimizeall()
start-sleep 5  # This is where the pop-up would be called.  It is just a placeholder.
$shell = New-Object -ComObject "Shell.Application"
$shell.undominimizeall()

Every line but the middle line in the above five lines of code were taken from this external website.