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