1 | # This document is a how-to for installing a Fedora scripts.mit.edu server. |
---|
2 | |
---|
3 | set -e -x |
---|
4 | |
---|
5 | [ -e /scripts-boot-count ] || echo 0 > /scripts-boot-count |
---|
6 | |
---|
7 | source_server="old-faithful.mit.edu" |
---|
8 | |
---|
9 | boot=${1:$(cat /scripts-boot-count)} |
---|
10 | |
---|
11 | doreboot() { |
---|
12 | echo $(( $boot + 1 )) > /scripts-boot-count; |
---|
13 | shutdown -r now "Rebooting for step $(cat /scripts-boot-count)" |
---|
14 | } |
---|
15 | |
---|
16 | YUM() { |
---|
17 | NSS_NONLOCAL_IGNORE=1 yum "$@" |
---|
18 | } |
---|
19 | |
---|
20 | # Helper files for the install are located in server/fedora/config. |
---|
21 | |
---|
22 | # Start with a normal install of Fedora. |
---|
23 | |
---|
24 | if [ $boot = 0 ]; then |
---|
25 | # When the initial configuration screen comes up, under "Firewall |
---|
26 | # configuration", disable the firewall, and under "System services", leave |
---|
27 | # enabled (as of Fedora 9) acpid, anacron, atd, cpuspeed, crond, |
---|
28 | # firstboot, fuse, haldaemon, ip6tables, iptables, irqbalance, |
---|
29 | # kerneloops, mdmonitor, messagebus, microcode_ctl, netfs, network, nscd, ntpd, |
---|
30 | # sshd, udev-post, and nothing else. |
---|
31 | echo "--disabled" > /etc/sysconfig/system-config-firewall |
---|
32 | for i in NetworkManager avahi-daemon bluetooth cups isdn nfslock pcscd restorecond rpcbind rpcgssd rpcidmapd sendmail; do |
---|
33 | chkconfig "$i" off |
---|
34 | done |
---|
35 | |
---|
36 | # Edit /etc/selinux/config so it has SELINUX=disabled and reboot. |
---|
37 | sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config |
---|
38 | doreboot |
---|
39 | fi |
---|
40 | |
---|
41 | if [ $boot = 1 ]; then |
---|
42 | # Create a scripts-build user account, and set up rpm to build in |
---|
43 | # $HOME by doing a |
---|
44 | # cp config/home/scripts-build/.rpmmacros /home/scripts-build/ |
---|
45 | # (If you just use the default setup, it will generate packages |
---|
46 | # in /usr/src/redhat.) |
---|
47 | adduser scripts-build |
---|
48 | |
---|
49 | # Check out the scripts.mit.edu svn repository. Configure svn not to cache |
---|
50 | # credentials. |
---|
51 | |
---|
52 | YUM install -y subversion |
---|
53 | |
---|
54 | cd /srv |
---|
55 | svn co svn://$source_server/trunk repository |
---|
56 | |
---|
57 | sed -i 's/^(# *)*store-passwords.*/store-passwords = no/' /root/.subversion/config |
---|
58 | sed -i 's/^(# *)*store-auth-creds.*/store-auth-creds = no/' /root/.subversion/config |
---|
59 | # The same tweaks should be made on /home/scripts-build/.subversion/config |
---|
60 | # once it exists (do something with svn as scripts-build) |
---|
61 | |
---|
62 | chown -R scripts-build /srv/repository |
---|
63 | |
---|
64 | # cd to server/fedora in the svn repository. |
---|
65 | cd /srv/repository/server/fedora |
---|
66 | |
---|
67 | # Run "make install-deps" to install various prereqs. Nonstandard |
---|
68 | # deps are in /mit/scripts/rpm. |
---|
69 | make install-deps |
---|
70 | |
---|
71 | # Install bind |
---|
72 | YUM install -y bind |
---|
73 | |
---|
74 | # Check out the scripts /etc configuration |
---|
75 | cd /root |
---|
76 | svn co svn://scripts.mit.edu/trunk/server/fedora/config/etc etc |
---|
77 | \cp -a etc / |
---|
78 | |
---|
79 | # yum remove nss_ldap, because nss-ldapd conflicts with it |
---|
80 | |
---|
81 | # env NSS_NONLOCAL_IGNORE=1 yum install scripts-base |
---|
82 | YUM install -y scripts-base |
---|
83 | |
---|
84 | # Rebuild mit-zephyr on a 32-bit machine, like the one at Joe's home. |
---|
85 | |
---|
86 | # Remember to set NSS_NONLOCAL_IGNORE=1 anytime you're setting up |
---|
87 | # anything, e.g. using yum. Otherwise useradd will query LDAP in a stupid way |
---|
88 | # that makes it hang forever. |
---|
89 | |
---|
90 | # Install and configure bind |
---|
91 | # - env NSS_NONLOCAL_IGNORE=1 yum install bind |
---|
92 | # - chkconfig named on |
---|
93 | # - service named start |
---|
94 | |
---|
95 | # Reload the iptables config to take down the restrictive firewall |
---|
96 | # service iptables restart |
---|
97 | |
---|
98 | # Copy over root's dotfiles from one of the other machines. |
---|
99 | |
---|
100 | # Replace rsyslog with syslog-ng by doing: |
---|
101 | # # rpm -e --nodeps rsyslog |
---|
102 | # # yum install syslog-ng |
---|
103 | |
---|
104 | # Install various dependencies of the scripts system, including syslog-ng, |
---|
105 | # glibc-devel.i586, python-twisted-core, mod_fcgid, nrpe, nagios-plugins-all. |
---|
106 | |
---|
107 | # Disable NetworkManager with chkconfig NetworkManager off. Configure |
---|
108 | # networking on the front end and back end, and the routing table to send |
---|
109 | # traffic over the back end. Make sure that chkconfig reports "network" on, so |
---|
110 | # that the network will still be configured at next boot. |
---|
111 | |
---|
112 | # Fix the openafs /usr/vice/etc <-> /etc/openafs mapping by changing |
---|
113 | # /usr/vice/etc/cacheinfo to contain: |
---|
114 | # /afs:/usr/vice/cache:10000000 |
---|
115 | # Also fix ThisCell to contain athena.mit.edu in both directories |
---|
116 | |
---|
117 | # Figure out why Zephyr isn't working. Most recently, it was because there |
---|
118 | # was a 64-bit RPM installed; remove it and install Joe's 32-bit one |
---|
119 | |
---|
120 | # Install the athena-base, athena-lprng, and athena-lprng-misc RPMs |
---|
121 | # from the Athena 9 build (these are present in our yum repo). Note |
---|
122 | # that you will have to use --nodeps for at least one of the lprng |
---|
123 | # ones because it thinks it needs the Athena hesiod RPM. It doesn't |
---|
124 | # really. Before doing this, run it without --nodeps and arrange to |
---|
125 | # install the rest of the things it really does depend on. This will |
---|
126 | # include a bunch of 32-bit rpms; go ahead and install the .i586 versions |
---|
127 | # of them. In the case of the Kerberos libraries, you'll be told that |
---|
128 | # there are conflicting files with the 64-bit versions of the packages, |
---|
129 | # which we scriptsify. You'll have to use --force to install those |
---|
130 | # rpms despite the conflicts. After doing that, you may want to |
---|
131 | # install the corresponding 64-bit scriptsified versions again, just |
---|
132 | # to be safe in case the 32-bit versions overwrite files that differ. |
---|
133 | # When you try this, it will complain that you already have the same |
---|
134 | # version installed; again, you'll need to use --force to do it anyway. |
---|
135 | # Yuck. |
---|
136 | |
---|
137 | # Install the full list of RPMs that users expect to be on the |
---|
138 | # scripts.mit.edu servers. See server/doc/rpm and |
---|
139 | # server/doc/rpm_snapshot. (Note that this is only a snapshot, and not |
---|
140 | # all packages may in fact be in use.) |
---|
141 | |
---|
142 | # Check which packages are installed on your new server that are not |
---|
143 | # in the snapshot, and remove ones that aren't needed for some reason |
---|
144 | # on the new machine. Otherwise, aside from bloat, you may end up |
---|
145 | # with undesirable things for security, like sendmail. |
---|
146 | |
---|
147 | # Check out the scripts /usr/vice/etc configuration |
---|
148 | cd /root |
---|
149 | mkdir vice |
---|
150 | cd vice |
---|
151 | svn co svn://scripts.mit.edu/trunk/server/fedora/config/usr/vice/etc etc |
---|
152 | \cp -a etc /usr/vice |
---|
153 | |
---|
154 | # Install the full list of perl modules that users expect to be on the |
---|
155 | # scripts.mit.edu servers. |
---|
156 | # - export PERL_MM_USE_DEFAULT=1 |
---|
157 | # - Run 'cpan', accept the default configuration, and do 'o conf |
---|
158 | # prerequisites_policy follow'. |
---|
159 | # - Parse the output of perldoc -u perllocal | grep head2 on an existing |
---|
160 | # server, and "notest install" them from the cpan prompt. |
---|
161 | # TO DO THIS: |
---|
162 | # On another server, run: |
---|
163 | # 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 |
---|
164 | # Then on the server you're installing, |
---|
165 | # cat perl-packages.txt | perl -MCPAN -e shell |
---|
166 | |
---|
167 | # Install the Python eggs and Ruby gems and PEAR/PECL doohickeys that are on |
---|
168 | # the other scripts.mit.edu servers and do not have RPMs. |
---|
169 | # - Look at /usr/lib/python2.6/site-packages and |
---|
170 | # /usr/lib64/python2.6/site-packages for Python eggs and modules. |
---|
171 | # First use 'yum search' to see if the relevant package is now available |
---|
172 | # as an RPM, and install that if it is. If not, then use easy_install. |
---|
173 | # - Look at `gem list` for Ruby gems. |
---|
174 | # Again, use 'yum search' and prefer RPMs, but failing that, 'gem install'. |
---|
175 | # - Look at `pear list` for Pear fruits (or whatever they're called). |
---|
176 | # Yet again, 'yum search' for RPMs before resorting to 'pear install'. Note |
---|
177 | # that for things in the beta repo, you'll need 'pear install package-beta'. |
---|
178 | # - Look at `pecl list` for PECL things. 'yum search', and if you must, |
---|
179 | # 'pecl install' needed items. |
---|
180 | |
---|
181 | # echo 'import site, os.path; site.addsitedir(os.path.expanduser("~/lib/python2.6/site-packages"))' > /usr/lib/python2.6/site-packages/00scripts-home.pth |
---|
182 | |
---|
183 | # Install the credentials. There are a lot of things to remember here: |
---|
184 | # o You probably installed the machine keytab long ago |
---|
185 | # o Use ktutil to combine the host/scripts.mit.edu and |
---|
186 | # host/scripts-vhosts.mit.edu keys with host/this-server.mit.edu in |
---|
187 | # the keytab. Do not use 'k5srvutil change' on the combined keytab |
---|
188 | # or you'll break the other servers. |
---|
189 | # o The daemon.scripts keytab |
---|
190 | # o The SSL cert private key |
---|
191 | # o The LDAP password for the signup process |
---|
192 | # o The SQL password for the signup process |
---|
193 | # o The LDAP keytab for this server, which will be used later |
---|
194 | # o Replace the ssh host keys with the ones common to all scripts servers |
---|
195 | # o You'll install an LDAP certificate signed by the scripts CA later |
---|
196 | # o Make sure root's .k5login is correct |
---|
197 | # o Make sure logview's .k5login is correct |
---|
198 | |
---|
199 | # If you are setting up a test server, pay attention to |
---|
200 | # /etc/sysconfig/network-scripts and do not bind scripts' IP address. |
---|
201 | # You will also need to modify /etc/ldap.conf, /etc/nss-ldapd.conf, |
---|
202 | # /etc/openldap/ldap.conf, and /etc/httpd/conf.d/vhost_ldap.conf to |
---|
203 | # use scripts.mit.edu instead of localhost. |
---|
204 | |
---|
205 | # Install fedora-ds-base and set up replication (see ./HOWTO-SETUP-LDAP |
---|
206 | # and ./fedora-ds-enable-ssl-and-kerberos.diff). |
---|
207 | |
---|
208 | # Make the services dirsrv, nslcd, nscd, postfix, and httpd start at |
---|
209 | # boot. Run chkconfig to make sure the set of services to be run is |
---|
210 | # correct. |
---|
211 | |
---|
212 | # cd /etc/postfix; postmap virtual |
---|
213 | # Otherwise postfix will appear to work, but actually not deliver mail |
---|
214 | |
---|
215 | # Run fmtutil-sys --all, which does something that makes TeX work. |
---|
216 | |
---|
217 | # Ensure that PHP isn't broken: |
---|
218 | # # mkdir /tmp/sessions |
---|
219 | # # chmod 01777 /tmp/sessions |
---|
220 | |
---|
221 | # Reboot the machine to restore a consistent state, in case you |
---|
222 | # changed anything. |
---|
223 | |
---|
224 | # (Optional) Beat your head against a wall. |
---|
225 | |
---|
226 | # Possibly perform other steps that I've neglected to put in this |
---|
227 | # document. |
---|