Jump to content

DAQ Setup with AlmaLinux9.4

From Luter 345 Experiments
Revision as of 15:07, 6 November 2024 by en>Brash (Setting Up the Computer)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Installation Instructions

Below we have compiled a guide that walks through a basic setup of CODA 2.6.2. Our intention in writing this walkthrough is to assist CNU physics undergraduates in setting up a simple data acquisition system. The guide is geared toward first time Linux users, however for those users who are more advanced, the basic process may still be helpful.

Notes:

1. Operating System: For this guide we used AlmaLinux 9.4, but any Linux distribution should be okay. (Some of the syntax and directory locations may change)

2. CODA Version: CODA 2.6.2

3. Hosted Files: Some sections we will have Links that list examples of various files or websites that may be used for reference.

4. Terminal Commands & Changes: We will be using a dollar sign ($) to signify a prompt for the regular user accounts, and a pound sign (#) for the root user. Also, we used greater than (>) and less than (<) symbols to signify user input.

Example User: [coda@jlabdaq ~]$

Example Root User: [root@jlabdaq ~]#

Example User Input: <codauser>

6. Text Editor: For a quick text editor we used vi. If you are unfamiliar with vi, one can easily look up the commands or use any text editor that you prefer (i.e. emacs, gedit, etc).

5. Troubleshooting/Hints: We have added Possible Issue and Hint sections to help with the installation process.

6. Patience: Some portions of CODA (i.e. cedit and debedit) are finicky and take practice to learn how to handle/tolerate them.

Our Setup

Throughout the guide we will be using our own configuration to act as an example. Below we have listed our configuration outline:

Experiment: Cosmic Ray Detector using two scintillator paddles with four PMTs.

VME Crate:

1. Linux Controller Name: jlabvme

2. ADC/TDC: v792n/v775n

3. Signal Units/Voltage: 1 FIFO, 1 CFD, 1 Delay Unit, 1 Quad Four Fold Logic Unit, 1 NIM/ECL Translator, 1 Trigger Interface, 1 HV Unit

Analysis/CODA Computer:

1. Hostname/Computer Name: jlabdaq (CentOs 6.5, x86_64)

2. CODA Account: coda

Database:

1. Database Name: PCSE

2. Configuration: ADCTDC

3. Session: Luter345

Setting Up the Computer

BIOS Settings

1. Enable the BIOS preference to boot from an external drive.

Hint: Some older machines may not be able to boot from a USB Drive, instead a disc will be needed.

2. Make sure that the USB ports are visible

Downloading AlmaLinux & Preparing the Computer

STEP 1: Installation

i. Run the "Install AlmaLinux 9.4" option. Testing the media is unnecessary.

ii. Follow the installer's instructions until you reach the summary screen.

iii. Under user settings, set a root password. Do not lock the root account, allowing root ssh login is optional.

iv. Under user settings, create a standard user.

v. Complete/begin the installation.

STEP 2: Installing Libraries and Updating

i. Turn on the connection to the internet

   1.	Go to system, preferences, network connections (GUI)
   2.	Double click System eth0
   3.	Select Connect Automatically and Available for all Users
   4.	Click Apply
   5.	Enter root password to save the information 

ii. Turn off screen saver (Optional)

   1.	Go to system, preferences, screensaver
   2.	Uncheck the lock option when the computer goes to the screensaver
   3.	Change the elapsed time for the screensaver (~ 40 minutes)
   4.	Click Close

iii. Open new shell (terminal)

       Hint: Make sure that you are super user, connected to the internet, and are in the home directory 
   1.	$ su
   2.	$ <root password> 

Link: Library Script

   3.	Run the libraries script : # ./lib32_install.sh 
   5.   Possible Issue: DATABASE DISK IMAGE IS MALFORMED. Normally this can be ignored for our purposes.	 
   6.	Once the script is done installing: # yum –y update
   7.	# exit

STEP 3: Create Second User Account (tcsh)

i. Go to system, administration, users and groups (GUI)

ii. Enter the root user password

iii. Click Add User

iv. Enter a username

v. No need to enter a full name

vi. Enter a password

vii. Change login shell to tcsh

STEP 4: Network Settings

i. Go to system/preferences/network connections (GUI)

ii. Double click System eth0

iii. Click ipv4 settings tab

iv. Method Dropdown: Change from DHCP to manual

v. Press add button under Addresses

Hint: This network setup is meant for a CNU configuration.

vi. Enter the address: 137.155.2.XX, netmask: 255.255.255.0, and gateway for your network (may need to contact administrator):137.155.2.4

vii. Enter the DNS server addresses: 137.155.2.50, 137.155.2.14 (may need administrator)

viii. Enter the search domain: pcs.cnu.edu (may need administrator)

ix. Click apply

x. Enter root password

STEP 5: Hosts File Changes

i. $ su

ii. $ <root password>

iii. # vi /etc/hosts

iv. Within the file add this line: <ip address> <domain name> <computer name>

   1.	Go to a new line in the file
   2.	Example: 137.155.2.58 jlabvme.pcs.cnu.edu jlabvme
   3.	Both computers need to be in the hosts file (i.e. jlabdaq & jlabvme)

v. Save the file and exit

vi. # exit

vii. $ ssh root@jlabvme

viii. $ <enter password for root@jalbvme>

ix. # vi /etc/hosts

Link: Hosts File

x. Within the hosts file add this line: <ip address> <domain name> <computer name>

xi. Save the file and exit

xii. #exit

xiii. Any computers that you wish to ssh into, make sure that they are added to the hosts file.

STEP 6: Turn Off Firewall (Otherwise add exceptions for the specific machines)

i. Go to system/administration/firewall (GUI)

ii. Enter root password

iii. Click Disable

iv. Click Apply (Look top left corner)

STEP 7: SSH Without Password

i. Login to CODA Account

ii. We are now switching so that all permissions are set to our CODA user account.

iii. Open a new shell (terminal)

iv. $ su

v. $ <root password>

vi. # /sbin/service sshd start

vii. # exit

viii. Hint: Make sure you are in the home directory: /home/<username>

ix. $ ssh-keygen –t rsa

x. $ <Press enter three times>

xi. $ cat .ssh/id_rsa.pub | ssh root@jlabvme ‘cat >> .ssh/authorized_keys’

xii. type yes

xiii. $ ssh root@jlabvme “chmod 700 .ssh; chmod 640 .ssh/authorized_keys”

xiv. $ ssh root@jlabvme

xv. # exit

xvi. Back on the CODA user account: $ ssh-add

Link: If help is needed: http://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/

Installing CODA

Downloading & Preparing CODA

STEP 1: Downloading CODA

i. Make sure that you are a user in tcsh

ii. Go to the jlab’s CODA wiki and download CODA 2.6.2

iii. Link: https://coda.jlab.org/wiki/index.php/CODA_2.6.2_Downloads

iv. Open a new shell (terminal)

v. $ su

vi. $ <root password>

vii. # mkdir /usr/local/coda

viii. # mv /home/<username>/Downloads/coda_2.6.2.tar.gz /usr/local/coda

ix. # cd /usr/local/coda

x. # tar –xf coda_2.6.2.tar.gz

xi. # exit

STEP 2: Making Directories for CODA

i. Open a new shell (terminal)

ii. $ mkdir /home/<codauser>/bin

iii. $ mkdir /home/<codauser>/msql

iv. $ mkdir /home/<codauser>/CODA

v. $ mkdir /home/<codauser>/CODA/cool

vi. $ mkdir /home/<codauser>/CODA/data

STEP 3: Setting Up Environment Variables

i. Edit an example setup file to set up the environment variables (dosetupcoda262)

Link: Environment Variables (dosetupcoda262)

ii. Put dosetupcoda262 in the coda user’s home directory

iii. Edit dosetupcoda262 with the following:

   1.	Variables that need editing:
    a.	MSQL_TCP_HOST <hostname>
    b.	MSQL_HOME /home/<codauser>/msql
    c.	EXPID <PCSE>
    d.	SESSION <Luter345>
    e.	CODA_DIRECTORY /home/<codauser>/CODA
    f.	CODADATA /home/<codauser>/CODA/data

iv. Create a .tcshrc file in the home directory that sources dossetupcoda262

Link: .tcshrc

   1.	$ vi ~/.tcshrc
   2.	Include the following line in the file:
   3.	LIST WHAT GOES IN THIS
   4.	source {$HOME}/dosetupcoda262
   5.	Hint: .tcshrc is a hidden file, to list it: $ ls -a 
   6.	To test if the sourcing worked properly, open a new shell to see if coda and AFECS is listed at the top of the window

STEP 4: MSQL Setup

i. Starting the msql database

   1.	Hint: The database must be running at all times. If the program is disrupted, the port that it is using will be left open. 
        If this occurs, kill the msql process and re-launch the database. 
   2.	Open a new shell (terminal) 
   3.	$ msqld
   4.	Rename the window msql for clarity

STEP 5: Changing Soft Link for Problem Library (cedit)

i. Open new shell (terminal)

   1.	$ su
   2.	$ <root password>
   3.	# cd /usr/lib
   4.	# ln –s libXm.so.4 libXm.so.3
   5.	This will create a soft link for the particular library that we need. (Previously used library: libXm.so.3.0.2)

STEP 6: Cedit (GUI for database; Must be running msqld)

i. Open a new shell (terminal)

ii. $ cedit

Possible Issue: If cedit does not open and throws an error: check if the database is running, the proper directories were made with the correct ownership, and that there are no missing libraries/links.

iii. Click: File->New Database

iv. Name the database <database name>

v. Create a new configuration

vi. Click: File->New

vii. Name the configuration <config name>

viii. Create a basic setup: ROC, EB, ER, and a data file

ix. See working example.

Link: CEDIT

STEP 7: Dbedit (text version of the database)

i. Open a new shell (terminal)

ii. $ dbedit

iii. Select local host from dropdown

iv. Select <database name> from dropdown

v. Compare all sections against a working example

Link: DBEDIT

STEP 8: NFS (Export the file systems from jlabdaq to jlabvme)

i. Open a new shell (terminal)

ii. $ su

iii. $ <root password>

iv. # vi /etc/exports

Link: Exports File

Hint: This is a CNU network configuration.

v. Edit this file by adding these lines:

   1.	/home 137.155.2.0/255.255.255.0(rw,sync,no_root_squash)
   2.	/usr/local/coda 137.155.2.0/255.255.255.0(rw,sync,no_root_squash)
   3.	/usr/lib/jvm 137.155.2.0/255.255.255.0(rw,sync,no_root_squash)

vi. Save and exit the file

vii. Hint: start NFS while super user

viii. # /sbin/chkconfig --levels 345 nfs on

ix. Check if NFS is on: # /sbin/chkconfig --list nfs status

x. # /etc/init.d/nfs start

xi. # exit

xii. ssh into jlabvme: $ ssh root@jlabvme

xiii. # vi /etc/fstab

Link: fstab File

xiv. Add these lines in preparation for mounting

   1.    jlabdaq:/home                 /daqhome           nfs            rw,sync       0 0
   2.    jlabdaq:/usr/local/coda      /usr/local/coda    nfs            defaults       0 0
   3.    jlabdaq:/usr/lib/jvm       /usr/lib/jvm         nfs            defaults       0 0

xv. Make the directories that were specified above

   1.    # mkdir /daqhome
   2.    # mkdir /usr/local/coda
   3.    # mkdir /usr/lib/jvm

xvi. # mount –a

xvii. Proper sourcing in jlabvme

   1.    Create a new environment variable file on jlabvme that has the NFS mounted directories. (We named ours coda_Luter345)  
   2.    Link: Environment Variables On jlabvme (coda_Luter345)
   3.    Once the the environment variables are set, they must be sourced
   4.    Create a new script that sources coda_Luter345 (We named ours setLuter345.sh)
   5.    Link: setLuter345.sh

Starting and Killing CODA

What needs to run?

In order to properly start CODA one must first run the following processes:

Hint: Make sure that each of these processes is run independently in their own shell.

1. To start database (new terminal): $ msqld

Hint: Leave the database running, it does not need to be turned off.

2. Remove session file (new terminal): $ rm /tmp/et_sys_$SESSION

Hint: This file needs to be removed every time et_start is run. However, if the file has never been created, it will throw an error. It is okay to ignore this.

3. Begin the event transfer system(same terminal that you removed the session file in): $ et_start

4. Start the run control platform (new terminal): $ rcplatform

Hint: Some time is needed for rcplatform to fully boot (about 5 seconds). Upon first running rcplatform, two prompts (within the rcplatform window) will ask the user if it is okay to start.

The next three steps allow the user to actively see the event builder, event recorder, and the readout controller. (Helpful for debugging)

5. Start event builder (EB) (new terminal): $ coda_eb_rc3 -i -s $SESSION -name EB1 -type CDEB

6. Start event recorder (ER) (new terminal): $ coda_er_rc3 -i -s $SESSION -name ER1 -type ER

7. Start readout controller (ROC) (new terminal): $ ssh -t root@jlabvme coda_roc_rc3 -i -s $SESSION -name ROC1 -type ROC

Hint: In step 7, the ROC must be accessed remotely using the ssh protocol.

8. Start the graphical interface for the run controller (new terminal): $ rcgui

Bash Scripts

Location: Computer: jlabdaq User: coda Directory: home/coda/bin

Small programs can be written in order to quickly start and end CODA in an efficient manner. To accomplish this, multiple terminals must be running in order to start various programs. Terminal emulation programs can easily solve this problem.

Xterm is the emulator that we chose to use.

1. StartCODA

Link: Startcoda Script

Within the script xterm can be utilized to run multiple processes in the background.

Example: xterm -bg white -fg black -geometry 96x12-0+192 -e $SHELL -c '$SHELL -c "echo Starting rcplatform; rcplatform"; read' &

The ampersand at the end lets the computer know to keep the process running without ending it when the script ends. Similar lines can be written in order to run all of the necessary processes.

2. KillCODA

Link: Killcoda Script

Once one is ready to close CODA, a simple script can be written to end all of the processes in an orderly fashion.

Example: ps wwwaux | grep rcplatform | awk '{print $2}' | xargs kill -9 &

Here is a statement that lists all running processes, finds the specific name, grabs the process ID, and then kills that process. This can be done for each process that was started.

3. Libraries for running CODA on this version (move/format this later)

ibgcc-11.4.1-3.el9.alma.1.i686

glibc-gconv-extra-2.34-100.el9_4.4.i686

glibc-2.34-100.el9_4.4.i686

libICE-1.0.10-8.el9.i686

libXau-1.0.9-8.el9.i686

libxcb-1.13.1-9.el9.i686

libX11-1.7.0-9.el9.i686

libXpm-3.5.13-10.el9.i686

libstdc++-11.4.1-3.el9.alma.1.i686

libstdc++-devel-11.4.1-3.el9.alma.1.i686

libXext-1.3.4-8.el9.i686

libXp-1.0.3-11.el9.i686

libuuid-2.37.4-18.el9.i686

libSM-1.2.3-10.el9.i686

libXt-1.2.0-6.el9.i686

libXmu-1.1.3-8.el9.i686

libnsl-2.34-100.el9_4.4.i686

libXi-1.7.10-8.el9.i686

libXtst-1.2.3-16.el9.i686

libXcomposite-0.4.5-7.el9.i686

zlib-1.2.11-40.el9.i686

libunistring-0.9.10-15.el9.i686

libtasn1-4.16.0-8.el9_1.i686

libffi-3.4.2-8.el9.i686

p11-kit-0.25.3-2.el9.i686

libidn2-2.3.0-7.el9.i686

libpng-1.6.37-12.el9.i686

xz-libs-5.2.5-8.el9_0.i686

libxml2-2.9.13-6.el9_4.i686

pcre2-10.40-5.el9.i686

pcre-8.44-3.el9.3.i686

nettle-3.9.1-1.el9.i686

gnutls-3.8.3-4.el9_4.i686

libsepol-3.6-1.el9.i686

libselinux-3.6-1.el9.i686

libbrotli-1.0.9-6.el9.i686

libblkid-2.37.4-18.el9.i686

libmount-2.37.4-18.el9.i686

glib2-2.68.4-14.el9_4.1.i686

graphite2-1.3.14-9.el9.i686

bzip2-libs-1.0.8-8.el9.i686

harfbuzz-2.7.4-10.el9.i686

freetype-2.10.4-9.el9.i686

fontconfig-2.14.0-2.el9_1.i686

libXrender-0.9.10-16.el9.i686

lksctp-tools-1.0.19-3.el9_4.i686

alsa-lib-1.2.10-2.el9.i686

java-1.8.0-openjdk-headless-1.8.0.432.b06-2.el9.i686

java-1.8.0-openjdk-1.8.0.432.b06-2.el9.i686

java-1.8.0-openjdk-devel-1.8.0.432.b06-2.el9.i686