RHEL / OEL 6 DVD als yum-Repository verwenden

Welcher Linux Administrator kennt das Problem nicht, nach der Installation von Linux sollen einzelne RPM-Pakete nachinstalliert werden. Aufgrund der vielen Abhängigkeiten zwischen den Paketen ist der direkte Einsatz des Tools rpm oft mühsam. Hier hat sich der yum-Einzeiler "yum install PACKAGENAME" bewährt.

In so mancher Firmenumgebung steht aber leider nicht direkt ein YUM-Repository zur Verfügung und die Server haben meist keinen Internetzugang. YUM kann die Installations-DVD mit ein wenig Nachhilfe auch direkt als Repository verwenden. Hier am Beispiel für Oracle Enterprise Linux 6 dargestellt (die DVD wurde unter /mnt gemountet):

[root@centos6 ~]# cd /mnt
[root@centos6 mnt]# cp media.repo /etc/yum.repos.d/
[root@centos6 mnt]# vi /etc/yum.repos.d/media.repo

In der Datei muss noch ein entsprechender Eintrag für den Parameter baseurl aufgenommen werden. In diesem Fall also:

baseurl=file:///mnt

JRockit Virtualization Edition

Ab heute gibt es Oracle WebLogic Server on JRockit Virtualization Edition als Download. Vor ein paar Wochen gab es bereits ein Meldung bei heise.de zu neuen Java-Virtualisierungswerkzeugen von Oracle - Oracle präsentiert Java-Virtualisierungswerkzeuge. Die technische Basis für dieses Produkt wurde Ende 2006 von der Firma BEA als Liquid VM angekündigt (theserverside.com - JRockit's Liquid VM could be the first real Java OS). Hinter der JRockit Virtualization Edition steckt der Ansatz eine Java VM direkt auf virtualisierter Hardware, ohne Betriebssystem-Schicht, laufen zu lassen. Einen ähnlichen Ansatz stellt das Projekt JNode.org (Java New Operating System Design Effort) dar.

Oracle liefert die JRockit Virtualization Edition zusammen mit Weblogic als 370 MB grosses Zip-File. Darin sind folgende Dateien enthalten:

# unzip -t wlsvePackage.zip 
Archive:  wlsvePackage.zip
    testing: wlsve/                   OK
    testing: wlsve/system.img         OK
    testing: wlsve/vm.cfg             OK
    testing: wlsveimagetool.jar       OK
    testing: README.txt               OK
    testing: wlsve_medrec_domain_with_odb.pdf   OK
    testing: THIRDPARTYLICENSEREADME.txt   OK

Hauptbestandteil ist das Disk-Image system.img

$ qemu-img info wlsve/system.img 
image: wlsve/system.img
file format: raw
virtual size: 1.0G (1073741824 bytes)
disk size: 1.0G

Als Dateisystem wird in diesem Disk-Image ext2 verwendet, die Disk lässt sich daher unter Linux ohne Schwierigkeiten direkt mounten.

# mount -o loop wlsve/system.img /mnt
# cd /mnt
# ls -l
total 20
drwx------ 8 root root 4096 2010-04-14 02:48 application
drwx------ 3 root root 4096 2010-04-14 02:49 boot
drwx------ 8 root root 4096 2010-04-14 02:49 jrockitve
drwx------ 2 root root 4096 2010-04-14 02:48 lost+found
-rw------- 1 root root  361 2010-04-14 02:49 VERSION

Für den Betrieb einer Virtuellen-Maschine mit JRockit VE wird eigentlich Oracle VM benötigt. In einem ersten Test ließ sich das Disk-Image aber auch in einer normalen Xen-Umgebung booten. Hierzu wurde die Konfigurations-Datei vm.cfg mit folgendem Inhalt versehen:

name="wlsve01"
bootloader="/usr/bin/pygrub"
memory=1024
disk=['tap:aio:/var/nfs/system.img,sda1,w']
vif=['bridge=xenbr0']

Der Start der Xen-Domain erfolgt dann wie gewohnt mit den entsprechenden Xen-Befehlen.

# xm create -c vm.cfg

Access MySQL Databases with Oracle HSODBC

Sometimes you need to access data stored in an different RDBMS like MySQL. Oracle provides an convenient way to access external data-sources via ODBC. To use Oracle HSODBC you can follow my step-by-step notes:

  • Install unixODBC and the MySQL ODBC Driver
    For Fedora Core 6 I installed the following RPMs:

    • unixODBC-2.2.11-7.1
    • mysql-connector-odbc-3.51.12-2.2
  • Configure /etc/odbc.ini
    [ODBC Data Sources]
    TimeSheetTest = MySQL ODBC PHP.TimeSheetTest DSN
    
    [TimeSheetTest]
    Driver       = /usr/lib/libmyodbc3.so
    Description  = MySQL ODBC 3.51 Driver DSN
    SERVER       = localhost
    PORT         = 3306
    USER         = root
    Password     = SECRET
    Database     = timesheet
    OPTION       = 3
    SOCKET       =
    
  • Test the ODBC Connection via isql
    [frank@w0004]$ isql TimeSheetTest
    Connected!
    sql-statement
    help [tablename]
    quit
    SQL> 
    
  • Oracle Configuration
    First ensure that the shell environment used to start the Oracle listener includes the following
    environment variables:

    export ODBCINI=/etc/odbc.ini
    export ODBCSYSINI=/etc
    

    To integrate that ODBC connection into Oracle you have to edit several configuration files:

    $ORACLE_HOME/hs/admin/initTimeSheetTest.ora

    HS_FDS_CONNECT_INFO = TimeSheetTest
    HS_FDS_TRACE_LEVEL = off
    HS_FDS_SHAREABLE_NAME = /usr/lib/libmyodbc3.so
    

    $ORACLE_HOME/network/admin/listener.ora

    ...
    SID_LIST_LISTENER =
    ...
        (SID_DESC =
          (PROGRAM = hsodbc)
          (ORACLE_HOME = /opt/oracle/ora10g)
          (SID_NAME = TimeSheetTest)
          (ENVS=LD_LIBRARY_PATH = /usr/lib:/opt/oracle/ora10g/lib)
        )
      )
    ...
    

    $ORACLE_HOME/network/admin/tnsnames.ora

    ...
    TIMESHEET = (DESCRIPTION = 
        (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)))
        (CONNECT_DATA = (SID= TimeSheetTest))(HS=OK)
      )
    ...
    
  • Test the Configuration with tnsping
    $ tnsping timesheet
    
    TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 05-SEP-2007 18:26:16
    
    Copyright (c) 1997, 2005, Oracle.  All rights reserved.
    
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
    (HOST = localhost)(PORT = 1521))) (CONNECT_DATA = (SID= TimeSheetTest))(HS=OK))
    OK (10 msec)
    
  • Create an Oracle Link in your Oracle Database instance
    SQL> CREATE PUBLIC DATABASE LINK timesheet
      CONNECT TO "root" IDENTIFIED BY "SECRET" USING 'TIMESHEET';
    

