pátek 29. listopadu 2013

Ansys 5.7 license manager (windows based) on Linux

Our professional version of Ansys 5.7 has been bound to a license manager running on a windows NT server. Once mighty server rests in peace already, but our professional Ansys is worth to use. At least time to time.

Our license is based on serial number of hard disc, from which is the flexlm started. OK, wine emulator allows to specify the label and serial of its (virtual) disks.

Wine installation on CentOS 6.4 x86_64

Remark: use just zypper in wine on (open)SUSE. However, Ansys on CentOS is said to be "oficially supported". It does not apply to this case, I guess.
Wine is not part of the official repository tree. As a first step configure EPEL repository (thanks to this link ).
yum install wget
wget https://fedoraproject.org/static/0608B895.txt --no-check-certificate
mv 0608B895.txt /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
rpm -ivh http://mirror.slu.cz/epel/6/i386/epel-release-6-8.noarch.rpm

check success:
[root@localhost ~]# yum repolist
repo id     repo name                                         status
base        CentOS-6 - Base                                   6,381
epel        Extra Packages for Enterprise Linux 6 - x86_64    10,031
extras      CentOS-6 - Extras                                 13
updates     CentOS-6 - Updates                                1,555

install Wine:
[root@localhost ~]# yum install wine
Yum finds and installs a huge number of 32bit dependencies. 

License manager configuration

Run winecfg and specify Windows NT compatibility. In the Drives panel press Advanced options and specify the serial number of the disk C: (or use ~/.wine/drive_c/.windows-serial file containing the serial number)

copy flexlm directory to C: (.wine/drive_c)

┌┌<─ ~/.wine/drive_c/flexlm ───────────────────────────.[^]>┐
││'n               Name                │ Size  │Modify time │
││/..                                  │UP--DIR│Nov 29 01:19│
││/Intel                               │   4096│Apr 26  2004│
││ ansyslmd                            │      0│Nov 29 01:45│
││ ansyslmd.ini                        │     33│Apr 26  2004│
││ license.dat                         │    224│Nov 29 01:38│
││ license.log                         │   1351│Nov 29 01:45│
││ lmgrd.8                             │    144│Nov 29 01:45│
││ startup.log                         │    227│Nov 29 01:45│
││                                     │       │            │



startup.sh :
#!/bin/bash
cd ~/.wine/drive_c/flexlm
date >>startup.log
LOGF=license.log
mv -f $LOGF license.log-`date +"%F+%T"`
nohup wine Intel/lmgrd.exe -z >> $LOGF 2>>startup.log  &

Check the status (it takes some time to start up the server)
[root@plchova3 flexlm]# wine Intel/lmutil.exe lmdiag -c license.dat
lmutil - Copyright (C) 1989-2001 Globetrotter Software, Inc.
FLEXlm diagnostics on Fri 11/29/2013 11:06

-----------------------------------------------------
License file: license.dat
-----------------------------------------------------
"ansys" v2001.0630, vendor: ansyslmd
  License server: hostname
  floating license no expiration date


This license can be checked out
-----------------------------------------------------
or:
[root@plchova3 flexlm]# wine Intel/lmutil.exe lmstat -a -c license.dat

For shutdown:

[root@plchova3 flexlm]# wine Intel/lmutil.exe lmdown -c license.dat
lmutil - Copyright (C) 1989-2001 Globetrotter Software, Inc.
[Detecting lmgrd processes...]

   Port@Host            Vendors
1) 1057@hostname        ansyslmd 

Are you sure (y/n)?  y
    1 FLEXlm License Server shut down

