Omnis Web Application Server on Linux

Aus MHC-Wiki

Wechseln zu: Navigation, Suche

Mainly there are 4 methods to do this:

  1. Logining in to a graphical console and start the Omnis webservice
  2. Running the X server by VNC, login remotely and start the Omnis webservice
  3. Running the X server by NX instead of VNC
  4. Running the Omnis webservice as a Linux service as described in technote 0011

This HowTo covers method #2 and #3. There will be an other HowTo for Method #4 soon.


Inhaltsverzeichnis

Install required Software

You will need a complete Linux setup with a working graphical userinterface like KDE or GNOME. I prefere Debian and Kubuntu. In addition you need:

  • xvnc
  • inetd or xinetd
  • apache 2 webserver
  • php and phpmyadmin if you want / need / like it

Install the Omnis Weservice

First download the webservice version you need / want, e.g:

wget ftp://ftp.omnis.net/Studio431/OmnisStudio/Server/Linux/Omnis-Studio-Webserver-4.3.1.i386.tgz

Unpack it in in /opt

cd /opt
tar xfz Omnis-Studio-Webservices-4.3.1.i386.tgz

This will result in a folder linke "os431web". Now set permissions:

chmod -R ogu+rw os43web

Create a run script:

cat > /opt/os431web/os.sh <<EOF
#!/bin/sh

export LD_LIBRARY_PATH=/opt/os431web

exec /opt/os431web/omnis
EOF

chmod +x /opt/os431web/os.sh

Create a Omnis user

Create a Omnis user by the command:

adduser omnis

Go to it's newly created home and prepare for VNC:

cd /home/omnis
mkdir .vnc

Create a VNC password. This password is requierd when you want to atatch to the VNC server.

vncpasswd .vnc/passwd

Make X Winodws remotely accessible by VNC

Enable XDMCP

KDE

Edit "kdmrc" and "Xaccess". On Debian and Ubuntu systems with KDE3 you will find it in /etc/kde3/kdm

kdmrc

[Xdmcp]
Enable=true
Port=177
Xaccess=/etc/kde3/kdm/Xaccess
Willing=/etc/kde3/kdm/Xwilling

Xaccess

localhost                                       #any host can get a login window
localhost               CHOOSER BROADCAST       #any indirect host can get a chooser

Restart "kdm". On Debian oder Ubuntu by: /etc/init.d/kdm restart

GNOME / XFCE

gdm.conf

Edit "gdm.conf". On Debian and Ubuntu systems you will find it in /etc/gdm

[daemon]
RemoteGreeter=/usr/lib/gdm/gdmlogin

[security]

[xdmcp]
Enable=true

[gui]

[greeter]

[chooser]

[debug]

Restart "gdm". On Debian oder Ubuntu by: /etc/init.d/gdm restart

If xfce4 is used in stead of Gnome a few more libraries are required:

apt-get install libgnomeui32 libgnomeui-0

Security

Unforunately XDM listens on *. Don't forget to firewall UDP 177 !

iptables -A input -p udp -i eth0 --dport 177  -j DROP
iptables -A input -p tcp -i eth0 --dport 6000 -j DROP

VNC with INETD

To start the VNC server you can use "inetd" or "xinetd". The advantage of "xinetd" is that you can restrict acces to the VNC server to localhost or anny other host. I prefere to restrict it to "localhost" and tunnel my VNC Sessions with SSH. This is more secure. You may set the parameters "geometry" and "depth" to values that fit you needs.

inetd

For "inetd" edit /etc/inetd.conf to contain the following line:

On Ubuntu

5900 stream tcp wait omnis /usr/bin/Xvnc Xvnc -inetd :1 -query localhost -geometry 1024x768 -depth 16 -dpi 92 -once passwordFile=/home/omnis/.vnc/passwd -extension XFIXES

On Debian

5900 stream tcp wait omnis /usr/bin/Xvnc Xvnc -inetd :1 -query localhost -geometry 1024x768 -depth 16 -dpi 92 -once passwordFile=/home/omnis/.vnc/passwd

xinetd

For "xinted" create a file e.g. named "omnis" in the folder /etc/xinted.d" with the following content:

On Ubuntu

service Xvnc
{
       type = UNLISTED
       disable = no
       socket_type = stream
       protocol = tcp
       wait = yes
       user = omnis
       server = /usr/bin/Xvnc
       server_args = -inetd :1 -query localhost -geometry 1024x768 -depth 16 -dpi 92 -once passwordFile=/home/omnis/.vnc/passwd -extension XFIXES
       port = 5901
}

