Installing Lino on a production server

Here is a set of conventions which we suggest to use as a site maintainer when setting up a Lino production server.

Configure a Lino production server

Install getlino into a shared virtual environment outside of your home:

$ sudo mkdir /usr/local/lino/shared/env
$ cd /usr/local/lino/shared/env
$ sudo chown root:www-data .
$ sudo chmod g+ws .
$ virtualenv -p python3 master
$ . master/bin/activate
$ pip install getlino

Run getlino configure as root:

$ sudo env PATH=$PATH getlino configure

For details see the documentation about getlino.

The env PATH=$PATH is needed to work around the controversial Debian feature of overriding the PATH for security reasons (source).

If your customers want to access their Lino from outside of their intranet, then you need to setup a domain name and add the --https option in above command line.

Install a first site. You will do the following for every new site on your server.

$ sudo env PATH=$PATH getlino startsite noi first

Point your browser to http://first.localhost

Some useful additions to your shell

Add the following to your system-wide /etc/bash.bashrc:

alias ll='ls -al'
alias a='. env/bin/activate'

function pywhich() {
  python -c "import $1; print($1.__file__)"
}

# find another name if your team also uses golang
function go() {
    for BASE in /usr/local/lino/lino_local
    do
      if [ -d $BASE/$1 ] ; then
        cd $BASE/$1;
        return;
      fi
    done
    echo Oops: no project $1
    return -1
}

If you want Logging all bash commands to syslog, then add also this:

# copied from http://backdrift.org/logging-bash-history-to-syslog-using-traps
function log2syslog
{
   declare COMMAND
   COMMAND=$(fc -ln -0)
   logger -p local1.notice -t bash -i -- "${USER}:${COMMAND}"
}
trap log2syslog DEBUG

After these changes you must close and reopen your terminal to activate them. You can now do the following to quickly cd to a project directory and activate its Python environment:

$ go prj1
$ a