Troubleshooting

  • check the drive serial number
    [root@localhost flexlm]# wine cmd
    
    CMD Version 1.4.1
    
    C:\flexlm>dir
    Volume in drive C has no label.
    Volume Serial Number is 70fa-1234
    
    Directory of C:\flexlm
    
    11/29/2013   1:45 AM  <dir>         .
    11/29/2013   1:19 AM  <dir>         ..
    11/29/2013   1:45 AM             0  ansyslmd
     4/26/2004   8:34 PM            33  ansyslmd.ini
     4/26/2004   8:23 PM  <dir>         Intel
    11/29/2013   1:38 AM           224  license.dat
    11/29/2013   2:05 AM         1,452  license.plchova.log
    11/29/2013   2:15 AM           144  lmgrd.8
    11/29/2013   1:45 AM           227  startup.log
           6 files                    2,080 bytes
           3 directories      7,727,013,888 bytes free
    

  • check the if hostname in the license.dat match the hostname, specify the same hostname in /etc/hosts
  • check the firewall settings. The two ports specified in the license file have to be opened fog incoming traffic
    SERVER hostname DISK_SERIAL_NUM=70fa1234 1057
    VENDOR ansyslmd PORT=1058
    
    INCREMENT ansys ansyslmd 2001.0630 permanent 1 3A8F12345678 \
     VENDOR_STRING=customer:00000001 SUPERSEDE ISSUED=24-May-2001 \
     START=03-Apr-2001
    
    
    The two ports are 1057 and 1058 in our case:
    iptables -A INPUT -m state -s $LAN --state NEW -m tcp -p tcp --dport 1057 -j ACCEPT
    iptables -A INPUT -m state -s $LAN --state NEW -m tcp -p tcp --dport 1058 -j ACCEPT
    
    or specify the corresponding rules in /etc/sysconfig/iptables (in CentOS).

pondělí 25. listopadu 2013

Ansys 5.7 on a recent linux workstation (openSUSE 12.3 x86_64 or CentOS6.5)

Some 15 years ago we have bought the professional version of ANSYS 5.7, from time to time somebody still uses it. Installation of such ancient sw is always challenging.


Prior the installation it is necessary to have uncompress installed; for openSUSE it is in gzip package, for CentOS use
yum install ncompress tcsh
The target environment is 64-bit openSUSE server. Installation script works in text mode (great!!) and works as expected. The license manager is running elsewhere, so  "Product only" installation has been performed. The license manager machine has to be included into the /ansys_inc/shared_files/licensing/ansyslmd.ini
SERVER=1057@flexlmserver.site
It seems, that the newer versions of ANSYS (v12.5, v14.0, v14.5) which are already installed in the tree /ansys_inc/ are untouched a working.

Let's try to start:
/ansys_inc/ansys57/bin/xansys57
Executing /ansys_inc/ansys57/bin/linuxia32/xans.e57
/ansys_inc/ansys57/bin/linuxia32/xans.e57: error while loading shared libraries: libXp.so.6: 
cannot open shared object file: No such file or directory


There is a few missing 32bit libraries, which have to be installed separately:
zypper in libXp6-32bit libXi6-32bit libGLU1-32bit 
yum -y install libXp.i686 lesstif.i686 libXi.i686 mesa-libGLU.i686

For openSUSE: The rare libXm.so.2 is included in the ANSYS installation:
rpm -ivh /ansys_inc/ansys57/syslib/OPENMOTIF/openmotif-2.1.30-2_ICS.i386.rpm
ln -sf /usr/X11R6/lib/libXm.so.2.1 /usr/lib/libXm.so.2

For CentOS: libXm.so.2 is included in lesstif
[root@hrabos ansys-5.7]# yum whatprovides  libXm.so.2
Loaded plugins: refresh-packagekit, replace
lesstif-0.95.2-1.el6.i686 : OSF/Motif library clone
Repo        : epel
Matched from:
Other       : libXm.so.2    .....

Now, /ansys_inc/ansys57/bin/xansys57 works well in a VNC environment.

Update, 2016-12-13
For CentOS 7:
lesstiff.rpm is available only in the 64 bit variant. Use corresponding package from the Fedora19 repository
rpm -ivh -force ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/releases/19/Fedora/i386/os/Packages/l/lesstif-0.95.2-5.fc19.i686.rpm

CentOS 6.0 inside virtual box machine

