source: branches/fc13-dev/server/doc/ @ 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 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
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.  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.
15doreboot() {
16    echo $(( $boot + 1 )) > /scripts-boot-count;
17    shutdown -r now "Rebooting for step $(cat /scripts-boot-count)"
20YUM() {
21    NSS_NONLOCAL_IGNORE=1 yum "$@"
24# Helper files for the install are located in server/fedora/config.
26# Start with a normal install of Fedora.
28if [ $boot = 0 ]; then
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.
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.
38    echo "--disabled" > /etc/sysconfig/system-config-firewall
39    for i in NetworkManager avahi-daemon bluetooth cups isdn nfslock nfs pcscd restorecond rpcbind rpcgssd rpcidmapd sendmail; do
40        chkconfig "$i" off
41    done
43# Turn on network, so we can connect at boot
44chkconfig network on
46# Edit /etc/selinux/config so it has SELINUX=disabled and reboot.
47    sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
48    doreboot
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
59# Check out the svn repository. Configure svn not to cache
60# credentials.
62    YUM install -y subversion
64    cd /srv
65    svn co svn://$branch repository
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
69# The same tweaks should be made on /home/scripts-build/.subversion/config
70# once it exists (do something with svn as scripts-build)
72    chown -R scripts-build /srv/repository
74# cd to server/fedora in the svn repository.
75    cd /srv/repository/server/fedora
77# Run "make install-deps" to install various prereqs.  Nonstandard
78# deps are in /mit/scripts/rpm.
79    YUM install -y make
80    make install-deps
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.
86# Add scripts-build to the group 'mock'
87    usermod -a -G mock scripts-build
89# Install bind
90    YUM install -y bind
92# Check out the scripts /etc configuration
93    cd /root
94    svn co svn://$branch/server/fedora/config/etc etc
95    # backslash to make us not use the alias
96    \cp -a etc /
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 address for the DNS server.  Be sure to revert it once
102# you have named.
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)
108    service named start
109    chkconfig named on
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.
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.
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
130    # FC13: Check if they are necessary
131    rpm -i krb5-libs-*.i586.rpm
132    rpm -U --force krb5-libs-*.scripts.1138.x86_64.rpm
134# env NSS_NONLOCAL_IGNORE=1 yum install scripts-base
135    YUM install -y scripts-base
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
139# that makes it hang forever. (This is why we're using YUM, not yum)
141# Reload the iptables config to take down the restrictive firewall
142    service iptables restart
144# Copy over root's dotfiles from one of the other machines.
145# Perhaps a useful change is to remove the default aliases
146    # On 2009-07-01, the dotfiles to transfer where:
147    #   .bashrc .ldapvirc (<- HAS PRIVILEDGED DATA)
148    #   .screenrc .ssh (<- directory) .vimrc
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
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.
159# Replace rsyslog with syslog-ng by doing:
160    rpm -e --nodeps rsyslog
161    YUM install -y syslog-ng
162    chkconfig syslog-ng on
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
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.
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)
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
182# Also fix ThisCell to contain in both directories
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
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
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
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
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
200    YUM install -y libXaw.i586 libXext.i586 libXmu.i586 ncurses-libs.i586 readline.i586
201    rpm -i --nodeps mit-zephyr-2.1-6-linux.i386.rpm
202    # test if it worked by sending an un-authed message
203    zwrite -d -c scripts -i test
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
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
221# Install the full list of RPMs that users expect to be on the
222# servers.
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
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.
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
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
243# Check out the scripts /usr/vice/etc configuration
244    cd /root
245    mkdir vice
246    cd vice
247    svn co svn:// etc
248    \cp -a etc /usr/vice
250# Install the full list of perl modules that users expect to be on the
251# servers.
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.
257# TO DO THIS:
258# On another server, run:
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
260# Then on the server you're installing,
261#    cat perl-packages.txt | perl -MCPAN -e shell
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
272# Install the Python eggs and Ruby gems and PEAR/PECL doohickeys that are on
273# the other servers and do not have RPMs.
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)
277# - Look at /usr/lib/python2.6/site-packages and
278#           /usr/lib64/python2.6/site-packages for Python eggs and modules.
279#   There will be a lot of gunk that was installed from packages;
280#   easy-install.pth will tell you what was easy_installed.
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.
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.)
286# - Look at `gem list` for Ruby gems.
287#   Again, use 'yum search' and prefer RPMs, but failing that, 'gem install'.
288#       ezyang: rspec-rails depends on rspec, and will override the Yum
289#       package, so... don't use that RPM yet
290# - Look at `pear list` for Pear fruits (or whatever they're called).
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'.
293#   (you might get complaints about the php_scripts module; ignore them)
294# - Look at `pecl list` for PECL things.  'yum search', and if you must,
295#   'pecl install' needed items. If it doesn't work, try 'pear install
296#   pecl/foo' or 'pecl install foo-beta' or those two combined.
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.
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
304# Install the credentials.  There are a lot of things to remember here:
305#   o This will be different if you're setting up our build/update server.
306#   o You probably installed the machine keytab long ago
307    ls -l /etc/krb5.keytab
308#   o Use ktutil to combine the host/ and
309#     host/ keys with host/ in
310#     the keytab.  Do not use 'k5srvutil change' on the combined keytab
311#     or you'll break the other servers. (real servers only)
312#   o The daemon.scripts keytab
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)
317#   o The whoisd password (real servers only)
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)
321#   o Make sure root's .k5login is correct
322    cat /root/.k5login
323#   o Make sure logview's .k5login is correct (real servers only)
325# If you are setting up a test server, pay attention to
326# /etc/sysconfig/network-scripts and do not bind scripts' IP address.
327# You will also need to modify:
328#   o /etc/ldap.conf
329#       add: host
330#   o /etc/nss-ldapd.conf
331#       replace: uri *****
332#       with: uri ldap://
333#   o /etc/openldap/ldap.conf
334#       add: URI ldap://
335#            BASE dc=scripts,dc=mit,dc=edu
336#   o /etc/httpd/conf.d/vhost_ldap.conf
337#       replace: VhostLDAPUrl ****
338#       with: VhostLDAPUrl "ldap://,dc=scripts,dc=mit,dc=edu"
339#   o /etc/postfix/virtual-alias-{domains,maps}
340#       replace: server_host *****
341#       with: server_host = ldap://
342# to use instead of localhost.
343# XXX: someone should write sed scripts to do this
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
349# Install 389-ds-base and set up replication (see ./HOWTO-SETUP-LDAP
350#   and ./389-ds-enable-ssl-and-kerberos.diff).
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.
355    chkconfig dirsrv on
356    chkconfig nslcd on
357    chkconfig nscd on
358    chkconfig postfix on
359    chkconfig httpd on
361# Postfix doesn't actually deliver mail; fix this
362    cd /etc/postfix
363    postmap virtual
365# Munin might not be monitoring packages that were installed after it
366    munin-node-configure --suggest --shell | sh
368# Run fmtutil-sys --all, which does something that makes TeX work.
369    fmtutil-sys --all
370    # ezyang: I got errors on xetex
372# Ensure that PHP isn't broken:
373    mkdir /tmp/sessions
374    chmod 01777 /tmp/sessions
376# Ensure fcgid isn't broken
377    chmod 755 /var/run/mod_fcgid # ezyang: I suspect this is no longer necessary
379# Fix etc by making sure none of our config files got overwritten
380    cd /etc
381    svn status | grep M
382    # ezyang: I had to revert krb5.conf (not with latest), nsswitch.conf and sysconfig/openafs
384# ThisCell got clobbered, replace it with
385    echo "" > /usr/vice/etc/ThisCell
387# Reboot the machine to restore a consistent state, in case you
388# changed anything.
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)
395# (Optional) Beat your head against a wall.
397# Possibly perform other steps that I've neglected to put in this
398# document.
399#   o For some reason, syslog-ng wasn't turning on automatically, so we weren't
400#     getting spew
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
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
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.