Difference between revisions of "MAS OS setup"

From MCEWiki
(Modernise MAS description)
(Moved pre-mce_install stuff (9.04 and earlier) to MAS OS setup (Ubuntu 6.06 to 9.04) to remove clutter)
Line 8: Line 8:
 
The automated installation package is tested, but as Ubuntu tweaks its packages the install script may fall slightly out of sync.  It's worth a shot though.
 
The automated installation package is tested, but as Ubuntu tweaks its packages the install script may fall slightly out of sync.  It's worth a shot though.
  
After installing Ubuntu 10.10 (desktop), get the install tarball:
+
After installing Ubuntu 10.04 (desktop), get the install tarball:
  
 
  cd ~
 
  cd ~
Line 66: Line 66:
 
= Ubuntu 6.06 - 9.04 =
 
= Ubuntu 6.06 - 9.04 =
  
== Disable CDROM seeking ==
+
See [[MAS OS setup (Ubuntu 6.06 to 9.04)]]
 
 
The package manager knows that you have the Ubuntu disk and will say things like
 
Media change: please insert the disc labeled
 
'Ubuntu-Server 6.06.1 _Dapper Drake_ - Release i386 (20060807.1)'
 
 
 
To disable this (and download packages from the internet instead), open /etc/apt/sources.list
 
sudo pico /etc/apt/sources.list
 
and remove (comment) the line
 
deb cdrom:[Ubuntu-Server 6.06.1 _Dapper Drake_ - Release i386 (20060807.1)]/ dapper main restricted
 
 
 
== Install required packages ==
 
 
 
sudo apt-get update
 
sudo apt-get install build-essential subversion emacs21 libreadline5-dev
 
 
 
== Enable universe repository and install GGV ==
 
 
 
Uncomment the line in /etc/apt/sources.list so it says
 
deb http://us.archive.ubuntu.com/ubuntu/ dapper universe
 
 
 
Then run
 
sudo apt-get update
 
sudo apt-get install gnome-gv
 
 
 
gnome-gv doesn't exist on 7.10, you'll have to settle for
 
sudo apt-get install gv
 
 
 
== Install packages that you shouldn't even want to install (soon to be optional) ==
 
sudo apt-get install tcsh
 
 
 
== Install desktop manager (optional) ==
 
sudo apt-get install ubuntu-desktop gdm
 
 
 
== Install python stuff ==
 
 
 
The 'pyth' branch MAS has experimental support for python using wx and matplotlib:
 
sudo apt-get install python-dev python-wxglade python-matplotlib python-numarray-ext swig
 
 
 
=== numpy and scipy ===
 
 
 
For loading / plotting MCE data in python using [[Python data and runfile modules | mce_data.py]], you will want numpy / scipy.  The Ubuntu packages can be a bit out of date, but should be enough for basic data manipulation and plotting.  Just run:
 
sudo apt-get install python-numpy python-scipy
 
 
 
For Ubuntu 6.06, numpy and scipy can be obtained following instructions from this page:
 
http://debs.astraw.com/dapper/
 
 
 
There are some very useful numpy features that are not available on older Ubuntu default packages.  To access such features it is not too hard to install more recent versions of numpy (and scipy) from sourceforge:
 
 
 
1. Remove Ubuntu numpy and scipy packages; install dependencies for the source.
 
sudo apt-get remove python-numpy python-scipy
 
sudo apt-get install libblas-dev lapack-dev
 
2. Get source tarballs from links below... unzip the contents.
 
http://sourceforge.net/projects/numpy
 
http://sourceforge.net/projects/scipy
 
3. Compile the source packages.  That means that in each folder you have to do:
 
./setup.py config
 
./setup.py build
 
sudo ./setup.py install
 
 
 
The config step complains a fair bit, but it's really obvious when there is an error rather than a warning.  The scipy package takes a long time to compile.
 
 
 
= Download and install MAS kernel patch =
 
 
 
== Download ==
 
 
 
If you're not compiling the kernel from scratch, download the binary packages from UBC:
 
wget http://e-mode.phas.ubc.ca/~mhasse/mce/kernel-headers-2.6.15.7-bigphys_10.00.Custom_i386.deb
 
wget http://e-mode.phas.ubc.ca/~mhasse/mce/kernel-image-2.6.15.7-bigphys_10.00.Custom_i386.deb
 
wget http://e-mode.phas.ubc.ca/~mhasse/mce/extras.patch
 
 
 
For '''Ubuntu 7.10''', get these instead:
 
