Last active
February 28, 2018 14:29
-
-
Save mwoodbri/8418f5b314ed097740b1bda8d9febe6f to your computer and use it in GitHub Desktop.
MRIdb installation script for EL6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -exo pipefail | |
curl -L https://imperialcollegelondon.box.com/shared/static/wm84f86ikub5mceibprp61cd7jxwanzp.gz | tar xz -C /opt | |
if [ -f /opt/mridb/conf/application-site.conf ]; then | |
echo "Updated MRIdb: $(cat /opt/mridb/VERSION)" | |
exit | |
fi | |
DEPS=/tmp/mridb-deps | |
if [ ! -d "$DEPS" ]; then | |
curl -L https://imperialcollegelondon.box.com/shared/static/gjuidrfqu3n7vvsltdp948ykbqcynwux.tar | tar x -C /tmp | |
fi | |
yum upgrade -y | |
yum install -y unzip patch postgresql-server policycoreutils-python gcc java-1.7.0-openjdk | |
yum install -y epel-release | |
yum install -y p7zip | |
yum install -y centos-release-scl | |
yum install -y python27-python-devel python27-numpy | |
RULENUM=$(iptables -L INPUT --line-numbers | grep 'REJECT' | awk '{print $1}') | |
iptables -I INPUT $RULENUM -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT | |
iptables -I INPUT $RULENUM -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT | |
iptables -I INPUT $RULENUM -m state --state NEW -m tcp -p tcp --dport 11112 -j ACCEPT | |
service iptables save | |
unzip -d /opt $DEPS/dcm4che-2.0.28-bin.zip | |
unzip -d /opt $DEPS/dcm4chee-2.17.3-psql.zip | |
unzip -d /opt $DEPS/lx64.zip | |
unzip -d /opt $DEPS/play-1.2.x.zip | |
unzip -d /opt $DEPS/ISD_dicom_tool.zip | |
tar xf $DEPS/xmedcon-0.13.0.tar.gz -C /opt | |
tar xf $DEPS/dcmtk-3.6.0-linux-i686-static.tar.bz2 -C /opt | |
unzip -d /tmp $DEPS/jboss-4.2.3.GA-jdk6.zip | |
ln -s /opt/dcm4chee-2.17.3-psql /opt/dcm4chee | |
tar xf $DEPS/jai_imageio-1_1-lib-linux-amd64.tar.gz --strip-components=2 -C /opt/dcm4chee/bin/native jai_imageio-1_1/lib/libclib_jiio.so | |
/opt/dcm4chee/bin/install_jboss.sh /tmp/jboss-4.2.3.GA | |
cp $DEPS/weasis.war /opt/dcm4chee/server/default/deploy | |
cp $DEPS/weasis-pacs-connector.war /opt/dcm4chee/server/default/deploy | |
patch /opt/dcm4chee/server/default/conf/dcm4chee-attribute-filter.xml <$DEPS/dcm4chee-attribute-filter.patch | |
patch /opt/dcm4chee/bin/dcm4chee_init_redhat.sh <$DEPS/dcm4chee_init_redhat.patch | |
mkdir -p /mnt/dcm4chee/archive | |
ln -s /mnt/dcm4chee/archive /opt/dcm4chee/server/default/archive | |
echo JBOSS_USER=RUNASIS >/etc/sysconfig/dcm4chee | |
echo JBOSS_HOME=$(readlink -f /opt/dcm4chee) >>/etc/sysconfig/dcm4chee | |
ln -s /opt/dcm4chee/bin/dcm4chee_init_redhat.sh /etc/init.d/dcm4chee | |
chkconfig --add dcm4chee | |
chkconfig dcm4chee on | |
chkconfig postgresql on | |
mkdir -p /mnt/pgsql/data | |
chown postgres.postgres /mnt/pgsql/data | |
echo PGDATA=/mnt/pgsql/data >/etc/sysconfig/pgsql/postgresql | |
semanage fcontext -a -t postgresql_db_t "/mnt/pgsql/data(/.*)?" | |
restorecon -R /mnt/pgsql/data | |
service postgresql initdb | |
sed -i 's/ident$/trust/' /mnt/pgsql/data/pg_hba.conf | |
service postgresql start | |
sleep 1 | |
export PGUSER=postgres | |
createdb pacsdb | |
psql pacsdb -f /opt/dcm4chee/sql/create.psql | |
touch /usr/share/pgsql/tsearch_data/empty.stop | |
psql pacsdb <<EOF | |
CREATE TEXT SEARCH CONFIGURATION english_nostop (COPY = english); | |
CREATE TEXT SEARCH DICTIONARY english_nostop (TEMPLATE = simple, STOPWORDS = empty); | |
ALTER TEXT SEARCH CONFIGURATION english_nostop ALTER MAPPING FOR asciihword, asciiword, hword, hword_asciipart, hword_part, word WITH english_nostop; | |
EOF | |
. /opt/rh/python27/enable | |
(cd $DEPS/pydicom-0.9.7 && python setup.py install) | |
easy_install -i https://pypi.python.org/simple/ nibabel | |
/opt/mricron/dcm2nii | |
sed -i 's/MinReorientMatrix=200/MinReorientMatrix=2000/' ~/.dcm2nii/dcm2nii.ini | |
touch /opt/mridb/conf/application-site.conf | |
/opt/play-1.2.x/play secret /opt/mridb | |
grep -F application.secret /opt/mridb/conf/application.conf >/opt/mridb/conf/application-site.conf | |
ln -s /opt/mridb/bin/mridb /etc/init.d/mridb | |
chkconfig --add mridb | |
chkconfig mridb on | |
echo "Installed MRIdb: $(cat /opt/mridb/VERSION)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment