Changes

From SME Server
Jump to navigationJump to search
11,309 bytes added ,  22:18, 27 October 2020
m
Line 6: Line 6:     
{{#smeversion: smeserver-BackupPC }}
 
{{#smeversion: smeserver-BackupPC }}
 +
{{#smeversion: smeserver-BackupPC4 }}
 
{{#smeversion: BackupPC }}
 
{{#smeversion: BackupPC }}
 +
{{#smeversion: BackupPC4 }}
    
=== Description ===
 
=== Description ===
Line 46: Line 48:     
=== Requirements ===
 
=== Requirements ===
*SME Server 7.X or 8.X
+
*SME Server 7.x, 8.x, 9.x or 10.x.
*a dedicated volume is recommended (can be a simple disk or a RAID array)
+
*A dedicated volume is recommended (can be a simple disk or a RAID array)
    
=== Installation ===
 
=== Installation ===
Line 84: Line 86:     
*configure needed repositories (needed on SME 8.X)
 
*configure needed repositories (needed on SME 8.X)
 +
 +
 +
====install the rpms (SME 7.X)====
 
You need to configure the EPEL directory as explained on this page: [[Epel]] and the sme7contribs as explained here due to SME7 now at EOL: [[SME8.0_Contribs_QA#Setup]]
 
You need to configure the EPEL directory as explained on this page: [[Epel]] and the sme7contribs as explained here due to SME7 now at EOL: [[SME8.0_Contribs_QA#Setup]]
  −
*install the rpms (SME 7.X)
   
  yum --enablerepo=sme7contribs install smeserver-BackupPC
 
  yum --enablerepo=sme7contribs install smeserver-BackupPC
 
  signal-event backuppc-update
 
  signal-event backuppc-update
   −
*install the rpms (SME 8.X)
+
====install the rpms (SME 8.X)====
yum --enablerepo=epel install BackupPC
   
  yum --enablerepo=smecontribs install smeserver-BackupPC
 
  yum --enablerepo=smecontribs install smeserver-BackupPC
  −
*updates configuration files following the installation
  −
signal-event backuppc-update
  −
   
*remove -N option for Samba >=3.5 from /etc/BackupPC/config.pl ( 3 lines) for SME8
 
*remove -N option for Samba >=3.5 from /etc/BackupPC/config.pl ( 3 lines) for SME8
 
  cp /etc/BackupPC/config.pl /etc/BackupPC/config.pl.orig
 
  cp /etc/BackupPC/config.pl /etc/BackupPC/config.pl.orig
Line 103: Line 101:  
http://sourceforge.net/apps/mediawiki/backuppc/index.php?title=Troubleshooting
 
http://sourceforge.net/apps/mediawiki/backuppc/index.php?title=Troubleshooting
 
and also bugs : [[bugzilla:7016]] and [[bugzilla:7281]]
 
and also bugs : [[bugzilla:7016]] and [[bugzilla:7281]]
 +
*updates configuration files following the installation
 +
signal-event backuppc-update
 +
 +
====install the rpms (SME 9.X)====
 +
yum --enablerepo=smecontribs install smeserver-BackupPC
 +
 +
*updates configuration files following the installation
 +
signal-event backuppc-update
 +
 +
====install the rpms (SME 10.X)====
 +
yum --enablerepo=smecontribs,epel,fws install smeserver-BackupPC
 +
 +
*updates configuration files following the installation
 +
signal-event backuppc-update
      Line 120: Line 132:     
When you submit, the configuration from smeserver-template will be copied on my_server. You then can edit my_server's config
 
When you submit, the configuration from smeserver-template will be copied on my_server. You then can edit my_server's config
 +
 +
====install the BackupPC4 rpms (SME 9.X)====
 +
Important you can not install both BackupPC (3) and BackupPC4 on the same server.
 +
 +
first the needed repo:
 +
yum install smeserver-extrarepositories-fws smeserver-extrarepositories-epel -y
 +
signal-event yum-modify
 +
then install it:
 +
yum --enablerepo=smecontribs,fws,epel install smeserver-BackupPC4
 +
 +
*updates configuration files following the installation
 +
signal-event backuppc-update
 +
 +
You should now be able to access the interface in the server-manager or directly on https://my.domain.tld/BackupPC
    
=== Upgrade from smeserver-backuppc.fws-3.0-1 ===
 
=== Upgrade from smeserver-backuppc.fws-3.0-1 ===
Line 144: Line 170:     
You should be done ;)
 
You should be done ;)
 +
 +
 +
 +
 +
===upgrade from BackupPC (3) to BackupPC4 rpms (SME 9.X)===
 +
TODO.
 +
You will mostly have some debugging to do regarding the bug {{Bugzilla:10514}}
 +
Also according to BackupPC documentaton this should be doable, but might need some manual tweaking in order to use both v3 and v4 pools during the transition delay:
 +
# http://backuppc.sourceforge.net/BackupPC-4.0.0.html#BackupPC-4.0
 +
# https://github.com/backuppc/backuppc/blob/master/bin/BackupPC_migrateV3toV4
 +
# https://www.srbu.se/index.php?option=com_content&view=article&id=210:migrating-backuppc-v3-pools-to-v4&catid=12&Itemid=121
 +
# https://github.com/backuppc/backuppc/issues/249
    
=== DB properties ===
 
=== DB properties ===
Line 159: Line 197:  
  visudo
 
  visudo
 
And close the file. If visudo detects an error, it'll tell you. }}
 
And close the file. If visudo detects an error, it'll tell you. }}
 +
 +
as an example if you want to be able to wake on lan :
 +
  config setprop backuppc sudo `config getprop backuppc sudo`,/sbin/ether-wake
 +
signal-event backuppc-update
 +
 +
then simply add a script to your prebackup command or your ping command like :
 +
 +
 +
#!/bin/sh
 +
# Set the mac address for each host
 +
host1_mac=<mac address>
 +
host1_name=<host name>
 +
host2_mac=<mac address>
 +
host2_name=<host name>
 +
# How long does the host take to boot
 +
boottime=120
 +
# Which interface to send the WoL packets out of
 +
interface=eth0
 +
# Function to check if the host pings
 +
pingcheck()
 +
{
 +
ping -w 5 -c 2 $1
 +
export pingstatus=$?
 +
}
 +
case $1 in
 +
        host1)
 +
                sudo etherwake -i $interface $host1_mac
 +
                sleep $boottime
 +
                pingcheck $host1_name
 +
                exit $pingstatus
 +
        ;;
 +
        host2)
 +
                sudo etherwake -i $interface $host2_mac
 +
                sleep $boottime
 +
                pingcheck $host2_name
 +
                exit $pingstatus
 +
        ;;
 +
        *)
 +
                echo "Unknown machine $1"
 +
                exit 1
 +
        ;;
 +
esac
 +
 +
 +
NB. If using the default backuppc admin user, you will need to use the full path for the above commands
 +
    Scripts should not be placed in /etc/BackupPC as permissions will be overwritten
    
=== Operation ===
 
=== Operation ===
 +
====Backup a smeserver====
 
To configure a SME Server client to be backed up using a configuration based on the provided smeserver-template, configure SSH from the backup server as follows:
 
To configure a SME Server client to be backed up using a configuration based on the provided smeserver-template, configure SSH from the backup server as follows:
   Line 169: Line 254:  
  "cat >> /root/.ssh/authorized_keys2"
 
  "cat >> /root/.ssh/authorized_keys2"
 
  (confirm the host key)
 
  (confirm the host key)
 +
 +
*ssh port different from 22
 +
 +
See this post :
 +
https://forums.contribs.org/index.php/topic,53586.0.html
 +
 +
====Restore or migrate a smeserver====
 +
If you simply want to restore a few files or a whole directory you just have to use the web interface, and within a few clicks you are done, with your files restored directly in place, or aside if you want.
 +
 +
 +
This will cover the opportunity to use this full or almost full backup to use the restoration option while installing a new manager, which will help you to migrate between versions.
 +
 +
* change '''SERVERNAME''' with the actual name of your backup
 +
* change '''-n -1''' with the number of the most uptodate fullbackup you want to use. (-1 means relative to the end: last available in this case)
 +
 +
su - backuppc -s /bin/sh
 +
cd ~
 +
mkdir myrestore
 +
cd myrestore/
 +
 +
to include and restore everything that is outside of the usual backuped folder in SME:
 +
/usr/share/BackupPC/bin/BackupPC_tarCreate  -h SERVERNAME -n -1 -s /  / > smeserver.tar
 +
 +
the base backup in the SME Server console would be an equivalent to this :
 +
  /usr/share/BackupPC/bin/BackupPC_tarCreate  -h SERVERNAME -n -1 -s  /    home/e-smith etc/e-smith/templates-custom etc/e-smith/templates-user-custom \
 +
etc/ssh root etc/sudoers  etc/passwd  etc/shadow etc/group etc/gshadow etc/samba/secrets.tdb  etc/samba/smbpasswd > smeserver.tar
 +
 +
 +
then you have just to copy this on a USB disk, or alternatively copy it in a virtual disk if your SME will be virtualized and can not plug any USB device
 +
mkdir /mnt/MyDisk
 +
mount /dev/disk/by-label/MyDisk /mnt/MyDisk
 +
mv /var/lib/BackupPC/myrestore/smeserver.tar /mnt/MyDisk/
 +
umount /mnt/MyDisk/
 +
 +
# install SME server
 +
# reboot
 +
# plug your drive when you see the screen asking for restoration
 +
 +
and you are done.
 +
 +
====Backup a Linux host through rsync====
 +
 +
To configure a Linux host client to be backed up, configure SSH from the backup server as follows in order to exchange certificates and to perform a login without passwords.
 +
 +
At the BackupPC server command line as root:
 +
 +
su -s /bin/bash backuppc
 +
ssh-keygen -t rsa -b 2048  # use a blank passphrase
 +
exit
 +
 +
Assuming SSH access to the remote host to be backed up is already configured, as root:
 +
su -s /bin/bash backuppc
 +
ssh-copy-id -i ~backuppc/.ssh/id_rsa.pub root@your.host.name
 +
exit
 +
 +
You can test the key exchange:
 +
 +
su -s /bin/bash backuppc  #become backuppc user
 +
ssh -l root your.host.name                                                    # add "-p 2222" for port 2222
 +
exit                      #from the remote_host
 +
exit                      #from the backuppc user back to root
 +
 +
You should be able to log in without a password.
 +
 +
Note: There are times when the backuppc user needs a real shell specified in /etc/passwd, for example, when the backuppc user is used to run sudo commands or pre/post scripts.<br />
 +
 +
Now you can go to the admin backuppc panel to set your host<br />
 +
 +
====Backup a Windows Client with rsync====
 +
 +
To configure a Windows client to be backed up via rsync, install rsync on the Windows client.  rysnc needs to be running as a service on the Windows client to ensure communication.
 +
There are several options/versions of rsync – the first I was able to get working was from http://sourceforge.net/projects/backuppc/files/cygwin-rsyncd/2.6.8_0/
 +
The zip file contains 7 files – the site goes into more detail about each of the files.  Depending on how you wish to use BackupPC will determine which files to edit.
 +
I use rsync without ssh keys – to do so create a local user with sufficient rights to the directory or directories on the Windows client, then edit the file rsync.secrets to include the UserID & Password.  You then use that same UserID & Password within the configuration from the BackupPC webpage – where you chose to back-up the client with Samba, rsync etc. The contents of rsync.secrets file is simply:
 +
  UserID:Password
 +
You will have to create a “Cygwin share” on the Windows box – that is done using the rsync.conf file.  The “Cygwin share” is the name you choose within the square brackets.  My rsync.conf file with a share name of “cdocs” (after removal of all personal information of course) looks like this:
 +
[cdocs]
 +
    path = c:/User
 +
    comment = c: Drive documents
 +
    auth users = <valid-back-up-user>
 +
    secrets file = c:/rsyncd/rsyncd.secrets
 +
    hosts allow = 192.168.1.1
 +
    strict modes = false
 +
    read only = true
 +
    list = false
 +
 +
We have share name (cdocs), path, the valid user created on the Windows client, the path to the rysnc.secrets file, an allowable host (this being the local backup server IP), modes, read only and list.  The options are mostly explained in the file – what it doesn’t show is that if you have a different version of rsync, the rsync.conf file looks a bit different.  This one is for rsync 3.0.9
 +
[cdocs]
 +
  Path = /cygdrive/c/Users/<USERNAME>
 +
  comment = c: User Data
 +
  strict modes = false
 +
  auth users = <valid-back-up-user>
 +
  secrets file = c:/rsyncd/rsyncd.secrets
 +
  hosts allow = 192.168.1.1
 +
  read only = false
 +
  list = false
 +
 +
The final thing that must happen to make rsync work properly is to load rysnc as a service on the Windows client.  The file service.bat shows the following command to accomplish this:
 +
c:/rsyncd/rsync.exe -a "--config=c:/rsyncd/rsyncd.conf --daemon --no-detach"
 +
 +
There is also a “gotcha” – sometimes port 873 is blocked by Windows Firewall, so you may need to fix that.
 +
 +
====Remove backups====
 +
*Remove all backups of a client
 +
rm -rf /var/lib/BackupPC/pc/<client>/
 +
sudo -u backuppc /usr/share/BackupPC/bin/BackupPC_serverMesg BackupPC_nightly run
 +
 +
*Remove One backup of a client
 +
cd /var/lib/BackupPC/pc/<client>/
 +
ls
 +
rm -fR <backup_number>
 +
sudo -u backuppc /usr/share/BackupPC/bin/BackupPC_serverMesg BackupPC_nightly run
 +
 +
{{warning box|
 +
Removing a single backup must be done with extreme care. You can safly remove the last backup for example, but if you remove a backup on which another one is based on, you can screw up your backups
 +
}}
 +
 +
After this, you will see space reclaimed and you can check it with df, but you still need to remove statistic line, otherwise you will see it in your web interface. To do that:
 +
 +
nano /var/lib/BackupPC/pc/<client>/backups
 +
With ctrl+k you can remove the line with <backup_number>.
 +
 +
Relog to your web interface and voila! No more <backup_number>.
 +
 +
===Known Issues===
 +
 +
* When restarting the BackupPC service you may receive the error as indicated below :<br />
 +
'''
 +
[root@backuppc ~]# service backuppc restart<br />
 +
 +
Shutting down BackupPC:                                    [  OK  ]
 +
Starting BackupPC:                                        [  OK  ]
 +
'''BackupPC: WARNING:  Your BackupPC $Conf{TopDir} is not listed in the locate
 +
BackupPC: database configuration's PRUNEPATHS.  This may cause all of your
 +
BackupPC: backed up files to be indexed!'''
 +
'''To remove the warning''' <br />
 +
 +
you should create a custom template '''/etc/e-smith/templates-custom/etc/updatedb.conf/10conf''' (copy the default /etc/e-smith/templates/etc/updatedb.conf/10conf)<br />
 +
mkdir -p /etc/e-smith/templates-custom/etc/updatedb.conf/
 +
cp /etc/e-smith/templates/etc/updatedb.conf/10conf /etc/e-smith/templates-custom/etc/updatedb.conf/
 +
 +
add the directory /var/lib/BackupPC to the PRUNEPATHS list, then
 +
expand-template /etc/updatedb.conf
 +
 +
* “aborted by signal=PIPE”
 +
Sometime the backup fails with this error, this error is related to the remote ssh service. You must set in the /etc/ssh/ssh_config of your remote host
 +
 +
  ServerAliveInterval 120
 +
 +
then restart your ssh service
 +
 +
One other way could be to set in the setting of backupPC (RsyncClientCmd)the default value for all hosts
 +
$Conf{RsyncClientCmd} = '$sshPath -o ServerAliveInterval=120 -q -x -l root $host $rsyncPath $argList+';
 +
 +
* trying backing up a SME Server you might encounter error or timeout on ssh, this is because of the AutoBlock function on sshd
 +
config setprop sshd AutoBlock disabled
 +
signal-event remoteaccess-update
 +
{{Tip box|if you disabled Autoblock, install denyhosts or fail2ban not to fall security.}}
    
=== Uninstall ===
 
=== Uninstall ===
Line 177: Line 420:  
and select the smeserver-BackupPC component or use {{BugzillaFileBug|product=SME%20Contribs|component=smeserver-BackupPC|title=this link}}
 
and select the smeserver-BackupPC component or use {{BugzillaFileBug|product=SME%20Contribs|component=smeserver-BackupPC|title=this link}}
   −
----
+
Below is an overview of the current issues for this contrib:{{#bugzilla:columns=id,product,version,status,summary|sort=id|order=desc|component=smeserver-backuppc|noresultsmessage=No open bugs found.}}
 +
 
 +
===Changelog===
 +
Only released version in smecontrib are listed here.
    +
{{ #smechangelog: smeserver-BackupPC}}
    
[[Category: Contrib]]
 
[[Category: Contrib]]
 
[[Category: Backup]]
 
[[Category: Backup]]
3,054

edits

Navigation menu