Work locally#
This guide provides instructions for setting up the LHCb stack and Allen standalone on an Ubuntu machine without the need to login on an LXPLUS machine.
Please note that in order to use the LHCb stack and Allen standalone seamlessly, it is necessary to have a CENTOS7/8 (or RHEL8) operating system and a proper LHCb environment. This can be accomplished by mounting the
/cvmfs
directory and running the LHCb environment within a Docker container.Additionally, large data files are stored in EOS, and for this reason, and you may choose to mount the
/eos
directory if you wish to work with them locally.
Set-up Kerberos#
Please refer to the official documentation for instructions on how to install Kerberos on your system.
On Ubuntu, you can use the following command to install Kerberos:
sudo apt-get install krb5-user
During the setup process, you can choose CERN.CH
as your default realm.
To sign in using Kerberos, run the following command, replacing jdoe
with your username:
kinit jdoe@CERN.CH
If you have set CERN.CH
as your default realm, you can simply use kinit jdoe
.
You will be prompted to enter your CERN password.
By using Kerberos, you will not need to enter your CERN password every time you connect to an LXPLUS computer. This is also required for building the LHCb stack.
Mount CVMFS#
Following the official documentation, the LHCb CVMFS repositories can be set up in your Ubuntu machine by following these steps:
# 1. Download the CVMFS installation package
wget https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest_all.deb
# 2. Install the package
sudo dpkg -i cvmfs-release-latest_all.deb
# 3. Remove the downloaded package
rm -f cvmfs-release-latest_all.deb
# 4. Update your packages
sudo apt-get update
# 5. Install CVMFS
sudo apt-get install cvmfs
Then, to configure the access to the specific LHCb CVMFS repositories, you need to edit
(or create) the /etc/cvmfs/default.local
file and add the following information:
CVMFS_REPOSITORIES=lhcb.cern.ch,lhcbdev.cern.ch,ganga.cern.ch
CVMFS_HTTP_PROXY=DIRECT
CVMFS_QUOTA_LIMIT=25000
CVMFS_CLIENT_PROFILE=single
To configure the repositories, run:
sudo cvmfs_config setup
Mount /cvmfs/lhcb.cern.ch
by running
mount -t cvmfs lhcb.cern.ch /cvmfs/lhcb.cern.ch
and similarly for lhcbdev.cern.ch
and ganga.cern.ch
.
Set up the LHCb grid proxy#
The LHCb grid proxy allows to use ganga
to perform operations on bookkeeping paths,
LFNs and PFNs, as well as download files from the grid (using the xrdcp
command).
Note that you do not need a LHCb proxy to download a file stored in the CERN site
of the grid.
Assuming that you have already set up your LHCb grid proxy on LXPLUS, the following are the instructions to create a grid proxy in your local Ubuntu machine (For other OS, please refer to this documentation.)
Install the VOMS client
sudo apt-get install voms-clients
Copy the required grid certificates and files from LXPLUS:
scp -r lxplus.cern.ch:.globus/ ~/.globus
This will also copy your LHCb grid certificate.
Copy the central LHCb grid certificates:
scp -r lxplus.cern.ch:/cvmfs/lhcb.cern.ch/etc/grid-security/ ~/grid-security
Add the following lines to your
~/.bashrc
file:export X509_CERT_DIR="$HOME/grid-security/certificates" export X509_VOMS_DIR="$HOME/grid-security/vomsdir" # Facultative. This allows to be able to pass the proxy to a Docker environment export X509_USER_CERT=$HOME/.globus/usercert.pem export X509_USER_KEY=$HOME/.globus/userkey.pem # Alias to create the proxy using `voms-proxy-init` alias lhcb-proxy-init='voms-proxy-init -voms "lhcb:/lhcb/Role=user" -vomses "$HOME/grid-security/vomses" -r --valid 168:00 -cert "$HOME/.globus/usercert.pem" -key "$HOME/.globus/userkey.pem"'
After making changes to your
~/.bashrc
file, remember to activate them by running the following command to refresh your environmentsource ~/.bashrc
To create your proxy, use the following command:
lhcb-proxy-init
Use the LHCb Environment through docker in CVMFS#
As explained in this twiki page, with a properly configured CVMFS installation, you can start the LHCb environment inside a Docker container using the following command,
/cvmfs/lhcb.cern.ch/lib/bin/lb-docker-run --lbenv --home --volume $HOME/.ssh:/userhome/.ssh:ro (--volume $HOME/.globus:/userhome/.globus:ro)
--home
, set a persistent home for this image and allows you to run it without root privileges.--lbenv
is supposed to source the LHCb environment, but for an unknown reason, it may not work when--home
is used. As a workaround, you will need to add the following line to your~/.bashrc
file inside the container:source /cvmfs/lhcb.cern.ch/lib/LbEnv
.--volume $HOME/.ssh:/userhome/.ssh:ro
binds the.ssh
folder from your host machine to the container, allowing you to perform Git operations inside the container.ro
stands for read-only.--volume $HOME/.globus:/userhome/.globus:ro
is optional and allows you to have access to the LHCb proxy that you created outside the Docker environment. If you choose to use it, you will also need to add the following lines to your~/.bashrc
file inside the container:export X509_CERT_DIR="/cvmfs/lhcb.cern.ch/etc/grid-security/certificates" export X509_VOMS_DIR="/cvmfs/lhcb.cern.ch/etc/grid-security/vomsdir" export X509_USER_PROXY=$HOME/.grid.proxy
In addition to the options mentioned, you can use --help
to view all available options
and their descriptions. This can help you customize and configure the docker environment
to suit your specific needs.
Please note that if you have configured CVMFS as per the previous section,
the lhcb.cern.ch
repository will be automatically mounted, and you don’t need
to run mount -t cvmfs lhcb.cern.ch /cvmfs/lhcb.cern.ch
.
Mount EOS#
To mount the EOS file system in your machine, you can follow the instructions in the CERN article
We will focus on mounting your home (/eos/user/{initial}/{username}
on LXPLUS)
and the LHCb repository (/eos/lhcb/
on LXPLUS).
To install the required dependencies, you can run the following bash commands:
# Configure the required APT repositories
echo "deb [arch=$(dpkg --print-architecture)] http://storage-ci.web.cern.ch/storage-ci/debian/xrootd/ $(lsb_release -cs) release" | sudo tee -a /etc/apt/sources.list.d/cerneos-client.list > /dev/null
echo "deb [arch=$(dpkg --print-architecture)] http://storage-ci.web.cern.ch/storage-ci/debian/eos/citrine/ $(lsb_release -cs) tag" | sudo tee -a /etc/apt/sources.list.d/cerneos-client.list > /dev/null
curl -sL http://storage-ci.web.cern.ch/storage-ci/storageci.key | sudo apt-key add -
# Install the eos-fusex package
sudo apt update
sudo apt install eos-fusex
Please note that the above commands are tailored for Ubuntu version 20.04 or earlier. If you are running Ubuntu version 22.04, you will need to replace the second line with the following command:
echo "deb [arch=$(dpkg --print-architecture)] http://storage-ci.web.cern.ch/storage-ci/debian/eos/diopside/ $(lsb_release -cs) tag" | sudo tee -a /etc/apt/sources.list.d/cerneos-client.list > /dev/null
After configuring the APT repositories and installing the necessary packages, you will need to create the configuration files for mounting your home directory and the LHCb repository.
To mount your home directory, create the file /etc/eos/fuse.home-j.conf
with the following content, replacing jdoe
with your own username, and j
by its initial
{"name":"home-j","hostport":"eoshome-j.cern.ch","remotemountdir":"/eos/user/j/", "localmountdir":"/eos/user/j/"}
To mount the LHCb folder, create the file /etc/eos/fuse.lhcb.conf
with the following content:
{"appname":"ubuntu","name":"lhcb","hostport":"eoslhcb.cern.ch","remotemountdir":"/eos/lhcb/","localmountdir":"/eos/lhcb/"}
Next, you will need to create the local directories and mount the EOS directories by running the following commands:
# Create the local directories
sudo mkdir -p /eos/user/j # or `user/a` if your username starts with an `a`
sudo mkdir -p /eos/lhcb
# Mount the EOS directories
sudo eosxd -ofsname=home-j # or `home-a` if your username starts with an `a`
sudo eosxd -ofsname=lhcb
It’s important to note that you will need to run the sudo eosxd
commands every time
your machine restarts. To make this process easier, you can add these commands
to a bash script.
Note
I do not know yet how to mount the EOS folder inside the docker image of the previous section.