Project

General

Profile

rpm_install.sh

Script to install gwms rpms on fermicloud - Douglas Strain, 01/29/2013 11:02 AM

 
1
#!/bin/bash
2

    
3
# Script to install glideinwms on a clean VM, such as fermicloud
4
#
5
# Uses rpms for glideinwms and osg-client
6
# usage: ./rpm_install [vofrontend|factory|userschedd|usercollector]
7

    
8
CONDOR=condor-7.6.6-x86_64_rhap_5-stripped.tar.gz
9
CONDOR_DIR=condor-7.6.6-x86_64_rhap_5-stripped
10
VERSION=osg-development
11
HOSTNAME=`hostname`
12
FACTORY=fermicloud121.fnal.gov
13

    
14
#VO=Engage
15
#FRONTEND=fermicloud107.fnal.gov
16

    
17
#INSTALL epel
18
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
19
yum -y install yum-priorities
20
rpm -Uvh http://repo.grid.iu.edu/osg-release-latest.rpm
21
yum -y install osg-ca-certs
22

    
23
if [[ "$1" == vofrontend* ]]; then
24
 yum -y --enablerepo=$VERSION install glideinwms-$1
25
 #Frontend configuration
26
 #sed -i "s/<vo>/$VO/" /etc/gwms-frontend/frontend.xml
27
 #sed -i "s/<schedd DN=\"Cert DN used by the schedd at fullname:\" fullname=\"Hostname of the schedd\"/<schedd DN=\"\/DC=org\/DC=doegrids\/OU=Services\/CN=$HOSTNAME\" fullname=\"$HOSTNAME\"/" /etc/gwms-frontend/frontend.xml
28
 #sed -i "s/<schedd DN=\"Cert DN used by the second Schedd at fullname:\" fullname=\"schedd name@Hostname of the second schedd\"/<schedd DN=\"\/DC=org\/DC=doegrids\/OU=Services\/CN=$HOSTNAME\" fullname=\"schedd_jobs2@$HOSTNAME\"/" /etc/gwms-frontend/frontend.xml
29
 sed -i "s/factory query_expr='.*'/factory query_expr='True'/" /etc/gwms-frontend/frontend.xml
30
 sed -i "s/collector DN=\"[^\"]*\"/collector DN=\"\/DC=org\/DC=doegrids\/OU=Services\/CN=$HOSTNAME\"/" /etc/gwms-frontend/frontend.xml
31
 sed -i "s/collector DN=\"[^\"]*\" comment/collector DN=\"\/DC=org\/DC=doegrids\/OU=Services\/CN=$FACTORY\" comment/" /etc/gwms-frontend/frontend.xml
32
 sed -i "s/factory_identity=\"[^\"]*\"/factory_identity=\"gfactory@$FACTORY\"/" /etc/gwms-frontend/frontend.xml
33
 sed -i "s/my_identity=\"[^\"]*\" node=\"[^\"]*\"/my_identity=\"vofrontend_service@$FACTORY\" node=\"$FACTORY\"/" /etc/gwms-frontend/frontend.xml
34
 sed -i "s/classad_proxy=\"[^\"]*\"/classad_proxy=\"\/tmp\/vo_proxy\"/" /etc/gwms-frontend/frontend.xml
35
 sed -i "s/security_name=\"[^\"]*\"/security_name=\"frontend\"/" /etc/gwms-frontend/frontend.xml
36
 sed -i "s/absfname=\"[^\"]*\"/absfname=\"\/tmp\/vo_proxy\"/" /etc/gwms-frontend/frontend.xml
37
 sed -i "s/proxy_DN=\"[^\"]*\"/proxy_DN=\"\/DC=org\/DC=doegrids\/OU=People\/CN=Doug Strain 834323\"/" /etc/gwms-frontend/frontend.xml
38
 sed -i "s/web_base_url=\"[^\"]*\"/web_base_url=\"http:\/\/$HOSTNAME:9000\/vofrontend\/stage\"/" /etc/gwms-frontend/frontend.xml
39
 sed -i "s/Listen 80/Listen 9000/" /etc/httpd/conf/httpd.conf
40
 sed -i "s/ Indexes/ \-Indexes/" /etc/httpd/conf/httpd.conf
41
 sed -i "s/Order allow,deny/Order deny,allow/" /etc/httpd/conf/httpd.conf
42
 sed -i "s/^\s*Allow from all/Deny from all\nAllow from 131.225\nAllow from 2620:6a::\/48/" /etc/httpd/conf/httpd.conf
43
 rm /etc/condor/config.d/00personal_condor.config
44
 echo "GSI \"^\/DC\=org\/DC\=doegrids\/OU\=Services\/CN\=$HOSTNAME$\" usercollector_service" > /etc/condor/certs/condor_mapfile
45
 sed -i "s/\./\\\./g" /etc/condor/certs/condor_mapfile
46
 echo "GSI \"^\/DC\=org\/DC\=doegrids\/OU\=People\/CN\=Doug\ Strain\ 834323$\" vofrontend_service" >> /etc/condor/certs/condor_mapfile
47
 echo "GSI (.*) anonymous" >> /etc/condor/certs/condor_mapfile
48
 echo "FS (.*) \1" >> /etc/condor/certs/condor_mapfile
49
 service httpd start
50
 if [ 'vofrontend' == "$1" ]; then
51
 	service condor start
52
 fi