I have tried the fresh installation inside the VM:
Booting  from the image downloaded from http://mirror.centos.org/centos/6/isos/x86_64/ I came to state, where the installation program is running, but it does not react to keyboard (VirtualBox console running in VNC viewer).

So I have downloaded the pre-installed CentOS 6.0 base x86_64 image form http://sourceforge.net/projects/virtualboximage/files/CentOS/6.0/CentOS-6-x86_64.7z/download
The text mode boots up flawlessly. After login  ("reverse" is the root pw) the system seems to work well. However, the network interface is not recognized.

1. Change keyboard layout from Italian to standard (us)
- edit the /etc/sysconfig/keyboard

2. LAN interface:
change persistent rules for networking:

cd /etc/udev/rules.d
vi 70-persistent-net.rules
delete the old (foreign) network card and change names of your interfaces

change hwadress in /etc/sysconfig/network-scripts/ifcfg-eth0
to match the true hw addresses (specified in Virtual Box configuration)
and
reboot

For static IP address configuration: see link
however, add DNS info into  /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=7....          # get uuid using "uuidgen eth0"
ONBOOT=yes
NM_CONTROLLED=no    # no network manager on this device
BOOTPROTO=static
IPADDR= 123.123.20.123
NETMASK=255.255.252.0
DNS1=123.123.20.10
DNS2=123.123.12.1
DNS3=8.8.8.8
DOMAIN="my.site.gov"
PEERDNS="yes"       # i.e. create /etc/resolv.conf
GATEWAY=123.123.20.31
DEFROUTE=yes        # i.e. use GW as default GW
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=E0:69:95:xx:xx:xx

Secondary IP addres for the primary interface:
edit /etc/sysconfig/network-scripts/ifcfg-eth0:1
DEVICE=eth0:1
BOOTPROTO=static
IPADDR=192.168.0.5
NETMASK=255.255.255.0
ONBOOT=yes
To activate: ifup eth0:1 Thanks.

Add static default route to  /etc/sysconfig/network
GATEWAY=123.123.20.31
 
Secondary ethernet adapter is set up by DHCP, it serves for local connections only:
edit /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
TYPE=Ethernet
UUID=0...           # get uuid using "uuidgen eth1"
ONBOOT=yes
NM_CONTROLLED=no  
BOOTPROTO=dhcp      # get IP address using dhcp
DEFROUTE=no         # no default route
PEERDNS=no          # do not use DNS from dhcp server
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="USB eth1"

3. software
clear installation cache according to documentation, the fastest mirror plugin is already active

update the distribution:
yum update
reboot
then check
cat /etc/redhat-release

ssh client, mc ... (ssh server is already running: take care of firewall /etc/sysconfig/iptables)
yum -y install openssh-clients 
yum -y install mc wget vim
yum -y install samba-client samba-common cifs-utils 

lsb and X11 base are necessary for ANSYS licence manager
yum -y install lsb

list available groups (patterns)
yum grouplist

install X11:
yum -y groupinstall "X Window System" "Desktop" "Fonts" "General Purpose Desktop"
yum -y install tigervnc-server
(thanks to this link)(running vnc as a service)(ssh tunnel for vncviewer)


I prefer Xfce4 for VNC desktop
yum -y groupinstall Xfce

Edit .vnc/xstartup:
vncconfig -iconic &
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
startxfce4

NTP client (see howto-install-ntp-to-synchronize-server-clock). Note, that if the time is too far off then ntpd may not be able to synchronize, but setting the correct time with ntpdate solve the issue (cf. the ntpdate call below).
yum -y install ntp ntpdate ntp-doc
chkconfig ntpd on
ntpdate time.ure.cas.cz
/etc/init.d/ntpd start
hwclock --systohc

Config: /etc/ntp.conf
server tik.cesnet.cz
server tak.cesnet.cz
server time.ure.cas.cz


install mysql, php (apache is already installed)
yum -y install mysql-server mysql php-mysql
service mysqld start
chkconfig --levels 35 mysqld on
service httpd start
chkconfig --levels 35 httpd on
yum -y install php php-mysql
yum -y install php-mbstring php-soap