Please note that MySQL is case-sensitive on tablenames, so you have to use:

SQL> select * from "timesheet_times"@timesheet;
...

Oracle SQLPlus / Unix Shell Script interaction

Sometimes you need interaction between between sqlplus and unix shell scripts, like passing some shell variables to sqlplus or executing shell scripts based on the output of an SQL-Select statement.

I used the following demo table:

[frank@w0004 ~]$ sqlplus /nolog
SQL> connect foo/bar
SQL> create table foobar (line varchar2(20));
SQL> insert into foobar values('test1');
SQL> insert into foobar values('test2');
SQL> insert into foobar values('test3');
SQL> commit;

And here comes the shell script I used:

#!/bin/bash
username=foo
password=bar

sqlplus -s /nolog << EOF | grep -v 'Connected' > tmpout.txt
set pagesize 0 feedback off verify off head off echo off
connect $username/$password
whenever sqlerror exit 1
select line from foobar;
exit;
EOF

if [ -f tmpout2 ]; then 
  rm tmpout2.txt 
fi

for i in `cat tmpout.txt`; do
sqlplus -s /nolog << EOF | grep -v 'Connected' >> tmpout2.txt
set pagesize 0 feedback off verify off head off echo off
connect $username/$password
whenever sqlerror exit 1
select * from foobar where line = '$i';
exit;
EOF
echo $i "row";
done

Cyrus 2.3.8 and Thunderbird 2.0 ACL Problem

I am currently moving my IT infrastructure to a new server. That included also an switch to Cyrus IMAP 2.3.8 - which comes with Fedora Core 6. After an smooth and short move I have seen - so far - on problem in combination with Thunderbird 2.0. I could move mails to the trash, but all "Delete Mail" buttons are disabled. :-(

It turned out that Cyrus 2.3.8 has a few more ACLs and to resolve that issue I had to add those ACLs to my mailboxes. You have a lot of users with many mailboxes? Jo Rhett has posted a short Perl-Script on the info-cyrus maillinglist http://lists.andrew.cmu.edu/pipermail/info-cyrus/2007-April/025878.html.