53
 echo "Don't forget to copy a valid recent proxy into /tmp/vo_proxy and then reconfig"
54
fi
55

    
56

    
57
# Note: we still need to modify CONDOR_HOST
58
# and add DNs to /etc/condor/cert/condor_mapfile
59
# and modify collectors/schedds in /etc/gwms-frontend/glideinwms.xml
60
if [ 'usercollector' == "$1" ]; then
61
 yum -y --enablerepo=$VERSION install glideinwms-usercollector
62
 rm /etc/condor/config.d/00personal_condor.config
63
 echo "GSI \"^\/DC\=org\/DC\=doegrids\/OU\=Services\/CN\=$HOSTNAME$\" usercollector_service" > /etc/condor/certs/condor_mapfile
64
 sed -i "s/\./\\\./g" /etc/condor/certs/condor_mapfile
65
 echo "GSI \"^\/DC\=org\/DC\=doegrids\/OU\=People\/CN\=Doug\ Strain\ 834323$\" vofrontend_service" >> /etc/condor/certs/condor_mapfile
66
 echo "GSI (.*) anonymous" >> /etc/condor/certs/condor_mapfile
67
 echo "FS (.*) \1" >> /etc/condor/certs/condor_mapfile
68
 service condor start
69
fi
70

    
71

    
72
if [ 'userschedd' == "$1" ]; then
73
 yum -y --enablerepo=$VERSION install glideinwms-userschedd
74
 rm /etc/condor/config.d/00personal_condor.config
75
 echo "GSI \"^\/DC\=org\/DC\=doegrids\/OU\=Services\/CN\=$HOSTNAME$\" usercollector_service" > /etc/condor/certs/condor_mapfile
76
 sed -i "s/\./\\\./g" /etc/condor/certs/condor_mapfile
77
 echo "GSI \"^\/DC\=org\/DC\=doegrids\/OU\=People\/CN\=Doug\ Strain\ 834323$\" vofrontend_service" >> /etc/condor/certs/condor_mapfile
78
 echo "GSI (.*) anonymous" >> /etc/condor/certs/condor_mapfile
79
 echo "FS (.*) \1" >> /etc/condor/certs/condor_mapfile
80
 service condor start
81
fi
82

    
83
if [ 'factory' == "$1" ]; then
84
 yum -y --enablerepo=$VERSION install glideinwms-factory
85
# sed -i "s/FRONTEND_HOST/$FRONTEND/" /etc/gwms-factory/glideinWMS.xml
86
 sed -i "s/http:\/\/$HOSTNAME/http:\/\/$HOSTNAME:9000/" /etc/gwms-factory/glideinWMS.xml
87
 sed -i "s/frontend name=\"[^\"]*\"/frontend name=\"frontend\"/" /etc/gwms-factory/glideinWMS.xml
88
 # Use gr7x1 node by default
89
 sed -i "s/<entry name=\"TEST_ENTRY\" .*>/<entry name=\"TEST3_GR7X1\" enabled=\"True\" gatekeeper=\"gr7x1.fnal.gov\/jobmanager-condor\" gridtype=\"gt2\" rsl=\"(queue=default)(jobtype=single)\" schedd_name=\"schedd_glideins4@$HOSTNAME\" verbosity=\"std\" work_dir=\"OSG\">/" /etc/gwms-factory/glideinWMS.xml
90
 sed -i "s/condor_tarball arch=\"default\" base_dir=\"\/usr\"/condor_tarball arch=\"default\" base_dir=\"\/var\/lib\/gwms-factory\/condor\/$CONDOR_DIR\"/" /etc/gwms-factory/glideinWMS.xml
91
 rm -f /etc/condor/config.d/00personal_condor.config
92
 pushd /var/lib/gwms-factory/condor
93
 scp dstrain@fnalu.fnal.gov:~/packages/$CONDOR .
94
 tar xzvf $CONDOR
95
 chown -R gfactory:gfactory .
96
 popd
97
# echo "GSI \"^\/DC\=org\/DC\=doegrids\/OU\=Services\/CN\=$HOSTNAME$\" vofrontend_service" > /etc/condor/certs/condor_mapfile
98
# sed -i "s/\./\\\./g" /etc/condor/certs/condor_mapfile
99
 echo "GSI \"^\/DC\=org\/DC\=doegrids\/OU\=People\/CN\=Doug\ Strain\ 834323$\" vofrontend_service" > /etc/condor/certs/condor_mapfile
100
 echo "GSI (.*) anonymous" >> /etc/condor/certs/condor_mapfile
101
 echo "FS (.*) \1" >> /etc/condor/certs/condor_mapfile
102
 sed -i "s/Listen 80/Listen 9000/" /etc/httpd/conf/httpd.conf
103
 sed -i "s/ Indexes/ \-Indexes/" /etc/httpd/conf/httpd.conf
104
 sed -i "s/Order allow,deny/Order deny,allow/" /etc/httpd/conf/httpd.conf
105
 sed -i "s/^\s*Allow from all/Deny from all\nAllow from 131.225\nAllow from 2620:6a::\/48/" /etc/httpd/conf/httpd.conf
106
 sed -i "s/valid-caller-gids = gfactory/valid-caller-gids = gfactory : 5111/" /etc/condor/privsep_config
107
 service httpd start
108
 service condor start
109
 service gwms-factory upgrade
110
fi
111

    
112