Using PowerShell Version 3, How Do You Determine If a Port Is Open for a given IP Address?

Problem scenario
You are using Windows 7 and PowerShell version 3.  You want to test if a port is open to a given IP address.  (If you are using a modern version of PowerShell, use the Test-NetConnection command.)   How do you find out if a port of an IP address is open or not?

Solution
Use the PowerShell function Test-TCPPortConnection written by Jonathan Medd.  Every line of this code except the last line was taken from here.

How Do You Get Jenkins Running on Linux to Work With Windows Servers?

Problem scenario
You want your central Jenkins 1.651.1 server running on Linux to push down builds (or run jobs) on Windows servers.  When you try to connect Jenkins master to a slave server, you get an error message like this:

“ERROR: Access is denied. See http://wiki.jenkins-ci.org/display/JENKINS/Windows+slaves+fail+to+start+via+DCOM for more information about how to resolve this. org.jinterop.dcom.common.JIException: Message not found for errorCode: 0x00000005 at org.jinterop.dcom.core.JIComServer.init(JIComServer.java:”

You know the credentials and IP address are correct. 

How Do You Troubleshoot Mounting a cifs File Share when You Get an Error about “wrong fs type, bad option, bad superblock”?

Problem scenario:  You run this command on a Linux CentOS server:

sudo mount -t cifs -o user=jdoe //172.33.44.55/contintshare /mnt/windows-share

But you get this error:  “mount: wrong fs type, bad option, bad superblock on //172.33.44.55/contintshare, missing codepage or helper program, or other error (for several file systems (e.g., nfs, cifs) you might need a /sbin/mount.<type> helper program)”

What do you do?

Solution

The error message is not clear or helpful. 

How Can You Recursively Search Subdirectories in Linux For a File That Has a Specific Text Pattern?

Problem scenario:  How do you use the grep command to recursively search most subdirectories (excluding some directories) for a pattern?  You want to find a file with a string like this:

/var/lib/pgsql/data

You are not interested in the files in directory paths that have one or more parent (or any antecedent) directories named “proc” nor “sys”.  You want to list files that have the above pattern. 

How Do You Share Files Between an Oracle VirtualBox Linux Guest and a Windows Host without Using vboxsf?

Problem scenario:  You have Oracle VirtualBox running on a Windows 7 computer as the host.  You have a Linux CentOS guest supported by Oracle VirtualBox.  You want to have a file share that does not rely on vboxsf.  What do you do?

Solution
1.  On the Windows host desktop, create a folder.  For this example, we’ll use “foobar” for the name.

How Do You Give Internet Access to a Linux Guest of Oracle VirtualBox Running on a Windows Host?

Problem scenario:
You created a new Linux CentOS 7.x guest server using Oracle VirtualBox on a Windows host.  Your Windows machine has Internet access.  From the Linux Guest you try to ping a 8.8.8.8 but you get this message “connect: Network is unreachable.”

How do you give the Linux guest Internet access?

Possible Solution #1
1.  Using the GUI of the Oracle VirtualBox guest server,

How Do You Install and Configure Postgresql on a Linux CentOS 7 Server?

Problem scenario:  You have a Linux Centos 7.3 server.  You want to get Postgresql to work on it.  What do you do?

Solution
To get Postgresql working on a CentOS 7.3 server, do the following four commands as the root user:

yum -y install postgresql-server postgresql-contrib

postgresql-setup initdb

systemctl start postgresql

systemctl enable postgresql

#  To issue SQL commands,

How Do You Find The Default Gateway of Your Linux Server?

Problem scenarios:  Either you are using CentOS 7.x (and ifconfig is even not a command) or you are using ifconfig and different flags (like -v for verbose), but you cannot find the default gateway.  How do you know if you have a default gateway even configured on a Linux server?

Solution  The “ifconfig” command cannot show the default gateway.  To find the default gateway on your Linux server,

How Do You Troubleshoot Chef’s Knife Command When You Get An Error About “Failed to read the private key”?

Problem scenario:  You are using knife commands and getting errors.  For example, you try to run this: knife client list
As a result, you get this error:

“WARN: Failed to read the private key /root/.chef/continual.pem: #<Errno::ENOENT: No such file or directory @ rb_sysopen – /root/.chef/continual.pem>
ERROR: Your private key could not be loaded from /root/.chef/continual.pem
Check your configuration file and ensure that your private key is readable”

What should you do?