source: drbl-biocluster/BioCluster_Setup.sh @ 186

Last change on this file since 186 was 103, checked in by jazz, 15 years ago
  • update download URLs.
  • add init.d script of openPBS/Torque
  • Property svn:executable set to *
File size: 7.6 KB
Line 
1#!/bin/bash
2
3biocluster_install()
4{
5#####################################################################
6# 以下為基本程式設計與生資相關自由軟體
7#####################################################################
8########
9# 安裝基本程式語言編譯環境
10########
11sudo apt-get -y install gcc g++ make autoconf build-essential
12########
13# 安裝 JDK 6 編譯環境
14########
15sudo apt-get -y install sun-java6-jdk
16########
17# 安裝 GNU R 相關套件
18# (去除 rjava 與 rmpi 套件, 因為 rmpi 必須特別設定成使用 mpich2 )
19########
20sudo apt-get -y install r-base
21sudo apt-get -y install `apt-cache search --names-only "^r-cran" | awk '{ print $1 }' | grep -v "r-cran-rjava" | grep -v "r-cran-rmpi" `
22########
23# 安裝 GNU R BioConductor 套件
24########
25if [ ! -e biocLite.R ]; then
26  sudo wget http://www.bioconductor.org/biocLite.R
27fi
28if [ ! -e BioConductor.R ]; then
29  cat > BioConductor.R << EOF
30source(file="$(pwd)/biocLite.R")
31biocLite()
32EOF
33  sudo R --no-save < BioConductor.R
34fi
35########
36# 安裝 GNU R ape 套件
37########
38sudo apt-get -f install libc6-dev g77 gfortran liblapack-dev
39if [ ! -e gee_4.13-14.tar.gz ]; then
40  wget http://cran.r-project.org/src/contrib/gee_4.13-14.tar.gz
41  sudo R CMD INSTALL gee_4.13-14.tar.gz
42fi
43if [ ! -e nlme_3.1-94.tar.gz ]; then
44  wget http://cran.r-project.org/src/contrib/nlme_3.1-94.tar.gz
45  sudo R CMD INSTALL nlme_3.1-94.tar.gz
46fi
47if [ ! -e lattice_0.17-25.tar.gz ]; then
48  wget http://cran.r-project.org/src/contrib/lattice_0.17-25.tar.gz
49  sudo R CMD INSTALL lattice_0.17-25.tar.gz
50fi
51if [ ! -e ape_2.3-2.tar.gz ]; then
52  wget http://cran.r-project.org/src/contrib/ape_2.3-2.tar.gz
53  sudo R CMD INSTALL ape_2.3-2.tar.gz
54fi
55#####################################################################
56# 以下為叢集環境的需求
57#####################################################################
58########
59# 安裝 MPICH2
60########
61if [ ! -e mpich2-1.0.8p1.tar.gz ]; then
62  wget http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/1.0.8p1/mpich2-1.0.8p1.tar.gz
63  tar zxvf mpich2-1.0.8p1.tar.gz
64  cd mpich2-1.0.8p1
65  ./configure CFLAGS="-fPIC" CXXFLAGS="-fPIC" FFLAGS="-fPIC" prefix=/opt/mpich2
66  sudo make
67  sudo make install
68  cd ..
69fi
70########
71# 安裝 openPBS / torque
72########
73if [ ! -e torque-2.3.6.tar.gz ]; then
74  wget wget http://www.clusterresources.com/downloads/torque/torque-2.3.6.tar.gz
75  tar zxvf torque-2.3.6.tar.gz
76  cd torque-2.3.6/
77  ./configure --prefix=/opt/torque
78  sudo make
79  sudo make install
80  sudo /opt/torque/sbin/pbs_server -t create
81  echo "$(hostname)" > nodes
82  sudo mv nodes /var/spool/torque/server_priv/nodes
83  echo "$(hostname)" > server_name
84  sudo mv server_name /var/spool/torque/server_name
85  cat > torque_conf << EOF
86create queue batch
87set queue batch queue_type = Execution
88set queue batch started = True
89set queue batch enabled = True
90set server default_queue = batch
91set server resources_default.nodes = 1
92set server scheduling = True
93set server acl_host_enable = True
94set server acl_hosts = *
95EOF
96  sudo /opt/torque/bin/qmgr < torque_conf
97  cat >> config << EOF
98\$pbsserver    $(hostname)
99\$logevent     255
100EOF
101  sudo mv config /var/spool/torque/mom_priv/jobs/config
102  sudo /opt/torque/bin/qterm -t quick
103  sudo /opt/torque/sbin/pbs_server
104  sudo /opt/torque/sbin/pbs_sched
105  sudo /opt/torque/sbin/pbs_mom
106  sudo /opt/torque/bin/pbsnodes -a
107  sudo cp contrib/init.d/debian.pbs_mom /etc/init.d/pbs_mom
108  sudo cp contrib/init.d/debian.pbs_sched /etc/init.d/pbs_sched
109  sudo cp contrib/init.d/debian.pbs_server /etc/init.d/pbs_server
110  cd ..
111fi
112
113########
114# 安裝 Lustre
115########
116if [ ! -e /etc/apt/sources.list.d/lustre.list ]; then
117  sudo echo "deb http://www.pdsi-scidac.org/repository/debian testing main" > lustre.list
118  sudo mv lustre.list /etc/apt/sources.list.d/lustre.list
119  sudo apt-get update
120  sudo apt-get -y --force-yes install pdsi-scidac-keyring
121  sudo apt-get -y install linux-image-2.6.22.19-lustre-686 lustre-modules-2.6.22.19-lustre-686 lustre-utils
122fi
123########
124# 安裝 Ganglia 叢集監控系統
125########
126if [ ! -f /usr/sbin/gmond ] || [ ! -f /usr/sbin/gmetad ]; then
127  echo "Installing Ganglia ...."
128  sudo apt-get install gmetad ganglia-monitor
129  sudo apt-get install rrdtool librrds-perl librrd2-dev apache2 libapache2-mod-php5 php5-gd apache2-mpm-prefork apache2-utils apache2.2-common libapr1 libaprutil1 libmysqlclient15off libpq5 mysql-common openssl-blacklist ssl-cert
130  echo "deb http://free.nchc.org.tw/debian testing main" > testing.list
131  sudo mv testing.list /etc/apt/sources.list.d/
132  sudo apt-get update
133  sudo apt-get install ganglia-webfrontend
134  sudo rm /etc/apt/sources.list.d/testing.list
135  sudo apt-get update
136fi
137#####################################################################
138# 以下為叢集版本的生資相關軟體
139#####################################################################
140########
141# 安裝 Rmpi
142########
143if [ ! -e Rmpi_0.5-7.tar.gz ]; then
144  wget http://www.stats.uwo.ca/faculty/yu/Rmpi/download/linux/Rmpi_0.5-7.tar.gz
145  sudo R CMD INSTALL Rmpi_0.5-7.tar.gz --configure-args=--with-mpi=/opt/mpich2
146fi
147########
148# 安裝 mpiBLAST
149# 參考 http://debianclusters.cs.uni.edu/index.php/Installing_mpiBLAST
150########
151sudo apt-get install csh
152if [ ! -e mpiBLAST-1.5.0-pio.tgz ]; then
153  wget http://www.mpiblast.org/downloads/files/mpiBLAST-1.5.0-pio.tgz
154  tar zxvf mpiBLAST-1.5.0-pio.tgz
155  cd mpiblast-1.5.0-pio
156  ./ncbi/make/makedis.csh 2>&1|tee out.makedis.txt
157  ./ncbi/make/makedis.csh 2>&1|tee out.makedis.txt
158  ./ncbi/make/makedis.csh 2>&1|tee out.makedis.txt
159  ./configure --prefix=/opt/mpiblast --with-mpi=/opt/mpich2 --with-ncbi=`pwd`/ncbi --enable-MPI_Alloc_mem
160  sudo make
161  sudo make install
162  cd ..
163fi
164
165if [ ! -e mito.nt.gz ]; then
166  wget ftp://ftp.ncbi.nlm.nih.gov/blast/db/FASTA/mito.nt.gz
167fi
168
169if [ ! -e add_path ]; then
170  cat > add_path << EOF
171echo "export PATH=\\\$PATH:/opt/torque/bin:/opt/mpich2/bin:/opt/mpiblast/bin" >> /etc/profile
172EOF
173  sudo sh add_path
174fi
175#####################################################################
176# 電腦叢集的網頁監控機制
177#####################################################################
178########
179# 安裝 wwwBLAST
180########
181if [ ! -e wwwblast-2.2.21-ia32-linux.tar.gz ]; then
182  wget ftp://ftp.ncbi.nlm.nih.gov/blast/executables/LATEST/wwwblast-2.2.21-ia32-linux.tar.gz
183  tar zxvf wwwblast-2.2.21-ia32-linux.tar.gz
184fi
185#####################################################################
186# 安裝 DRBL
187#####################################################################
188if [ ! -e GPG-KEY-DRBL ]; then
189  wget http://drbl.nchc.org.tw/GPG-KEY-DRBL
190  sudo apt-key add GPG-KEY-DRBL
191  echo "deb http://free.nchc.org.tw/drbl-core drbl stable" > drbl.list
192  sudo mv drbl.list /etc/apt/sources.list.d/
193  sudo apt-get update
194  sudo apt-get install drbl
195  sudo /opt/drbl/sbin/drblsrv -i
196  sudo /opt/drbl/sbin/drblpush -i
197fi
198}
199
200function biocluster_config()
201{
202########
203# 設定 Torque
204########
205if [ -d /var/spool/torque/ ]; then
206  for i in `sudo ls /tftpboot/nodes/`
207  do 
208    sudo cp -r /var/spool/torque /tftpboot/nodes/$i/var/spool/
209  done
210fi
211}
212
213if [ ! -e /etc/debian_version ]; then
214  echo "本批次安裝檔目前僅適用 Debian 或 Ubuntu 系列,敬請見諒!!"
215  exit 1
216fi
217
218case "$1" in
219  clean)
220    sudo rm -rf add_path ape_2.3-2.tar.gz biocLite.R BioConductor.R blast gee_4.13-14.tar.gz GPG-KEY-DRBL lattice_0.17-25.tar.gz mito.nt.gz mpiblast-1.5.0-pio mpiBLAST-1.5.0-pio.tgz mpich2-1.0.8p1 mpich2-1.0.8p1.tar.gz nlme_3.1-94.tar.gz Rmpi_0.5-7.tar.gz torque-2.3.6 torque-2.3.6.tar.gz wwwblast-2.2.21-ia32-linux.tar.gz
221    exit 0;
222    ;;
223  install)
224    biocluster_install
225    ;;
226  config)
227    biocluster_config
228    ;;
229  *)
230    echo "Usage: $0 [ install | config | clean ]"
231    ;;
232esac
Note: See TracBrowser for help on using the repository browser.