Ahoy there! This is my personal blog which I use as my memory extension and a medium to share stuff that could be useful to others.

There are PHP applications which use MSSQL as the back-end database and such applications require FreeTDS to enable PHP code interface with MSSQL. This article describes how to install PHP and FreeTDS on Linux hosts.

To compile or not?: Typically, it is recommended to use package managers like yum to install software on Linux platforms. Using package managers facilitates installation and administration (e.g. updates) of the software. However, when the software requires special options to be set or modules/extensions to be enabled, it may be difficult to obtain software built to suit those requirements. In such cases, it will be required to compile the software from its source. If compiling, then it will be prudent to organize all compiled software in standard locations on the host.

Given below are the implementation steps that were used for installing PHP 5.3.3 and FreeTDS 0.91 on RHEL 6.2.

NOTE: All commands in the examples below must be executed with root privileges, unless otherwise stated.

STEP 1: Create Installation Directory Structure

  • Use the following commands to create an appropriate directory structure for compiled software:
mkdir /opt/src
  • Use a standard location (e.g. /opt) to install all software compiled from source to facilitate administration (re-compilation, removal, etc.)

STEP 2: Download and Unpack Software Source

  • Download software sources (typically *.tar.gz files) and place them in /opt/src
  • Unpack source software (*.tar.gz) as per the following examples:
tar xfz php-5.3.3.tar.gz
tar xfz freetds-0.91.tar.gz

The above commands will create directories /opt/src/php-5.3.3 and /opt/src/freetds-0.91

STEP 3: Compile and Build FreeTDS

Compile and build FreeTDS as per the example below:

cd /opt/src/freetds-0.91
./configure --prefix=/opt/freetds-0.91
make
make install

NOTE: In order to facilitate administration, you may create a soft link as follows:

cd /opt
ln -s freetds-0.91 freetds

STEP 4: Compile and Build PHP

Compile and build PHP as per the example below:

cd /opt/src/php-5.3.3
./configure --prefix=/opt/php-5.3.3 --with-config-file-path=/opt/php-5.3.3
make
make install

NOTE: In order to facilitate administration, you may create a soft link as follows:

cd /opt
ln -s php-5.3.3 php

STEP 5: Compile and Build the PHP Sybase Extension

PHP requires the sybase_ct extension to allow PHP code to interface with MSSQL. You may compile and build the sybase_ct extension as follows:

cd /opt/src/php-5.3.3/ext/sybase_ct
sh ../../scripts/phpize
./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config --with-sybase-ct=/opt/freetds
make
make install

STEP 6: Enable the PHP Sybase Extension

Enable the sybase_ct extension by adding the following line to /opt/php/php.ini

extension=sybase_ct.so

STEP 7: Verify the PHP (with FreeTDS) Installation

If PHP and the sybase_ct extension have been successfully installed, you should be able to view the sybase_ct module when displaying the PHP configuration information as shown below:

Execute the following command (any user):

php -i | grep sybase_ct

If you see "sybase_ct" in the output, then it means that PHP and the sybase_ct extension have been successfully installed.

NOTE: Since PHP and FreeTDS have been compiled from source and installed in non-standard locations, you must add /opt/php/bin:/opt/freetds/bin to a user’s PATH environment variable.

VN:F [1.9.22_1171]
Rating: +2 (from 2 votes)

Problem:

The osad service does not start (RHEL 5.7) and throws the following error:

Starting osad: Unable to load module osad

Background & Analysis:

The osad service is required on all Red Hat Network Satellite clients to receive pushed actions from the RHN Satellite Server. For more details on the osad and related services, please refer this Spacewalk (open-source version of RHN Satellite) article.

Solution:

The osad service depends on the python-hashlibs package.

STEP 1: Install python-hashlibs

Install python-hashlibs as follows:

sudo rpm -ivh <package>

where <package>= the name of the python-hashlibs rpm

Refer the screenshot below:

osad-python-haslib-dep

NOTE: You may also use a "yum install" if python-haslibs is available in any of your your yum repositories.

(1) The solution above describes a successful problem-solving experience and may not be applicable to other problems with similar symptoms.

(2) Your rating of this post will be much appreciated as it gives me and others who read this article, an indication of whether this solution has worked for people other than me. Also, feel free to leave comments.

 

VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Installing software on RHEL platforms using yum is straightforward. However, based on your environment, there could be a few more steps to get there. So, here’s what I did to install Tomcat 6 on RHEL 6.2:

Environment:

OS: Red Hat Enterprise Linux Server release 6.2 (Santiago)

Yum Repos: Red Hat Enterprise Linux Server (v. 6 for 64-bit x86_64), RHN Tools for RHEL (v. 6 for 64-bit x86_64)

Implementation:

STEP 1: Install the Tomcat6 Web Servlet container

sudo yum groupinstall web-servlet

STEP 2: Enable the Tomcat6 service

sudo chkconfig tomcat6 on

STEP 3: Change ownership for the Tomcat6 resources

When tomcat6 is installed via STEP 1, a user and group with the same name (tomcat) is created. For security, the user is created without an interactive login shell (/sbin/nologin). So, in order to ensure that the application support individuals don’t require root privileges, you must do the following:

 

