AFS Backups » History » Version 1
Joseph Foley, 2015-09-05 02:57
| 1 | 1 | Joseph Foley | h1. AFS Backups |
|---|---|---|---|
| 2 | |||
| 3 | h2. Software and instructions |
||
| 4 | |||
| 5 | * BackupAFS at UNC |
||
| 6 | ** http://www.physics.unc.edu/~stephen/BackupAFS/ |
||
| 7 | |||
| 8 | h2. Installation at DevNet |
||
| 9 | |||
| 10 | Based upon directions at http://www.physics.unc.edu/~stephen/BackupAFS/ |
||
| 11 | |||
| 12 | # Open up firewall on SSL and normal web ports on eir.dev.ru.is |
||
| 13 | # Become root |
||
| 14 | <pre> sudo su -</pre> |
||
| 15 | # Install the openafs client |
||
| 16 | <pre>apt-get -y install krb5-auth-dialog krb5-user krb5-clients libpam-ccreds libpam-krb5 build-essential dkms linux-headers-`uname -r` openafs-modules-dkms openafs-{client,krb5}</pre> |
||
| 17 | # Diable AFS backups (bos) |
||
| 18 | ## TODO |
||
| 19 | # Install prerequisites |
||
| 20 | <pre>sudo apt-get install apache2 libapache2-mod-auth-kerb postfix pigz libxml-rss-perl</pre> |
||
| 21 | # Stop apache |
||
| 22 | <pre>service apache2 stop</pre> |
||
| 23 | # Create a backup user and give (foley) remote access to it |
||
| 24 | <pre>adduser --home /home/backupafs --shell /bin/bash backupafs |
||
| 25 | echo foley@DEV.RU.IS > /home/backupafs/.k5login</pre> |
||
| 26 | # Create a location for the backups (or mount a drive here if you already have one) |
||
| 27 | <pre>mkdir -p /srv/backupafs |
||
| 28 | chown backupafs:backupafs /srv/backupafs |
||
| 29 | chmod 700 /srv/backupafs</pre> |
||
| 30 | # Grab the backupafs package http://www.sourceforge.net/projects/backupafs. Alternatively, copy it from/afs/dev.ru.is/service/backupafs/SVN/src/BackupAFS-1.0.0 |
||
| 31 | <pre>cp -rp /afs/dev.ru.is/service/backupafs/SVN/src/BackupAFS-1.0.0 /home/backupafs/ |
||
| 32 | cd /home/backupafs/BackupAFS-1.0.0</pre> |
||
| 33 | # Run the install script |
||
| 34 | <pre>perl configure.pl</pre> |
||
| 35 | ** Install directory: @/usr/local@ |
||
| 36 | ** Data directory: @/srv/backupafs@ |
||
| 37 | ** CGI-bin @/var/www/vhosts/backupafs/cgi-bin@ |
||
| 38 | ** Apache image directory @/var/www/vhosts/backupafs/htdocs/images@ |
||
| 39 | ** URL for image directory @/images@ |
||
| 40 | ** Ignore the gentoo warning, unless you are running gentoo. |
||
| 41 | # copy the site script (and adjust) into the apache configs and enable it |
||
| 42 | <pre>cp /afs/dev.ru.is/service/backupafs/SVN/conf/001-backupafs /etc/apache2/sites-available/. |
||
| 43 | a2ensite 001-backupafs</pre> |
||
| 44 | # Create a HTTP keytab for kerberized access. This example assumes your hostname is @bor.dev.ru.is@ |
||
| 45 | <pre>admin |
||
| 46 | Authenticating as principal foley/admin@DEV.RU.IS with password. |
||
| 47 | Password for foley/admin@DEV.RU.IS: |
||
| 48 | kadmin: ank -randkey HTTP/bor.dev.ru.is |
||
| 49 | WARNING: no policy specified for HTTP/bor.dev.ru.is@DEV.RU.IS; defaulting to no policy |
||
| 50 | Principal "HTTP/bor.dev.ru.is@DEV.RU.IS" created. |
||
| 51 | kadmin: ktadd -k /etc/BackupAFS/krb5.keytab HTTP/bor.dev.ru.is |
||
| 52 | Entry for principal HTTP/bor.dev.ru.is with kvno 2, encryption type aes256-cts-hmac-sha1-96 added to keytab WRFILE:/etc/BackupAFS/krb5.keytab. |
||
| 53 | Entry for principal HTTP/bor.dev.ru.is with kvno 2, encryption type arcfour-hmac added to keytab WRFILE:/etc/BackupAFS/krb5.keytab. |
||
| 54 | Entry for principal HTTP/bor.dev.ru.is with kvno 2, encryption type des3-cbc-sha1 added to keytab WRFILE:/etc/BackupAFS/krb5.keytab. |
||
| 55 | Entry for principal HTTP/bor.dev.ru.is with kvno 2, encryption type des-cbc-crc added to keytab WRFILE:/etc/BackupAFS/krb5.keytab. |
||
| 56 | kadmin: quit |
||
| 57 | </pre> |
||
| 58 | # Fix owner and permissions on keytab |
||
| 59 | <pre>cd /etc/BackupAFS/ |
||
| 60 | /etc/BackupAFS# chown backupafs:backupafs krb5.keytab |
||
| 61 | /etc/BackupAFS# chmod 600 krb5.keytab </pre> |
||
| 62 | # Set administrator users yb adding them to the $Conf{CgiAdminUsers} variable in /etc/BackupAFS/config.pl. Separate multiple users with spaces. |
||
| 63 | <pre>$Conf{CgiAdminUsers} = 'foley@DEV.RU.IS';</pre> |
||
| 64 | # Turn on SSL |
||
| 65 | <pre>a2enmod ssl</pre> |
||
| 66 | # Set the apache server to run as backupafs instead of www-data. Look for @APACHE_RUN_USER@ and @APACHE_RUN_GROUP@ in |
||
| 67 | @/etc/apache2/envvars@ |
||
| 68 | emacs /etc/apache2/envvars |
||
| 69 | </pre> |
||
| 70 | ** export APACHE_RUN_USER=backupafs |
||
| 71 | **export APACHE_RUN_GROUP=backupafs |
||
| 72 | # start up the webserver |
||
| 73 | <pre>service apache2 start</pre> |
||
| 74 | # setup the init scripts and start the daemon. Set the script to be executable for convenince |
||
| 75 | <pre>cp /home/backupafs/BackupAFS-1.0.0/init.d/debian-backupafs /etc/init.d/backupafs |
||
| 76 | update-rc.d backupafs defaults |
||
| 77 | /bin/sh /etc/init.d/backupafs start |
||
| 78 | chmod 755 /etc/init.d/backupafs</pre> |
||
| 79 | # setup the AFS keys. Keep these keys secure! |
||
| 80 | <pre>mkdir -p /etc/openafs/server |
||
| 81 | chmod 700 /etc/openafs/server |
||
| 82 | cd /etc/openafs |
||
| 83 | cp -r root@afsfs1.dev.ru.is:/etc/openafs/server /etc/openafs |
||
| 84 | cd server |
||
| 85 | chown -R backupafs:backupafs . |
||
| 86 | chmod 700 KeyFile |
||
| 87 | </pre> |
||
| 88 | |||
| 89 | h2. Emails and notifications |
||
| 90 | |||
| 91 | # Become backupafs |
||
| 92 | <pre> su backupafs</pre> |
||
| 93 | # Test all the command line options |
||
| 94 | <pre>/usr/local/bin/BackupAFS_serverMesg status info |
||
| 95 | /usr/local/bin/BackupAFS_serverMesg jobs |
||
| 96 | /usr/local/bin/BackupAFS_serverMesg volsets |
||
| 97 | </pre> |
||
| 98 | # Check email delivery |
||
| 99 | <pre>BackupAFS_sendEmail -u MYNAME@MYDOMAIN.COM</pre> |
||
| 100 | ## Check the list delivery |
||
| 101 | <pre>BackupAFS_sendEmail -u devnet-backup@list.ru.is</pre> |
||
| 102 | |||
| 103 | # Setup a nightly check to see if the script is still running |
||
| 104 | **<pre>crontab -e</pre> |
||
| 105 | ** Add these lines |
||
| 106 | <pre># This checks if the backupafs script is running and sends email if not |
||
| 107 | 59 23 * * * /usr/local/bin//BackupAFS_sendEmail -c</pre> |
||
| 108 | |||
| 109 | h2. Tweaks |
||
| 110 | |||
| 111 | h3. Fixing the logo |
||
| 112 | |||
| 113 | # Grab the DevNet logo from @/afs/dev.ru.is/project/devnet/Public/logo@ There is a convenience link in the backupafs area. |
||
| 114 | <pre>cp /afs/dev.ru.is/service/backupafs/logo/devnet |
||
| 115 | </pre> |
||
| 116 | |||
| 117 | h2. Migrating from old backup server |
||
| 118 | |||
| 119 | * Rsync the old backups |
||
| 120 | <pre>sudo su - |
||
| 121 | rsync -avux root@backupafs.dev.ru.is:/srv/backupafs /srv |
||
| 122 | </pre> |
||
| 123 | * Grab the config and the Vollist from @/etc/BackupAFS@. Alternatively grab the ones from AFS in @/afs/dev.ru.is/service/software/backupafs/svn/config@ |
||
| 124 | |||
| 125 | h2. Reference |
||
| 126 | |||
| 127 | * http://linuxbox.com/drupal/files/downloads/afs_backup_afsbp2005.pdf |