How Do You Get around the Message “AUTHENTICATING FOR org.freedesktop.systemd1.manage-units”?

Problem scenario
You are running a yum command or running a script on a RHEL server.  You get this prompt:

"==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: Cloud User (ec2-user)
Password:
"

What do you do to troubleshoot this prompt as no password seems to work?

Solution
Cancel out of the prompt.  Re-run the command but this time with "sudo " in front of it.  Alternatively you could run "sudo su -" to assume the root user.  But it would be best to use "sudo " in front of the command you were trying to run.

How Do You Deploy Nginx to a Docker Container on an AWS Linux Server?

Problem scenario
You installed Docker (on either Ubuntu or RedHat, see the links if you actually need help with that).  You do not want to create a Docker network on your server. How do you create a simple Docker container with Nginx without creating a user-defined network?

Solution
#1  Run these two commands:
docker pull nginx
docker run --name docker-nginx -p 80:80 nginx

# If the command hangs, use ctrl-c.  In our experience, the Docker container is successfully created despite not gracefully returning to the command prompt as you would normally expect.  Other people have experienced this problem.
# To read more about this problem of the "docker run" command hanging, you can see this link or this Docker website posting.

#2  Run two more commands:
docker ps -a

# Find the alphanumeric container ID in the results of the above command.  Then substitute abcd1234 for that container ID in the following command:

docker start abcd1234
#Run the above command but with the Docker container ID.

#3  Now assuming outbound connections from your AWS instance are not blocked over port 80 (this depends on the configuration of the Security Group in AWS that governs your Linux server), you should be able to open a web browser and type in the external IP address of the Linux server.  To find the external IP address from the back-end, run this command from the Linux server's command prompt:  curl http://icanhazip.com
The result of that command can be used from a web UI to test Nginx in a Docker container.

How Do You Troubleshoot the Docker Error “User specified IP address is supported on user defined networks only”?

Problem scenario
When using a "docker run" command you get this error: "Error response from daemon: User specified IP address is supported on user defined networks only."  What do you do to create a user-defined network?

Solution
#1  From the Linux server (the Docker host), run this command:  ip addr show

#2  Look at the results for eth0.  Find its "inet" IP address and subnet mask (e.g., 172.31.38.151/20). This is the internal IP address of the Docker server and its subnet mask in shorthand notation.  To determine the IP address of this Docker network you will create, mentally increment the last octet's integer value by 1 and keep the subnet mask for the construction of a command below.  If the octet (after incrementing it) is above 255, find an addressable IP number not being used and within the subnet mask for the server's IP address.

#3  Run a command like the following emboldened command, however you may want to substitute "isolated_nw1" with the name of your choice for this user-defined network.  You must substitute x.x.x.x in the draft of the command below with the IP address this network will have (possibly as simple as one greater than the last octet of the server's internal IP address).  You will likely substitute 20 with the subnet mask short hand notation that the server's internal IP address has.

docker network create --driver bridge isolated_nw1 --subnet x.x.x.x/20

The result may look like this:

docker network create --driver bridge isolated_nw1 --subnet 172.31.38.152/20

Take a note of this IP address and mentally increment the last octet one more time.  You'll use that [incremented] IP address later for a Docker container.  But that should fix the problem of not having a Docker user-defined network.

If you are interested in networking containers, you may want to read a short posting about Flannel or Calico.

How Do You Choose the Right Spell When Using Conjure-Up and The “Enter” Key Does Not Work?

Problem scenario
The conjure-up menu is not working.  You run a command like "conjure-up kubernetes" and get to a prompt/screen with an orange banner at the top.  The "Tab" key works.  But "Enter" only works on the "Quit" button.  There is no error message.  How do you proceed with this conjure-up menu prompt  (e.g., to deploy Kubernetes) when the only option that works is "Quit"?

Solution
Expand your Putty session so the GUI is bigger on your screen (wider and longer).  If you cannot see all the options in the conjure-up menu, the menu will throw no errors, but it will not work correctly either.  The "Enter" key will have no effect unless you highlight "Quit."  Once expanded, the "Enter" key will work and allow you to proceed.

How Do You Generate a Load for Your Nginx or Apache Web Server?

Problem scenario
You set up a load balancing mechanism for your Nginx or Apache web server.  You want to test it and set up an artificial load of traffic.  You want to generate a significant amount of traffic to test the HTTP load balancing mechanism.  How do you do this?

Solution
Here are three scripts that can, by themselves, download a web page 100 times when they execute.  The languages are Bash, Python (but the OS must be Linux), and PowerShell.  So if you have a Windows workstation and Linux computer, you should be able to get some traffic for your web page.  You may want to modify the web page to be larger (with more text).  You may want to modify the scripts below to change the "100" to "1000" for a longer-running script.  The load that these scripts will place will be a longer duration if you change the "100" in them to "1000".  A fourth suggestion would be to use Gatling.

