Installing IRAF

The basic tool for scientific work on images from telescopes, which are in fits format, is the Image Reduction and Analysis Facility or in short: IRAF. It has been in use since its inception in 1981 by National Optical Astronomy Observatory (NOAO) and further strengthened when the Space Telescope Science Institute chose it as the operating environment for operating it's data in 1983, it has supported astronomers ever since. It is completely based on the command line and can only be installed in Unix Based Operating Systems like Linux and OSX; it doesn't work in Windows but works on the iPad!!!

Installing and becoming familiar with IRAF took me some time; although I have to say that I am by no means a professional yet! The main problem is that most of the documents regarding how to use and install IRAF in its webpage are very old; for example when telescopes still used tapes to store data!!! There are instructions on how to install IRAF on other webpages, but to finally succeed in installing IRAF no one webpage or instructions page was enough for me. So, as I (painstakingly!!!) installed it along with all the necessary external programs, I wrote down the steps one by one for the absolute beginner (like my self), so hopefully others won't go through all the problems and misunderstandings I did!

I applied this process just after installing a fresh 32bit Scientific Linux on my personal Laptop and a 64bit Scientific Linux system on my office Desktop and I installed the relevent 64bit and 32 versions of all the programs mentioned in their webpages. Scientific Linux shares the same base structure as Fedora and Red Hat Enterprise Linux, so this installation equally applies to them too. So let's get started:

X11IRAF

