CentOS networking not active after installation

I needed to install a CentOS 6.4 server in a VM and after installing I was not able to hit anything on the Internet, or any network for that matter.  When I tried using the yum packages manager I received the error “Couldn’t resolve host ‘mirrorlist.centos.org…” and I was at a loss on what to do next.  I was not able to ping anything.

This led me to look into the networking and and upon opening the /etc/resolv.conf I found it totally empty.  So I then opened /etc/sysconfig/network-scripts/ifcfg-eth0 and found the issue.  The line “ONBOOT” was set to “no”.

The complete file /etc/sysconfig/network-scripts/ifcfg-eth0 after I altered it: (NOTE: the only thing I altered was the ONBOOT flag.)

DEVICE=eth0
HWADDR=09:00:27:D7:61:8D
TYPE=Ethernet
UUID=q93perfj-earf-ewrf-wqer-546877145475
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp

After changing “ONBOOT” to “yes”, then rebooted for the configuration to take effect, all is good now.  I probably could have simply done a networking restart, but reboot on a fresh system was pretty fast.

Get SSL running on Apache (CentOS)

I was playing with a new virtual server that had CentOS installed on it recently, and wanted to get SSL working for Apache.  Since I was only setting up a development server I really didn’t need to purchase a certificate and decided to use a self-signed certificate.  Here is what I did:

First I needed to get ‘make’ and ‘mod_ssl’ running to allow for this. (I use sudo but you could login as su)

sudo yum install make
sudo yum install mod_ssl

Next I did the following steps:

  1. Go to /etc/pki/tls/certs
  2. Run the command sudo make mycert.pem
  3. Enter the information you are prompted for about country, state, city, host name etc, your certificate and key has been created
  4. Now edit /etc/httpd/conf.d/ssl.conf and update the following items:
    • SSLCACertificateFile /etc/pki/tls/certs/mycert.pem
    • SSLCACertificateKeyFile /etc/pki/tls/mycert.pem
  5. I was forced to create a symbolic link for the SSLCACertificateKeyFile as follows: (I think this was supposed to happen automagically.)
    • I went to /etc/pki/tls and created the symbolic link using the next line.
    • sudo ln -s certs/mycert.pem mycert.pem
  6. Restart Apache (/etc/init.d/httpd restart)

There, now you have a self-signed certificate for your apache virtualhosts.

Adding mssql capability to PHP5 on CentOS

I had a need to connect to MSSQL using PHP version 5 from a CentOS 5 server. To do this I needed FreeTDS and the module mssql in PHP. After a diligent search I found that there was no quick and easy way to install the mssql module, like “up2date install php-gd” to get GD to work from PHP.

I found a few places that had ideas and hints to make this work, but finally used the directions I found at http://www.howtoforge.com/installing_php_mssql_centos5.0 (slightly altered to fit my means) and will duplicate here so I can easily find it later.

At first I thought I needed to recompile PHP, but as it turned out I only needed to pre-compile it so that I could fetch the mssql.so, and then manually edit the php.ini to use it.

Continue reading Adding mssql capability to PHP5 on CentOS