Bacula Community 9.x Official Packages Installation Script

As of version 9.x, Bacula is again making backup clients available for Windows machines as well as packages for Linux distributions, this time only for Debian, Ubuntu and CentOS or RedHat, but will soon release for more distributions.

In order to download by packages, you must register on the website for free and fill in your name, surname and email at the following address: https://blog.bacula.org/bacula-binary-package-download/

You will receive an alphanumeric key that must be entered while the script is running.

Debian and CentOS Automatic Installation Script

1) Download the installation script, give permission and run

wget -c http://www.bacula.lat/wp-content/uploads/2018/09/bacula_community_install.txt -O /usr/local/bin/_bacula_community_install.sh
chmod a+x /usr/local/bin/_bacula_community_install.sh
/usr/local/bin/_bacula_community_install.sh

2) Inform the Bacula key received by email

--------------------------------------------------
# Inform your Bacula Key
# This key is obtained with a registration in Bacula.org.
# http://blog.bacula.org/download-community-binaries
Please, fill with your Bacula Key:

The packages are still taking a while to come out after releasing the source code versions, so do not wait for the latest version of the package as soon as a new version of Bacula comes out.
Probably in the near future the Bacula Community team can improve this.

For now you must complete the version for debian or centos which is the last available for each operating system.
This script was tested in CentOS 7.5 and Debian 9.5 (stretch)

3) Inform the version for installation

# This script will only work with the latest Debian and CentOS versions
--------------------------------------------------
Inform the Bacula version
  - 9.0.0
  - 9.0.4
  - 9.0.5
  - 9.0.6
  - 9.0.7
  - 9.0.8
  - 9.2.0
  - 9.2.1
Choose your Bacula Version:

4) Select the MySQL or PostgreSQL database

What do you want to do?
  1) Install Bacula with PostgreSQL
  2) Install Bacula with MySQL
  3) Exit
Select an option [1-3]:

* Remarks: This script is suitable for machines with clean operating system, no database or Bacula installed. Debian Manual Installation

Debian Manual Installation

#!/bin/bash

bacula_version="9.2.1"
bacula_key="XXXXXXXXXXXXX"
export DEBIAN_FRONTEND=noninteractive

# Requirements to install Bacula by packages
apt-get install -y zip wget bzip2


# Download the repository keys
wget -c https://www.bacula.org/downloads/Bacula-4096-Distribution-Verification-key.asc -O /tmp/Bacula-4096-Distribution-Verification-key.asc


# Add key in the local repository
apt-key add /tmp/Bacula-4096-Distribution-Verification-key.asc


# Create the Bacula Community repository
echo "# Bacula Community
deb http://www.bacula.org/packages/${bacula_key}/debs/${bacula_version}/stretch/amd64" > /etc/apt/sources.list.d/bacula-community.list

###################################################################
# Install the MySQL or PostgreSQL database
# Select the commands according to the desired option


#==================================================================
# Install MySQL
wget -c https://repo.mysql.com/RPM-GPG-KEY-mysql -O /tmp/RPM-GPG-KEY-mysql --no-check-certificate
apt-key add /tmp/RPM-GPG-KEY-mysql
echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-apt-config
deb http://repo.mysql.com/apt/debian/ stretch mysql-5.7
deb http://repo.mysql.com/apt/debian/ stretch mysql-tools
deb http://repo.mysql.com/apt/debian/ stretch mysql-tools-preview
deb-src http://repo.mysql.com/apt/debian/ stretch mysql-5.7" > /etc/apt/sources.list.d/mysql.list
apt-get update
apt-get install -y mysql-community-server
apt-get install -y bacula-mysql
systemctl enable mysql
systemctl start mysql

# Create the database of Bacula data with MySQL
/opt/bacula/scripts/create_mysql_database
/opt/bacula/scripts/make_mysql_tables
/opt/bacula/scripts/grant_mysql_privileges


#==================================================================
# Install PostgreSQL
apt-get update
apt-get install -y postgresql postgresql-client
apt-get install -y bacula-postgresql


# Enable and start PostgreSQL during boot
systemctl enable postgresql
systemctl start postgresql


