notícias
Tecnologias de espaço de servidor nos EÁU: lançamento do Falconcloud
Serverspace Black Friday
JH
Joe Harris
December 28, 2020
Atualizado June 7, 2023

How to Install and Configure Bacula with PostgreSQL on CentOS 8

Backup CentOS Linux

We have already considered installing the Bacula client on the CentOS 8 and saving backups on a remote machine using it, did a general overview of Bacula and installed the Director on the Ubuntu 20.04 server. In this tutorial, we will install the main components of Bacula together with the PostgreSQL database on the CentOS 8 server.

Installing and configuring PostgreSQL

Bacula can work with the PostgreSQL database management system. Let's install it, init and start.

# dnf install postgresql-server
# postgresql-setup initdb
# systemctl enable --now postgresql

Create a user for Bacula.

# sudo su - postgres
$ createuser bacula
$ psql
psql (10.14)
Type "help" for help.
postgres=# ALTER USER bacula PASSWORD 'bacula';
ALTER ROLE
postgres=# ALTER USER bacula LOGIN SUPERUSER CREATEDB CREATEROLE;
ALTER ROLE
postgres=# q
$ exit
logout

Uncomment the following setting in the /var/lib/pgsql/data/postgresql.conf file:

listen_addresses = 'localhost'

Change the connection configuration to the following format in the file /var/lib/pgsql/data/pg_hba.conf:

# TYPE  DATABASE        USER            ADDRESS                 METHOD
# "local" is for Unix domain socket connections only
local   all             all                                     peer
local   bacula          bacula                                  md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
...

Restart the service.

systemctl restart postgresql.service

Installing and configuring Bacula

First, install Bacula components.

dnf install bacula-director bacula-storage bacula-console bacula-client

The following scripts automate the process of preparing the database, tables, and privileges. You need to execute them on behalf of the newly created user Bacula.

cd /usr/libexec/bacula/
sudo -u bacula ./create_postgresql_database
sudo -u bacula ./make_postgresql_tables
sudo -u bacula ./grant_postgresql_privileges

Create any folder for storing backups and set bacula as its owner.

mkdir /opt/bacula
chown bacula:bacula /opt/bacula

Open the /etc/bacula/bacula-dir.conf file and find the FileSet section with the Full Set name. Here, in the Include section you can set required folders to be backuped. Add /opt/bacula in the Exclude section.

FileSet {
Name = "Full Set"
Include {
...
File = /home/user
File = /folder/to/backup
}
Exclude {
File = /opt/bacula

}}

After that open the /etc/bacula/bacula-sd.conf file and set Archive Device = /opt/bacula for both Devices.

Device {
...
Archive Device = /opt/bacula
...
}

Start the services.

systemctl enable --now bacula-dir.service
systemctl enable --now bacula-fd.service
systemctl enable --now bacula-sd.service

Now the folders specified in section Include of the FileSet will be backed up daily. To start the backup task now, go to the Bacula Management Console.

# bconsole

Enter the run command and follow the instructions. To restore files, use restore command. To view scheduled Jobs, enter status and then 1. To see all available commands, type help.

Avaliação:
5 fora de 5
Аverage rating : 5
Avaliado por: 1
CEP 01311-930 São Paulo Avenida Paulista, nº 1765, 7º andar, Cj. 72, CV 10172, Bela Vista
+ 55 11 5118-1047
ITGLOBAL.COM BR LTDA
Usamos cookies para melhorar sua experiência no Serverspace. Ao continuar a navegar em nosso site, você concorda com o Uso de Cookies e com a Política de Privacidade.