The most important element in this package is xgterm, it is the terminal emulator that you will have to run IRAF in if you want to use its graphic or image cursor (to interact with the images or generated graphs). So here are the steps you have to take to install it. You just have to type the commands after the # sign in the Command Line.

  1. Log in as root and go to the root directory:
        # su
        # cd /
  2. Make this file structure: /iraf/iraf/x11iraf/:
        # mkdir iraf
        # mkdir /iraf/iraf/
        # mkdir /iraf/iraf/x11iraf/
        # cd /iraf/iraf/x11iraf/
  3. You will need the C language shell (if you don't already have it):
        # yum install tcsh
  4. Go to this address and download the appropriate version.
  5. Move your downloaded file; probably it's in /home/YOURID/Downloads to the directory you created above.
         # mv /home/YOURID/Downloads/x11iraf-v2.0BETA-bin.redhat.tar.gz ./
  6. Unpack the downloaded file:
         # tar zxvf x11iraf-v2.0BETA-bin.redhat.tar.gz
  7. You will need the libXmu.so.6 and libncurses.so.5 shared libraries to run xgterm, you can install them with:
        # yum install libXmu.so.6 libncurses.so.5
  8. run the install script in /iraf/iraf/x11iraf/:
        # ./install
  9. Answer the prompts and you are done.

ds9

From the webpage: "SAOImage DS9 is an astronomical imaging and data visualization application." This is actually a very useful, simple and easy Graphical User Interface (GUI) application for you to view the fits images and do simple operations on them. Through IRAF's Image Cursor, ds9 interacts with IRAF. If you are using Fedora, simply typing the command # ds9 as root will install it from the Fedora repositories. If it doesn't work (you don't have the repositories installed) or you are using another operating system, here is how to install it:

  1. Download its file fromthe webpage
  2. Unpack it:
        # tar zxvf [filename]
  3. Copy the ds9 file to /usr/local/bin:
        # mv ds9 /usr/local/bin
  4. By typing ds9 any where in the command line (outside of IRAF) you can begin using it.
  5. In case an error is printed, complaining that libXss.so.1 does not exist or cannot be found, run yum install libXScrnSaver.

XPA is the "X Public Access" mechanism, its a messaging system in DS9 that allows e.g. host scripts to load images or control the display. After running ds9 if you get an error regarding XPA enter these commands if you are using the bash shell:
    # cd ~
    # vim .bashrc
Once inside vim, press i to be able to insert text, add this command:
    export XPA_METHOD=local
Save by pressing Esc first and ZZ (the Shift and z keys together, twice). Esc and :wq can also be used.
To stop this command when you run DS9 from the Graphic User Interface, follow the above procedures on ~/.profile also, if you don't already have that file, don't worry, the second command will create it. But have in mind that you need to log-in again for this change to take effect.
Note: You will need to log out and back in again for these changes to take effect.

IRAF 2.16 (64 bit)

And Finally; IRAF!!! As far as I know, there is no "YUM" or "RPM" installation script for IRAF and the following procedures are the only way to successfully install it (I have tried my best to be as "step by step" and explained as possible). Installing the older versions of IRAF was very hard and time consuming but since version IRAF 2.15.1, installation has become much easier. To understand the exact file system of IRAF, it is very good to read it's installation manual, but if you just want to install it, this is how to do it:

Again I assume your Fedora (or Linux) is newly installed; you might already have some of the requirements installed. The file structure we made in steps 1 & 2 of X11IRAF are essential for installing IRAF, if you want to install IRAF without installing X11IRAF, be sure to make that file structure before following the steps bellow.

  1. You will need the C language shell; step 3 in x11iraf.
        # tcsh.
  2. Log in as root (if you aren't):
        # su
        # cd /iraf/iraf/
  3. You have to make an IRAF user. The easy way is to run this command:
        # useradd -mr -d/iraf/iraf -s/bin/csh iraf
    You can run man useradd to see what these options mean. The hard way is to go through the GUI (Graphic user interface): In GNOME 2.x you can Go to "System", then "Administration" and "Users and Groups", there, click "Add User", define its login shell to be tcsh, its name to be iraf and its home directory to be /iraf/iraf/local. You can set the User ID or UID to 490 in Fedora (or 999 in Debian) if you don't want it to be displayed on your log-in screen. Isn't the command line so much easier ;-)?
  4. Set the environment so that # iraf means /iraf/iraf:
        # setenv iraf /iraf/iraf/
  5. Download the file from the IRAF webpage and move it to /iraf/iraf:
        # mv /home/YOURID/Downloads/iraf.lnux.x86_64.gz ./
  6. Unzip the file:
        # tar zxvf [filename]
  7. Go to
        # cd /iraf/iraf/unix/hlib/
  8. Install IRAF and answer all the questions:
        # ./install.csh
  9. Go back to your original ID:
        # su YOURID
  10. Go to your home directory (where you want to use IRAF in):
        # cd
  11. Open xgterm. The & sign is for keeping your current terminal emulator working while you are using xgterm:
        # xgterm &
  12. In xgterm, you have to "Make IRAF", actually this process, creates a login.cl file and an "up-arm" folder where ever you run it so that the settings you make in IRAF will be saved for your future use. It will ask you a question about your terminal (reply xgterm) and if you want it to create the "up-arm" directory, answer them and you are finished.
        # mkiraf
  13. To enter IRAF, type cl when you are in your home directory and IRAF will run.
  14. To see if your installation has gone well, you can display an image and its surface like the top picture of this page, note that I have used # for the Linux environment and vocl> for the IRAF environment. dev$pix is an IRAF image file (not a fits file) that was copied on your computer along with the install, you can read more about it and how to use IRAF in the IRAF beginners guide. Just keep in mind that you have to run ds9 separately before entering IRAF. DS9 can store 16 images in 16 frames at the same time, so upon requesting to display an image, it will ask you which frame you would like to fill.
        # ds9 &
        # cl
        vocl>display dev$pix
        vocl>surface dev$pix

IRAF 2.16 (32 bit)

All the initial steps are the same with the 64bit IRAF. Only one difference: Before going to step 7, follow the following procedures:

  • You have to make two symbolic links, one in the /iraf/iraf/ file and one in the /iraf/iraf/noao/ file:
        # cd /iraf/iraf/
        # ln -s bin.linux bin.redhat
        # cd /iraf/iraf/noao
        # ln -s bin.linux bin.redhat
  • Continue from step 7 in the 64bit list.

Arch Linux

If you are using more updated GNU/Linux distributions (for example Arch linux), the libtinfo.so.5 will not exist any more. So you have create this symbolic link:
    # su
    # ln -s /usr/lib/libncurses.so.5 /usr/lib/libtinfo.so.5
This should be done after installing IRAF but before running cl.
I strongly recommend Arch Linux for anyone who is interested in understanding how GNU/Linux works. It is a "build it your self" type of operating system, so it has a fantastic Wiki full of great information. This enables you to learn what the packages actually do and how they fit together.
After all, as astronomers, we can't claim to be curious in learning about the universe when we are ignorant to the tool that we are spending most our days behind (the operating system). Arch Linux also has the most updated and original (unmodified by the distribution's administrators) versions of nearly all GNU/Linux utilities, libraries and programs. It is some time I have moved to Arch Linux from Red Hat based and Ubuntu distributions and my whole experience with the computer has dramatically changed for the better.

Installing the STSDAS packages in IRAF

To manipulate HST images you will need the STSDAS package, installing it is very easy:

  1. In this webpage, under "Getting STSDAS And TABLES", click on the second "Linux" link (the first is only TABELS) and save the .tar.gz file.
  2. As the webpage says, you can simply go into the uncompressed folder and run ./install_helper. But it has to be in a place that will not be changed. The best place is in IRAF's own directory. Replace the X.X with the values on the file you download:
        # su
        # mv /home/username/stsci_iraf-X.X.tar.gz /iraf/iraf
        # cd /iraf/iraf
        # tar -zxvf stsci_iraf-X.X.tar.gz
        # cd stsci_iraf-X.X
        # ./install_helper
    This will print out some information for you. In my case at least, after I did that, it says to Edit the file /iraf/irafunix/hlib/extern.pkg. But /iraf/irafunix/ doesn't exist! They have clearly forgot to type a / (slash)! So I edited /iraf/iraf/unix/hlib/extern.pkg instead. To edit the file, as the guide says, you just have to copy and paste the particular part of the output of ./install_helper into the particular position in this file. In the end, you can remove the initially downloaded file:
        # rm ../stsci_iraf-X.X.tar.gz
    Next time you run IRAF, you will see the stsdas, tables, stecf names included in your IRAF packages.

 

Comments and suggestions
If you find any problems in these procedures or feel I have not mentioned something important, please don't hesitate to tell me ;-). As you can see below, this page serves as a reference for a large audience so your suggestions can be very useful for other astronomers.

 

Acknowledgments
I thank Stephen Williams and Stuart Taylor for their encouraging and instructive comments on improving the explanations in this webpage.

 

Main content last updated: November 21st, 2014.
Page first uploaded: February 11th, 2011.

Tohoku University Astronomical Institute, 6-3 Aramaki, Aoba-ku, Sendai, Japan, 980-8578
    akhlaghi :a:t: astr.tohoku.ac.jp, Office: Physics A; 838, +81-80-3335-9474