On Debian

service Xvnc
{
       type = UNLISTED
       disable = no
       socket_type = stream
       protocol = tcp
       wait = yes
       user = omnis
       server = /usr/bin/Xvnc
       server_args = -inetd :1 -query localhost -geometry 1024x768 -depth 16 -dpi 92 -once passwordFile=/home/omnis/.vnc/passwd
       port = 5901
}

If you want to bind only to "localhost" to prevent direct remote connections to VNC for more security add the following line:

       bind = 127.0.0.1

Test it!

Direct

Try to connect to the VNC server. You shold get a KDE or GNOME login screen. Login as "omnis" user. Other users should be able to atatche to you sessesion simultaniousely. After you close the VNC session the "omnis" user stays loged in and the webservice stays online.

Via SSH

If you have choosen xinetd and told xinetd to bind VNC only to local host then you can connect to the VNC Server by a SSH tunnel. For Unix based client systems (Linux, Mac OS X) you simply can do this on the shell by:

ssh omnis@server.name -L5901:127.0.0.1:5901

Where "omnis" is a vaild user which can login by SSH, "server.name" ist the hostname or IP of your server, the first 5901 is the port VNC listens on on you server, 127.0.0.1 is localhost and the second 5901 is the local port on your client PC you direct you VNC viewer to connect to. Now login and simply stay loged in, direct you VNC viewer to localhost (127.0.0.1) and display 1. That should do the trick.

For Windows you can use putty for this. Tunneling setup for putty is described e.g. here in detail.

SSL Explorer - an other option

To securely access VNC you can also use SSL Explorer but the configuration is beyond this document.

http://sourceforge.net/projects/sslexplorer/


Alternate VNC Method

If you don't want to use "inetd" you can use a simpler method. The requirements are the same but with this method you do not need the "Make X Winodws remotely accessible by VNC" section at all. The rest also applies to this method.

Edit the file .vnc/xstartup or create it if it does not exist. Make it look like this:

#!/bin/sh 

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
startkde

You may use any other X startup command instead of "startkde".

Create a start scrtip for VNC:

cat > /usr/local/bin/startvnc <<EOF
#!/bin/bash

/usr/bin/vnc4server :0 -geometry 1024x768 -pixelformat rgb888
EOF

chmod +x /usr/local/bin/startvnc

Now login as user "omnis" by e.g. ssh and start the VNC server by:

startvnc

Now you sould be able to connect to the GUI by VNC.

NX

NX is more convenient and has all security options of SSH as it uses SSH for the connection. You can download NX a the Nomachine website. As usual i demonstrate this with Debian Packages:

Get it (version as to 2008/08/06):

wget http://64.34.161.181/download/3.2.0/Linux/nxclient_3.2.0-14_i386.deb
wget http://64.34.161.181/download/3.2.0/Linux/nxnode_3.2.0-11_i386.deb
wget http://64.34.161.181/download/3.2.0/Linux/FE/nxserver_3.2.0-13_i386.deb

And install it:

dpkg -i nxclient_3.2.0-14_i386.deb
apt-get install -f
dpkg -i nxnode_3.2.0-11_i386.deb
dpkg -i nxserver_3.2.0-13_i386.deb

At the server side thats all you have to do. The NX client is available for all major Plattforms for free at the Nomachin Website. What to do after installation you can see at my NX Client HowTo.

Webservice configuration

Omnis Webclient Server

First create a menuentry for the Omnis Webclient Server:

cat > /usr/share/applications/omnisWeb.desktop <<EOF
[Desktop Entry]
Name=Omnis 4.3.1 Webservice
Comment=Omnis 4.3.1 Webservice
Exec=/opt/os431web/os.sh
Icon=/opt/os431web/studio.png
Terminal=0
Type=Application
Encoding=UTF-8
Categories=Development;Application;
EOF

Now you should find Omnis Webclient Server in you system menu. If not log off and relog on. Now you should be able to start it an enter you license data.

Webserver

Apache configuration with the Omnis Apache modul (recomended)

Using the "Debian method" create 2 files:

/etc/apache2/mods-available/omnis.load

LoadModule omnis_module /opt/os43web/webserver/apache22/mod_omnis.so

/etc/apache2/mods-available/omnis.conf

#
# Configuration file for Omnis Module
#
<IfModule mod_omnis.cpp>
   <Location /omnis_apache>
       SetHandler omnis-apache
   </Location>
