1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Mini httpd

From backuppc

Jump to: navigation, search

Contents

Installation BackupPC for FreeBSD.



My requirements are basically simple, I wanted to run backuppc in its own server with ssl on a non-standard port with authentication; and have a small footprint and easily maintained. Apache is WAY too big for a simple task as this, and on some machines I already had lighttpd and while it is possible to setup different config for lighttpd.. I just wanted a simple answer found in a small stand alone httpd. I found that thttpd and stunnel were buggy on the mac with safari and a few other cases. mini_httpd does ssl, auth, cgi and let you configure the port. So far works great. This does work on FreeBSD6 and FreeBSD7.

These directions do not include samba. This means that you will have to install samba and edit the /usr/local/etc/BackupPC/config.pl to reflect where smbclient/nmbclient is on your own.. (you can also install samba yourself before you follow these directions and the configure script will pick it up and populate it for you..)

These directions use the portmaster script which can be found in /usr/ports/ports-mgmt/portmaster and the bash shell found in /usr/ports/bin/bash. I prefer to use vi as my editor.

mini_httpd



Install mini_httpd via the ports:

cd /usr/ports/www/mini_httpd && portmaster .

after the build completes

I do this to make a dedicated BackupPC user

pw groupadd backuppc -g 800
pw useradd backuppc -u 800 -s /usr/local/bin/bash -d /usr/local/BackupPC -m

/usr/local/www/mini_httpd_config

user=backuppc
dir=/usr/local/www/backuppc
cgipat=cgi-bin/*
logfile=/var/log/mini_httpd.log
pidfile=/var/run/mini_httpd.pid
port=2359
ssl
certfile=/usr/local/etc/ssl/certs/domain.com/server.pem
#debug

If you do not want a ssl cert, do not forget to comment the ssl line

And create a user for authentication:

mkdir -p /usr/local/www/backuppc/cgi-bin
htpasswd -c /usr/local/www/backuppc/cgi-bin/.htpasswd username
chown -R backuppc:backuppc /usr/local/www/backuppc

I used the password 'password' for this example

ssl cert


mkdir -p /usr/local/etc/ssl/certs/domain.com
cd /usr/local/etc/ssl/certs/domain.com
openssl req -new -x509 -keyout server.pem -out server.pem -days 768 -nodes
chown -R backuppc:backuppc /usr/local/etc/ssl/certs/domain.com
chmod 0600 /usr/local/etc/ssl/certs/domain.com

startup mini_httpd



start mini_httpd and make it is working properly with ssl, your chosen port as well as authentication.

/usr/local/etc/rc.d/mini_httpd.sh start

Then open https://your.ip.address:2359/cgi-bin/ , it should then as you for the username/password combination that you created (which is specified in /usr/local/www/backuppc/cgi-bin/.htaccess)

do you have perl?



find out where perl is on your system:

which perl

If you have a freebsd system without perl..

cd /usr/ports/lang/perl5.8/ && portmaster .

when that is done or you find that you have perl already installed...


do you have rsync?



find out where rsync is on your system

which rsync

if you have a FreeBSD system without rsync..

cd /usr/ports/net/rsync && portmaster .

when that is done or you find out you have rsync already installed..

a few perl modules..



BackupPC needs a few perl modules as well.. luckily they are in the ports..

cd /usr/ports/archivers/p5-Compress-Zlib/ && portmaster .
cd /usr/ports/net/p5-File-RsyncP/ && portmaster .

download and install backuppc


cd /tmp
fetch http://downloads.sourceforge.net/backuppc/BackupPC-3.1.0.tar.gz
tar zxfv BackupPC-3.1.0.tar.gz
cd BackupPC-3.1.0

Now run configure.pl and install BackupPC

 perl configure.pl --batch --backuppc-user=backuppc --config-dir /usr/local/etc/BackupPC \
--data-dir /usr/local/www/backuppc --cgi-dir /usr/local/www/backuppc/cgi-bin \
--hostname domain.com --html-dir /usr/local/www/backuppc/images --html-dir-url /images \
--install-dir /usr/local/BackupPC --log-dir /var/log/BackupPC --set-perms

copy the init script and start the daemon..

cp init.d/freebsd-backuppc /usr/local/etc/rc.d/backuppc
chmod 555 /usr/local/etc/rc.d/backuppc
/usr/local/etc/rc.d/backuppc rcvar >> /etc/rc.conf

now edit /etc/rc.conf and set backuppc_enable=NO to backuppc_enable=YES

fix somethings in config.pl

cd /usr/local/etc/BackupPC

Make sure these settings are correctly for your install, as they control important things about how your backuppc server works.. :

$Conf{ServerHost}
$Conf{UmaskMode}
$Conf{TopDir}
$Conf{FullKeepCnt}
$Conf{FullKeepCntMin}
$Conf{FullAgeMax}
$Conf{IncrKeepCnt}
$Conf{XferMethod}
$Conf{PingMaxMsec}
$Conf{EMailFromUserName}
$Conf{EMailAdminUserName}
$Conf{EMailUserDestDomain}
$Conf{CgiAdminUsers}
$Conf{CgiURL}

Of this list, these are the most important ones to understand:

$Conf{TopDir} - where backups are stored, directory needs to be backuppc:backuppc
$Conf{CgiAdminUsers} - names specified in /usr/local/www/backuppc/cgi-bin/.htaccess
$Conf{CgiURL} - url of this install, if you are using ssl.. should say https://

I have my $Conf{TopDir} set to /exports/backuppc, this is what I needed to do:

mkdir -p /exports/backuppc/pc /exports/backuppc/cpool
chown -R backuppc:backuppc /exports/backuppc

as they control basic operation/authentication/location of your backups and usernames

start up BackupPC


you should now be able to startup backuppc and access your install:

/usr/local/etc/rc.d/backuppc start

open a browser and go to:

https://domain.com:2359/cgi-bin/BackupPC_Admin

this should ask you for authentication (if you followed this guide.. it was setup with username/password) providing that should give you the server status screen:

BackupPC Server Status

General Server Information

    * The servers PID is 35880, on host domain.com, version 3.1.0, started at 4/8 11:15.
    * This status was generated at 4/8 11:16.
    * The configuration was last loaded at 4/8 11:15.
    * PCs will be next queued at 4/8 12:00.
    * Other info:
          o 0 pending backup requests from last scheduled wakeup,
          o 0 pending user backup requests,
          o 0 pending command requests,
          o Pool is 0.00GB comprising files and directories (as of 4/8 11:16),
          o Pool hashing gives repeated files with longest chain ,
          o Nightly cleanup removed 0 files of size 0.00GB (around 4/8 11:16),

At this point the server is working and you can log in to it.

You should see a link on the left hand side titled Documentation.. you may now begin to read this and refer to it as needed in the future.

Thank you for taking the time to read this. I hope it saves someone else time other than me :)

Personal tools