Problem scenario
You want to configure the LAMP stack (Linux, Apache web server, MySQL/MariaDB, and PHP) on a running a RedHat distribution of Linux. How do you do this?
Solution
Run this command:
sudo yum -y install php httpd mariadb-server
A Technical I.T./DevOps Blog
Problem scenario
You want to configure the LAMP stack (Linux, Apache web server, MySQL/MariaDB, and PHP) on a running a RedHat distribution of Linux. How do you do this?
Solution
Run this command:
sudo yum -y install php httpd mariadb-server
Problem scenario
You are trying to start HDFS. But you get this error: "WARN conf.Configuration: bad conf file: element not <property>"
What should you do?
Solution
Look at mapred-site.xml, hdfs-site.xml, and core-site.xml files. Verify you have a <property> tag in each file.
cat /path/to/mapred-site.xml | grep -i property
cat /path/to/hdfs-site.xml | grep -i property
cat /path/to/core-site.xml | grep -i property
If there is no <property> tag and closing </property> tag in each one of these three files, you may receive this error above.
Look for something like this:
<configuration>
<name>
...
</name>
</configuration>
The above is an example of a missing <property> tag.
Problem scenario
Your enterprise's policies are to install a version of Jenkins that is lower than the latest. How do you install Jenkins 1.651.1 on Ubuntu 16.04?
Solution
1. Install Java. See this posting if you do not know how.
2. Run these three commands to install Jenkins 1.651.1 (but you can chance the version whichever one is available):
curl -L https://pkg.jenkins.io/debian-stable/binary/jenkins_1.651.1_all.deb > /tmp/jenkins_1.651.1_all.deb
sudo apt-get -y install daemon
sudo dpkg -i /tmp/jenkins_1.651.1_all.deb
Problem scenario
You are using a RedHat derivative distribution of Linux (e.g., CentOS/RHEL/Fedora). To eliminate a Hadoop error, you need to install a variety of packages. How do you install Maven, openjdk, libssl-Dev, build-Essential, and pkgconf?
Solution
To install Maven, see this article.
For the rest of the packages, run these commands:
sudo yum -y install java-1.8.0-openjdk-devel openssl-devel cmake protobuf
sudo yum -y groupinstall 'Development Tools'
curl ftp://rpmfind.net/linux/fedora/linux/updates/25/x86_64/p/pkgconf-1.3.7-1.fc25.x86_64.rpm > pkgconf-1.3.7-1.fc25.x86_64.rpm
curl ftp://rpmfind.net/linux/fedora/linux/updates/25/x86_64/l/libpkgconf-1.3.7-1.fc25.x86_64.rpm > libpkgconf-1.3.7-1.fc25.x86_64.rpm
sudo rpm -ivh *.rpm
Problem scenario
You want to know how to discuss Microsoft's public cloud offering. You do not know how to pronounce "Azure." How should it be pronounced?
Solution
It is pronounced "azh-er" according to Dictionary.com. To hear it pronounced you can click on the link above. Another related video is here.
Problem scenario
You set up Chef server and Chef client on Linux servers. On the Chef client server you run this command:
knife client list
You get this as the output:
ERROR: The object you are looking for could not be found
Response: <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>Chef - 404 Not Found</title>
<link media="all" rel="stylesheet" type="text/css" href="/css/all.css" />
<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="/css/lt7.css" /><![endif]-->
</head>
<body>
<div class="header-block">
<div id="header">
<strong class="logo"><a href="https://www.chef.io">Chef</a></strong>
</div>
</div>
<div id="wrapper">
<div id="main">
<div class="mybox">
<div id="content">
<h1>404 - Not Found</h1>
<p>Sorry, I can't find what you are looking for.</p>
</div>
</div>
</div>
</div>
<div class="footer-block">
<div id="footer">
<div class="mybox">
</div>
<div class="footer-bottom">
<span>© 2010 – 2017 Chef Software, Inc. All Rights Reserved</span>
</div>
</div>
</div>
</body>
</html>
What do you do?
Solution
Find knife.rb. (Use "sudo find / -name knife.rb".) In this file find the "chef_server_url".
Verify the end of the URL has "/organizations/nameOfOrganization" (with no quotes where "nameOfOrganization" is the name of your organization as configured on the Chef server). Some directions (or instructions) on different websites do not make it clear that the URL must have this last part, with the FQDN of the Chef server as the first part.
If the URL does not have "/organizations/nameOfOrganization", the above error may occur when running "knife client list". If this posting has not helped you, you may also want to see this posting.
Problem scenarios
This is a two-in-one posting. The same solution works for two different problem scenarios.
Problem scenario A
You want to create a certificate signing request permissions file (a csr.pem) to learn more about it. You also want to try to use HTTPS as a test. How do you do these things?
Problem scenario B
You want to implement a solution with TLS. You want to test out an example to be able to know what it is like beyond theory and reading about it. You find many articles on the internet to be old. How do you use TLS?
Solution
1. Install Node.JS on a Linux server. You need a Linux server that is not blocking port 8000 with at least 1 GB of RAM. Use these directions to install Node. You do not need a web server (like Apache web server or Nginx) to be installed.
2. Go to any given directory on the Linux server. Run these four commands and respond to their prompts as you see fit*:
sudo openssl genrsa -out key.pem
sudo openssl req -new -key key.pem -out csr.pem
sudo openssl x509 -req -days 9999 -in csr.pem -signkey key.pem -out cert.pem
sudo rm csr.pem
3. In the same directory create a new file named test.js with the following content:
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert.pem')
};
var a = https.createServer(options, function (req, res) {
res.writeHead(200);
res.end("hello world\n");
}).listen(8000);
// Code taken from https://docs.nodejitsu.com/articles/HTTP/servers/how-to-create-a-HTTPS-server/
4. Run this command "node test.js"
5. Open a second terminal to your Linux server. Run this command: curl -k https://127.0.0.1:8000
You'll see "hello world". You are now done. Be advised that the -k flag defeats the ssl certificate requirement. From the client server you could upload the .crt file to /etc/ssl/certs/ca-certificates.crt. Then the -k flag should not be necessary with the curl command to access the JavaScript web page.
6. Optional step if you do not want to do step #5:
You can open a web browser and go to this url (where x.x.x.x is the external IP address of the Linux server): https://x.x.x.x:8000
In Chrome you will have to click "Advanced" to accept an exception as the certificate will not be valid.
You'll see "hello world".
* OpenSSL (or openssl commands) use TLS. The openssl man page (as taken from a Linux server) says this: "OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) network protocols and related cryptography standards required by them."
Problem scenario
You have installed Chef server on a RedHat Enterprise Linux (RHEL) server in AWS. You have installed Chef client on another RHEL instance in AWS. You simply want your Chef client to receive configuration management changes (e.g., you want Chef recipes to work). The command "chef node list" on your Chef client server returns no servers. You ran this command from the Chef client:
sudo chef-client -S https://<FQDN of Chef server>/organization/contint
But you received an error like this:
Chef encountered an error attempting to create the client "<FQDN of Chef Client computer>"
================================================================================
System Info:
------------
chef_version=13.4.19
ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
program_name=chef-client worker: ppid=5156;start=14:10:31;
executable=/opt/chef/bin/chef-client
[2017-09-13T14:10:31+00:00] WARN: *****************************************
[2017-09-13T14:10:31+00:00] WARN: Did not find config file: /etc/chef/client.rb, using command line options.
[2017-09-13T14:10:31+00:00] WARN: *****************************************
Starting Chef Client, version 13.4.19
Creating a new client identity for ip-172-31-10-187.us-west-1.compute.internal using the validator key.
[2017-09-13T14:10:32+00:00] ERROR: SSL Validation failure connecting to host: <FQDN of Chef server> - SSL_connect returned=1 errno=0 state=error: certificate verify failed
[2017-09-13T14:10:32+00:00] ERROR: SSL Validation failure connecting to host: <FQDN of Chef server> - SSL_connect returned=1 errno=0 state=error: certificate verify failed
Running handlers:
[2017-09-13T14:10:32+00:00] ERROR: Running exception handlers
[2017-09-13T14:10:32+00:00] ERROR: Running exception handlers
Running handlers complete
[2017-09-13T14:10:32+00:00] ERROR: Exception handlers complete
[2017-09-13T14:10:32+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 01 seconds
[2017-09-13T14:10:32+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
You examined /var/chef/cache/chef-stacktrace.out. It shows
"OpenSSL::SSL::SSLError: SSL Error connecting to https://<FQDN of Chef server>/organization/contint/clients - SSL_connect returned=1 errno=0 state=error: certificate verify failed
...
>>>> Caused by OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed"
On the Chef server you could not find a "trusted_certs" file or folder besides these:
"/opt/opscode/embedded/lib/ruby/gems/2.2.0/gems/berkshelf-5.6.5/spec/data/trusted_certs
/opt/opscode/embedded/lib/ruby/gems/2.2.0/gems/chef-12.19.36/spec/data/trusted_certs
/opt/opscode/embedded/service/gem/ruby/2.2.0/gems/chef-12.19.36/spec/data/trusted_certs
/opt/chef-manage/embedded/lib/ruby/gems/2.3.0/gems/berkshelf-6.1.0/spec/data/trusted_certs
/opt/chef-manage/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/spec/data/trusted_certs
/opt/chef-manage/embedded/service/gem/ruby/2.3.0/gems/chef-11.16.2/spec/data/trusted_certs
/opt/opscode-push-jobs-server/embedded/lib/ruby/gems/2.2.0/gems/chef-12.13.37/spec/data/trusted_certs
/opt/opscode-push-jobs-server/embedded/service/gem/ruby/2.2.0/gems/chef-12.12.15/spec/data/trusted_certs
/opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/berkshelf-6.3.1/spec/data/trusted_certs
/opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.3.42/spec/data/trusted_certs"
On the chef server a run of "knife ssl fetch" does not fix the problem. How do you solve this problem so your Chef client can register with the Chef server and eventually work?
Solution
The command "chef node list" may not work if ChefDK is installed. Use "knife node list" instead (from a workstation with knife or the Chef sever itself). To see if ChefDK is installed, run "chef -v". If ChefDK is not installed on the Chef server, keep reading.
On the Chef client, create a client.rb file in /etc/chef/ directory. Here is a minimal example (with just three lines) that you could modify and adapt to your own needs:
chef_server_url 'https://<FQDN of Chef server>/organizations/contint'
validation_client_name 'contint-validator'
ssl_verify_mode :verify_none
Replace <FQDN of Chef Server> with the FQDN of the Chef server. Replace "contint" with your organization name (e.g., the company nickname). Now this command from your Chef client should work:
sudo chef-client -S https://<FQDN of Chef server>/organization/contint
Now "chef node list" should work from Chef server.
Problem scenario
You want to find the resource groups in your Azure account. Either you have already installed Azure PowerShell on Windows 7 or on Windows 10 you have installed the Azure modules. You have connected to an Azure account (e.g., with this command Login-AzureRMAccount). What is the PowerShell command to list the resource groups in the Azure account?
Solution
Run this command:Find-AzureRmResourceGroup
# It will work with the Azure Cloud Shell too.
Problem scenario
You are not sure if Apache Parquet has been installed on your Linux server.
Solution
Run this command:
parquet --help
# This assumes you have logged out and logged back in after installing it. It assumes that the parquet exe is in the PATH environment variable too.