source: branches/fc11-dev/server/doc/ @ 1218

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