Here is a bash script that will download a web page 100 times (just replace 10.10.0.1 with the URL you want to download):

#!/bin/bash 
function callit {
   curl 'http://10.10.0.1'
}
i="0" 
while [ $i -lt 100 ]
do
  callit
  i=$[$i+1]
done
echo "it is done"

Here is a Python script that will work on a Linux server; it will download a web page 100 times (just replace 10.10.0.1 with the URL you want to download):

import os
i=0
while (i < 100):
  os.system("curl http://10.10.0.1 >> delete")
  i = i + 1

Here is a PowerShell script to download the web page (you can replace this with the URL http://10.10.0.1 to your own website) 100 times:

function dwnld-webpage {
   $website = Invoke-WebRequest -URI "http://10.10.0.1"
   echo $website.content >> delete.txt
}
$i=0
while ($i -lt 100) {
  dwnld-webpage
  $i++
} 

You may want to try Gatling too.

How Do You Install the Zabbix Client on an Ubuntu AWS Instance?

Problem scenario
You are running Ubuntu Linux in AWS.  You want to monitor it with your Zabbix server.  (To set up a Zabbix server in AWS, see this posting.)  How do you install the Zabbix client on an Ubuntu server?

Solution
Section 1

Make sure your AWS Security group allows for inbound connections from the internal IP address of the Zabbix server on any TCP port.  Otherwise the client will not be able to be monitored.

Section 2
Run this command:  sudo apt-get -y install zabbix-agent

Section 3
Go to the back end of the Zabbix server. Find the internal IP address of the Zabbix server's back end, run this command and find a different IP address from 127.0.0.1:  ip addr show | grep inet

Then run "hostname -f".  Keep this IP address and FQDN for the next steps performed on the other server.

Section 4
Return to the Linux server that will receive the agent.

sudo vi /etc/zabbix/zabbix_agentd.conf

Edit line 85 and change the "127.0.0.1" to the internal IP address of the Zabbix server.    It will look like this:
Server=10.1.1.1

Edit line 126 so "ServerActive=" is assigned the internal IP address of the Zabbix server.  It will look like this:
ServerActive=10.1.1.1

Edit line 137 so that "Hostname=" is assigned the internal FQDN of the Zabbix server.  It will look like this:
Hostname=fqdn.zabbix.com

Save the changes of the file.  From the command prompt run these commands:

sudo systemctl start zabbix-agent
sudo systemctl enable zabbix-agent

Section 5
Go to the web UI of the Zabbix server.  Go to Configuration -> Hosts -> Create Host.

In hostname, enter the internal FQDN of the client server.  In the Groups section, highlight "Linux servers" and "Virtual Machines."  Click the "left arrow" button to move these two groups to the "In Groups" section.  In the "IP Address" of the "Agent interfaces" section, enter the IP address.

Click "Add" in the lower left-center section.

Click the hostname that is hyperlinked.

Click the "Templates" tab (but not the highest of the "Templates" tab) that is below other tabs.  Here is a picture of where to click:

The resulting screen should look like this:

In the "Link new templates" field, type "Template OS Linux."  Click the correct suggestion as it appears.   Then type in "Template App SSH Service."  Click the correct suggestion as it appears.  Click "Add."  Then click "Update."

You are done.  Be prepared to see this alert "Lack of free swap space on ..."   These directions are just designed to get you started.

How Can You Learn about Kubernetes in One Hour?

Problem scenario
You need to learn more about Kubernetes but do not know where to start.  You have roughly one hour to try to know much more about Kubernetes.  What should you do?

Solution
For an introduction to Kubernetes, see these two articles from Linux.com and TechTarget.

This DigitalOcean article is a little out of date (as of 9/18/17), but it still has some information to glean from.

If you want to know why some people think Kubernetes is the hottest technology out there right now (as of September 2017), see this webpage.

For an overview of different concepts and keywords in Kubernetes, see either this link or this other one.

(A now broken link was available to learn about the Kubernetes API in a technical way to actually use it: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md
We know this link no longer works.)

Below are links to news about Kubernetes.  If you want to buy a book on Kubernetes, see this posting.

Kubernetes – Production-Grade Container Orchestration

How Do You Install Zabbix Server on RHEL 7.x Running in AWS?

Problem scenario
You have a RedHat Linux server with only 1 vCPU and 1 GB of RAM.  You want to install Zabbix Server to monitor other servers.  How do you deploy Zabbix server to an AWS instance of RHEL?

Solution
1. Install the LAMP stack components by running this command:
sudo yum -y install php httpd mariadb-server

2.  Install essential Zabbix components with these four commands:
sudo rpm --import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX

sudo rpm -Uv  http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm

sudo yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional

sudo yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway php-mbstring php-bcmath

3.  Configure the zabbix.conf file.
i.  sudo vi /etc/httpd/conf.d/zabbix.conf
Change the time zone entry by first uncommenting it out.  To find your time zone in the Americas, go to this link in a web browser.

ii.  This entry may look like this when you are done:

        php_value date.timezone America/New_York

iii. Save the changes to zabbix.conf.

4.  Restart the Apache web service daemon with this command:  sudo systemctl restart httpd

5. Start the MariaDB service with this command:  sudo systemctl start mariadb.service

6. This step of a command will assign the MySQL/MariaDB administrator password (for the database user "root"). Replace "strongpassword" with the password of your choice when you actually run this Linux command.

i.  Run this command: stty -echo
Please note that you will not see keystrokes on the terminal after you run the above command.  This is so you can type in a password and have no one else view it.

ii.  Replace "strongPassword" below with the password you want the root user of your MySQL server to have.  Once "strongPassword" is substituted, run the command below and press enter.

var1=strongPassword

iii.  Run this command:  stty echo

iv.  Run this command:  mysqladmin -u root password $var1

7.i.  Now you should be able to use this command to get into a SQL command prompt with this command:
mysql -u root -p

ii.  Type in the password (the one entered in step #6.ii) to the prompt you see.

8.  Now that you are the MariaDB prompt, enter this command: create database zabbixdb character set utf8;

9.  Now run this command but ask other people looking at your screen to turn away (and replace "strongPassword" with the password for root):

grant all privileges on zabbixdb.* to 'zabbixuser'@'localhost' identified by 'strongPassword';

#Expect to see "0 rows affected" by the above command.

10. Now run this command (which should display "0 rows affected" after it is succesfully run):

flush privileges;

11. Then exit the SQL command prompt with this command:  exit

12. i. Run this command:  sudo find / -name schema.sql

ii. With the result from the above command, run a new command like this (just substitute the "/path/to/file/found/above/schema.sql" with the file found in the above command):
mysql -u zabbixuser -p zabbixdb < /path/to/file/found/above/schema.sql

iii. At the prompt you now see, enter the password you chose for mysql above (in step 6.ii).

13. i. Run this command: sudo find / -name images.sql

ii. With the result from the above command run a new command like this  (just substitute the "/path/to/file/found/above/images.sql" with the file found in the above command):
mysql -u zabbixuser -p zabbixdb < /path/to/file/found/above/images.sql

iii. At the prompt you now see, enter the password you chose for mysql above (in step 6.ii).

14. i. Run this command: sudo find / -name data.sql

ii. With the result from the above command run a new command like this  (just substitute the "/path/to/file/found/above/data.sql" with the file found in the above command):

mysql -u zabbixuser -p zabbixdb < /path/to/file/found/above/data.sql

iii.  At the prompt you now see, enter the password you chose for mysql above (in step 6.ii).

15.  Modify the zabbix_server configuration file.

i. sudo vi /etc/zabbix/zabbix_server.conf

ii. Uncomment out the DBPassword stanza on line 106.  It will look like this at first:

# DBPassword=

It will look like this when you have uncommented it:

 DBPassword=

iii. Make sure these stanzas have the values as follows:

DBName=zabbixdb  #(unless you deviated from these directions above),

DBUser=zabbixuser #(unless you deviated from these directions above),

DBPassword=strongPassword #replace "strongPassword" with the password you chose above in step 6.ii.

iv. Save the changes.

16. i. sudo vi /etc/zabbix/zabbix_agentd.conf

ii.  #Change line number137 to look like this:

Hostname=127.0.0.1

iii. Save the changes.

17. i.  sudo vi /etc/php.ini

ii.  Find the following five settings and change them so their numbers reflect the following:

max_execution_time = 600
max_input_time = 600
memory_limit = 256M
post_max_size = 32M
upload_max_filesize = 16M

(These suggested settings above were taken from this link.)

iii.   Find the "date.timezone" stanza and change it to your time zone as found in this link.  For example, it may end up being like this (with no semi-colon):

date.timezone = America/New_York

iv. Save the changes to /etc/php.ini.

18.  Start many services.  You can cut and paste the following:
sudo systemctl restart httpd; sudo systemctl restart mariadb;
sudo systemctl enable zabbix-server; sudo systemctl enable zabbix-agent;
sudo systemctl start zabbix-server; sudo systemctl start zabbix-agent;

19.  i. Open a web browser.  Craft the URL like this:

http://<external IP address of the RHEL server>/zabbix

ii.  Click "Next" in the lower right hand corner.

iii.  On the right hand column, you should see green OKs.  Click next.

iv. For the "3. Configure DB connection" menu, enter the password you entered above (step 6.ii) in the password field.  Change the database name to zabbixdb unless you deviated from these directions.

v.  Click "Test Connection."  It should say "OK" after the menu refreshes.  Click "Next."

vi.  For Zabbix server details (#4 menu option), just click "Next."

vii.  For the "5. Pre-installation summary", just click "Next."

viii.  For the "6. Install" menu, just click "Finish."

ix.  Go back to the back end (command prompt of the Linux server).  Run this command:
sudo setsebool -P httpd_can_connect_zabbix=1

20.  At the Zabbix GUI login, enter admin for the user and zabbix for the password.

Happy Constitution Day!

Today is Constitution Day.  It was the final day of what was then called The Grand Convention or The Federal Convention.  We now know that almost three month convention in Philadelphia as the Constitutional Convention.  The meeting place was then called the State House.  This building still stands, and is now called Independence Hall.  We recommend people make a trip to Independence Hall and the nearby The National Constitution Center in Philadelphia to learn more about how the Constitution was drafted, debated, and adopted.  It is wise to have a copy of the U.S. Constitution.

During the convention the small states and larger states had different opinions about how representation in a legislature would work.  When the delegates of the states finally agreed on having a two-chamber legislature with one body (the House) having proportional representation and another (the Senate) having fixed representation, there was far greater harmony in the convention.  Small states wanted a say in this new government, but larger (more populous) states did not want to lose control of their tax dollars.  This blended system is known as The Connecticut Compromise and was the idea of Oliver Ellsworth and Roger Sherman. 

Today DevOps engineering seeks to blend development with I.T. operations. 

How Do You Install the Zabbix Client on a RHEL 7.x Server in AWS?

Problem scenario
You have set up Zabbix server (i.e., using these directions).  How do you configure another RedHat Linux server in AWS to be configured with the client so the Zabbix will monitor it?

Solution

Section 1
1.  Make sure your AWS Security group (that governs this AWS instance that will be a client) allows for inbound connections from the internal IP address of the Zabbix server on any TCP port.  Otherwise the client will not be able to be monitored.

Section 2
2.  One the AWS instance (Linux server) that will be the Zabbix client, run these three commands:

sudo rpm --import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX
sudo rpm -Uv  http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm
sudo yum install zabbix-agent -y

Section 3
3.  Go to the back end of the Zabbix server. Find the internal IP address of the Zabbix server's back end, run this command and find a different IP address from 127.0.0.1:  ip addr show | grep inet

Then run "hostname -f".  Keep this IP address and FQDN for the next steps performed on the other server.

Section 4
4.  Return to the AWS instance (Linux server) that will receive the agent.
i.  Run this command:  sudo vi /etc/zabbix/zabbix_agentd.conf

ii.  Edit line 84 and change the "127.0.0.1" to the internal IP address of the Zabbix server.    It will look like this:
Server=10.1.1.1

iii.  Edit line 126 so "ServerActive=" is assigned the internal IP address of the Zabbix server.  It will look like this:
ServerActive=10.1.1.1

iv.  Edit line 135 so that "Hostname=" is assigned the internal FQDN of the Zabbix server.  It will look like this:
Hostname=ip-172-31-29-241.us-east-2.compute.internal

v.  Save the changes.

vi.  Run these two commands:
sudo systemctl start zabbix-agent
sudo systemctl enable zabbix-agent

vii.  Find the internal IP address of the Zabbix client server's back end, run this command and find a different IP address from 127.0.0.1:  ip addr show | grep inet
Then run "hostname -f".  Keep this IP address and FQDN for the next steps performed on the other server.

Section 5
5.  i.  Go to the web UI of the Zabbix server.  Go to Configuration -> Hosts -> Create Host.

ii.  In hostname, enter the internal FQDN of the client server.  In the Groups section, highlight "Linux servers" and "Virtual Machines."  Click the "left arrow" button to move these two groups to the "In Groups" section. 

iii. In the "IP Address" of the "Agent interfaces" section, enter the IP address found in Section 4 above.

iv.  Click "Add" in the lower left-center section.

v.  Click the hostname that is hyperlinked.

vi.  Click "Templates" (but not the highest of the "Templates" tab) that is below other tabs.  Here is a picture of where to click.

The resulting view, after you click on the correct "Templates" tab, should look like this:

vii.  In the "Link new templates" field, type "Template OS Linux."  Click the correct suggestion as it appears.  Then type in "Template App SSH Service."  Click the correct suggestion as it appears. 

viii.  Click "Add."  

ix.  Then click "Update."

x.  You are done.  Be prepared to see this alert "Lack of free swap space on ..."   These directions are just designed to get you started.