wiki:InstalldCacheOnUbuntu1404
Last modified 3 years ago Last modified on 08/17/15 18:09:10

Howto install dCache on Ubuntu 14.04 from scratch =

This howto will guide you through all steps needed to run a minimal dCache on Ubuntu 14.04.

Prerequisites

Packages

First install the following packages from the regular Ubuntu repositories:

# sudo apt-get install build-essential git maven postgresql apache2-utils nfs-common build-essential debhelper quilt 

You will also need Java8 to compile and run dCache. I suggest you add the webupd8 PPA to your repositories as described here Then do

# sudo apt-get update
# sudo apt-get install oracle-java8-installer

Keys and Certificates

If you don't have ssh user keys, generate a new pair by running

# ssh-keygen

This will put public and private keys in ~/.ssh/

If you don't have SSL certificates yet for your system, you can generate a self-signed certificate in /etc/grid-security/

# sudo su
# mkdir -p /etc/grid-security
# cd /etc/grid-security
# openssl genrsa 2048 > hostkey.pem
# openssl req -new -x509 -nodes -sha -days 3650 -key hostkey.pem > host.cert
# openssl x509 -noout -fingerprint -text < host.cert > host.info
# cat host.cert hostkey.pem > hostcert.pem
# chmod 400 hostkey.pem hostcert.pem

Later we will have to make these files to be owned by the user dcache

Building dCache

To build dCache you first have to check out the sources from GitHub. Check out the sources using git in a directory of your choice:

# git clone https://github.com/dCache/dcache.git

This will create a dcache sub-directory containing the sources. Once those dependencies are satisfied, change into that directory and build the package with the following command

# mvn -am -pl packages/fhs package -P deb

Building will take a couple of minutes. Afterwards the deb-package will be located in the packages/fhs/target directory.

Installing and Configuring dCache

Install the package with the following command:

# sudo dpkg -i dcache_*-1_all.deb

Preparing PostgreSQL

Edit your /etc/postgresql/9.4/main/pg_hba.conf file to look like the following:

# Database administrative login by Unix domain socket
local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD
# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

This will allow connections from localhost to the database.

Next create the necessary users and databases for dCache. To do that you have to become user postgres:

# sudo su - postgres

Now as user postgres execute the following commands:

createuser -U postgres --no-superuser --no-createrole --createdb dcache
createdb -O dcache -U postgres alarms
createdb -O dcache -U postgres chimera
createdb -O dcache -U postgres billing
createdb -O dcache -U postgres pinmanager
createdb -O dcache -U postgres spacemanager
createdb -O dcache -U postgres transfermanager
createdb -O dcache -U postgres srm

Configuration

This is a good time to do the chown for the hostkey and hostcert files in /etc/grid-security. Do

# sudo chown dcache /etc/grid-security/hostkey.pem /etc/grid-security/hostcert.pem

/etc/dcache/dcache.conf

In dcache.conf set the following properties:

dcache.layout = layout
dcache.log.level.events = info

You can call the layout file as you want, but it needs to match the filename in the next section.

/etc/dcache/layouts/layout.conf

admin.enable.colors = false
alarms.db.type = xml
dcache.enable.space-reservation = true
dcache.enable.overwrite = true
pnfsmanager.default-access-latency = ONLINE
pnfsmanager.default-retention-policy = OUTPUT
srm.persistence.enable.history = true
dcache.authn.ciphers = DISABLE_EC,DISABLE_RC4

[dCacheDomain]
 dcache.java.memory.heap=2048m
 dcache.java.options.extra=-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n -Djdk.tls.ephemeralDHKeySize=matched
[dCacheDomain/admin]
[dCacheDomain/alarms]
[dCacheDomain/poolmanager]
[dCacheDomain/spacemanager]
[dCacheDomain/pnfsmanager]
[dCacheDomain/cleaner]
[dCacheDomain/gplazma]
[dCacheDomain/pinmanager]
[dCacheDomain/billing]
[dCacheDomain/topo]
[dCacheDomain/info]
[dCacheDomain/statistics]
[dCacheDomain/transfermanagers]
[dCacheDomain/httpd]
[dCacheDomain/nfs]
[dCacheDomain/webdav]
 webdav.authn.basic=true
 webdav.cell.name=webdav
 webdav.authn.protocol = http
 webdav.authz.anonymous-operations = FULL
 webdav.net.port = 2880

/etc/dcache/gplazma.conf

A very simple configuration that allows username+password authentication can be done with the following entries in gplazma.conf

auth    optional  htpasswd
map     requisite authzdb
session requisite authzdb

/etc/dcache/htpasswd

For the configuration in the previous section to work we now need to create a entry for our user in /etc/dcache/htpasswd. You can do this by running, with your own username

# htpasswd -c /etc/dcache/htpasswd username

/etc/grid-security/storage-authzdb

To map the username to uid and gid on our system, we have to create mapping entries in a files called storage-authzdb. Add an entry like the following with the uid and gid for your system:

version 2.1

authorize username read-write 1000 1000 / / /
authorize another  read-only  1234 1000 / / /

Pools

To store files in dCache you need at least one pool. You can use the dcache command to create a pool. We create the entry for this pool in our layout file using the dcache command. In the example we generate a 10G pool called "pool1" in a domain called "pools"

# sudo dcache pool create --size=10000000000 /pools pool1 pools

Run dCache

Before the first run, do

# sudo dcache database update

and now finally run dCache

# sudo dcache start

Use dCache