wget http://e-mode.phas.ubc.ca/~mhasse/mce/linux-headers-2.6.22.9-bigphys_10.00.Custom_i386.deb
 
wget http://e-mode.phas.ubc.ca/~mhasse/mce/linux-image-2.6.22.9-bigphys_10.00.Custom_i386.deb
 
 
 
 
 
On '''Ubuntu 7.10''' machines '''without PAE''' hardware (i.e. a maximum of 4G of system memory) use:
 
wget http://e-mode.phas.ubc.ca/~mhasse/mce/linux-headers-2.6.22.14-bigphys_2.6.22.14-bigphys-10.00.Custom_i386.deb
 
wget http://e-mode.phas.ubc.ca/~mhasse/mce/linux-image-2.6.22.14-bigphys_2.6.22.14-bigphys-10.00.Custom_i386.deb
 
 
 
== Install ==
 
 
 
Then, install the packages using dpkg:
 
sudo dpkg -i kernel-headers-2.6.15.7-bigphys_10.00.Custom_i386.deb
 
sudo dpkg -i kernel-image-2.6.15.7-bigphys_10.00.Custom_i386.deb
 
The "image" file might complain about symbolic links, no big deal.
 
 
 
On '''Ubuntu 7.10''', instead install these:
 
sudo dpkg -i linux-headers-2.6.22.9-bigphys_10.00.Custom_i386.deb
 
sudo dpkg -i linux-image-2.6.22.9-bigphys_10.00.Custom_i386.deb
 
 
 
Why are these ones called "linux" instead of "kernel"?  I think it's because I got them from Ubuntu repositories instead of kernel.org.
 
 
 
On '''Ubuntu 7.10''' machines '''without PAE''' install these:
 
sudo dpkg -i linux-headers-2.6.22.14-bigphys_2.6.22.14-bigphys-10.00.Custom_i386.deb
 
sudo dpkg -i linux-image-2.6.22.14-bigphys_2.6.22.14-bigphys-10.00.Custom_i386.deb
 
 
 
The '''Ubuntu 8.04''' kernel has a sound-card driver that lays claim to the Motorola DSP on the PCI card.  We have to blacklist this module to prevent it from trying to configure the card as a sound card.  Add the following to the bottom of /etc/modprobe.d/blacklist :
 
# Conflicts with Astro-cam PCI card!!
 
blacklist snd_asihpi
 
 
 
== Patch ==
 
 
 
This makes it possible to compile against the kernel package as though it had been locally compiled originally.
 
cd /usr/src/kernel-headers-2.6.15.7-bigphys/
 
sudo patch -p1 < ~/extras.patch
 
 
 
This step is not necessary for Ubuntu 7.10.  It may be necessary to link the kernel headers into /lib/modules:
 
  sudo ln -s /usr/src/linux-headers-2.6.22.9-bigphys/ /lib/modules/2.6.22.9-bigphys/build
 
 
 
== Boot menu ==
 
 
 
