source: branches/fc15-dev/server/doc/ @ 2046

Last change on this file since 2046 was 2046, checked in by ezyang, 13 years ago
Massive doc updates.
File size: 15.8 KB
1# This document is a how-to for installing a Fedora server.
2# It is semi-vaguely in the form of a shell script, but is not really
3# runnable as it stands.
5# Notation
6# [PRODUCTION] Production server that will be put into the pool
7# [WIZARD]     Semi-production server that will only have
8#              daemon.scripts-security-upd bits, among other
9#              restricted permissions
10# [TESTSERVER] Completely untrusted server
12# This is actually just "pick an active scripts server".  It can't be
13# because our networking config points that domain
14# at localhost, and if our server is not setup at that point things
15# will break.
18# 'branch' is the current svn branch you are on.  You want to
19# use trunk if your just installing a new server, and branches/fcXX-dev
20# if your preparing a server on a new Fedora release.
23# 'server' is the public hostname of your server, for SCP'ing files
24# to and from.
27# ----------------------------->8--------------------------------------
28#                       FIRST TIME INSTRUCTIONS
30# [PRODUCTION] If this is the first time you've installed this hostname,
31# you will need to update a bunch of files to add support for it. These
32# include:
33#   o Adding all aliases to /etc/httpd/conf.d/scripts-vhost-names.conf
34#     (usually this is hostname,, h-n,,
35#     scriptsN,, and the IP address.)
36#   o Adding routing rules for the static IP in
37#     /etc/sysconfig/network-scripts/route-eth1
38#   o Adding the IP address to the hosts file (same hosts as for
39#     scripts-vhost-names)
40#   o Update SSH config at
41#       - server/fedora/config/etc/ssh/shosts.equiv
42#       - server/fedora/config/etc/ssh/ssh_known_hosts
43#       - server/fedora/config/etc/ssh/sshd_config : DenyUsers
44#     (the last part is critical to ensure that rooting one server
45#     doesn't give you root to all the other servers)
46#   o Put the hostname information in LDAP so SVN and Git work
47#   o Set up Nagios monitoring on sipb-noc for the host
48#   o Set up the host as in the pool on r-b/r-b /etc/heartbeat/
49#   o Update locker/etc/known_hosts
51# You will also need to prepare the keytabs for credit-card.  In particular,
52# use ktutil to combine the host/ and
53# host/ keys with host/ in
54# the keytab.  Do not use 'k5srvutil change' on the combined keytab
55# or you'll break the other servers. (real servers only).  Be
56# careful about writing out the keytab: if you write it to an
57# existing file the keys will just get appended.  The correct
58# credential list should look like:
59#   ktutil:  l
60#   slot KVNO Principal
61#   ---- ---- ---------------------------------------------------------------------
62#      1    5 host/
63#      2    3 host/
64#      3    2      host/
66# The LDAP keytab should be by itself, so be sure to delete it and
67# put it in its own file.
68# ----------------------------->8--------------------------------------
70# Start with a Scripts kickstarted install of Fedora (install-fedora)
72# Take updates, reboot if there's a kernel update.
73    yum update -y
75# Get rid of network manager
76    yum remove NetworkManager
78# This is superseded by credit-card, but only for [PRODUCTION]
79# Don't use credit-card on [WIZARD]: it will put in the wrong creds!
81#   # All types of servers will have an /etc/daemon.keytab file, however,
82#   # different types of server will have different credentials in this
83#   # keytab.
84#   #   [PRODUCTION] daemon.scripts
85#   #   [WIZARD]     daemon.scripts-security-upd
86#   #   [TESTSERVER] daemon.scripts-test
88# Check out the scripts /etc configuration
89    cd /root
90    \cp -a etc /
91    chmod 0440 /etc/sudoers
93# Make sure network is working.  Kickstart should have
94# configured eth0 and eth1 correctly; use service network restart
95# to add the new routes from etc in route-eth1.
96    systemctl restart network.service
97    # Check everything worked:
98    route
99    ifconfig
100    cat /etc/hosts
101    cat /etc/sysconfig/network-scripts/route-eth1
103# This is the point at which you should start updating scriptsified
104# packages for a new Fedora release.  Consult 'upgrade-tips' for more
105# information.
106    yum install -y scripts-base
107    # Some of these packages are naughty and clobber some of our files
108    cd /etc
109    svn revert resolv.conf hosts sysconfig/openafs
111# Replace rsyslog with syslog-ng by doing:
112    rpm -e --nodeps rsyslog
113    yum install -y syslog-ng
114    systemctl enable syslog-ng.service
116# Install the full list of RPMs that users expect to be on the
117# servers.
118rpm -qa --queryformat "%{Name}.%{Arch}\n" | sort > packages.txt
119# arrange for packages.txt to be passed to the server, then run:
120# --skip-broken will (usually) prevent you from having to sit through
121# several minutes of dependency resolution until it decides that
122# it can't install /one/ package.
123    yum install -y --skip-broken $(cat packages.txt)
125# Make sure sendmail isn't installed
126    yum remove sendmail
128# Check which packages are installed on your new server that are not
129# in the snapshot, and remove ones that aren't needed for some reason
130# on the new machine.  Otherwise, aside from bloat, you may end up
131# with undesirable things for security, like sendmail.
132    rpm -qa --queryformat "%{Name}.%{Arch}\n" | grep -v kernel | sort > newpackages.txt
133    diff -u packages.txt newpackages.txt | grep -v kernel | less
134    # here's a cute script that removes all extra packages
135    yum erase -y $(grep -Fxvf packages.txt newpackages.txt)
136    # 20101208 - Mysteriously we manage to get these extra packages
137    # from kickstart: mcelog mobile-broadband-provider-info
138    # ModemManager PackageKit
140# We need an upstream version of cgi which we've packaged ourselves, but
141# it doesn't work with the haskell-platform package which expects
142# explicit versions.  So temporarily rpm -e the package, and then
143# install it again after you install haskell-platform.  [Note: You
144# probably won't need this in Fedora 15 or something, when the Haskell
145# Platform gets updated.]
146    rpm -e ghc-cgi-devel ghc-cgi
147    yum install -y haskell-platform
148    yumdownloader ghc-cgi
149    yumdownloader ghc-cgi-devel
150    rpm -i ghc-cgi*1.8.1*.rpm
152# Note: Since ultimately we'd like to move away from using per-language
153# package manager and all of these be RPMs, it is of questionable
154# importance how much /good/ automation for these is necessary.
156# Warning: For a new release, we're supposed to check if Fedora has
157# packaged up the RPM.  Unfortunately we don't really have good incants
158# for this.
160# Install the full list of perl modules that users expect to be on the
161# servers.
162    cd /root
163    export PERL_MM_USE_DEFAULT=1
164    cpan # this is interactive, enter the next two lines
165        o conf prerequisites_policy follow
166        o conf commit
167# on a reference server
168perldoc -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
169# arrange for perl-packages.txt to be transferred to server
170    cat perl-packages.txt | perl -MCPAN -e shell
172# Install the Python eggs and Ruby gems and PEAR/PECL doohickeys that are on
173# the other servers and do not have RPMs.
174# The general mode of operation will be to run the "list" command
175# on both servers, see what the differences are, check if those diffs
176# are packaged up as rpms, and install them (rpm if possible, native otherwise)
177# - Look at /usr/lib/python2.6/site-packages and
178#           /usr/lib64/python2.6/site-packages for Python eggs and modules.
179#   There will be a lot of gunk that was installed from packages;
180#   easy-install.pth in /usr/lib/ will tell you what was easy_installed.
181#   First use 'yum search' to see if the relevant package is now available
182#   as an RPM, and install that if it is.  If not, then use easy_install.
183#   Pass -Z to easy_install to install them unzipped, as some zipped eggs
184#   want to be able to write to ~/.python-eggs.  (Also makes sourcediving
185#   easier.)
186# 'easy_install AuthKit jsonlib2 pygit'
187cat /usr/lib/python2.7/site-packages/easy-install.pth | grep "^./" | cut -c3- | cut -f1 -d- > egg.txt
188    cat egg.txt | xargs easy_install -Z
190# - Look at `gem list` for Ruby gems.
191#   Again, use 'yum search' and prefer RPMs, but failing that, 'gem install'.
192#       ezyang: rspec-rails depends on rspec, and will override the Yum
193#       package, so... don't use that RPM yet
194# XXX This doesn't do the right thing for old version gems
195gem list --no-version > gem.txt
196    gem install $(gem list --no-version | grep -Fxvf - gem.txt)
197    # Also, we need to install the old rails version
199# - Look at `pear list` for Pear fruits (or whatever they're called).
200#   Yet again, 'yum search' for RPMs before resorting to 'pear install'.  Note
201#   that for things in the beta repo, you'll need 'pear install package-beta'.
202#   (you might get complaints about the php_scripts module; ignore them)
203pear list | tail -n +4 | cut -f 1 -d " " > pear.txt
204    pear config-set preferred_state beta
205    pear channel-update
206    pear install $(pear list | tail -n +4 | cut -f 1 -d " " | grep -Fxvf - pear.txt)
208# - Look at `pecl list` for PECL things.  'yum search', and if you must,
209#   'pecl install' needed items. If it doesn't work, try 'pear install
210#   pecl/foo' or 'pecl install foo-beta' or those two combined.
211pecl list | tail -n +4 | cut -f 1 -d " " > pecl.txt
212    pecl install --nodeps $(pecl list | tail -n +4 | cut -f 1 -d " " | grep -Fxvf - pecl.txt)
214# ----------------------------->8--------------------------------------
215#                       INFINITE CONFIGURATION
217# Run credit-card to clone in credentials and make things runabble
218python push $server
220# [PRODUCTION/WIZARD] Fix the openafs /usr/vice/etc <-> /etc/openafs
221# mapping.
222    echo "/afs:/usr/vice/cache:10000000" > /usr/vice/etc/cacheinfo
223    echo "" > /usr/vice/etc/ThisCell
224# [TESTSERVER] If you're installing a test server, this needs to be
225# much smaller; the max filesize on XVM is 10GB.  Pick something like
226# 500000. Also, some of the AFS parameters are kind of retarded (and if
227# you're low on disk space, will actually exhaust our inodes).  Edit
228# these parameters in /etc/sysconfig/openafs
229    echo "/afs:/usr/vice/cache:500000" > /usr/vice/etc/cacheinfo
232# Test that zephyr is working
233    systemctl enable zhm.service
234    systemctl start zhm.service
235    echo 'Test!' | zwrite -d -c scripts -i test
237# Check out the scripts /usr/vice/etc configuration
238    cd /root/vice
239    \cp -a etc /usr/vice
241# [PRODUCTION] Set up replication (see ./install-ldap).
242# You'll need the LDAP keytab for this server: be sure to chown it
243# fedora-ds after you create the fedora-ds user
244    ls -l /etc/dirsrv/keytab
245    cat install-ldap
247    systemctl enable openafs-client.service
248    systemctl enable dirsrv.service
249    systemctl enable nslcd.service
250    systemctl enable nscd.service
251    systemctl enable postfix.service
252    systemctl enable nrpe.service
253    systemctl enable httpd.service # not for [WIZARD]
255    systemctl start openafs-client.service
256    systemctl start dirsrv.service
257    systemctl start nslcd.service
258    systemctl start nscd.service
259    systemctl start postfix.service
260    systemctl start nrpe.service
261    systemctl start httpd.service # not for [WIZARD]
263# Note about OpenAFS: Check that fs sysname is correct.  You should see,
264# among others, 'amd64_fedoraX_scripts' (vary X) and 'scripts'. If it's
265# not, you probably did a distro upgrade and should update
266# /etc/sysconfig/openafs (XXX this is wrong: figuring out new
267# systemd world order).
268    fs sysname
270# Postfix doesn't actually deliver mail; fix this
271    cd /etc/postfix
272    postmap virtual
274# Munin might not be monitoring packages that were installed after it
275    munin-node-configure --suggest --shell | sh
277# Run fmtutil-sys --all, which does something that makes TeX work.
278# (Note: this errors on XeTeX which is ok.)
279    fmtutil-sys --all
281# Ensure that PHP isn't broken:
282    mkdir /tmp/sessions
283    chmod 01777 /tmp/sessions
284    # XXX: this seems to get deleted if tmp gets cleaned up, so we
285    # might need something a little better (maybe init script.)
287# Fix etc by making sure none of our config files got overwritten
288    cd /etc
289    svn status -q
290    # Some usual candidates for clobbering include nsswitch.conf and
291    # sysconfig/openafs
292    # [WIZARD/TEST] Remember that changes you made should not get
293    # reverted!
295# ThisCell got clobbered, replace it with
296    echo "" > /usr/vice/etc/ThisCell
298# Reboot the machine to restore a consistent state, in case you
299# changed anything. (Note: Starting kdump fails (this is ok))
301# When all is said and done, fix up the Subversion checkouts
302    cd /etc
303    svn switch --relocate svn://$source_server/ svn://
304    cd /usr/vice/etc
305    svn switch --relocate svn://$source_server/ svn://
306    cd /srv/repository
307    # Some commands should be run as the scripts-build user, not root.
308    alias asbuild="sudo -u scripts-build"
309    asbuild svn switch --relocate svn://$source_server/ svn://
310    asbuild svn up # verify works
312# ------------------------------->8-------------------------------
315# [OPTIONAL] Your machine's hostname is baked in at install time;
316# in the rare case you need to change it: it appears to be in:
317#   o /etc/sysconfig/network
318#   o your lvm thingies; probably don't need to edit
320# [WIZARD/TESTSERVER] If you are setting up a non-production server,
321# there are some services that it won't provide, and you will need to
322# make it talk to a real server instead.  In particular:
323#   - We don't serve the web, so don't bind
324#   - We don't serve LDAP, so use another server
325# This involves editing the following files:
326#   o /etc/sysconfig/network-scripts/ifcfg-lo:0
327#   o /etc/sysconfig/network-scripts/ifcfg-lo:1
328#   o /etc/sysconfig/network-scripts/ifcfg-lo:2
329#   o /etc/sysconfig/network-scripts/ifcfg-lo:3
330       \rm /etc/sysconfig/network-scripts/ifcfg-lo:{0,1,2,3}
331#   o /etc/ldap.conf
332#       add: host
333#   o /etc/{nss-ldapd,nslcd}.conf
334#       replace: uri ldapi://%2fvar%2frun%2fdirsrv%2fslapd-scripts.socket/
335#       with: uri ldap://
336#   o /etc/openldap/ldap.conf
337#       add: URI ldap://
338#            BASE dc=scripts,dc=mit,dc=edu
339#   o /etc/httpd/conf.d/vhost_ldap.conf
340#       replace: VhostLDAPUrl "ldap://,dc=scripts,dc=mit,dc=edu"
341#       with: VhostLDAPUrl "ldap://,dc=scripts,dc=mit,dc=edu"
342#   o /etc/postfix/virtual-alias-{domains,maps}
343#       replace: server_host ldapi://%2fvar%2frun%2fdirsrv%2fslapd-scripts.socket/
344#       with: server_host = ldap://
345# to use instead of localhost.
346# XXX: someone should write sed scripts to do this
348# [WIZARD/TESTSERVER] If you are setting up a non-production server,
349# afsagent's cronjob will attempt to be renewing with the wrong
350# credentials (daemon.scripts). Change this:
351    vim /home/afsagent/renew # replace all mentions of
354#   - You need a self-signed SSL cert or Apache will refuse to start
355#     or do SSL.  Generate with:
356    openssl req -new -x509 -keyout /etc/pki/tls/private/scripts.key -out /etc/pki/tls/certs/scripts.cert -nodes
357#     Also make /etc/pki/tls/certs/ca.pem match up (XXX what's the
358#     incant for that?)
360# [TESTSERVER] More stuff for test servers
361#   - Make (/etc/aliases) root mail go to /dev/null, so we don't spam people
362#   - Edit /etc/httpd/conf.d/scripts-vhost-names.conf to have
363#     be an accepted vhost name
364#   - Look at the old test server and see what config changes are floating around
Note: See TracBrowser for help on using the repository browser.