sudo chown -R tomcat:tomcat /usr/share/tomcat6
sudo chown -R tomcat:tomcat /etc/tomcat6/*

 

NOTE: By default, the tomcat user is created with umask 022 and so individual accounts will require sudo privileges to modify the resources owned by tomcat. This also ensures that all operations on tomcat resources are audited.

 

STEP 4: Test the Tomcat6 service

After doing STEPS 1-3, I started/stopped tomcat6 using the following commands:

sudo service tomcat6 start
sudo service tomcat6 stop

Tomcat6 started and stopped successfully (and http://localhost:8080 was accessible), but the following two messages in catalina.out bugged me:

INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib

SEVERE: destroyMBeans: Throwable javax.management.MalformedObjectNameException: Cannot create object name for org.apache.catalina.connector.Connector@290fd7f6 at org.apache.catalina.mbeans.MBeanUtils.createObjectName(MBeanUtils.java:764) at org.apache.catalina.mbeans.MBeanUtils.destroyMBean(MBeanUtils.java:1416)

.

The first INFO message was logged whenever tomcat6 was started and the SEVERE message was logged whenever tomcat6 was stopped.

Getting rid of the INFO message requires installing the Tomcat Native Library (see STEP 5) and it’s recommended that you do this for optimal performance (native code faster than Java bytecode).

Regarding the SEVERE message, it seems to have been fixed in Tomcat 6.0.25 ( refer Tomcat6 Bug ) and the version I installed using the above steps was 6.0.24. As this error is harmless, I’d wait for 6.0.25.

 

STEP 5: Install the Tomcat Native Library

Unfortunately, the standard RHEL yum repos used in our company (see Environment above) did not contain packages for the Tomcat Native Library. So, here’s what I did to install the library:

  • Install the pre-requisite packages
sudo yum install apr apr-devel java-1.6.0-openjdk-devel.x86_64 openssl-devel.x86_64

NOTE: I required only the above packages, but your requirement may vary based on your existing OS installation.

  • Download the tomcat native library from here
  • Execute the following commands:
# Extract downloaded tar
tar xvzf tomcat-native-1.1.22-src.tar.gz

# Configure
cd tomcat-native-1.1.22-src/jni/native
sudo ./configure \
--with-apr=/usr/bin/apr-1-config \
--with-java-home=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64 \
--with-ssl=/usr/include/openssl \
--prefix=/usr/lib64

# Make
sudo make

#Make Install
sudo make install

# The steps above installed the library in /usr/lib64/lib. As the default LD_LIBRARY_PATH 
#includes /usr/lib64, you may either change the path or set up links as shown below:

cd /usr/lib64
sudo ln -s lib/libtcnative-1.so.0.1.22 libtcnative-1.so
sudo ln -s lib/libtcnative-1.so.0.1.22 libtcnative-1.so.0

Successful installation of the Tomcat Native library will show something similar to the following in catalina.out when you start the tomcat6 service:

INFO: Loaded APR based Apache Tomcat Native library 1.1.22.

I observed that the Tomcat Native Library made quite an improvement to the tomcat6 server start time. Prior to installation, tomcat 6 started in about 144ms and after installation, it took only around 77ms!

VN:F [1.9.22_1171]
Rating: +23 (from 35 votes)

Red Hat Enterprise Linux (RHEL) cluster configuration file is /etc/cluster/cluster.conf

NOTE: Red Hat discourages direct editing of the cluster configuration file and recommends using the system-config-cluster GUI.

However, if you need to edit the file, here’s a method that works:

STEP 1: Edit the  Cluster Configuration file on any one node in the cluster

  • Open /etc/cluster/cluster.conf using your favourite editor amd make your required changes.
  • Ensure that you increment the config_version (in line 2) by 1. For example, if the config_version is 45, then make it 46.
  • Save and close the file

STEP 2: Update the cluster

Execute the following command (with root privileges) on the same node used in STEP 1:

ccs_tool update /etc/cluster/cluster.conf

The above command will display output similar to the following:

Config file updated from version 45 to 46

Update complete.

VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

At times, to meet performance requirements, you would want to disable file system journaling. Given below are steps to do so for an ext4 file system (e.g. /dev/sda1). These steps have been tested on RHEL 5.7). All commands are to be executed with root privileges:

STEP 1: Unmount the file system partition whose journaling you wish to disable

Use the following command to unmount the partition on /dev/sda1 (let’s say it’s /opt):

umount /opt

NOTE: The command used above is umount and not unmount.

STEP 2: Disable journaling for the file system

Use the following command to disable journaling for an ext4 file system:

tune4fs -O ^has_journal /dev/sda1

 

STEP 3: Perform a file system check

Use the following command to perform a file system check. This is not strictly required, but is recommended for checking file system integrity after disabling journaling:

e4fsck –f /dev/sda1

 

STEP 4: Reboot

You may use the following command to reboot the Linux OS:

shutdown –r now

 

STEP 5: Verify that the file system has journaling disabled and the partition is mounted

After the host has rebooted, you may use the following commands to check if journaling is disabled for the filesystem and the partition is mounted:

dmesg | grep EXT4

Expected output similar to: EXT4-fs (dm-3): mounted filesystem without journal

df -h

 

In order to re-enable journaling, repeat all the STEPS above, but without the ‘^’ in STEP 2.

VN:F [1.9.22_1171]
Rating: +17 (from 23 votes)
 Page 7 of 33  « First  ... « 5  6  7  8  9 » ...  Last »