My Thoughts On …

February 29, 2008

Oracle support for with Red Hat PHP rpms

Filed under: Linux, Tips & Tricks — admin @ 3:04 pm

For this you will need to get the Oracle instant client and the OCi8 pecl package.

Install Apache, PHP, the Oracle instant client, MySQL support if you want it and packages to build from source code.

yum install httpd php php-mysql php-pear php-develyum groupinstall “Development Tools”

Add the library config for php

echo extension=oci8.so > /etc/php.d/oci8.ini

Add the Oracle instant client to dynamic linker

echo /usr/include/oracle/VERSION/client > /etc/ld.so.conf.d/oracle_client.conf
ldconfig -v

Untar the PECL package and prepare it for compiling

tar -xzvf oci-VERSION.tgz
cd oci-VERSION
phpize

Configure the PECL package as a shared object using the instant client and specifing were the Oracle client libraries are. Then build and install it.

./configure –with-oci8=shared,instantclient,/usr/lib/oracle/VERSION/client/lib
make
make install

Start Apache

service httpd start

Create a php info page and checked to see if oci8 is there

echo <? phpinfo(); ?> > /var/www/html/phpinfo.php

December 21, 2007

SSH key pair setup

Filed under: Automation, Linux — Tags: — admin @ 12:20 am

Generate the key
To generate the key run the following command as the user you want the public/private key pair to work for
/usr/bin/ssh-keygen

This will ask you three questions:
Enter file in which to save the key (/home/USER/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

For the first question just hit enter so the private key will be saved in the users home directory. The second and third question will determine if anything will need to be entered at login. If this is for a “role” account that will run commands via ssh you should just hit enter for both questions. If you want to type a pass phrase each time you login, type it in at this time. Once you have answered all three question a public/private key pair will produced and put in the directory of the first question. When you look in this directory you will see two files, id_rsa and id_rsa.pub. The file with the .pub is the public key; never distribute the private key.

Distribution of the public key
As the user the key pair will be used for and from the server where the private key is located, copy the public key with scp:
/usr/bin/scp /home/USER/.ssh/id_rsa.pub remote.server:~/.

Once the public has been copied over, login in to the server. Check for the /home/USER/.ssh directory and make sure the perms are set to 700 or drwx——. If the directory does not exist create it with this command
/bin/mkdir -m 700 /home/USER/.ssh

Now we need to get the public key information into /home/USER/.ssh/authorized_keys with this command
/bin/cat /home/USER/id_rsa.pub >> /home/USER/.ssh/authorized_keys

If the authorized_keys file was there already make sure the perms for the file are set to 644 or -rw-r–r–. Now logout of the server and then relogin. If everything has been setup correctly you should get in with out typing anything, if you left the pass phrase section blank, or by typing in your passphrase.

Powered by WordPress