3. February 2015

Install ]project-open[ on Ubuntu 14.4 LTS

Here is a quick run on how to install ]project-open[ with the cognovís Checkout on Ubuntu LTS 14.04. Become ROOT first and update your system

sudo su –
apt-get update
apt-get -y dist-upgrade
apt-get -y install emacs24-nox
shutdown -r now

Create the file /etc/apt/sources.list.d/pgdg.list, and add a line for the repository

sudo su –
echo ‘deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main’ >> /etc/apt/sources.list.d/pgdg.list
wget –quiet -O pg_key https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add pg_key
apt-get update

Install necessary components

Install PostgreSQL 8.4 (only version currently supporting ]project-open[)

apt-get -y install daemontools daemontools-run postgresql-8.4 postgresql-doc-8.4 postgresql-client-8.4 postgresql-server-dev-8.4 postgresql-contrib-8.4 make graphviz git-core emacs unzip zip ldap-utils debhelper dpkg-dev libc-client2007e-dev libcurl4-gnutls-dev mercurial bc

Get the sourcecode

cd /usr/local/src
wget http://sourceforge.net/projects/tcl/files/Tcl/8.5.19/tcl8.5.19-src.tar.gz

wget https://sourceforge.net/projects/tcllib/files/tcllib/1.19/tcllib-1.19.tar.gz
wget http://sourceforge.net/projects/tcl/files/Thread%20Extension/2.7.0/thread2.7.0.tar.gz
wget http://sourceforge.net/projects/next-scripting/files/2.1.0/nsf2.1.0.tar.gz
git clone https://github.com/tDOM/tdom.git
git clone https://github.com/cognovis/aolserver.git
git clone https://github.com/cognovis/nspostgres.git
cd aolserver
git clone https://github.com/cognovis/nscache.git
git clone https://github.com/cognovis/nssha1.git
git clone https://github.com/cognovis/nsimap.git
git clone https://github.com/flightaware/tclcurl-fa

Install TCL

cd /usr/local/src
tar xvfz tcl8.5.19-src.tar.gz
cd tcl8.5.19/unix
./configure –enable-threads –prefix=/usr/lib/aolserver4
make
make install
source /usr/lib/aolserver4/lib/tclConfig.sh
ln -sf /usr/lib/aolserver4/bin/tclsh8.5.19 /usr/lib/aolserver4/bin/tclsh

Now install tcllib

cd /usr/local/src
tar xvfz tcllib-1.19.tar.gz
cd tcllib-1.19/
./configure –prefix=/usr/lib/aolserver4
make install

Install aolserver

cd /usr/local/src/aolserver
chmod 755 *
/usr/lib/aolserver4/bin/tclsh8.5 ./nsconfig.tcl
make
make install

Install nspostgres

cd /usr/local/src/nspostgres
make POSTGRES=PG_CONFIG ACS=1
make install POSTGRES=PG_CONFIG ACS=1

Install nssha1

cd /usr/local/src/aolserver/nssha1
make
make install

Install nscache

cd /usr/local/src/aolserver/nscache
make
make install

Install nsimap

cd /usr/local/src/aolserver/nsimap
make
make install

Install thread

cd /usr/local/src/
tar xvfz thread2.7.0.tar.gz
cd thread2.7.0/unix/
../configure –enable-threads –prefix=/usr/lib/aolserver4/ –exec-prefix=/usr/lib/aolserver4 –with-naviserver=/usr/lib/aolserver4 –with-tcl=/usr/lib/aolserver4/lib
make
make install

Install nsproxy

cd /usr/local/src/aolserver/nsproxy
make
make install

Install xotcl

cd /usr/local/src
tar xfzv nsf2.1.0.tar.gz
cd nsf2.1.0
./configure –enable-threads –enable-symbols –prefix=/usr/lib/aolserver4 –exec-prefix=/usr/lib/aolserver4 –with-tcl=/usr/lib/aolserver4/lib
make
make install-aol

Install tdom

cd /usr/local/src/tdom/unix
../configure –enable-threads –disable-tdomalloc –prefix=/usr/lib/aolserver4 –exec-prefix=/usr/lib/aolserver4 –with-tcl=/usr/lib/aolserver4/lib
make
make install

Install tclcurl

cd /usr/local/src/tclcurl-fa
./configure –enable-threads –prefix=/usr/lib/aolserver4/ –exec-prefix=/usr/lib/aolserver4 –with-tcl=/usr/lib/aolserver4/lib
make
make install

Install TLS (e.g. for intranet-collmex)

cd /usr/local/src/
apt-get -y install libssl-dev
wget http://downloads.sourceforge.net/tls/tls1.6.7-src.tar.gz
tar xzpf tls1.6.7-src.tar.gz
cd tls1.6.7
./configure –with-ssl-dir=/usr –enable-threads –enable-shared –prefix=/usr/lib/aolserver4 –exec-prefix=/usr/lib/aolserver4 –with-tcl=/usr/lib/aolserver4/lib –with-tclinclude=/usr/lib/aolserver4/include/
make install

Install SQLLITE (e.g. for intranet-trados)

cd /usr/local/src/
wget https://www.sqlite.org/2016/sqlite-autoconf-3150200.tar.gz
tar xzpf sqlite-autoconf-3150200.tar.gz
cd sqlite-autoconf-3150200/tea
./configure –prefix=/usr/lib/aolserver4 –exec-prefix=/usr/lib/aolserver4 –enable-threads –enable-symbols –with-tcl=/usr/lib/aolserver4/lib
make install

apt-get install mdbtools

Install TCLWS (e.g. for intranet-translation-memoq)

cd /usr/local/src/
wget http://core.tcl.tk/tclws/tarball/Web+Services+for+Tcl+%28aka+tclws%29-a84ca21e4687142a.tar.gz
tar xvfz Web+Services+for+Tcl+\(aka+tclws\)-a84ca21e4687142a.tar.gz
cd Web_Services_for_Tcl__aka_tclws_-a84ca21e4687142a/

# Edit Makefile to point to /usr/lib/aolserver4/lib/tclws
make install

Configure the system

Prepare the system for a larger postgres memory usage

sysctl -w kernel.shmmax=554115072
echo ‘kernel.shmmax=554115072’ >> /etc/sysctl.conf
# Double check that it correctly was added in a new line
more /etc/sysctl.conf

Edit the configuration to allow add_missing_from, default_with_oids and set the regex_flavor to extended.
Also add pg_stat_statements to the shared_preload_libraries and increase effective_cache_size (1024MB) and shared_buffers (512MB) if you can.

emacs /etc/postgresql/8.4/main/postgresql.conf
/etc/init.d/postgresql restart

Setup basic permissions

groupadd web
mkdir /etc/aolserver4
mkdir /var/log/aolserver4
chown -R www-data.web /var/log/aolserver4

Install ]project-open[

Prepare the projop user.

mkdir /var/lib/aolserver
useradd -g web -d /var/lib/aolserver/projop -m -s /bin/bash projop
su – postgres
createuser -s projop
exit

Now get yourself ]project-open[ and load the dump file. The following description tells you how to get the code if you are a customer of cognovis

sudo su – projop
createdb -E UNICODE projop
# if you have an account with cognovis, you can try “git clone git@gitlab.com:project-open/translation.git”
mv translation/* .
mv translation/.git* .
rm -rf translation
./update-code.sh

Assuming you have a dumpile called projop in your current directory

psql -f files/projop.dmp
psql -f /usr/share/postgresql/8.4/contrib/pg_stat_statements.sql

Copy the config files and prepare the log directory

# Become root again
exit
cp /var/lib/aolserver/projop/files/projop.tcl /etc/aolserver4/
mkdir /var/log/aolserver4/projop
chown projop.web /var/log/aolserver4/projop/

Configure daemontools.

mkdir /var/lib/supervise/projop
mkdir /var/lib/supervise/projop/env
echo ‘en_US.UTF-8’ >/var/lib/supervise/projop/env/LANG
echo ‘en_US.UTF-8’ >/var/lib/supervise/projop/env/LC_ALL
cp /var/lib/aolserver/projop/files/run /var/lib/supervise/projop

emacs /var/lib/supervise/projop

# Make sure it looks like this

exec envdir /etc/service/projop/env /bin/sh -c ‘export HOME=/var/lib/aolserver/projop ; exec /usr/lib/aolserver4/bin/nsd -it /etc/aolserver4/projop.tcl -u projop -g web’

chown -R projop.web /var/lib/supervise/projop
update-service –add /var/lib/supervise/projop/ projop
initctl start svscan

You need to make sure to use envdir

Now you should see your aolserver nicely starting up. To make it restart, install the svgroup software

cp /var/lib/aolserver/projop/packages/acs-core-docs/www/files/svgroup.txt /usr/local/bin/svgroup
chmod 755 /usr/local/bin/svgroup
svgroup web /etc/service/projop

Setup demo user

Prepare the podemo user.

useradd -g web -d /var/lib/aolserver/podemo -m -s /bin/bash podemo
su – postgres
createuser -s podemo
exit

Now get yourself ]project-open[ and load the dump file. The following description tells you how to get the code if you are a customer of cognovis

sudo su – podemo
createdb -E UNICODE podemo
git clone https://github.com/cognovis/po.git
# if you have an account, try git@github.com:cognovis/po.git instead
mv po/* .
mv po/.git* .
rm -rf po
./update-code.sh

Assuming you have a dumpile called projop in your current directory

psql -f files/projop.dmp
psql -f /usr/share/postgresql/8.4/contrib/pg_stat_statements.sql

Copy the config files and prepare the log directory

# Become root again
exit
cp /var/lib/aolserver/podemo/files/podemo.tcl /etc/aolserver4/
mkdir /var/log/aolserver4/podemo
chown podemo.web /var/log/aolserver4/podemo/

Configure daemontools.

mkdir /var/lib/supervise/podemo
cp /var/lib/aolserver/podemo/files/run-podemo /var/lib/supervise/podemo
chown -R podemo.web /var/lib/supervise/podemo
update-service –add /var/lib/supervise/podemo/ podemo
svgroup web /etc/service/projop

LibreOffice

For PDF Generation in ]project-open[ we need OpenOffice. Sadly Ubuntu only uses libreoffice, so we have to solve things manually

apt-get -y install jodconverter libreoffice
cp /var/lib/aolserver/projop/packages/intranet-openoffice/libreoffice-init /etc/init.d/openoffice
chmod 755 /etc/init.d/openoffice
update-rc.d openoffice defaults
apt-get -y install ttf-mscorefonts-installer
sudo dpkg-reconfigure fontconfig
sudo fc-cache -fv

If you have additional fonts, copy them to /usr/share/fonts/truetype and run sudo fc-cache -fv again.

LDAP

Install PERL modules

apt-get install perl ldap-utils
cpan
-> install
-> install IO::Socket::PortState
-> install Net::LDAP
(follow defaults)

On the Website, install the auth-ldap-adldapsearch package and follow the steps at /intranet-sysconfig/ldap/ldap-ip-port.

Postfix

To send mails from your server you ideally have a relay host which allows you to send mails using smtp.

apt-get install postfix heirloom-mailx

  1. Select smarthost
  2. Enter your system name
  3. Enter the DNS name of your relay host

emacs /etc/postfix/main.cf

# Search for relayhost and add the following lines beneath it

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/smtp_auth
smtp_sasl_security_options = noanonymous

sudo emacs /etc/postfix/smtp_auth

# Now add your credentials to smtp_auth in clear text
yourrelayhost.com yourusername:yourpassword

postmap /etc/postfix/smtp_auth
/etc/init.d/postfix reload
chmod 700 /etc/postfix/smtp_auth

OPTIONAL FOR DEVELOPMENT: Emacs with nice fonts

sudo su –
cd /usr/share/emacs/site-lisp
wget http://www.emacswiki.org/elisp/color-occur.el
wget http://openacs.org/storage/view/xowiki-resources%5C/oacs.el.tar
tar xf oacs.el.tar
apt-get install psgml mmm-mode
cd /usr/share/emacs/site-lisp
git clone https://github.com/sellout/emacs-color-theme-solarized.git

After this login as the user who is doing the development

su – podemo

and edit you .emacs file.

(add-to-list ‘load-path “/usr/share/emacs/site-lisp/oacs”)
(require ‘oacs)
(setq user-full-name “”)
(setq user-mail-address “”)
(add-to-list ‘auto-mode-alist ‘(“\\.vuh” . tcl-mode))
(add-to-list ‘auto-mode-alist ‘(“\\.adp” . html-mode))
(add-to-list ‘load-path “/usr/share/emacs/site-lisp/emacs-color-theme-solarized”)
(require ‘color-theme-solarized)
(color-theme-solarized-dark)

NGINX

# Enable CORS

sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get install nginx
sudo apt-get install nginx-extras

Edit nginx.conf to include

 client_max_body_size        100m;
 log_format main '$remote_addr - $remote_user [$time_local] "$request" '
 '$status $body_bytes_sent "$http_referer" '
 '"$http_user_agent" "$http_x_forwarded_for"';

 proxy_buffers 8 16k;
 proxy_buffer_size 32k;
 proxy_read_timeout 120s;
 proxy_send_timeout 120s;

Then make sure that you have the config in sites-available:

###############
# ]po[ server
#####################
server {
listen yourip;
server_name projop.yourdomain.com;

location / {
client_max_body_size 50M;
proxy_read_timeout 180;
proxy_connect_timeout 180;

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

# if ($http_origin ~* (http?://.*localhost(:[0-9]+)?$)) {
set $cors “1”;
# }

if ($request_method = ‘OPTIONS’) {
set $cors “${cors}o”;
}
if ($cors = “1”) {
add_header ‘Access-Control-Allow-Origin’ ‘*’;
add_header ‘Access-Control-Allow-Methods’ ‘GET, POST, OPTIONS’;
add_header ‘Access-Control-Allow-Headers’ ‘DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range\
‘;
add_header ‘Access-Control-Expose-Headers’ ‘DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Rang\
e’;
proxy_pass http://127.0.0.1:8000;
}

if ($cors = “1o”) {
more_set_headers ‘Access-Control-Allow-Origin: $http_origin’;
more_set_headers ‘Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE’;
more_set_headers ‘Access-Control-Allow-Credentials: true’;
#
# Custom headers and headers various browsers *should* be OK with but aren’t
#
add_header ‘Access-Control-Allow-Headers’ ‘DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range’;
#
# Tell client that this pre-flight info is valid for 20 days
#
add_header ‘Access-Control-Max-Age’ 1728000;
add_header ‘Content-Type’ ‘text/plain charset=UTF-8’;
add_header ‘Content-Length’ 0;
return 204;
}

proxy_pass http://127.0.0.1:8000;
}

access_log /var/log/nginx/kolibri.access.log main;
}

Datenschutzerklärung | ]project-open[ | ImpressumKontakt
Icons made by SimpleIcon and Freepik from www.flaticon.com is licensed by CC BY 3.0