How Do You Know What Version of Foreman Is Installed?

Problem scenario
You inherited a server with Foreman installed. What should you do to find out what version is installed?

Solution
1. Run this command: sudo find / -name foreman-installer -type f
2. Based on the results above, run this:
sudo /path/to/foreman-installer --foreman-version

# Replace "path/to" with the path results of the first command (e.g., /usr/sbin/").

Where Is The “Welcome to Nginx!” Page Stored in a Docker Container?

Problem scenario
You installed Nginx in a Docker container on a RedHat Linux server.  You go to this container with a web browser and see the default screen.  Where is the default file (on the back-end) that users see from the front-end by default that says "Welcome to nginx!"?

Solution
This is the name and location of the file (assuming the Docker container was created via the public repository):

/usr/share/nginx/html/index.html

How Do You Determine which yum-config-manager Repos Can be Enabled?

Problem scenario
You want to see options for the yum-config-manager command. How do you find which repositories can be enabled for a Red Hat Enterprise Linux server?

Solution
Run this command: sudo yum repolist all

With the output on the left, you will need what is left of the "/" (forward slash) if one appears in a command like this: sudo yum-config-manager --enable rhui-REGION-rhel-server-rhscl

Let's say you see this output below from the sudo yum repolist all command:

rhui-REGION-rhel-server-source-supplementary/7Server/x86_64 Red Hat Enterprise Linux Server 7 Supplementary (SRPMs) disabled

To use this output, as a single example, you will want only the rhui-REGION-rhel-server-source-supplementary as the argument to the "enable" flag option with your yum-config-manager command. The format of the output gives more details that would not necessarily be used in subsequent commands.
The rhui-REGION-rhel-server-extras is a common package to want or need to enable.

How Do You Use rpm to Remove a Repository You Installed?

Problem scenario
You accidentally used a command like this:
sudo rpm -ivh http://path/to…

You accidentally installed and configured a remote repository that you do not want to retrieve packages from. How do you use rpm to remove the configuration?

Solution
1. Run this command: cd /etc/yum.repos.d/
2. Delete the file that is there as a consequence of your "rpm" command.
3. Run this: sudo yum -y update
4. You are done. Now you should be able to install packages from repositories other than the one you accidentally configured.

How Do You Troubleshoot a Web Server in GCP Not Working via a Web Browser when Port 80 Is Not Blocked?

Problem scenario
From a web browser these commands succeed (where x.x.x.x is the external IP address of the Linux VM serving the web service):

Test-NetConnection -ComputerName x.x.x.x -Port 80
Test-NetConnection -ComputerName x.x.x.x -Port 443

But when you open a web browser and go to the x.x.x.x IP address, but the page does not load. You may get an error message about it timing out or not being reached or available. How do you fix this?

Solution

  1. Log into GCP.
  2. Click on the VM instances.
  3. Click on the server's name as it should be hyperlinked.
  4. Click "Edit".
  5. Go to the Firewalls section. Click the boxes for "Allow HTTP traffic" and "Allow HTTPS traffic".
  6. Scroll to the bottom. Click "Save".

How Do You Send a Multi-Line Email from the Command Prompt Using Mailx on a RHEL Server?

Problem scenario
You want to send more than one line of text as the body of an email. You want to use the command prompt of a RedHat Enterprise Linux server.

Solution
Prerequisites
You have installed mailx. If you need to do this, run this command: sudo yum -y install mailx

Procedures
1. Create the multi-line message that you want to send in a file. Call it foobar.txt.
2. Use this command:

cat foobar.txt | mail -s "placeSubjectHere" -r email@from.com destiny@destination.com

-replace "placeSubjectHere" with the subject of your email
-replace "email@from.com" with the email address that you want the email to appear to be from
-replace "destiny@destination.com" with the destination email address

3. The email should have been sent. You are done.

An Alternative Way To Send Email
Another way to do this is with Python; to learn how to use Python and not install anything else, see this external posting.

How Do You Find the Version of Java that is Installed on Your Windows Server?

Problem scenario
You want determine what version of Java is installed (if any). What do you do?

Solution
Open PowerShell and run this command:
(Get-WmiObject Win32_Product | Where {$_.Name -match "Java"}).Version

Alternative way without PowerShell:
1. Go to Control Panel -> Uninstall a Program
2. See if Java is installed