Default www root is /var/www/http in CentOS, but I am used to have it in /srv/www. SELinux settings prevent in an easy change of the DocumentRoot. To disable SELINUX for http (various booleans/setsebool hints do not work in 6.4):
yum -y install policycoreutils-python
semanage permissive -a httpd_t
or better: correct the security context for new www root:
chcon -Rv --type=httpd_sys_content_t  /srv/www


Edit /etc/httpd/conf/httpd.conf :
DocumentRoot "/srv/www/htdocs"

FTP server: (SElinux has to be disabled with this setup)
yum -y install vsftpd xinetd lftp
edit /etc/vsftpd/vsftpd.conf:
anonymous_enable=YES
anon_root=/srv/ftp
anon_upload_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
xferlog_enable=YES
xferlog_std_format=YES
deny_email_enable=YES
banned_email_file=/srv/vsftpd.banned_emails
userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd/user_list
and add allowed users into /etc/vsftpd/user_list file:
anonymous
userA
userB

The fake login shells have to be present in /etc/shells. Otherwise you cannot log in in ftp.
useradd --home-dir /srv/userA --no-create-home --shell /sbin/nologin userA 
useradd --home-dir /srv/userB --no-create-home --shell /sbin/nologin userB 

Default permissions for anonymous user's directory:
chown -R ftp. /srv/ftp
chmod 733 /srv/ftp/upload/
chmod 555 /srv/ftp /srv/ftp/pub/

xinetd: /etc/xinetd.d/vsftpd
service ftp
{
        socket_type             = stream
        protocol                = tcp
        wait                    = no
        user                    = root
        server                  = /usr/sbin/vsftpd
        disable                 = no
}

service xinetd start
chkconfig xinetd on

SSH: setup public key based authentification

generate public/private key pair:
ssh-keygen -t dsa

