Tag Archives | CentOS

My Debian/Raspberry Pi cheat sheet (translations from CentOS)

I have worked on Solaris and RedHat/CentOS (although Solaris was many years ago, so I  should just admit that I no longer know where anything is). I find Debian to be a different dialect than RedHat. This post is going to serve as my translation cheat sheet.

  1. I use the  bash complete string below with ssh and ping. It was not working under Debain. Turns out that the host names are hashed in the known_hosts files under Debian. I had to add “HashKnownHosts no” to my .ssh/config and then re-populate the known_hosts file.
    complete -W "$(sed -e 's/^  *//' -e '/^#/d' -e 's/[, ].*//' -e '/\[/d' ~/.ssh/known_hosts | sort -u)" ssh ping
  2. Debian on arm does not seem to have sysvconfig so I need to go into /etc/init.d/script name to start,stop,restart,status a service
  3. To stop a service from running at boot “update-rc.d -f smb remove” (chkconfig smb off)
  4. To start a service at boot “update-rc.d nfs defaults” (chkconfig nsf off)
  5. cat /etc/debian_version = cat /etc/redhat-release
  6. More to come

CentOS 6 in a VM – Console resolution

I can NEVER remember this, and every time I re-install CentOS in a VM I have to go searching.

If you want the console size to be larger in a vm add vga=791 (for 1024×768) to the end of the kernel line in /etc/grub.conf.

The VESA values (for linux) are here

How to add Gnome to a CentOS 6 minimal install

I have been using the minimal iso (CentOS-6.0-x86_64-minimal.iso) to install CentOS 6. I wanted to add a GUI to my vm, but I could not find easy documentation showing how to add a GUI, or Gnome in this case, to a CentOS 6 minimal install. I was not looking for the smallest X windows install, I was just trying to get the Desktop to function like it would as if I installed from the full DVD.

There are a lot of results of how to do this, but things have been renamed in CentOS 6, so that made it more difficult to figure out. Also, there are “Short Names” and I am assuming they are called “Long Names” associated with a yum groupinstall, which added to my confusion.

To add Gnome/GUI to a minimal CentOS 6 install run (short name version):

yum groupinstall basic-desktop desktop-platform x11 fonts

And the “long name” version:

yum groupinstall "Desktop" "Desktop Platform" "X Window System" "Fonts"

Hope that helps someone or at least help me to remember.

How to remove a machine from a RHN Satellite

I wanted to move a VM from a RHN Satellite back to the default Red Hat Network. I found these two files contained all the info:


I just moved them aside and ran rhn_register to re-register the system.

Then I ran “yum clean all” to make yum happy

Rebuild your the default CentOS yum.repo.d folder

On a dev machine, somehow, I managed to erase my yum.repo.d contents. I wanted to rebuild the repo files back to their default. First you need to figure out what version you are using:

  • cat /etc/redhat-release

Then visit the correct release at : http://vault.centos.org/

  • navigate to the correct os/x86_64/CentOS/ directory (could be os/x86_64/CentOS/ i386/)
  • Download the following files to the server:
    • wget http://vault.centos.org/5.x/os/x86_64/CentOS/centos-release-notes-5.x-0.x86_64.rpm
    • wget http://vault.centos.org/5.x/os/x86_64/CentOS/centos-release-5-x.el5.centos.x86_64.rpm
  • Then install the two rpms:
    • rpm -Uivh *.rpm
Should be back to the original shipping repo files.

php53 included in CentOS 5.6

I wish I read release notes, it would make my life easier. In my previous post, I was worried about CentOS 5.x not having a new enough version of PHP to run the soon to be release WordPress 3.2. Well, RedHat’s 5.6 release notes clearly say:

Version 5.3.3 of PHP is now available in Red Hat Enterprise Linux 5.6 as the separate php53 package

To move to the 5.3 version of PHP, I ran the following commands:

  • yum erase php\*
  • yum install php53 php53-gd php53-mysql php53-pdo php53-mbstring  php53-cli php53-devel php53-common php53-xml

That was easy.

CentOS, NTPD, VMware and sleeping.

I have a MacPro at home, and I am running VMware Fusion on it. At night, I sleep the machine to save electricity. I have a CentOS guest running and the time is always out of sync. After the VM is restored from sleep, the NTP service is no longer running and my time really drifts.

I finally sat down and tried to figure out my time sync issues on CentOS and VMware. This document explains it all. At the bottom they say you should turn off VMware tools time sync and use NTPD.

To install NTPD (with the recommended changes from the above document)

  1. yum install ntp
  2. chkconfig ntpd on
  3. sed -i 1i”tinker panic 0″ /etc/ntp.conf
  4. sed -i “s/^server\t127.127.1.0/#server\t127.127.1.0/g” /etc/ntp.conf
  5. sed -i “s/^fudge\t127.127.1.0/#fudge\t127.127.1.0/g” /etc/ntp.conf
  6. service ntpd start

The “tinker panic 0” is the most important part. Now when my VMware Fusion wakes and the CentOS guest powers on, NTP gets everything setup correctly.

CentOS Kickstart with local CDROM media and a “http config file”

At our NYC office, I have a PXE/Kickstart system setup. All I need to do is boot to PXE, and I can install CentOS with very little intervention. I have to choose Server vs Desktop (each choice points to a different http hosted kickstart cfg file.) and I have to setup my partitons how I want them.

Recently I was tasked to setup a new office in LA. I had taken a CentOS iso with me, but I wanted to use the standard config file (hosted over http) at the central office. Basically I wanted to use the local bits with a remote config file. I learned a couple fo things going through this exercise.

  1. It is not easy to serach for KickStart config file examples becasue KickStart is the name of the process and the name of the config file.
  2. When booting from an ISO, if you want use local bits with a remote KickStart config file, the command is
    • linux ks=http://url.server.com/
    • The kickstart file must have the directive: cdrom
    • you can not have both “url” and “cdrom” in the same file. It will use the first one it finds (or last, I do not remember which)
  3. You can not combine both command line parameters and a kickstart file – the KickStart file overrides. For example I used:
    • linux ks=http://url.server.com/ks.cfg method=cdrom and I did not have “cdrom” in the config file. The installer prompted me for media type.

The only way I could use local bits with a KickStart file, was to specify “cdrom” in the config file. Which means I had to have yet another option/config file= dekstop,server, server-cdrom.

WordPress 3.2 requirements and CentOS 5.6

Current requirements

  • PHP version 4.3 or greater
  • MySQL version 4.1.2 or greater

WordPress 3.2 requirements:

  • PHP version 5.2.4 or greater
  • MySQL version 5.0 or greater.

Default PHP on Cent0S 5.6 = PHP 5.1.6.


Updated: See this post on how to install an updated PHP on CentOS 5.6

Script to compare RPMs on two different CentOS servers

I wanted to make sure that the same RPMs were installed on several servers. I wasn’t worried about versions of RPMs because everything should be kept up to date via yum. So I sat down and wrote the script below. It has been on my ToDo list for quite a while!

RRPM=$(ssh $REMOTESERVER "rpm -qa --queryformat '%{NAME}\n'" )
LRPM=$(rpm -qa --queryformat '%{NAME}\n')

echo "*** Missing from $REMOTESERVER" ***
grep -vf <(echo "$RRPM"| sort) <(echo "$LRPM"|sort)
echo "*** Missing from Local system ***"
grep -vf <(echo "$LRPM"| sort) <(echo "$RRPM"|sort)

This script connects to a remote machine and compares RPMs installed there to the RPMs that are installed locally.