# Create the Bacula database with PostgreSQL
su - postgres -c "/opt/bacula/scripts/create_postgresql_database"
su - postgres -c "/opt/bacula/scripts/make_postgresql_tables"
su - postgres -c "/opt/bacula/scripts/grant_postgresql_privileges"
###################################################################


# Enable the start of daemons during boot
systemctl enable bacula-fd.service
systemctl enable bacula-sd.service
systemctl enable bacula-dir.service


# Start the Bacula daemons
systemctl start bacula-fd.service
systemctl start bacula-sd.service
systemctl start bacula-dir.service


# Create shortcut in /usr/sbin with Bacula binaries
# This allows you to run the daemons and utilities
# Without entering the /opt/bacula/bin directory
for i in `ls /opt/bacula/bin`; do
    ln -s /opt/bacula/bin/$i /usr/sbin/$i;
done


# Replace the bconsole.conf address to localhost by default
sed '/[Aa]ddress/s/=s.*/= localhost/g' -i  /opt/bacula/etc/bconsole.conf

CentOS Manual Installation

#!/bin/bash

# Enter the desired version
bacula_version="9.2.1"

# Enter the key received by email
bacula_key="XXXXXXXXXXXXX"


# Requirements to install Bacula by packages
yum install -y zip wget apt-transport-https bzip2


# Download the repository keys
wget -c https://www.bacula.org/downloads/Bacula-4096-Distribution-Verification-key.asc -O /tmp/Bacula-4096-Distribution-Verification-key.asc


# Add key in the local repository
rpm --import /tmp/Bacula-4096-Distribution-Verification-key.asc


# Create the Bacula Community repository
echo "[Bacula-Community]
name=CentOS - Bacula - Community
baseurl=http://www.bacula.org/packages/${bacula_key}/rpms/${bacula_version}/el7/x86_64/
enabled=1
protect=0
gpgcheck=0" > /etc/yum.repos.d/bacula-community.repo


###################################################################
# Install the MySQL or PostgreSQL database
# Select the commands according to the desired option


#==================================================================
# Install MySQL
rpm --import /tmp/RPM-GPG-KEY-mysql
wget -c http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm -O /tmp/mysql57-community-release-el7-9.noarch.rpm
rpm -ivh /tmp/mysql57-community-release-el7-9.noarch.rpm
yum install -y mysql-community-server
mysqld --initialize-insecure --user=mysql
systemctl enable mysqld
systemctl start mysqld
yum install -y bacula-mysql


# Create the database of Bacula data with MySQL
/opt/bacula/scripts/create_mysql_database
/opt/bacula/scripts/make_mysql_tables
/opt/bacula/scripts/grant_mysql_privileges


#==================================================================
# Install PostgreSQL
yum install -y postgresql-server
yum install -y bacula-postgresql --exclude=bacula-mysql
postgresql-setup initdb


# Enable and start PostgreSQL during boot
systemctl enable postgresql
systemctl start postgresql


# Create the Bacula database with PostgreSQL
su - postgres -c "/opt/bacula/scripts/create_postgresql_database"
su - postgres -c "/opt/bacula/scripts/make_postgresql_tables"
su - postgres -c "/opt/bacula/scripts/grant_postgresql_privileges"
###################################################################

# Firewall Rules
firewall-cmd --permanent --zone=public --add-port=9101-9103/tcp
firewall-cmd --reload
# Enable the start of daemons during boot
systemctl enable bacula-fd.service
systemctl enable bacula-sd.service
systemctl enable bacula-dir.service


# Start the Bacula daemons
systemctl start bacula-fd.service
systemctl start bacula-sd.service
systemctl start bacula-dir.service


# Create shortcut in /usr/sbin with Bacula binaries
# This allows you to run the daemons and utilities
# Without entering the /opt/bacula/bin directory
for i in `ls /opt/bacula/bin`; do
    ln -s /opt/bacula/bin/$i /usr/sbin/$i;
done


# Replace the bconsole.conf address to localhost by default
sed '/[Aa]ddress/s/=s.*/= localhost/g' -i  /opt/bacula/etc/bconsole.conf

Disponível em: pt-brPortuguês (Portuguese (Brazil)) enEnglish esEspañol (Spanish)

Leave a Reply

Close Menu