We need to add the kernel option that causes bigphys to allocate boot memory for our driver.  In older versions of MAS (especially ACT's stable release) we also need to disable "acpi".  It's a good idea to not run any DSP/MCE commands until all of your kernel options are in place.
 
 
 
Having installed the kernel "image" package, the kernel should show up in the boot loader (grub)'s kernel list.
 
 
 
=== Editing the kernel list ===
 
As root (or using sudo), edit the file /boot/grub/menu.lst . 
 
sudo pico /boot/grub/menu.lst
 
Go to the list of kernels, below the line "## ## End Default Options ##", and find the new kernel entry.  On Ubuntu 6.06, it should be the third block (index 2), and look like this:
 
 
 
title          Ubuntu, kernel 2.6.15.7-bigphys
 
root            (hd0,0)
 
kernel          /vmlinuz-2.6.15.7-bigphys root=/dev/sda3 ro quiet splash
 
initrd          /initrd.img-2.6.15.7-bigphys
 
savedefault
 
boot
 
 
 
Add the kernel options to the "kernel" line, producing either this (recent MAS):
 
kernel          /vmlinuz-2.6.15.7-bigphys root=/dev/sda3 ro quiet splash bigphysarea=8192
 
or this (old MAS, esp. ACT):
 
kernel          /vmlinuz-2.6.15.7-bigphys root=/dev/sda3 ro quiet splash bigphysarea=8192 acpi=off
 
 
 
Save and close the file, and reboot to test this kernel.  If the kernel "works", you can edit menu.lst again and change the value of the "default" option to point to this kernel:
 
default    2
 
 
 
'''Ubuntu 7.10 and later''': the kernel packages install a bit differently so the block will likely be the first one in the list.  The 'kernel' line  must change from something like
 
kernel          /boot/vmlinuz-2.6.22.9-bigphys root=UUID=1b6e7b54-894d-4571-9f0a-527fe0103975 ro quiet splash
 
to
 
kernel          /boot/vmlinuz-2.6.22.9-bigphys root=UUID=1b6e7b54-894d-4571-9f0a-527fe0103975 ro quiet splash bigphysarea=8192
 
Note that the long hexadecimal serial numbers are system specifc and yours are probably different than these ones.  Leave them as they are and just add the new kernel options.  The "default" option will probably be
 
default    0
 
but it's a good idea to count these things out for yourself.
 
  
 
= Configure the system for MCE users =  
 
= Configure the system for MCE users =  

Revision as of 19:19, 1 October 2010

Supported operating systems

  • Ubuntu 10.04, 9.10, 9.04, 8.10, 8.04, 7.10, 6.06.
  • 10.04 is an LTS release. Users should not expect support, in the near term, for Ubuntu releases newer than this.

Ubuntu 10.04

The automated installation package is tested, but as Ubuntu tweaks its packages the install script may fall slightly out of sync. It's worth a shot though.

After installing Ubuntu 10.04 (desktop), get the install tarball:

cd ~
wget http://e-mode.phas.ubc.ca/~mhasse/mce/ubuntu_10.04/ubuntu_10.04_install.tar.gz
tar -xzf ubuntu_10.04_install.tar.gz
cd install/

Install additional ubuntu packages

From that install folder, run

bash install.bash

Bigphysarea kernel patch

You can either download the compiled kernels or build them from scratch.

From install folder, run EITHER

bash kernel_download.bash

or

bash kernel_build.bash

Then when one or the other of those has succeeded, install them:

bash kernel_install.bash

You can now proceed to the section below titled "Configure the system for MCE users".


Ubuntu 9.10

Starting with Ubuntu 9.10, some effort has been made to automate the installation. After installing Ubuntu 9.10 (desktop), get the install tarball:

cd ~
wget http://e-mode.phas.ubc.ca/~mhasse/mce/ubuntu_09.10/install.tar.gz
tar -xzf install.tar.gz
cd install/

Install additional ubuntu packages

From that install folder, run

bash install.bash

Bigphysarea kernel patch

You can either download the compiled kernels or build them from scratch.

From install folder, run EITHER

bash kernel_download.bash

or

bash kernel_build.bash

Then when one or the other of those has succeeded, install them:

bash kernel_install.bash

You can now proceed to the section below titled "Configure the system for MCE users".


Ubuntu 6.06 - 9.04

See MAS OS setup (Ubuntu 6.06 to 9.04)

Configure the system for MCE users

Permissions and umask

Set the umask for all users to give write access for their group by default.

Edit /etc/profile and change the "umask 022" line to

umask 002

Edit /etc/login.defs and find the line that start "# UMASK" and change it to

UMASK           002

Any users wishing to use MCE under their own accounts should be added to the "mce" group and should have "mce" as their primary group. Their umask must be set properly, or other users will not be free to manipulate shared files.

To setup additional system users, see the page on MAS user setup.

Folders

This is the sort of thing that should be done by an install script...

Data directory:

sudo mkdir /data
sudo chown mce:mce /data
sudo chmod g+ws /data
mkdir /data/cryo/

Configuration directory:

sudo mkdir /etc/mce
sudo chgrp mce /etc/mce
sudo chmod g+ws /etc/mce

If necessary, branch mce_script

You can work with a complete checked-out tree, or not.

In the first case:

svn checkout svn://e-mode.phas.ubc.ca/mce_script
svn copy mce_script/trunk mce_script/branch/{your_project_name}
svn commit mce_script

Alternately, do the copy directly on the svn server (it is automatically committed):

svn copy svn://e-mode.phas.ubc.ca/mce_script/trunk svn://e-mode.phas.ubc.ca/mce_script/branch/{your_project_name}

There should be no need to branch MAS: just use trunk.

Then check out the appropriate branch (or the whole tree) on the new machine.

Download (checkout) MAS and mce_script

See MAS svn repository.

Compile and install MAS

The following procedure outlines the default situation, where MAS is being installed on a computer containing only one fibre card. For information on running MAS with multiple fibre cards in one computer, see Multicard MAS.

Install libconfig

MAS uses libconfig to manage its configuration files. The webpage is here: http://www.hyperrealm.com/libconfig/. To install libconfig run the following:

 wget http://www.hyperrealm.com/libconfig/libconfig-1.3.2.tar.gz
 tar -xzf libconfig-1.3.2.tar.gz
 cd libconfig-1.3.2
 ./configure
 make
 sudo make install

To make the system aware of this library, add "/usr/local/lib" to /etc/ld.so.conf and run "sudo ldconfig". i.e.

 echo /usr/local/lib | sudo tee -a /etc/ld.so.conf
 sudo ldconfig

On newer systems (Ubuntu 7.10) you can do this instead:

 echo /usr/local/include | sudo tee /etc/ld.so.conf.d/libconfig.conf
 sudo ldconfig

./configure

MAS uses autoconf for some basic configuration stuff. The biggest thing you usually need to tell it is what the basic username and group should be for mce data. Also, there are a few options for the driver and some stupid python stuff.

From the MAS source folder, run

./configure

Some useful options:

 --disable-driver        suppress driver compilation/installation
 --disable-bigphysarea   compile driver without bigphysarea support
 --disable-config2       suppress mas.cfg and mce.cfg generation/installation
 --with-user=USER        set default MCE user
 --with-group=GROUP      set default MCE group
 --with-kernel-dir=DIR   set kernel build directory (typically automatically determined)

Run

./configure --help

for a full list. When running, configure will complain if it cannot find something, and even suggest what package you need to install.

mce.cfg

After running configure, but before running make, you must specify a template file (mce.cin) which will be used to generate the hardware configuration file (mce.cfg). Full details of this procedure are given in the mce.cfg page, but briefly:

  1. copy an appropriate template from config2/v4/ or config2/v5/ to config2/mce.cin
  2. edit the config2/mce.cin file to describe your MCE.

The configuration file will be installed automatically when make install is run below. This entire step can be skipped if you passed --disable-config2 to configure above, but note that MAS will not function without mce.cfg and mas.cfg installed.

make

This often works.

make clean; make

Test the driver

It is wise to test that the driver does not kill your machine before installing it to load on boot. After compiling do:

cd driver
sudo ./reload

This will load the driver, which should then try to talk to the SDSU PCI card if it is installed. Note that since "reload" first unloads the driver if it is present, and then loads the driver from the current folder, it may report an "ERROR" message if the first step fails, even though the driver is successfully loaded. The definitive way to check that the driver is loaded is

 cat /proc/mce_dsp

If this file does not exist, the driver isn't loaded. If the cat prints out a bunch of low-level driver information, you're in good shape.

sudo make install

If you're satisfied that the driver works, install the whole thing. Go back up to the MAS base folder and run

sudo make install

This will do the following:

  1. install the kernel driver, driver/mce_dsp.ko, into /lib/modules/$(uname -r)/kernel/drivers/misc/, and re-scan the module dependencies.
  2. install the MAS binaries from applications/ and the scripts from script/ into /usr/mce/bin
  3. install the MAS udev ruleset scripts/91-mas.rules into /etc/udev/rules.d/. These udev rules will ensure that the mce_dsp module is loaded and the MAS device nodes are created at boot time.
  4. install the mas logging daemon script /etc/init.d/mas init script. The driver can then be started/restarted as desired through this script: /etc/init.d/mas restart The driver will automatically be set to load on boot. To disable this, remove the symbolic link "/etc/rc2.d/S99mas".
  5. install the hardware configuration file, config2/mce.cfg, and the MAS configuration file, config2/mas.cfg to /etc/mce/.

Install mce_script

The mce_script files are designed so that users can fairly easily run a different set of scripts. We will install a system default set in /usr/mce/mce_script

cd /usr/mce
svn checkout svn://e-mode.phas.ubc.ca/mce_script/branch/{your_experiment} mce_script

Current experiments include ACT and SPIDER.

mas_env.bash

To set up the environment and path to use these scripts and idl codes, a user should do "source mas_env.bash". (This file used to live in mas/config, but has been moved into mce_script/template.) Non-developer users can source /usr/mce/mce_script/template/mas_env.bash directly; advanced users may want to keep their own copy (or several different copies) in their home folder.

Note that MAS/mce_script scripts should *not* source mas_env.bash! The whole point of it is that paths should be flexible.

.bashrc

To have bash start up with the MAS variables defined, and the paths ready, add the following lines to .bashrc :

export MAS_ROOT=/usr/mce/mce_script/
source $MAS_ROOT/template/mas_env.bash
export IDL_PATH="<IDL_DEFAULT>:$MAS_IDL/mas"

While you're in there, you may want to define a few aliases. In particular, I always uncomment the alias ll='ls-l' line.