Share Pastebin
Guest
Public paste!

backuppc setup

By: a guest | Mar 19th, 2010 | Syntax: None | Size: 5.69 KB | Hits: 85 | Expires: Never
Copy text to clipboard
  1.  
  2. Sun virtual box
  3. created new VM, dynamicaly expanding HD (~90gb)
  4. set up networking for bridged
  5. set the mac address to:  08:00:27:44:43:FB
  6. create backup pool HD
  7. in the settings menu, click the + icon on the HD icon; select "create"
  8. make it dynamically expanding
  9. name it backuppc_pool, and save it to an external HD
  10. make its size 940gb
  11. on the command line
  12. $ VBoxManage modifyhd $PATH_TO_HD --type writethrough
  13. fresh install of ubuntu 9.10 server
  14. default options until hostname
  15. @hostname = backuppc-server
  16. @partition disks = Guided use entire disk and set up LVM
  17. @set up users and passwords
  18. new user = bgadmin
  19. username for your account = bgadmin
  20. password (for development) = qaz
  21. dont encrypt home directory
  22. @select and install software
  23. no automatic updates
  24. @software selection only choose OpenSSH Server
  25. reboot, removing the virtual cdrom
  26.  
  27. CREATE SNAPSHOT OF FRESH INSTALLATION (fresh install)
  28.  
  29. Update/upgrade all packages
  30. $ sudo apt-get update
  31. $ sudo apt-get upgrade
  32.  
  33. CREATE A NEW SNAPSHOT AFTER UPDATES (updates post fresh install)
  34.  
  35. Install Avahi
  36. $ sudo apt-get install avahi-daemon
  37. configure avahi
  38. $ sudo vi /etc/avahi/avahi-daemon.conf
  39. #host-name=foo => host-name=backuppc-server
  40. Install Backuppc
  41. $ sudo apt-get install backuppc
  42. local only for postfix configuration
  43. default for system mail name
  44. apache2 for backuppc
  45. web user with the following credentials
  46. backuppc
  47. xliI1Raf (change with `htpasswd /etc/backuppc/htpasswd backuppc`)
  48. $ sudo htpasswd /etc/backuppc/htpasswd backuppc
  49. chaned to: cinagro77
  50. Install PureFTPd
  51. $ sudo apt-get install pure-ftpd
  52.  
  53. CREATE A SNAPSHOT AFTER MAIN APPLICATIONS ARE INSTALLED
  54.  
  55. PureFTPD configuration
  56. $ sudo groupadd ftpgroup
  57. $ sudo useradd -g ftpgroup -d /dev/null -s /etc ftpuser
  58. $ cd /etc/pure-ftpd/auth
  59. $ sudo ln -s /etc/pure-ftpd/conf/PureDB 50pure
  60. $ sudo mkdir -p /var/ftp/pureftp/bguser (create that structure)
  61. $ sudo pure-pw useradd bguser -u ftpuser -g ftpgroup -d /var/ftp/pureftp/bguser
  62. using password: cinq50
  63. $ sudo pure-pw mkdb
  64. $ sudo vi /etc/pure-ftpd/conf/PAMAuthentication
  65. yes => no
  66. create folders and set permissions for file transfers
  67. $ cd /var/ftp/pureftp/bguser
  68. $ sudo mkdir server-key client-keys client-configs default-configs client-kh
  69. $ sudo chown root:ftpgroup *
  70. $ sudo chmod g+r-w server-key default-configs
  71. $ sudo chmod g+w-r client-*
  72. restart pureftp
  73. $ sudo /etc/init.d/pure-ft restart
  74.  
  75. BackupPC configuration - SSH/config files
  76. $ sudo su -s /bin/bash backuppc
  77. $ cd /etc/backuppc
  78. $ mkdir client-keys client-kh client-configs
  79. $ rm /etc/backuppc/pc
  80. $ ln -s /etc/backuppc/client-configs/ /etc/backuppc/pc
  81. $ mkdir .ssh
  82. $ chmod 700 .ssh
  83. $ cd .ssh
  84. $ ssh-keygen -t rsa -f id_rsa -N '' (pair of single quotation marks)
  85. $  
  86. $ touch authorized_keys known_hosts
  87. $ chmod 600 authorized_keys known_hosts  (should be needed, use if authorized_keys isnt writeable)
  88. $ exit (go back to bgadmin)
  89. $ sudo chown backuppc:www-data /etc/backuppc/client-configs /etc/backuppc/pc
  90. copy the server ssh key to the appropriate directory for the clients to get
  91. $ sudo cp /etc/backuppc/.ssh/id_rsa.pub /var/ftp/pureftp/bguser/server-key/backuppc_id_rsa.pub
  92. $ sudo chown root:ftpgroup /var/ftp/pureftp/bguser/server-key/backuppc_id_rsa.pub
  93. $ sudo chmod g+r /var/ftp/pureftp/bguser/server-key/backuppc_id_rsa.pub
  94.  
  95.  
  96.  
  97. Add bgadmin to the working groups for this project
  98. $ sudo usermod -a -G backuppc,ftpgroup bgadmin
  99.  
  100.  
  101. CREATE A SNAPSHOT AT THIS POINT
  102. $ sudo shutdown -P now
  103.  
  104.  
  105. Making the initial backup pool HD
  106. $ sudo parted /dev/sdb
  107. mklabel
  108. gpt
  109. mkpart
  110. backuppc_pool
  111. ext4
  112. 0%
  113. 100%
  114. quit
  115. sudo mkfs.ext4 -L backuppc_pool /dev/sdb1
  116.  
  117. Pointing the pool to the new disk
  118. mount the fresh filesystem
  119. $ sudo mount -t ext4 /dev/sdb1 /mnt
  120. copy the files residing where the mount point will be
  121. $ sudo cp -dpR /var/lib/backuppc/. /mnt
  122. unmount the filesystem
  123. $ sudo umount /dev/sdb1
  124. move the fresh directory in case of foul up (can also use the original directory on a fresh drive)
  125. $ sudo mv /var/lib/backuppc /var/lib/backuppc.orig
  126. make the new directory, that will be the mount point
  127. $ sudo mkdir /var/lib/backuppc
  128. mount the filesystem to this diectory
  129. $ sudo mount -t ext4 /dev/sdb1 /var/lib/backuppc
  130. if everything is ok, add the mount to fstab
  131. $ sudo vi /etc/fstab (deliniated with spaces, I believe)
  132. LABEL=backuppc_pool    /var/lib/backuppc    ext4    defaults,auto    0    2  
  133.  
  134.  
  135. BackupPC configuration - Migrate default .SSH directory
  136. make a link to the .ssh directory in .etc
  137. $ sudo ln -s /etc/backuppc/.ssh /var/lib/backuppc/.ssh
  138.    
  139.  
  140. Make a very simple script to automate moving new client data
  141. $ sudo vi /sbin/import-client-data
  142. #! /bin/bash
  143. echo "Copying client configuration files..."
  144. mv -uv /var/ftp/pureftp/bguser/client-configs/*.pl /etc/backuppc/
  145. echo "Combining client rsa keys..."
  146. mv -uv /var/ftp/pureftp/bguser/client-keys/*.pub /etc/backuppc/.ssh/client-keys/
  147. mv -uv /var/ftp/pureftp/bguser/client-kh/*.kh /etc/backuppc/.ssh/client-kh
  148. cat /etc/backuppc/.ssh/client-keys/*.pub > /etc/backuppc/.ssh/authorized_keys
  149. cat /etc/backuppc/.ssh/client-kh/*.kh > /etc/backuppc/.ssh/known_hosts
  150. $ sudo chmod +x /sbin/import-client-data (always run the script with sudo)
  151.  
  152. ALL INITIAL SETUP IS DONE - CREATE A SNAPSHOT HERE
  153.  
  154. Edit some server stuff on the web
  155. go to http://backuppc-server.local/backuppc/index.cgi?action=editConfig
  156. click the Xfer tab
  157. xfermethod: smb => rsync
  158. rsync args:  add " --checksum-seed=32761 "
  159.  
  160.  
  161. $Conf{BackupFilesOnly} = {
  162.   '*' => [
  163.     '/Users/USERNAME'
  164.   ]
  165. };
  166. $Conf{BackupFilesExclude} = {
  167.   '*' => [
  168.     '.DS_Store'
  169.   ]
  170. };
  171. $Conf{RsyncClientCmd} = '$sshPath -c blowfish -q -x -l USERNAME $host $rsyncPath $argList+';
  172. $Conf{RsyncClientRestoreCmd} = '$sshPath -c blowfish -q -x -l USERNAME $host $rsyncPath $argList+';