</IfModule>

And the create symlinks to activate the module:

cd /etc/apache2/mods-enabled
ln -s ../mods-available/omnis.* .

Restart Apache.

Apache configuration with the Omnis CGI (NOT recomended)

This is not revomended as the Apache module is knowen to be mtuch faster. To use this create a symlink on "nph-omniscgi" to the server CGI folder, e.g. /usr/lib/cgi-bin on Debian:

ln -s /opt/os431web/webserver/cgi/nph-omniscgi /usr/lib/cgi-bin

Restart Apache.

Web site integration

for the Apache module veriosn use: /omnis_apache
(Or what ever you've set the "Location" tag in the Apache configuration to.)

for the CGI version use: /cgi-bin/nph-omniscgi

Static HTML for the module version:

<html><head><title>YOUR GREAT APP</title></head>

<body bgcolor="#ffffff">
<!-- Enter the correct values below for OmnisServer, OmnisLibrary, OmnisClass, -->
<!-- WebServerURL, WebServerScript for both platforms and browsers. -->
<center>
<!-- Use for Microsoft -->
<!-- ActiveX object START-->
<object classid="clsid:13510606-30FA-11D2-B383-444553540000" height="750" width="1000">
  <param name="_Version" value="65536">
  <param name="_ExtentX" value="7161">
  <param name="_ExtentY" value="7373">
  <param name="_StockProps" value="0">
  <param name="OmnisServer" value="5912">
  <param name="OmnisLibrary" value="yourlib">
  <param name="OmnisClass" value="yourclass">
  <param name="WebServerURL" value="http://127.0.0.1">
  <param name="WebServerScript" value="/omnis_apache">

<!-- Netscape object START-->
<embed type="application/OMNIS-RCC-plugin" name="rcc1" width="1000" height="750" OmnisServer="5912" OmnisLibrary="yourlib" OmnisClass="yourclass" WebServerUrl="http://127.0.0.1" WebServerScript="/omnis_apache">
<!-- Netscape object END-->
</object>
<!-- ActiveX object END-->

<script>
var embed = document.embeds[0];
</script>
</center>
</p>
</body></html>


!! D R A F T !! U N T E S T E D !!

If you have installed PHP you may want to use the PHP script written by Michael Hufschmidt. The file OmnisWebClass is required and will be included in the main script:

<html>
<head>
<title>Omnis Studio Webinar</title>
</head>
<body bgcolor="#FFFFFF">

<h1>Rich Internet Applications with the Omnis Web Client Technology<h1>

<h3>To use this page, you need to install the Omnis Web Client Plug-in into your browser.<br>You can obtain it from <a href="http://www.omnis.net/download/webeval.html" target="_blank">here</a></h3>

<hr noshade size="3">
<h3>Display <a href="webinar.php">rfAlbums</a> or <a href="webinar_test.php">rfTest</a></h3>
<p>Omnis Plug-in starts here</p>
<?php
  $phplib = '/srv/www/htdocs/phpsub';  // Linux PCs
  set_include_path(get_include_path() . PATH_SEPARATOR . $phplib);
  require_once('OmnisWebClass.php');
  $ub = new OmnisWebClass('webinar.ini', 'rfAlbums');
  $ub->display_plugin();
?>

<p>Omnis Plug-in ends here</p>

<hr noshade size="3">
<p> </p>

<img src="omnis_ria.gif" width="717" height="693" border="0" alt="">
</body>
</html>

You also need a ini file for configuration:

; ini - File for Webinar / Omnis Test
; Version for Voyager
; Autor: Michael Hufschmidt
; First created 2008-05-29, last modified  2008-05-29
WebServerURL_int = http://127.0.0.1
WebServerURL_ext = http://www.rainingdata.de
WebServerScript = /cgi-bin/nph-omniscgi
OmnisServer = 127.0.0.1
OmnisPort = 5912
OmnisLibrary = TEST
OmnisClass = rfAlbums
OmnisWidth = 560
OmnisHeight = 480

References

KDE: http://ubuntuforums.org/showthread.php?t=259448

GNOME: http://ubuntuforums.org/showthread.php?t=197964

XVNC: http://www.linuxcertif.com/man/1/Xvnc4/

XINETD: http://www.xinetd.org/

Nomachine: http://www.nomachine.com

Technote 0011: http://www.omnis.net/technotes/tnwe0011.html

Persönliche Werkzeuge
Navigation