Build Core On Ubuntu » History » Version 9
« Previous -
Version 9/20
(diff) -
Next » -
Current version
johu, 09/09/2010 02:04 AM
update git reference to gitorious
Building Quassel core from source on Ubuntu¶
These instructions tell how to build the latest quassel core for your Ubuntu server.
Since it scales better with many users and huge amounts of history, using PostgreSQL database as backend will be explained, too.
Make sure repositores are up-to-date¶
sudo apt-get update
Install required dependencies and build tools¶
sudo apt-get install git-core qt4-dev-tools libqt4-dev libqt4-sql-sqlite screen
Also install the sql driver for your planned backend.
- For sqlite (Quassels default, suggested for single user setups):
sudo apt-get install libqt4-sql-sqlite
- For PostgreSQL (suggested for multiuser setups):
sudo apt-get install libqt4-sql-psql
Get the sources¶
git clone git://gitorious.org/quassel/quassel.git
Build it¶
mkdir quassel/build cd quassel/build cmake -DWANT_CORE=1 -DWANT_QTCLIENT=0 -DWANT_MONO=0 ../ make optional step: make install
Another common option to cmake would be:
-DINSTALL_PREFIX=/path/where/it/should/be/installed
Otherwise /usr/local/ is used as the install prefix.
Optional Step: Use PostgreSQL as backend¶
Setup PostgreSQL database master user¶
Setup quassel PostgreSQL database. The database password will be asked later by the Quassel client configuration wizard.¶
sudo -i sudo -u postgres psql postgres=# CREATE USER quassel ENCRYPTED PASSWORD 'somepassword'; CREATE ROLE postgres=# CREATE DATABASE quassel WITH OWNER quassel ENCODING 'UTF8'; CREATE DATABASE
Optional Step: Create SSL certificate:¶
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout ~/.config/quassel-irc.org/quasselCert.pem -out ~/.config/quassel-irc.org/quasselCert.pem
Running Core¶
Screen is a terminal tool which allwos you to leave terminal sessions running background even when you are logged out.
We run quassel in screen so that core keeps running as long as it is killed or the server is restarted
screen cd quassel/build ./quasselcore
Now you can shut down your terminal and the quassel core still keeps running.
Later we can reattach to this screen session to check out the quassel core terminal output to see if there has been any problems. Login in and type:
screen -x
Now you should how you left your terminal last time you shut it down.
Starting using it¶
Configuration wizard will guide you through the rest of the setup when you connect to your Quassel core using Quassel client for the first time. Remember to choose PostgreSQL backend instead of SQLite when asked.
Start as Daemon¶
make install, create a user quasselcore with quassel group and create the /etc/init.d/quasselcore:
### BEGIN INIT INFO # Provides: quasselcore # Required-Start: $network $local_fs # Required-Stop: # Should-Start: # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: distributed IRC client using a central core component # Description: This is the core component of Quassel. A modern, # cross-platform, distributed IRC client, meaning that one # (or multiple) client(s) can attach to and detach from this # central core. It's much like the popular combination # of screen and a text-based IRC client such as WeeChat. ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/local/bin/quasselcore NAME=quasselcore DESC="distributed IRC core" LOGDIR=/var/log/quassel PIDFILE=/var/run/quasselcore.pid test -x $DAEMON || exit 0 . /lib/lsb/init-functions DAEMON_OPTS="" DIETIME=10 STARTIME=3 LOGFILE=$LOGDIR/core.log DATADIR=/var/cache/quassel DAEMONUSER=quasselcore if [ -f /etc/default/$NAME ] ; then . /etc/default/$NAME fi if [ -n "$DAEMONUSER" ] ; then if getent passwd | grep -q "^$DAEMONUSER:"; then # Obtain the uid and gid DAEMONUID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $3}'` DAEMONGID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $4}'` else log_failure_msg "The user $DAEMONUSER, required to run $NAME does not exist." exit 1 fi fi set -e running_pid() { pid=$1 name=$2 [ -z "$pid" ] && return 1 [ ! -d /proc/$pid ] && return 1 cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1` [ "$cmd" != "$name" ] && return 1 return 0 } running() { [ ! -f "$PIDFILE" ] && return 1 pid=`cat $PIDFILE` running_pid $pid $DAEMON || return 1 return 0 } start_server() { start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \ --background --chuid $DAEMONUSER --exec $DAEMON \ -- --logfile=$LOGFILE --loglevel=$LOGLEVEL --configdir=$DATADIR \ --port=$PORT \ $DAEMON_OPTS errcode=$? return $errcode } stop_server() { start-stop-daemon --stop --quiet --pidfile $PIDFILE --user $DAEMONUSER \ --exec $DAEMON errcode=$? return $errcode } force_stop() { [ ! -e "$PIDFILE" ] && return if running ; then kill -15 $pid # Is it really dead? sleep "$DIETIME"s if running ; then kill -9 $pid sleep "$DIETIME"s if running ; then echo "Cannot kill $NAME (pid=$pid)!" exit 1 fi fi fi rm -f $PIDFILE } case "$1" in start) log_daemon_msg "Starting $DESC" "$NAME" # Check if it's running first if running ; then log_progress_msg "apparently already running" log_end_msg 0 exit 0 fi if start_server ; then [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time if running ; then log_end_msg 0 else log_end_msg 1 fi else log_end_msg 1 fi ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" if running ; then stop_server log_end_msg $? else log_progress_msg "apparently not running" log_end_msg 0 exit 0 fi ;; force-stop) $0 stop if running; then # If it's still running try to kill it more forcefully log_daemon_msg "Stopping (force) $DESC" "$NAME" force_stop log_end_msg $? fi ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" stop_server # Wait some sensible amount, some server need this [ -n "$DIETIME" ] && sleep $DIETIME start_server [ -n "$STARTTIME" ] && sleep $STARTTIME running log_end_msg $? ;; status) log_daemon_msg "Checking status of $DESC" "$NAME" if running ; then log_success_msg "running" log_end_msg 0 else log_success_msg "apparently not running" log_end_msg 1 exit 1 fi ;; reload) log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon" log_warning_msg "cannot re-read the config file (use restart)." ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2 exit 1 ;; esac exit 0
And now...
Binary: /usr/local/bin/quasselcore
The logfile is: /var/log/quassel/core.log
PID-file: /var/run/quasselcore.pid
Data dir (confi, cert): /var/cache/quassel
Daemon-user: quasselcore
Ok... Start:
/etc/init.d/quasselcore start