setting up PostgreSQL database for Galaxy

RETURN to CCG Ubuntu Directory

Table of Contents


Dec. 30, 2012
Install PostgreSQL 9.1
  
    To install the latest PostgreSQL:
    

$ sudo apt-get install postgresql


Dec. 30, 2012
PostgreSQL server setup
    
    first set up the PostgreSQL postgres user password:
    

$ sudo -u postgres psql postgres $ \password postgres

and give the password "postgres" when prompted.

Dec. 1, 2012
Create database for Galaxy
  
    To set up a database for Galaxy, I installed pgAdminIII, a GUI interface to manage PostgreSQL.
    

$ sudo apt-get install pgadmin3

From the pgAdminIII tool I created a database named "galaxy" and made 'postgres' the owner.

Dec. 1, 2012
Configure PostgreSQL for Galaxy
  
    PostgreSQL installs config files in /etc/postgresql/9.1/main. And data in /var/lib/postgresql/9.1/main.
    I edited the postgres pg_hba.conf file to allow everyone access from the CCG Ubuntu server.
    

$ sudo vi /etc/postgresql/9.1/main/pg_hba.conf

edit the commented out lines as follows:

local all all trust host all all 127.0.0.1/32 trust host all all ::1/128 trust host all all 0.0.0.0/0 md5

Edit the 'postgresql.conf file to allow connection from all computers: Change and uncomment "listen_addresses = 'localhost'" to "listen_addresses = '*'".

listen_addresses = '*'


Dec. 1, 2012
Configure Galaxy to connect to PostgreSQL
  
    Galaxy must be configured to communicate with the PostgreSQL database.
    Edit the universe_wsgi.ini file in /data/galaxy/galaxy-dist.
    I made the following changes:

admin_users = bsimison@calacademy.org host = 10.5.10.18 [IP ADDRESS] database_connection = postgres://postgres:postgres@localhost:5432/galaxy


Dec. 6, 2012
Setting up auto start for Galaxy server
    To get Galaxy server to start automatically, use the Ubuntu "init.d" system. In the /data/galaxy/galaxy-dist/contrib directory is a
    sample init file "galaxy.debian-init" that needs to be editied and copied to the /etc/init.d directory. The edited lines are highlighted
    in red:

#!/bin/bash # Author: James Casbon, 2009 ### BEGIN INIT INFO # Provides: galaxy # Required-Start: $network $local_fs $mysql # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Galaxy ### END INIT INFO . /lib/lsb/init-functions USER="galaxy" GROUP="nogroup" DIR="/data/galaxy/galaxy-dist/" PYTHON="/usr/bin/python" OPTS="-ES ./scripts/paster.py serve --log-file /home/galaxy/galaxy.log universe_wsgi.ini" PIDFILE="/var/run/galaxy.pid" case "${1:-''}" in 'start') log_daemon_msg "Starting Galaxy" if start-stop-daemon --chuid $USER --group $GROUP --start --make-pidfile \ --pidfile $PIDFILE --background --chdir $DIR --exec $PYTHON -- $OPTS; then log_end_msg 0 else log_end_msg 1 fi ;; 'stop') log_daemon_msg "Stopping Galaxy" if start-stop-daemon --stop --pidfile $PIDFILE; then log_end_msg 0 else log_end_msg 1 fi ;; 'restart') # restart commands here $0 stop $0 start ;; *) # no parameter specified echo "Usage: $SELF start|stop|restart|reload|force-reload|status" exit 1 ;; esac

Then run the command to add entries to the rc*.d directories to start Galaxy at startup:

$ update-rc.d galaxy defaults