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. 

 » Read more..

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.

 » Read more..

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,

 » Read more..

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,

 » Read more..

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,

 » Read more..

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?

 » Read more..

How Do You Determine the Version of PowerShell That You Are Using?

Problem scenario: How do you find out what version of PowerShell you are using?

Solution
Run this command:  $PSVersionTable.PSVersion

 » Read more..

How Do You Troubleshoot The Linux Error “/sbin/mount.vboxsf: mounting failed with the error: Protocol error”?

Problem scenario:  You are trying to share files between your Windows desktop host of Oracle VirtualBox and a Linux guest virtual server.  You run this command:

mount -t vboxsf contint /mnt/windows-share

but you get this error:

“/sbin/mount.vboxsf: mounting failed with the error: Protocol error”

Solution
For the example command above that reproduces the error, the “contint” needs to match the “Name” value in what was configured in the Oracle VirtualBox Devices -Shared Folders -Shared Folder Settings window.

 » Read more..

How To Install CentOS Linux 7

Question:  How do you install CentOS Linux 7?

Solution
1.  Create a bootable .iso. 
2.  Insert the bootable media and boot to it.  If the media is a USB stick, boot the server to it.  For some BIOS you may need to press F12 during the splash screen after turning on the server/workstation.  When you in the boot menu, choose the device that has the bootable media.

 » Read more..

How Do You Determine the Repo ID When For The “reposync” Command?

Problem scenario:  Synchronizing yum repositories has a number of benefits.  In a secure environment, CentOS/RedHat/Fedora servers have no access to the Internet.  There are numerous valuable yum repos on the Internet.  Your network administrator may grant you temporary access to such an Internet repository.  You may go to the directory on a server on your network that you want to mirror a copy or house a non-updating copy of the repo locally. 

 » Read more..