Biboroku

Saturday, November 14, 2009

Installing Freemind on Debian Lenny

Filed under: Debian, Lenny, Linux — nomo17k @ 21:15

Download .deb from Freemind’s sourceforge web page, e.g., freemind_0.8.1-2_all.deb. Then

# apt-get install sun-java6-jre
# apt-get install libcommons-codec-java libcommons-lang-java libjcalendar-java
# apt-get install libjgoodies-forms-java librelaxng-datatype-java
# dpkg -i freemind_0.8.1-2_all.deb

Add the following line to ~/.bashrc:

export JAVA_HOME=/usr/lib/jvm/java-6-sun

(Without the environment variable set, I could not get freemind to run at all.) You can then launch it by typing freemind on the shell or choose the program in the menu under office.

Monday, April 20, 2009

Astro Software in Debian Lenny

Filed under: Debian, Lenny, Linux, Research — nomo17k @ 17:44

Here my goal is to build a computing environment where Python is the glue of all the astro-related tools (PyRAF, stsci_python, etc.).

IRAF

In order to use PyRAF, IRAF needs to be installed first.

Python

At the very least, I want the basic Python packages related to science/data analysis:

# apt-get install python ipython python-doc
# apt-get install python-numpy python-scipy python-matplotlib

PyRAF

Install several Python packages:

# apt-get install tk8.4-dev python-tk libf2c2-dev
# apt-get install python-dev python-pmw python-urwid

Test if the required Python modules exists by making sure that no ImportError occurs below:

# python
>>> import readline
>>> import Tkinter
>>> Tkinter._test()
>>> import Pmw
>>> import urwid

If you have an installation of previous version, check the section Cleaning An Old Installation of the installation instruction at the STSci web site to make sure things are clean.

Prepare the source directory:

# mkdir /usr/local/src/python_packages/stsci_python
# cd /usr/local/src/python_packages/stsci_python

Download and extract the source:

# wget http://stsdas.stsci.edu/download/stsci_python_2.7/stsci_python_2.7.tar.gz
# gunzip -c stsci_python_2.7.tar.gz | tar xvf -
# cd stsci_python_2.7/

Normally, using python setup.py install will do the job, but it probably ends in compilation error, complaining the header file cfunc.h not found. In order to force the installation, modify setup.py in the current directory, so that at the very end of the file an additional include directory is defined:

distutils.core.setup(

    # This name is used in various file names to identify this item.
    name="stsci_python",

    # This version is expected to be compared to other version numbers.
    # It will also appear in some file names.
    version="2.7",

    # Apparently, description is not used anywhere.
    description="",

    packages = all_packages,
    package_dir = all_package_dir,
    ext_modules = all_ext_modules,
    scripts = all_scripts,
    data_files = all_data_files,
    include_dirs = ['/usr/lib/python2.5/site-packages/numpy/numarray/numpy']
)

Then we can follow the normal instruction:

# python setup.py install
# cd stscidocs
# python setup.py install

Before running PyRAF for the first time, clear the cache by removing directories under your “pyraf” directory, which is located in where you have your loginuser.cl for IRAF.

That’s it!

Friday, April 17, 2009

IRAF on Debian Lenny

Filed under: Debian, Lenny, Linux, Research — nomo17k @ 15:54

Here is my installation note for IRAF (ver 2.14.1) on Debian Lenny.

Basically, the installation procedure does not differ much from the one outlined in the official IRAF installation guide.

First, create “iraf” user account to the system if it does not exist already. Also, install the C shell (csh) as it appears to be the preferred shell for IRAF (people apparently don’t know when to move on).

$ sudo apt-get install csh ncompress
$ sudo adduser iraf

After user “iraf” has been added to the system, change its home directory and the default shell by modifying /etc/passwd to read:

iraf:x:1002:1002:IRAF Admin,,,:/iraf/iraf/local:/bin/csh

Note that the number 1002 may be different depending on how many users already have the accounts on the system. Only change the last two entries delimited by colon to /iraf/iraf/local and /bin/csh.

We assume IRAF will be installed under /usr/local/iraf, and a symlink /iraf points to that directory:

# mkdir /usr/local/iraf
# chown iraf /usr/local/iraf
# chgrp iraf /usr/local/iraf
# ln -s /usr/local/iraf /iraf

Login as user “iraf,” and create a bunch of directories:

# su iraf
% cd /usr/local/iraf
% mkdir extern imdirs iraf irafbin x11iraf
% mkdir irafbin/bin.linux
% mkdir irafbin/noao.bin.linux

Install x11iraf. You may use the pre-built binary distribution:

% cd /usr/local/iraf/x11iraf
% wget http://iraf.noao.edu/x11iraf/x11iraf-v2.0BETA-bin.redhat.tar.gz
% gunzip -c x11* | tar xvf -
% su
# ./install
# exit

and select defaults for all the user input upon installation. (Note that if xgterm quits on an error complaining about “ptys,” then you may need to turn on the kernel configurations CONFIG_LEGACY_PTYS and CONFIG_UNIX98_PTYS; yes, you may need to rebuild the kernel…)

