How Do You Connect to Your Apache Spark Deployment in AWS?

Problem scenario
You have recently deployed Apache Spark to AWS.  You see the EC-2 instances were created.  But you cannot access them over the web UI (even over ports 4140, 8088, or 50070).  You cannot access the instances via Putty.  You changed your normal Security Group to allow TCP communication from your work station’s IP address.  What should you do to connect to your new Spark instance for the first time?

How Do You Deploy an Apache Spark Cluster in AWS?

Problem scenario
You want to deploy Apache Spark to AWS.  How do you do this?

Solution
1.  Log into the AWS management console.  Once in, go to this link.

2.  Click “Create cluster” and then “Quick Create”

3. For Software Configuration, choose “Spark:…”

4. For “Security and access”, for EC2 key pair, choose the key pair you desire.

How Do You Change the Password of the PostgreSQL Instance Account Named “Postgres”?

Problem scenario
You want to change the password at the SQL level — not with the OS — of the user named Postgres in your PostgreSQL install.  How do you change this password?

Solution
1.  Enter the SQL database to run a DDL command.
2.  Run this command to change the user named “postgres” to the password “abcd1234” with no quotes:

ALTER USER “postgres” WITH PASSWORD ‘abcd1234’;

How Do You Solve the Problem with Apache Web Server That Says “Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}”?

Problem scenario
Your website is not working.  When you browse to the login page, the browser loads forever.  There seems to be a problem with the web server itself.

On the back end, you run this command from the operating system’s command line:
netstat -anlp | apache2

It produces output like this:


[Sun Aug 06 21:03:22.088579 2017] [core:warn] [pid 30144] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Sun Aug 06 21:03:22.088682 2017] [core:warn] [pid 30144] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Sun Aug 06 21:03:22.088697 2017] [core:warn] [pid 30144] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Sun Aug 06 21:03:22.088701 2017] [core:warn] [pid 30144] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Sun Aug 06 21:03:22.088712 2017] [core:warn] [pid 30144] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sun Aug 06 21:03:22.099496 2017] [core:warn] [pid 30144] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sun Aug 06 21:03:22.099764 2017] [core:warn] [pid 30144] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Sun Aug 06 21:03:22.099775 2017] [core:warn] [pid 30144] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}

What should you do to fix this?

How Do You Solve the Apache Web Server Problem That Says “AH00558: apache2: Could not reliably determine the server’s fully qualified domain name”?

Problem scenario
Your website is not working.  When you browse to the login page, the browser loads forever.  There seems to be a problem with the web server itself.

On the back end, you run this command from the operating system’s command line:
netstat -anlp | apache2

You see this as the result of this command:
“AH00558: apache2: Could not reliably determine the server’s fully qualified domain name,

How Do You Avoid Using the Root User When Doing Linux Administration?

Problem scenario
You’ve been given root credentials.  How do you create a new user and make it a sudoer so you can install and remove OS packages?

You know that it is best to use a non-root user for Linux administration. You have been given a root user.  How do you create a non-root user with full sudoer privileges?

Solution
This example assumes that the username is “mike.” 

How Do You Troubleshoot the Error “Errors were encountered while processing: docker.io E: Sub-process /usr/bin/dpkg returned an error code (1)”?

Problem scenario
You want to remove Docker from your Ubuntu server.  You tried this command:

sudo apt-get remove docker

But you see this:



 Active: failed (Result: exit-code) since Sun 2017-08-06 21:59:11 EDT; 11ms ago
     Docs: https://docs.docker.com
  Process: 21981 ExecStart=/usr/bin/dockerd -H fd:// $DOCKER_OPTS (code=exited, status=1/FAILURE)
 Main PID: 21981 (code=exited, status=1/FAILURE)
   Memory: 14.0M
  

How Do You Configure the LAPP Stack to Authenticate and Allow Subsequent Pages Navigable Based on the Original Authentication?

Problem scenario
You are deploying a LAPP (Linux, Apache, PostgreSQL, and PHP) stack. You want the authentication to be done via a Postgres database behind-the-scenes.  You can control the credentials from the back end this way.  You want the user to be able to click around in the application once logged in.  You want only one challenge for user login credentials.  

How do you create a PHP login page (i.e.,

How Do You Troubleshoot a 500 URL Return Code with a PHP Web Page That Is Using pg_connect?

Problem scenario
You have an Apache web server with PHP code.  You are trying to integrate web pages with Postgresql.  When browsing to a web page (.php), you are getting a 500 URL return code.  Your PHP web page file is using the reserved command “pg_connect.”  How do you overcome this 500 URL return code error and have the web page work?

Solution
Possible solution #1:  Reboot the web server.

How Do You Read in Keyboard Input from a User and Invoke a Unix Shell Command with a C++ Program?

Problem scenario
You want to see how C++ works.  You want to read in user input from the keyboard and have the C++ program run a bash command.  How do you do this?

Solution
Compile this code (e.g., as a file named “test.cpp” with “g++ test.cpp”) and run it (e.g., ./a.out):

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;