TODO: Out of date, use scripts/jointconfig instead. (nov 2013)
Alexander Rødseth for USIT, June 2013
TODO: Update with the information from July 2013 in tools.rst
Step by step
Log in to cere-utv01.uio.no
Checkout cerebrum to ~/checkout/cerebrum
Create a directory for the configuration files and local scripts:
mkdir -p ~/checkout/cerebrum/{conf,bin}
Create ~/checkout/cerebrum/conf/config.dat:
# Config file for bofhd Cerebrum.modules.no.uio.bofhd_uio_cmds/BofhdExtension Cerebrum.modules.no.uio.bofhd_guestaccounts_cmds/BofhdExtension #Cerebrum.modules.no.uio.printer_quota.bofhd_pq_cmds/BofhdExtension Cerebrum.modules.no.uio.bofhd_ephorte_cmds/BofhdExtension #Cerebrum.modules.dns.bofhd_dns_cmds/BofhdExtension #Cerebrum.modules.dns.Subnet/BofhdExtension
Create ~/checkout/conf/cereconf.py:
execfile(os.path.expanduser("/cerebrum/uio/etc/cerebrum/cereconf.py")) CEREBRUM_DATABASE_CONNECT_DATA['user'] = "cerebrum" CEREBRUM_DATABASE_CONNECT_DATA['host'] = "dbpg-cere-utv.uio.no" CEREBRUM_DATABASE_NAME = "cerebrum_uio_rw"
Create one empty configuration file:
touch ~/checkout/cerebrum/conf/cereconf_dns.py
Use Robert's cerebrum_path.py, put it in ~/checkout/cerebrum/conf:
# -*- coding: utf-8 -*- import inspect as _inspect import os as _os import sys as _sys import pwd as _pwd _commonprefix = "/cerebrum" _instances = { 'uio': '%s/uio/' % _commonprefix, 'uia': '%s/uia/' % _commonprefix, 'gisk': '%s/giske/' % _commonprefix, 'nih': '%s/nih/' % _commonprefix, 'ofk': '%s/ofk/' % _commonprefix, 'nmh': '%s/nmh/' % _commonprefix, 'hiof': '%s/hiof/' % _commonprefix, 'hih': '%s/hih/' % _commonprefix, 'web': '%s/webid/' % _commonprefix, } #try: # _prefix = _instances[_pwd.getpwuid(_os.getuid())[0]] #except KeyError: # assert False, "Unknown user %s, check %s\n" % (_os.getlogin(), __file__) _prefix = _instances[_os.environ.get('CEREBRUM_INST') or 'uio'] _sys.path.append(_os.path.join(_prefix, 'etc', 'cerebrum')) _sys.path.append(_os.path.join(_prefix, 'lib', 'python2.5', 'site-packages')) _f = _inspect.currentframe() while _f.f_back: _f = _f.f_back try: _fn = _f.f_globals['__file__'] except KeyError: _sys.stderr.write("Running session from command line\n") else: pass #_fn = _os.path.realpath(_fn) #if _fn.startswith(_commonprefix): # assert _fn.startswith(_prefix), "Not allowed to run %s as %s\n" % (_fn, # _pwd.getpwuid(_os.getuid())[0]) #for _i in map(_os.path.realpath, _sys.path): # if _i.startswith(_commonprefix): # assert _i.startswith(_prefix), "%s not allowed in PYTHONPATH\n" % _i
Set a new PATH and PYTHONPATH by putting this in your ~/.zshrc or ~/.bashrc file:
if [ `hostname` = 'cere-utv01.uio.no' ]; then echo -n 'Development environment...' export PYTHONPATH=~/checkout/cerebrum/conf:~/checkout/cerebrum:/site/lib/python2.5/site-packages export PATH=/local/bin:$PATH echo 'ok' fi
Logg off and on again or just run $SHELL
Put this in ~/checkout/cerebrum/bin/bofhd.sh (select your own port number):
#!/bin/sh python ~/checkout/cerebrum/servers/bofhd/bofhd.py \ -c ~/checkout/cerebrum/conf/config.dat \ --logger-name=console \ --logger-level=DEBUG \ --port 1337
And this in ~/checkout/cerebrum/bin/bofh.sh (use the port number you just selected):
#!/bin/sh bofh --url https://cere-utv01.uio.no:1337 \ --set "console_prompt=test_uio_bofh> "
Make the scripts executable:
chmod +x ~/checkout/cerebrum/bin/*
Run bofhd and bofh in tmux (if tmux is not available, use screen instead):
cd ~/checkout/cerebrum tmux bin/bofhd.sh
Press ctrl-b, c, then type (for screen, use ctrl-a, c):
bin/bofh.sh
Done!
Local installations
Install mx:
sudo yum install mx
Create your own PostgreSQL database with user data
... to be written