Install the source:

% cd /usr/local/iraf/iraf
% wget http://iraf.noao.edu/iraf/ftp/iraf/v214/PCIX/as.pcix.gen.gz
% gunzip -c as.pcix.gen.gz | tar xvf -

Install the binaries:

% cd ../irafbin/bin.linux
% wget http://iraf.noao.edu/iraf/ftp/iraf/v214/PCIX/ib.lnux.x86.gz
% gunzip -c ib.lnux.x86.gz | tar xvf -

% cd ../noao.bin.linux
% wget http://iraf.noao.edu/iraf/ftp/iraf/v214/PCIX/nb.lnux.x86.gz
% gunzip -c nb.lnux.x86.gz | tar xvf -
% exit

Run the install script:

# su iraf
% cd $iraf/unix/hlib
% source irafuser.csh
% su
# ./install

Follow the instruction for the most part, but the following are not necessary: IRAF networking and tapecap device.

# exit
% cd
% source .login
% rehash
% cl

This should start ecl.

For exposing external packages (which must already be installed if not already) within IRAF, the text file extern.pkg can be reused if these packages are already installed. Copy it from a previous installation to /usr/local/iraf/iraf/unix/hlib.

# External (non core-system) packages.  To install a new package, add the
# two statements to define the package root directory and package task,
# then add the package helpdb to the `helpdb' list.

reset	noao		= iraf$noao/
task	noao.pkg	= noao$noao.cl

reset	tables		= /iraf/extern/tables/
task	tables.pkg	= tables$tables.cl

reset	mscred		= /iraf/extern/mscred/
task	mscred.pkg	= mscred$mscred.cl

reset	stsdas		= /iraf/extern/stsdas/
task	stsdas.pkg	= stsdas$stsdas.cl
task	apropos		= stsdas$apropos.cl

reset	rvsao		= /iraf/extern/rvsao/rvsao-2.5.0/
task	rvsao.pkg	= rvsao$rvsao.cl

reset	xdimsum		= /iraf/extern/xdimsum/
task	xdimsum.pkg	= xdimsum$xdimsum.cl

reset	fuzzy		= /iraf/extern/fuzzy/
task	$fuzzy.pkg	= fuzzy$fuzzy.cl

set	crrefer		= "/home/astro_data/stsci_data/"

reset   helpdb          = "lib$helpdb.mip\
                          ,noao$lib/helpdb.mip\
                          ,tables$lib/helpdb.mip\
                          ,stsdas$lib/helpdb.mip\
                          ,mscred$lib/helpdb.mip\
                          ,rvsao$lib/helpdb.mip\
			  ,xdimsum$lib/helpdb.mip\
                          "

keep

You can simply comment out lines with “#” if some packages are not installed.

The packages stsdas and tables should be installed following the official instruction.

Friday, March 27, 2009

Running Scripts at Login or Logout of a KDE Session

Filed under: Debian, Linux — nomo17k @ 19:14

Here is the situation: You want to run a customized script when you login or logout of a KDE session.

Here is the solution: You can place a custom script in the directory ~/.kde/Autostart to run when you login to a KDE session. Likewise, you can place the script in the directory ~/.kde/shutdown to run when you logout of a KDE session. The latter directory does not appear to be created by default. If it does not exist, you can just create it by

$ mkdir ~/.kde/shutdown

One thing about running scripts out of ~/.kde/shutdown directory is that it does not recognize all the customization done in your BASH startup scripts, like ~/.bashrc. You may source these files within the scripts in ~/.kde/shutdown, but another approach is to make a script with the contents:

#!/bin/bash
DO SOMETHING BEFORE LOGOUT
# Launch KDE logout interface
dcop kdesktop KDesktopIface logout
DO AFTER LOGOUT

On the KDE panel, select “Add -> Special Button -> None-KDE Application” to create a button pointing to this script. This way, you can run commands assuming all the customization still intact (before logout), and even after you actually logout (as if you put scripts in ~/.kde/shutdown).

Formatting a USB Drive for Use with Debian

Filed under: Debian, Linux — nomo17k @ 18:52

I use an external USB drive just for backing up stuff on my Debian desktop box. I of course want to use the ext3 filesystem rather than FAT-like system. :)

Note that this method wipes out the filesystem on the drive. Install hotplug-type package such that upon plugging the USB drive in the device is attached to somewhere in the system. In a log, you should be able to see a message like:

# tail /var/log/messages
...
kernel: Attached scsi disk sda at scsi1, channel 0, id 0, lun 0

so here the device is at /dev/sda, for example. Then prepare a partition:

# fdisk /dev/sda

See help for detail on fdisk command. Then press “p” to see a list of partitions, and to create a new one press “n.” Finally press “w” to actually create it. To use ext3 filesystem, do

# mkfs.ext3 /dev/sda1

Add the following line to /etc/fstab:

/dev/sda1 /media/usbdrive auto user,noauto 0 0

assuming /media/usbdrive is the mount point.

Olympus C-750 on Debian Etch

Filed under: Debian, Etch, Linux — nomo17k @ 18:42

