download debian file from: http://download.proxmox.com/debian/pbs-client/dists/bullseye/main/
the correct file to choose is: proxmox-backup-client-static_3.4.7-1_amd64.deb
go to the folder where you downloaded it and run it with:
sudo apt install ./proxmox-backup-client-static_3.4.7-1_amd64.deb
create a hidden folder on your home where you will store the login credentials for the Proxmox Backup Server on which you will save the backups.
in my case I created the following in my home directory with
mkdir .config/proxmox-backup-client/user_che_ha_accesso_al_datastore@192.168.123.124:8007
inside it create the .config file containing the configuration for accessing the PBS
in my case i named it SERVERHP.cfg
nano SERVERHP.cfg
populate it with the following data:
user=user_che_ha_accesso_al_datastore@pbs (user who has access to PBS)
password=”password” (the password you use to access PBS without the quotes)
save CTRL+O exit CTRL+X
Now we need to use the user’s token ID to log in without having to enter the datastore credentials each time.
On the PBS GUI, under “Access Control,” we’ll need to create the user, grant them permissions to access the datastore, and create the token ID (note that it’s only shown once, so save it).
Once the user and token ID have been created, go to the datastore (in my case, SERVERHP) and add the token ID you created.
Once this is done on the client:
export PBS_PASSWORD=’token_creato’
To create the backup you need to run from the command line
Let’s say I want to create a backup of the /mnt/CONDIVISA folder and I want to name the backup “condivisa” (the name of the backup we will create must be expressed with the .pxar extension)
- in my case the datastore on PBS is called “SERVERHP”
- PBS has ip 192.168.123.124
- user:backup_user
- I’ve chosen to backup the folders: /mnt/CONDIVISA and /var/log
- I chose the “host” backup mode which is recommended for this kind of backup
(I use sudo command followed by -E to make sudo inherit the environment variable created for the user “backup_user” which otherwise would not work with root alone)
sudo -E proxmox-backup-client backup \
condivisa.pxar:/mnt/CONDIVISA \
varlog.pxar:/var/log \
–repository ‘backup_user@pbs!token_backupuser@192.168.123.124:8007:SERVERHP’ \
–backup-type host
Now we automate the execution every day at 3:00 AM with a cron job.
Instead of running the command directly in cron, it’s cleaner to create a script, for example:
/usr/local/bin/pbs_backup.sh
sudo nano…
#!/bin/bash
# Variabile del token
export PBS_PASSWORD=’LA_SECRET_STRING_DEL_TOKEN’
# Backup con sudo e variabile ereditata
sudo -E proxmox-backup-client backup \
condivisa.pxar:/mnt/CONDIVISA \
varlog.pxar:/var/log \
–repository ‘backup_user@pbs!token_backupuser@192.168.123.124:8007:SERVERHP’ \
–backup-type host >> /var/log/pbs_backup.log 2>&1
Then make the script executable:
sudo chmod +x /usr/local/bin/pbs_backup.sh
Open the crontab of the user running the backup (root if you want to use sudo without a password):
sudo crontab -e
0 3 * * * /usr/local/bin/pbs_backup.sh

Lascia un commento
Devi essere connesso per inviare un commento.