How to Configure CentOS for Graphical X11 or Multiuser Mode on Boot

Sometimes when I install CentOS it does not start up in “graphical mode” – that is it starts up directly at the command prompt rather than automatically starting up X Windows. You can configure CentOS to start up in whatever mode you want including graphical mode by editing the file /etc/inittab. To change the startup mode of CentOS open that file with a text editor.

# nano /etc/inittab

The file should look like the following:

# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
id:3:initdefault:

As you can see, the file gives you the number-to-mode mapping at the top. All you need you do is change the number in the last line listed above. So for me I needed to change the 3 to a 5:

id:5:initdefault:

So my final /etc/inittab file looked like the following:

# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
id:3:initdefault:

Reboot your computer and it should now start up in whatever mode you specified.

Error When Compiling PHP in CentOS 64 Bit

Library files in CentOS 64 bit are stored in the directory /usr/lib64. But in normal 32 bit CentOS, library files are stored in /usr/lib so this causes a problem when trying to compile source code that looks for library files in /usr/lib. When using the default configure options for compiling PHP, the directory /usr/lib is searched for library files so if you have any 64 bit applications installed, their associated library files will not be found. For example, trying to compile PHP with the configure option:

--with-mysql=/usr

will result in the error:

/usr/bin/ld: cannot find -lmysqlclient

You can fix this MySQL error and other configure errors relating to library files not being found by adding the following option to the configure line:

--with-libdir=lib64

Code

How to Install VMWare Tools in CentOS 5

Install software needed by VMware Tools

1. Install packages to build the kernel modules

yum install gcc kernel-devel

2. Check the running kernel matches the kernel headers

uname -r             # running kernel
rpm -q kernel-devel  # installed kernel headers

3. If the two versions do not match, run

yum -y upgrade kernel kernel-devel
reboot

4. Find out where the kernel headers are (you may need this later)

ls -d /usr/src/kernels/$(uname -r)*/include

Prepare and install VMware Tools

1. From VMware Workstation: go to VM> Install VMware Tools

2. From the VM: mount the virtual cd drive

mount /dev/cdrom /mnt/

3. Extract VMware Tools to /tmp/

tar -C /tmp -zxvf /mnt/VMwareTools-5.5.3-34685.tar.gz

4. Unmount the virtual cd drive

umount /mnt

5. Now run the installer

cd /tmp/vmware-tools-distrib
./vmware-install.pl

6. When asked Do you want to run vmware-config-tools.pl?, answer “Yes”.

VMWare Infrastructure

CentOS – How to Configure the Software Update Application to Use a Proxy Server

To get the Software Update application in CentOS to use a web proxy server, add the following line to the /etc/yum.conf file:

proxy=http://www.theProxyServer.com:port/

Replace “www.theProxyServer.com:port” with the URL and port number of the proxy service running on the proxy server. The “/” at the end is important so don’t forget to add it.