User Tools

Site Tools


backuppc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
backuppc [2014/11/24 01:52]
ben
backuppc [2014/11/24 02:02] (current)
ben
Line 3: Line 3:
 ===== Installation ===== ===== Installation =====
   * Download the installation package from [[http://sourceforge.net/projects/backuppc/|the SourceForge project]].   * Download the installation package from [[http://sourceforge.net/projects/backuppc/|the SourceForge project]].
-  * Install Perl if it isn't already: +  * Install Perl if it isn't already: <code bash> 
- sudo apt-get install perl +sudo apt-get install perl 
-  * If you want BackupPC to be able to compress the backups (probably a good idea, unless you have lots of hard disk space and CPU time is scarce), run: +</code> 
- cpan +  * If you want BackupPC to be able to compress the backups (probably a good idea, unless you have lots of hard disk space and CPU time is scarce), run: <code bash> 
-:then from <code>cpan</code> run: +cpan 
- install Compress::Zlib +</code> 
-:and then exit <code>cpan</code> (Ctrl+D)+    * then from ''cpan'' run: <code bash> 
-  * If you want web access to BackupPC (again, a good idea) you'll need to install Apache2 and <code>mod_perl</code> +install Compress::Zlib 
- sudo apt-get install apache2 libapache2-mod-perl2 +</code> 
-  * Enable <code>suExec</code> +    * and then exit ''cpan'' with ''Ctrl+D''
- sudo a2enmod suexec +  * If you want web access to BackupPC (again, a good idea) you'll need to install Apache2 and ''mod_perl'': <code bash
-  * Extract the .tar.gz file: +sudo apt-get install apache2 libapache2-mod-perl2 
- tar -xzf BackupPC-3.1.0.tar.gz +</code> 
-  * Change into the newly-created directory: +  * Enable ''suExec'': <code bash
- cd BackupPC-3.1.0 +sudo a2enmod suexec 
-  * Create a symlink at **/bin/perl** pointing at your real Perl binary, because the BackupPC configuration script looks for it in the wrong place (you could also change the shebang in the **configure.pl** script, but I was lazy): +</code> 
- sudo ln /usr/bin/perl /bin/perl +  * Extract the .tar.gz file: <code bash> 
-  * Run the configuration script +tar -xzf BackupPC-3.1.0.tar.gz 
- sudo ./configure.pl+</code> 
 +  * Change into the newly-created directory: <code bash> 
 +cd BackupPC-3.1.0 
 +</code> 
 +  * Create a symlink at **/bin/perl** pointing at your real Perl binary, because the BackupPC configuration script looks for it in the wrong place (you could also change the shebang in the **configure.pl** script, but I was lazy): <code bash> 
 +sudo ln /usr/bin/perl /bin/perl 
 +</code> 
 +  * Run the configuration script: <code bash> 
 +sudo ./configure.pl 
 +</code>
   * Follow the instructions, answering the questions as appropriate.   * Follow the instructions, answering the questions as appropriate.
-  * Modify the BackupPC configuration file: +  * Modify the BackupPC configuration file: <code bash> 
- vi /etc/BackupPC/config.pl +vi /etc/BackupPC/config.pl 
-  * Modify the list of hosts to back up: +</code> 
- vi /etc/BackupPC/hosts +  * Modify the list of hosts to back up: <code bash> 
-  * Rename the script it placed in your **cgi-bin** directory to give it a **.cgi** extension: +vi /etc/BackupPC/hosts 
- mv /var/www/cgi-bin/BackupPC_Admin /var/www/cgi-bin/BackupPC_Admin.cgi +</code> 
-  * SuExec can only work per-virtual host, so create a new virtual host for BackupPC specifically: +  * Rename the script it placed in your **cgi-bin** directory to give it a **.cgi** extension: <code bash> 
- sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/backuppc +mv /var/www/cgi-bin/BackupPC_Admin /var/www/cgi-bin/BackupPC_Admin.cgi 
-  * Enable that site: +</code> 
- sudo a2ensite backuppc+  * SuExec can only work per-virtual host, so create a new virtual host for BackupPC specifically: <code bash> 
 +sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/backuppc 
 +</code> 
 +  * Enable that site: <code bash> 
 +sudo a2ensite backuppc 
 +</code>
   * Modify the new site to tell Apache to listen on a new port (e.g. 8085), that this virtual host will be on that port, to deny access to everything in **/var/www** that isn't part of BackupPC, require a password to access BackupPC's admin pages (a password isn't strictly necessary, but if you don't log in using basic auth you can't actually view anything...) and to enable CGI (Perl) handling for **.cgi**/**.pl** files.  Your **sites-available/backuppc** file should end up looking something like this:   * Modify the new site to tell Apache to listen on a new port (e.g. 8085), that this virtual host will be on that port, to deny access to everything in **/var/www** that isn't part of BackupPC, require a password to access BackupPC's admin pages (a password isn't strictly necessary, but if you don't log in using basic auth you can't actually view anything...) and to enable CGI (Perl) handling for **.cgi**/**.pl** files.  Your **sites-available/backuppc** file should end up looking something like this:
- Listen 8085 +<code apache> 
- NameVirtualHost *:8085 +  Listen 8085 
- <VirtualHost *:8085> +  NameVirtualHost *:8085 
-         SuexecUserGroup backuppc backuppc +  <VirtualHost *:8085> 
-         DocumentRoot /var/www/ +          SuexecUserGroup backuppc backuppc 
-  +          DocumentRoot /var/www/ 
-         #Also prevent access to our .htpasswd file +   
-         <Files ~ "\.htpasswd$"> +          #Also prevent access to our .htpasswd file 
-                 Order allow,deny +          <Files ~ "\.htpasswd$"> 
-                 Deny from all +                  Order allow,deny 
-         </Files> +                  Deny from all 
-         <Directory /var/www/> +          </Files> 
-                 Options Indexes FollowSymLinks MultiViews +          <Directory /var/www/> 
-                 AllowOverride None +                  Options Indexes FollowSymLinks MultiViews 
-                 Order allow,deny +                  AllowOverride None 
-                 Deny from all +                  Order allow,deny 
-         </Directory> +                  Deny from all 
-         <Directory /var/www/BackupPC> +          </Directory> 
-                 Order allow,deny +          <Directory /var/www/BackupPC> 
-                 Allow from all +                  Order allow,deny 
-         </Directory> +                  Allow from all 
-         <Directory /var/www/cgi-bin> +          </Directory> 
-                 AddHandler cgi-script .cgi .pl +          <Directory /var/www/cgi-bin> 
-                 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch +                  AddHandler cgi-script .cgi .pl 
-                 Order allow,deny +                  Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch 
-                 Allow from all +                  Order allow,deny 
-  +                  Allow from all 
-                 AuthType Basic +   
-                 AuthName "BackupPC" +                  AuthType Basic 
-                 AuthUserFile /var/www/backuppc.htpasswd +                  AuthName "BackupPC" 
-                 Require valid-user +                  AuthUserFile /var/www/backuppc.htpasswd 
-         </Directory> +                  Require valid-user 
-  +          </Directory> 
-         ErrorLog /var/log/apache2/error-backuppc.log +   
-         LogLevel warn +          ErrorLog /var/log/apache2/error-backuppc.log 
-         CustomLog /var/log/apache2/access-backuppc.log combined +          LogLevel warn 
-         ServerSignature On +          CustomLog /var/log/apache2/access-backuppc.log combined 
- </VirtualHost> +          ServerSignature On 
-  * Additionally, if you add a HTTP 403 <code>ErrorDocument</code> directive to the <code><Directory /var/www/></code> block, you can automatically "redirectusers who don't go to **/cgi-bin/BackupPC_Admin.cgi** to that file, saving you typing that path, too: +  </VirtualHost
- ErrorDocument 403 /cgi-bin/BackupPC_Admin.cgi +</code
-:then you can just go to http:////machinename//:8085/ instead of http:////machinename//:8085/cgi-bin/BackupPC_Admin.cgi. +  * Additionally, if you add a HTTP 403 ''ErrorDocument'' directive to the ''<Directory /var/www/>'' block, you can automatically ''redirect'' users who don't go to **/cgi-bin/BackupPC_Admin.cgi** to that file, saving you typing that path, too: <code bash> 
-  * Save that file and reload Apache: +ErrorDocument 403 /cgi-bin/BackupPC_Admin.cgi 
- sudo /etc/init.d/apache2 force-reload +</code> 
-  * Create a password file that matches the above Apache configuration.  The username you specify must match the username you specified in the BackupPC hosts configuration file earlier: +    * then you can just go to ''http://machinename:8085/'' instead of ''http:////machinename//:8085/cgi-bin/BackupPC_Admin.cgi''
- htpasswd -c /var/www/backuppc.htpasswd //andrew// +  * Save that file and reload Apache: <code bash> 
-  * Add any required extra users to that password file so that every user mentioned in the BackupPC hosts configuration file can log in: +sudo /etc/init.d/apache2 force-reload 
- htpasswd /var/www/backuppc.htpasswd //notandrew// +</code> 
-  * Copy the **init.d** script from BackupPC's installation source directory (the directory you extracted the .tar.gz to) to your **/etc/init.d** directory.  For Ubuntu, we're using the Debian script: +  * Create a password file that matches the above Apache configuration.  The username you specify must match the username you specified in the BackupPC hosts configuration file earlier: <code bash> 
- sudo cp ~/backuppc/init.d/debian-backuppc /etc/init.d/backuppc +htpasswd -c /var/www/backuppc.htpasswd andrew 
-  * Tell BackupPC to start on boot: +</code> 
- sudo update-rc.d backuppc defaults +  * Add any required extra users to that password file so that every user mentioned in the BackupPC hosts configuration file can log in: <code bash> 
-  * Set the permissions of the BackupPC **init.d** script: +htpasswd /var/www/backuppc.htpasswd notandrew 
- sudo chmod 755 /etc/init.d/backuppc +</code> 
-  * Ensure that the permissions on the BackupPC directories are correct: +  * Copy the **init.d** script from BackupPC's installation source directory (the directory you extracted the .tar.gz to) to your ''/etc/init.d'' directory.  For Ubuntu, we're using the Debian script: <code bash> 
- sudo chown -R backuppc:backuppc /data +sudo cp ~/backuppc/init.d/debian-backuppc /etc/init.d/backuppc 
- sudo find /data -type d -exec chmod 750 {} \; +</code> 
-  * Start BackupPC: +  * Tell BackupPC to start on boot: <code bash> 
- sudo /etc/init.d/backuppc start +sudo update-rc.d backuppc defaults 
-  * Browse to http:////MachineName//:8085/BackupPC_Admin.cgi and change anything necessary in the GUI.+</code> 
 +  * Set the permissions of the BackupPC ''init.d'' script: <code bash> 
 +sudo chmod 755 /etc/init.d/backuppc 
 +</code> 
 +  * Ensure that the permissions on the BackupPC directories are correct: <code bash> 
 +sudo chown -R backuppc:backuppc /data 
 +sudo find /data -type d -exec chmod 750 {} \; 
 +</code> 
 +  * Start BackupPC: <code bash> 
 +sudo /etc/init.d/backuppc start 
 +</code> 
 +  * Browse to ''http://MachineName:8085/BackupPC_Admin.cgi'' and change anything necessary in the GUI.
  
 ===== Troubleshooting ===== ===== Troubleshooting =====
backuppc.txt · Last modified: 2014/11/24 02:02 by ben