source: branches/fc13-dev/server/doc/install-howto.sh @ 1619

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