source: trunk/server/doc/install-howto.sh @ 1298

Last change on this file since 1298 was 1296, checked in by mitchb, 15 years ago
fedora-ds is now 389-ds - "People like alphanumeric digits"
File size: 15.3 KB
Line 
1# This document is a how-to for installing a Fedora scripts.mit.edu server.
2
3set -e -x
4
5[ -e /scripts-boot-count ] || echo 0 > /scripts-boot-count
6
7source_server="old-faithful.mit.edu"
8
9boot=${1:$(cat /scripts-boot-count)}
10
11# XXX: let 'branch' be the current svn branch you are on
12
13doreboot() {
14    echo $(( $boot + 1 )) > /scripts-boot-count;
15    shutdown -r now "Rebooting for step $(cat /scripts-boot-count)"
16}
17
18YUM() {
19    NSS_NONLOCAL_IGNORE=1 yum "$@"
20}
21
22# Helper files for the install are located in server/fedora/config.
23
24# Start with a normal install of Fedora.
25
26if [ $boot = 0 ]; then
27# When the initial configuration screen comes up, under "Firewall
28# configuration", disable the firewall, and under "System services", leave
29# enabled (as of Fedora 9) acpid, anacron, atd, cpuspeed, crond,
30# firstboot, fuse, haldaemon, ip6tables, iptables, irqbalance,
31# kerneloops, mdmonitor, messagebus, microcode_ctl, netfs, network, nscd, ntpd,
32# sshd, udev-post, and nothing else.
33    echo "--disabled" > /etc/sysconfig/system-config-firewall
34    for i in NetworkManager avahi-daemon bluetooth cups isdn nfslock pcscd restorecond rpcbind rpcgssd rpcidmapd sendmail; do
35        chkconfig "$i" off
36    done
37
38# Edit /etc/selinux/config so it has SELINUX=disabled and reboot.
39    sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
40    doreboot
41fi
42
43if [ $boot = 1 ]; then
44# Create a scripts-build user account, and set up rpm to build in
45# $HOME by doing a
46# cp config/home/scripts-build/.rpmmacros /home/scripts-build/
47# (If you just use the default setup, it will generate packages
48# in /usr/src/redhat.)
49    adduser scripts-build
50
51# Check out the scripts.mit.edu svn repository. Configure svn not to cache
52# credentials.
53
54    YUM install -y subversion
55
56    cd /srv
57    svn co svn://$source_server/$branch repository
58
59    sed -i 's/^(# *)*store-passwords.*/store-passwords = no/' /root/.subversion/config
60    sed -i 's/^(# *)*store-auth-creds.*/store-auth-creds = no/' /root/.subversion/config
61# The same tweaks should be made on /home/scripts-build/.subversion/config
62# once it exists (do something with svn as scripts-build)
63
64    chown -R scripts-build /srv/repository
65
66# cd to server/fedora in the svn repository.
67    cd /srv/repository/server/fedora
68
69# Run "make install-deps" to install various prereqs.  Nonstandard
70# deps are in /mit/scripts/rpm.
71    YUM install -y make
72    make install-deps
73
74# Install bind
75    YUM install -y bind
76
77# Check out the scripts /etc configuration
78    cd /root
79    svn co svn://scripts.mit.edu/$branch/server/fedora/config/etc etc
80    # backslash to make us not use the alias
81    \cp -a etc /
82
83# NOTE: You will have just lost DNS resolution and the abilit
84# to do password SSH in
85
86    service named start
87    chkconfig named on
88
89# In the case of the Kerberos libraries, you'll be told that
90# there are conflicting files with the 64-bit versions of the packages,
91# which we scriptsify.  You'll have to use --force to install those
92# rpms despite the conflicts.  After doing that, you may want to
93# install the corresponding 64-bit scriptsified versions again, just
94# to be safe in case the 32-bit versions overwrite files that differ.
95# When you try this, it will complain that you already have the same
96# version installed; again, you'll need to use --force to do it anyway.
97
98# We need yumdownloader to force some RPMs
99    # XXX: This might be wrong. Sanity check what packages ou
100    # have when done
101    YUM install -y yum-utils
102    yumdownloader krb5-libs
103    # XXX: These version numbers are hardcoded, need some cli-fu to generalize
104    rpm -i krb5-libs-*.i586.rpm
105    rpm -U --force krb5-libs-*.scripts.1138.x86_64.rpm
106
107# env NSS_NONLOCAL_IGNORE=1 yum install scripts-base
108    YUM install -y scripts-base
109
110# Install mit-zephyr
111    YUM install -y mit-zephyr
112
113# Remember to set NSS_NONLOCAL_IGNORE=1 anytime you're setting up
114# anything, e.g. using yum. Otherwise useradd will query LDAP in a stupid way
115# that makes it hang forever. (This is why we're using YUM, not yum)
116
117# Reload the iptables config to take down the restrictive firewall
118    service iptables restart
119
120# Copy over root's dotfiles from one of the other machines.
121# Perhaps a useful change is to remove the default aliases
122    # On 2009-07-01, the dotfiles to transfer where:
123    #   .bashrc .ldapvirc .screenrc .ssh (<- directory) .vimrc
124    # Trying to scp from server to server won't work, as scp
125    # will attempt to negotiate a server-to-server connection.
126    # Instead, scp to your trusted machine as a temporary file,
127    # and then push to the other server
128
129# Replace rsyslog with syslog-ng by doing:
130    rpm -e --nodeps rsyslog
131    YUM install -y syslog-ng
132    chkconfig syslog-ng on
133
134# Install various dependencies of the scripts system, including
135# glibc-devel.i586 (ezyang: already installed for me),
136# python-twisted-core (ditto), mod_fcgid, nrpe, nagios-plugins-all.
137    YUM install -y mod_fcgid
138    YUM install -y nrpe
139    YUM install -y nagios-plugins-all
140
141# Disable NetworkManager with chkconfig NetworkManager off. Configure
142# networking on the front end and back end, and the routing table to send
143# traffic over the back end. Make sure that chkconfig reports "network" on, so
144# that the network will still be configured at next boot.
145# ezyang: For me, NetworkManager was not installed at this point, and
146# we had already done the basic config for networking front end and
147# back end (because I wanted ssh access, and not just conserver access)
148
149# Fix the openafs /usr/vice/etc <-> /etc/openafs mapping by changing
150#  /usr/vice/etc/cacheinfo to contain:
151#       /afs:/usr/vice/cache:10000000
152# Also fix ThisCell to contain athena.mit.edu in both directories
153    echo "/afs:/usr/vice/cache:10000000" > /usr/vice/etc/cacheinfo
154    # ezyang: ThisCell on b-k and c-w don't have anything special
155    # written here
156
157# Figure out why Zephyr isn't working. Most recently, it was because there
158# was a 64-bit RPM installed; remove it and install Joe's 32-bit one
159    YUM erase -y mit-zephyr
160    # mit-zephyr has a spurious dependency on mit-krb-config
161    yumdownloader mit-zephyr.i386
162    # if deps change, this breaks
163    YUM install -y libXaw.i586 libXext.i586 libXmu.i586 ncurses-libs.i586 readline.i58
164    rpm -i --nodeps mit-zephyr-2.1-6-linux.i386.rpm
165
166# Install the athena-base, athena-lprng, and athena-lprng-misc RPMs
167# from the Athena 9 build (these are present in our yum repo).  Note
168# that you will have to use --nodeps for at least one of the lprng
169# ones because it thinks it needs the Athena hesiod RPM.  It doesn't
170# really.  Before doing this, run it without --nodeps and arrange to
171# install the rest of the things it really does depend on.  This will
172# include a bunch of 32-bit rpms; go ahead and install the .i586 versions
173# of them.
174    YUM install -y athena-base
175    YUM install -y athena-lprng
176    yumdownloader athena-lprng-misc
177    # ezyang: I couldn't find any deps for this that existed in the repos
178    # You might get a "find: `/usr/athena/info': No such file or directory"
179    # error; this is fine
180    rpm -i --nodeps athena-lprng-misc-9.4-0.i386.rpm
181
182# Install the full list of RPMs that users expect to be on the
183# scripts.mit.edu servers.
184
185# ezyang: Running the below I got file conflicts. To fix (since I had
186# botched steps above), I manually compared package lists and installed
187# them.  If you've done the krb5 setup originally correctly, then
188# write down what you had to do here.
189    yumdownloader krb5-devel
190    rpm -i --force krb5-devel-*.i586.rpm
191    rpm -U --force krb5-devel-*.scripts.1138.x86_64.rpm
192    yumdownloader krb5-server
193    rpm -i --force krb5-server-*.scripts.1138.x86_64.rpm
194
195
196# on another server, run:
197rpm -qa --queryformat "%{Name}.%{Arch}\n" | sort > packages.txt
198# arrange for packages.txt to be passed to the server, then run:
199    # notice that yum is not capitalized
200    # Also notice skip-broken
201    cat packages.txt | NSS_NONLOCAL_IGNORE=1 xargs yum install -y --skip-broken
202
203# Check which packages are installed on your new server that are not
204# in the snapshot, and remove ones that aren't needed for some reason
205# on the new machine.  Otherwise, aside from bloat, you may end up
206# with undesirable things for security, like sendmail.
207    rpm -qa --queryformat "%{Name}.%{Arch}\n" | sort > newpackages.txt
208    diff -u packages.txt newpackages.txt  | less
209    # if all went well, you'll probably see multiple kernel versions
210    # as the only diff
211    # ezyang: I got exim installed as another package
212
213# Check out the scripts /usr/vice/etc configuration
214    cd /root
215    mkdir vice
216    cd vice
217    svn co svn://scripts.mit.edu/trunk/server/fedora/config/usr/vice/etc etc
218    \cp -a etc /usr/vice
219
220# Install the full list of perl modules that users expect to be on the
221# scripts.mit.edu servers.
222# - export PERL_MM_USE_DEFAULT=1
223# - Run 'cpan', accept the default configuration, and do 'o conf
224#   prerequisites_policy follow'.
225# - Parse the output of perldoc -u perllocal | grep head2 on an existing
226#   server, and "notest install" them from the cpan prompt.
227# TO DO THIS:
228# On another server, run:
229# perldoc -u perllocal | grep head2 | cut -f 3 -d '<' | cut -f 1 -d '|' | sort -u | perl -ne 'chomp; print "notest install $_\n" if system("rpm -q --whatprovides \"perl($_)\" >/dev/null 2>/dev/null")' > /mit/scripts/config/perl-packages.txt
230# Then on the server you're installing,
231#    cat perl-packages.txt | perl -MCPAN -e shell
232    export PERL_MM_USE_DEFAULT=1
233    # XXX: Some interactive gobbeldygook
234    cpan
235        o conf prerequisites_policy follow
236        o conf commit
237# on a reference server
238perldoc -u perllocal | grep head2 | cut -f 3 -d '<' | cut -f 1 -d '|' | sort -u | perl -ne 'chomp; print "notest install $_\n" if system("rpm -q --whatprovides \"perl($_)\" >/dev/null 2>/dev/null")' > perl-packages.txt
239# arrange for perl-packages.txt to be transferred to server
240    cat perl-packages.txt | perl -MCPAN -e shell
241
242# Install the Python eggs and Ruby gems and PEAR/PECL doohickeys that are on
243# the other scripts.mit.edu servers and do not have RPMs.
244# The general mode of operation will be to run the "list" command
245# on both servers, see what the differences are, check if those diffs
246# are packaged up as rpms, and install them (rpm if possible, native otherwise)
247# - Look at /usr/lib/python2.6/site-packages and
248#           /usr/lib64/python2.6/site-packages for Python eggs and modules.
249#   There will be a lot of gunk that was installed from packages;
250#   easy-install.pth will tell you what was easy_installed.
251#   First use 'yum search' to see if the relevant package is now available
252#   as an RPM, and install that if it is.  If not, then use easy_install.
253# - Look at `gem list` for Ruby gems.
254#   Again, use 'yum search' and prefer RPMs, but failing that, 'gem install'.
255#       ezyang: rspec-rails depends on rspec, and will override the Yum
256#       package, so... don't use that RPM yet
257# - Look at `pear list` for Pear fruits (or whatever they're called).
258#   Yet again, 'yum search' for RPMs before resorting to 'pear install'.  Note
259#   that for things in the beta repo, you'll need 'pear install package-beta'.
260#   (you might get complaints about the php_scripts module; ignore them)
261# - Look at `pecl list` for PECL things.  'yum search', and if you must,
262#   'pecl install' needed items.
263    # Automating this... will require a lot of batonning between
264    # the servers. Probably best way to do it is to write an actual
265    # script.
266
267# Setup some Python config
268    echo 'import site, os.path; site.addsitedir(os.path.expanduser("~/lib/python2.6/site-packages"))' > /usr/lib/python2.6/site-packages/00scripts-home.pth
269
270# Install the credentials.  There are a lot of things to remember here:
271#   o This will be different if you're setting up our build/update server.
272#   o You probably installed the machine keytab long ago
273    ls -l /etc/krb5.keytab
274#   o Use ktutil to combine the host/scripts.mit.edu and
275#     host/scripts-vhosts.mit.edu keys with host/this-server.mit.edu in
276#     the keytab.  Do not use 'k5srvutil change' on the combined keytab
277#     or you'll break the other servers. (real servers only)
278#   o The daemon.scripts keytab
279    ls -l /etc/daemon.keytab
280#   o The SSL cert private key (real servers only)
281#   o The LDAP password for the signup process (real servers only)
282#   o The SQL password for the signup process (real servers only)
283#   o The LDAP keytab for this server, which will be used later (real servers only)
284#   o Replace the ssh host keys with the ones common to all scripts servers (real servers only)
285#   o You'll install an LDAP certificate signed by the scripts CA later (real servers only)
286#   o Make sure root's .k5login is correct
287    cat /root/.k5login
288#   o Make sure logview's .k5login is correct (real servers only)
289
290# If you are setting up a test server, pay attention to
291# /etc/sysconfig/network-scripts and do not bind scripts' IP address.
292# You will also need to modify:
293#   o /etc/ldap.conf
294#       add: host scripts.mit.edu
295#   o /etc/nss-ldapd.conf
296#       replace: uri *****
297#       with: uri ldap://scripts.mit.edu/
298#   o /etc/openldap/ldap.conf
299#       add: URI ldap://scripts.mit.edu/
300#            BASE dc=scripts,dc=mit,dc=edu
301#   o /etc/httpd/conf.d/vhost_ldap.conf
302#       replace: VhostLDAPUrl ****
303#       with: VhostLDAPUrl "ldap://scripts.mit.edu/ou=VirtualHosts,dc=scripts,dc=mit,dc=edu"
304# to use scripts.mit.edu instead of localhost.
305# XXX: someone should write sed scripts to do this
306
307# If you are setting up a test server, afsagent's cronjob will attempt
308# to be renewing with the wrong credentials (daemon.scripts). Change this:
309    vim /home/afsagent/renew # replace all mentions of daemon.scripts.mit.edu
310
311# Install 389-ds-base and set up replication (see ./HOWTO-SETUP-LDAP
312#   and ./389-ds-enable-ssl-and-kerberos.diff).
313
314# Make the services dirsrv, nslcd, nscd, postfix, and httpd start at
315# boot. Run chkconfig to make sure the set of services to be run is
316# correct.
317    chkconfig dirsrv on
318    chkconfig nslcd on
319    chkconfig nscd on
320    chkconfig postfix on
321    chkconfig httpd on
322
323# Postfix doesn't actually deliver mail; fix this
324    cd /etc/postfix
325    postmap virtual
326
327# Run fmtutil-sys --all, which does something that makes TeX work.
328    fmtutil-sys --all
329    # ezyang: I got errors on xetex
330
331# Ensure that PHP isn't broken:
332    mkdir /tmp/sessions
333    chmod 01777 /tmp/sessions
334
335# Ensure that fcgid isn't broken:
336    chmod 755 /var/run/httpd
337    # ezyang: The below didn't exist for me
338    chmod 755 /var/run/httpd/mod_fcgid
339    chmod 755 /var/run/mod_fcgid
340
341# Fix etc by making sure none of our config files got overwritten
342    cd /etc
343    svn status | grep M
344    # ezyang: I had to revert krb5.conf, nsswitch.conf and sysconfig/openafs
345
346# Reboot the machine to restore a consistent state, in case you
347# changed anything.
348    # ezyang: When I rebooted, the following things happened:
349    #   o Starting kdump failed (this is ok)
350    #   o postfix mailbombed us
351    #   o firstboot configuration screen popped up (ignored; manually will do
352    #     chkconfig after the fact)
353
354# (Optional) Beat your head against a wall.
355
356# Possibly perform other steps that I've neglected to put in this
357# document.
358#   o In the first install of not-backward, ThisCell got clobbered, resulting
359#     in trying to get tickets from openafs.org. Not sure when it got
360#     clobbered -- ezyang
361#   o For some reason, syslog-ng wasn't turning on automatically, so we weren't
362#     getting spew
363
364# Some info about changing hostnames: it appears to be in:
365#   o /etc/sysconfig/network
366#   o your lvm thingies; probably don't need to edit
Note: See TracBrowser for help on using the repository browser.