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