set correct permissions of the ~/.ssh directory
chmod 700 ~/.ssh && chmod 600 ~/.ssh/*

transfer your public key to a new server:
cat ~/.ssh/id_dsa.pub | ssh user@server \
        'mkdir -p .ssh && cat >>.ssh/authorized_keys && \
         chmod 700 .ssh && chmod 600 .ssh/*'

Ensure that permissions of the ~/.ssh directory are correct (as above).

neděle 24. listopadu 2013

Ansys 12.x-14.0 license manager on openSUSE

update Ansys license manager installation program regularly fails to produce a running configuration on openSUSE servers. Key to success full installation was to run separately flexlm and interconnect. These scripts should work in 14.5 too, as there the installation script fails as well. The modified startup script are shown here:

The ansys license manager is run under user "licence", its installed in the directory /home/licence/ansys_inc/.

In
/home/licence/ansys_inc/shared_files/licensing/init_ansysli :
change

ANSYSLIC_DIR="/home/licence/ansys_inc/shared_files/licensing"

The init_ansli script is going to be linked to /etc/init.d
The start script will keep the old log files in the time stamped copies.

/home/licence/ansys_inc/shared_files/licensing/start_ansysli :


#!/bin/sh
#
LMGRD="${ANSYSLIC_DIR}/lin32/lmgrd"

# Self-locate
selfdir="`dirname $0`"

# Does licsh.ini exist?
if test -r "${selfdir}/lic_admin/licsh.ini"; then
  . ${selfdir}/lic_admin/licsh.ini
  if test -x "${ANSYSLIC_DIR}/${ANSYSLIC_SYSDIR}/ansysli_server"; then
    su licence -c "date >> ${ANSYSLIC_DIR}/ansyslic.start.log"
    su licence -c "${ANSYSLIC_DIR}/${ANSYSLIC_SYSDIR}/ansysli_server < /dev/null"
    mv -f ${ANSYSLIC_DIR}/license.log ${ANSYSLIC_DIR}/license.log-`date +"%F+%T"`
    su licence -c "${LMGRD} -c ${ANSYSLIC_DIR}/license.dat -l ${ANSYSLIC_DIR}/license.log >>${ANSYSLIC_DIR}/ansyslic.start.log  2>&1"
  else
    echo "ERROR: '${ANSYSLIC_DIR}/${ANSYSLIC_SYSDIR}/ansysli_server' cannot be executed."
    echo "Cannot start the ANSYS, Inc. License Manager."
    exit 1
  fi
else
  echo "ERROR: '${selfdir}/lic_admin/licsh.ini' is not readable."
  echo "Cannot start the ANSYS, Inc. License Manager."
  exit 1
fi

exit 0


The shutdown script is almost untouched. Just stop explicitly the flexlm.

/home/licence/ansys_inc/shared_files/licensing/stop_ansysli :

#!/bin/sh
#
LMGRD="${ANSYSLIC_DIR}/lin32/lmutil"

# Self-locate
selfdir="`dirname $0`"

# Does licsh.ini exist?
if test -r "${selfdir}/lic_admin/licsh.ini"; then
  . ${selfdir}/lic_admin/licsh.ini
  if test -x "${ANSYSLIC_DIR}/${ANSYSLIC_SYSDIR}/ansysli_server"; then
    exec ${ANSYSLIC_DIR}/${ANSYSLIC_SYSDIR}/ansysli_server -k stop
    exec ${LMGRD} lmdown -c ${ANSYSLIC_DIR}/license.dat -force >>${ANSYSLIC_DIR}/ansyslic.start.log  2>&1
  else
    echo "ERROR: '${ANSYSLIC_DIR}/${ANSYSLIC_SYSDIR}/ansysli_server' cannot be executed."
    echo "Cannot stop the ANSYS, Inc. License Manager."
    exit 1
  fi
else
  echo "ERROR: '${selfdir}/lic_admin/licsh.ini' is not readable."
  echo "Cannot stop the ANSYS, Inc. License Manager."
  exit 1
fi
exit 0



Update

It is said that the "officially supported platforms for ANSYS are SLES and RHEL", silently CentOS too. On a recent CentOS installation the installation script "INSTALL.LM" works correctly and out-of-box script init_ansli starts and stops  the license manager as expected.

čtvrtek 21. listopadu 2013

Ansys 12.1, 14.0, 14.5 on openSUSE


Let's have a fresh installed openSUSE 12.3 machine (as minimal text-mode server).

The only prerequisite for the license manager is the package lsb:

zypper in lsb

Having lsb installed, I can install the license manager from the newest version available (14.5). However, the installation is not straightforward on openSUSE, the launching script is not able to launch the flexlm part of the manager. It has to be launched in advance. Then everything works.

For Ansys 12.1 itself (and VNC etc), install the following:
 
zypper in command-not-found
zypper in x11 -t pattern
zypper install tightvnc
zypper in libGLU1
zypper in openmotif openmotif-libs
ln -s /usr/lib64/libXm.so.4 /usr/lib64/libXm.so.3
(the last command is daring and cheeky, of course. But it seems to work.)

Now install the oldest Ansys. It correctly finds the license manager available and does not try to install its own (old) version.

Ansys 14.0 installs OK. Neither this version installs the license manager.

Ansys 14.5 installer tries to mess up the running license manager, but everything ends up well. No problems to launch /ansys_inc/v145/ansys/bin/launcher145.

pondělí 18. listopadu 2013

X11 forwarding request failed on channel 0

Obvious error with various sources and solutions. It appears mostly after fresh installation.

Symptom:
client:~/Desktop> ssh -v -XC root@server
OpenSSH_6.0p1, OpenSSL 1.0.1e 11 Feb 2013
...

debug1: Requesting X11 forwarding with authentication spoofing.
debug1: Requesting authentication agent forwarding.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
X11 forwarding request failed on channel 0

Solution:
server:~ # zypper in xauth
server:~ # vi /etc/ssh/sshd_config

in sshd_config  specify
AddressFamily inet

and restart sshd. IPv6 is disabled on client as well as on server.