Note: This may be an obsolete method of using the digital camera with Debian (I would use udev but otherwise let KDE handle it as a simple USB device). I’m keeping this for record.

The kernel (2.6.x) must have USB_STORAGE (M), USB_HID, and USB_DEVICEFS. Options SCSI (M) and BLK_DEV_SD (M) under SCSI device support are also needed.

Add usb-storage to /etc/modules file for automatic startup on boot. Then

# apt-get install sg3-utils hotplug
# tail /var/log/messages

to see where the digital camera is located. Use that to add an entry to /etc/fstab:

/dev/sda1    /media/camera       vfat     noauto,user,umask=000    0    0

Connect the camera to a USB port, and turns it on. Reboot the machine. The camera can be mounted using

$ mount /media/camera

Sunday, March 22, 2009

Simple Firewall with iptables on Debian

Filed under: Debian, Linux — nomo17k @ 18:04

Install iptables:

# apt-get install iptables

First, make a set of iptables rules and save it to a file (say, /etc/firewall-rules.sh):

# BEGIN /etc/firewall-rules.sh
#!/bin/sh

iptables -F

iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport ssh -j ACCEPT
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport rsync -j ACCEPT
iptables -A INPUT -j DROP
# END /etc/firewall-rules.sh

Modify /etc/network/interfaces such that the firewall script gets executed when the network connection gets established:

iface eth0 inet dhcp
  pre-up /etc/firewall-rules.sh eth0

Do the security checkup with ShieldsUP! by Gibson Research Corporation to see if the firewall is working.

IDL v6.0.3 on Debian Etch

Filed under: Debian, Etch, Linux — nomo17k @ 17:46

(Note: This is an old installation note.)

Install version 6.0 as described in the installation guide (i.e., install in /usr/local/rsi). Since v6.0 is in the archive, you need to contact the customer support to obtain a link to the download. Also ask for v6.0.3 patch, which is a separate download.

After installing IDL, you need to install the license manager. lmgrd needs accss to a temporary location, so do:

# sudo mkdir /usr/tmp

Store the license file to /usr/local/rsi/license/license.dat.

Make a script that runs lmgrd:

#!/bin/bash
LD_ASSUME_KERNEL=2.4.1
export LD_ASSUME_KERNEL
/usr/local/rsi/idl/bin/lmgrd > /tmp/idl_lmgrd.log

Copy the above script (call it run_lmgrd) to /etc/init.d, and make a symlink to it in /etc/rc2.d/S20run_lmgrd. After rebooting (or running the script manually), the license should be honored.

Obtain the IDL Astronomy User’s Library (file: astron.tar.gz) and install .pro files into /usr/local/lib/idl/astrolib/pro

Adding the above path to IDL_PATH enables the use.

Recycle and store .idlenv and .idlstartup into the user’s home directory.

Add lines

. /usr/local/rsi/idl/bin/idl_setup.bash
. /home/taro/.idlenv
export LM_LICENSE_FILE=/usr/local/rsi/license/license.dat

to ~/.bashrc.

Install the v6.0.3 patch following the supplied instruction manual.

Wine on Debian Lenny

Filed under: Debian, Lenny, Linux — nomo17k @ 17:40

To install Wine, do

# apt-get install wine

To launch a Windows Explorer-like file browser, do

$ winefile

in which you can manage installers and programs just like in Windows.

Installing IEs4Linux

Follow the instruction here.

Microsoft Natural Ergonomic Keyboard 4000 on Debian Lenny

Filed under: Debian, Lenny, Linux — nomo17k @ 17:34

Unfortunately not all the “special keys” can be enabled at this point; the zoom bar in the middle being notable example. For my own use it really doesn’t matter since I rarely make use of them.

An approach here is to use an APT pinning to get a later version of the xkb-data package from the testing repository. That includes the keyboard layout data for MS Ergonomic Keyboard 7000, which we can use.

First, add a testing repository to /etc/apt/sources.list:

deb http://ftp.us.debian.org/debian lenny main contrib non-free
deb-src http://ftp.us.debian.org/debian lenny main contrib non-free

deb http://www.debian-multimedia.org/ lenny main

deb http://security.debian.org/ lenny/updates main contrib non-free
deb-src http://security.debian.org/ lenny/updates main contrib non-free

# only for a few packages
deb http://ftp.us.debian.org/debian testing main contrib non-free

In /etc/apt/preferences, have the following lines:

Package: *
Pin: release v=5.0*
Pin-Priority: 700

Package: xkb-data
Pin: release a=testing
Pin-Priority: 650

Here v = 5.0* means the stable version (Lenny is 5.0). So only xkb-data will be fetched from testing, but the rest remains stable.

Then install the xkb-data package:

# apt-get update
# apt-get install xkb-data

Now under the K menu go to Control Center -> Regional & Accessibility -> Keyboard Layout -> Layout. Choose Microsoft Natural Wireless Ergonomic Keyboard 7000 as the Keyboard model. Restart X.

Most special keys should be working by now.

Next Page »

Blog at WordPress.com.