How Do You Find a Linux Log That Was Modified in the past 10 Minutes?

Problem scenario:  In Linux, you want to view log activity captured recently.  Looking through all the logs in /var/log can take a great deal of time.  How do you correlate a recent event by finding log files that were modified in the past 10 minutes?

Solution
Run this command:
find /var/log -mmin -10

This command will find files in /var/log and its subdirectories. 

How Do You Use an .Ova File with Oracle VirtualBox?

Problem Scenario:  You downloaded an .ova file.  You want to create a virtual server (a clone) with this pre-configured OS.  How do you use Oracle VirtualBox to use this .ova file?

Solution
1.  Open Oracle VirtualBox
2.  Go to File -Import Appliance (or press Ctrl-i)
3.  Select the OVA file
4.  Click “Next”
5.  Now you are ready to start the VM.

How Do You Install Nginx on a CentOS/RHEL/Fedora Server?

Problem scenario
You want to install Nginx on a CentOS/RHEL/Fedora Linux server.  What do you do?

Solution
1.  Create a file here: /etc/yum.repos.d/nginx.repo

2.  It should have these five non-blank lines:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1

3.  Run these commands:

sudo yum -y update
sudo yum -y install nginx
sudo systemctl start nginx

How Do You Troubleshoot a C++ Program That Will Not Compile Due to Undefined Reference Errors?

Problem scenario: You try to compile a C++ program with gcc, but you get this output:

/tmp/ccj6eKDl.o: In function `main’:
q.cpp:(.text+0x14): undefined reference to `std::cout’
q.cpp:(.text+0x19): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)’
q.cpp:(.text+0x28): undefined reference to `std::cout’
q.cpp:(.text+0x2d): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)’
/tmp/ccj6eKDl.o: In function `__static_initialization_and_destruction_0(int, int)’:
q.cpp:(.text+0x55): undefined reference to `std::ios_base::Init::Init()’
q.cpp:(.text+0x6c): undefined reference to `std::ios_base::Init::~Init()’
collect2: error: ld returned 1 exit status

What do you do?

How Do You Troubleshoot Installing Oracle VirtualBox Guest Additions on a CentOS Server?

Problem scenario
You are running Oracle VirtualBox on a Windows host.  You have Linux CentOS guest server.  Guest additions fails to install.  You tried to run this script VBoxLinuxAdditions.run.  The run fails with an error saying “
check /var/log/VBoxGuestAdditions.log for details.”

You examined /var/log/VBoxGuestAdditions.log, and it said this:
“vboxadd.sh: failed: Look at /var/log/vboxadd-install.log to find out what went wrong.
vboxadd.sh: failed: Please check that you have gcc,

How Do You Permanently Change the Hostname of a Linux CentOS Server?

Problem scenario:  You edited the /etc/hosts file and the /etc/sysconfig/network file to have a new hostname. You used the “hostname newHostname” command (where newHostname is the desired new host name). You rebooted the server and the hostname is still localhost.localdomain. How do you configure the host name to be different?

Solution
None of the above steps were necessary for changing the hostname for the purposes of having the “hostname” command return a new hostname. 

How Do You Find the Network Interface Name of a CentOS 7.X Server That Will Connect to the Default Gateway of Your Network?

Problem scenario:  You want to find the name of the network interface that can connect to the default gateway on your Linux CentOS 7.x server.  Typical new deployments of CentOS 7.x using the minimal .ISO do not have the “route” utility nor the “ifconfig” utility installed.  How do you find the interface’s name (e.g., eth0) without using the “route” command? 

Solutions

Solution #1 (preferred)