source: trunk/server/doc/ @ 1381

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