Showing posts with label Bareos. Show all posts
Showing posts with label Bareos. Show all posts

Wednesday, September 11, 2019

Bareos Client Configuration

Bareos has changed the structure of the configuration files allowing for different sections of the configuration to be isolated in their own files. This improves readability and allows for third-party applications to be written to edit the Bareos configuration. 
If you are new to Bareos or Bareos installation, read the introduction in this article to get more information.
The new way to configure a client is done at the Bareos Client and the Bareos Server. Please take note which host is the following command is executed on.
To create and configure a new Baresos Client,  follow the steps below
1.       Generate a password and copy it somewhere
# < /dev/urandom tr -dc A-Za-z0-9 | head -c32; echo
8wstlW1xkTQmmt1mLdbKjIWSuoSy1F69
2.       Log into the Bareos Server
3.       execute the Bareos Console
# bconsole
4.       Create the client configuration. In this example the client name is prod-server and the IP address is 192.168.0.2. Replace it with the correct IP address and add the password generated above
* configure add client name=prod-server address=192.168.0.2 password=8wstlW1xkTQmmt1mLdbKjIWSuoSy1F69
A sample output is below
*configure add client name=prod-server address=192.168.0.2 password=8wstlW1xkTQmmt1mLdbKjIWSuoSy1F69
Exported resource file "/etc/bareos/bareos-dir-export/client/prod-server/bareos-fd.d/director/bareos-dir.conf":
Director {
 Name = bareos-dir
 Password = "[md5]f7180d44d3cad452f611e2dfdfd3b007"
}
Created resource config file "/etc/bareos/bareos-dir.d/client/prod-server.conf":
Client {
 Name = prod-server
 Address = 192.168.0.2
 Password = 8wstlW1xkTQmmt1mLdbKjIWSuoSy1F69
}
*exit
5.       Restart Bareos Director
# systemctl restart bareos-dir
# systemctl status bareos-dir

The configuration information for the bareos client is the Resource Config File. This must be copied to the Bareos client host in the following steps.

A. On the Bareos server:
The Bareos Client requires information from the Bareos server. The information is in the resource file created when the client configuration was created on the Bareos Server.
Install the configuration for the bareos client using the commands below to copy the configuration file to the bareos client (e.g. prod-server with the IP address 192.168.0.2). On the Bareos Server, from the prompt

# scp /etc/bareos/bareos-dir-export/client/prod-server/bareos-fd.d/director/bareos-dir.conf root@192.168.0.2:/etc/bareos/bareos-fd.d/director/

B. On the Bareos Client
Log into the Bareos Client host (where the Bareos Client is installed), in this example, prod-server (IP 192.168.0.2).
1.       Edit the client configuration file
# cd /etc/bareos/bareos-fd.d/client
# vi myself.conf

2.       Change the Name from localhost to prod-server
Client {
      Name = localhost-fd prod-server
      Maximum Concurrent Jobs = 20

3.       Save the file and test whether this configuration is correct
# bareos-fd –t
The configuration is correct if there are no error messages.

4.       Apply the new configuration by restarting the client.
# systemctl restart bareos-fd
This can be verified with the command 
# systemctl status bareos-fd
Look for the line beginning with " Active " which should say " active (running) ".

Verify on the Bareos server:

# bconsole
* status  client=prod-server
Connecting to Client coders at 192.168.0.2:9102
prod-server Version: 17.2.4 (21 Sep 2017)  x86_64-redhat-linux-gnu redhat CentOS Linux release 7.4.1708 (Core)
Daemon started 09-Jan-19 18:24. Jobs: run=204 running=0.
 Heap: heap=36,864 smbytes=37,990 max_bytes=2,220,893 bufs=227 max_bufs=386
 Sizeof: boffset_t=8 size_t=8 debug=0 trace=0 bwlimit=0kB/s

Thursday, May 19, 2016

How to install the Bareos Web UI

A bit of a background

Since Bareos is a descendant of the Bacula backup system, there are several ways to administer the system. There is a console-based bconsole, a character menu-driven system. For a GUI experience there is BAT (Bacula Admin Tool), which provides most of the features of bconsole. If you are using Webmin, there is Bacula Backup module which provides basic configuration and administration. A dedicated web interface was eventually developed, called Bacula-Web. However it is more of a monitoring tool than anything else. What drove a wedge between long time bacula users and the Bacula project is the web administration tool, which is available for the commercial version of Bacula but not the open source version. Other efforts at building a web administration tool have faltered with projects like Web-Bacula stalled and abandoned.
Bareos was committed from the get-go to a web administration tool. As more and more features were added, the Bareos WebUI finally moved out from a monitoring tool to an administration tool. However, it still does not support changing the Bareos configuration. The WebUI works through the Bareos Director to execute it's operation. Installing the WebUI can be done in three stages, installing configuring and finalising the setup.

Installing the Bareos WebUI

If you have followed the Bareos server setup post, the Bareos and EPEL repository should be already be set up. Installing it is very easy.

yum install bareos-webui

That will install the WebUI and the ZendFramework it runs on, plus it's dependencies. The process may take sometime as it installs over 100 packages automatically.

Configuring the Bareos WebUI

Configuration for the Bareos WebUI is tied closely to the Director. Most Bareos setups have one installation and one Bareos Director. However, the Bareos WebUI can support multiple directors, allowing for organisations using Bareos Backup to have multiple setups that are heavily customised for the purpose of the backup and backup strategy.
Again, the Bareos developers have provided an easy way to do this. Run the following commands as a privileged user or root user to add the WebUI configuration to a Director setup.

echo "@/etc/bareos/bareos-dir.d/webui-consoles.conf" >> /etc/bareos/bareos-dir.conf 
echo "@/etc/bareos/bareos-dir.d/webui-profiles.conf" >> /etc/bareos/bareos-dir.conf
 
The two commands add a line to the Director configuration. The top line is for the WebUI console configuration file. The file contains critical information such as the name of the profile, the username and password used to access the profile. This is the username and password used to log into Bareos WebUI. The default username is user1 and password is CHANGME. The bottom line is for the profile configuration. The configuration defines what the profile, and therefore the user, can do. The default profile name is webui and the default file allows full access. Restart the Bareos Director to load the new configuration.

service bareos-dir restart

If the server is a fresh installation, start the apache webserver and configure the firewall to allow connection to port 80.  The Bareos WebUI installation will setup the apache configuration in /etc/httpd/conf.d/bareos-webui.conf. Point your browser to the URL http://<Ip address of server>/bareos-webui and log in.
Once the Dashboard is shown, run a the sample job by going to Jobs, and the Run tab. Find the BackupClient1 line. Under the Action column, click the Run button. To check whether the job completed successfully, go back to the Dashboard or the Overview tab under Jobs.

Finalizing the setup

To complete the setup, make sure the apache server is set to start at book.

chckconfig httpd on

Make sure the firewall configuration is also saved.

Friday, May 13, 2016

Backing up a Windows PC with Bareos

This article will cover on how to install the Bareos Client for Windows to backup windows files. Although it is not necessary, the Bareos server should be installed first. This is to ensure that the some information, like the name of the Bareos Director has been set. In fact, that is the only information that is required from the server. The client is built specifically for windows and is smart enough to invoke the VSS service which allows it to backup files that are open by other applications.
Installation could not be easer.

  1. Get the installation files from http://download.bareos.org/bareos/release/latest/windows.
  2. Run the installation program, select FileDaemon.
  3. Give the PC a name to identify itself. This is the Client Name.  Also enter the name of the Bareos Server.  In the Network Address box, you can enter the PC's IP address or it's DNS name.
  4. The program will show the information that is required to be added to the Bareos Director. This will tell the Director where to find the client. Make note or save the client configuration information to be added to the Bareos Director.
  5. The program will install the Bareos Client and set it so that it will start up automatically after the next restart. You can do a test now but you have to start the program manually. 
 You can test the backup of the PC by adding the above information into the Bareos Director configuration on the server and creating a job for it. Don't forget to restart the director for it to recognise the new configuration. Bareos has a windows fileset that is geared to backup all files on  the Windows PC.

Thursday, April 28, 2016

Installing the Bareos server

Some background is needed before setting up the Bareos server. The Bareos backup system is based on the Bacula backup system. It consists of  a Director (the central component),  a file system agent and a storage agent. If this is the first time installation, install the backup system components on the same server for testing purposes. The installation process is divided into three stages.

  1. Setting up the Bareos repository
  2. Installing in the programs 
  3. Setting up or configuring the system
A. Setting up the repository
  1. Refer to quickstart information in official documentation for your Distro specific instruction
  2. For RedHat, it's basically
    1. add the Bareos yum repository. The repositories are here. Make sure the client version matches the Bareos server version. Choose the version of RedHat or CentOS for the target server. Download the bareos.repo file to /etc/yum.repos.d
    2. do a yum check-update to update the repositories to load them
  3. For Oracle Linux, enable the Optional Latest repository.
  4. The latest verions requires the EPEL repository to be added also.
B. Installing the application
This requires a decision on the choice of database to use. Both MariaDB/MySQL and PostgeSQL are offered as option. Install bareos together with the choice of back-end. Using the example below will also install other necessary components. However, the database of choice must be installed first. For RedHat users using MariaDB/MySQL,

yum install bareos bareos-database-mysql bareos-webui

C. Configuring the system
After the program/application files are installed, the database has to be configured. A Bareos database has to be created, the tables within the Bareos database have to be made and the correct privileges assigned.  If this is a fresh server, install  mysql withe the following command

yum install mysql mysql-server
or
yum install mariadb-server

And then start mysql with the command: service mysqld start.

Bareos provides the script files to create the tables necessary. For MySQL/MariaDB the commands are
 
/usr/lib/bareos/scripts/create_bareos_database 
/usr/lib/bareos/scripts/make_bareos_tables 
/usr/lib/bareos/scripts/grant_bareos_privileges

Run these from a privileged or root account. If the database has just been installed, the commands would run without a problem. However, running a system without passwords is dangerous. After testing, secure this by following these instructions.

If your are using MySQL Community Edition version 8 and above, additional steps are required. You must run mysql_secure_installation to set the new root password. Create a ~/.my.cnf file in the root directory. And then run the 3 scripts above. Granting privileges  may cause additional errors if your password validation is set. Set the password in the file /etc/bareos/bareos-dir.d/catalog/MyCatalog.conf.

After configuring MySQL for Bareos, start the Bareos components to start the system
service bareos-dir start
service bareos-fd start
service bareos-sd start

Thankfully, the default installation will not only install the Director, File Daemon (agent) and Storage Daemon but also a working configuration.You can follow the instructions at the official bareos installation to do a sample test.

 If you have a different distribution or an existing server setup, refer to the Bareos installation documentation for more information and options. 

Reference
https://www.svennd.be/installing-bareos-on-centos-7/

Wednesday, November 25, 2015

Installing Bareos Client

This guide covers the installation of the Bareos Client in it's most common form, for file backup or also known as a FileDaemon (bareos-fd). It goes through the process of installing the client and testing whether it works. I will post an installation guide for Bareos Client for database backup and as a storage node (StorageDaemon) some time in the future.
First, there are several assumptions taken.
  • No Bareos client or anoy other component installed previously. Install client to backup files only. 
  • Focus is on installation via packages so that updates packages are applied as they come out. Particularly useful if your organization validates updates prior to roll-out.
  • Server-side configuration is using Webmin via the Bacula module (in Webmin: System --> Backup)  This is no longer possible with newer versions of Bareos. Refer to to this updated post on Bareos client configuration for newer instructions.
First the following information is needed
  • The hostname or IP address of the client or machine to be backed up. We'll call this the Client.
  • The name that will be given to the Client in the Bareos system. Usually Client-fd
  • The name of Director in the Bareos system.
  1. Add Bareos repository on the client / target server.
    1. Refer to quickstart information in official documentation for your Distro specific instruction
    2. For RedHat, it's basically
      1. add the Bareos yum repository. The repositories are here. Make sure the client version matches the Bareos server version. Choose the version of RedHat or CentOS for the target server. Download the bareos.repo file to /etc/yum.repos.d
      2. If you haven't added the Epel repository, add the repository. Instructions are here.
      3. do a yum check-update to update the repositories to load them
  2. Install Bareos filedaemon. For Redhat: yum install bareos-filedaemon
  3. Configure the client by editing the /etc/bareos/bareos-fd.conf file
    1. Set Bareos server / Director name in Director section, entry "Name = "
    2. Make note of  
      1. FileDaemon name - set the entry "Name =" in FileDaemon section
      2. Director password - create a password and set the entry "Password =" in the Director section. Make this long and complicated because this will not be used by users.
    3. Start the FileDaemon / Bareos Client:  service bareos-fd start
    4. Open the Bareos Client port (tcp port 9102) on the firewall, if necessary 
  4. Configure Bareos server via Webmin
    1. Create client
      1. System => Bacula backup, Backup Clients, Add new backup client
      2. Enter 
        1. Client name =  FileDaemon name (from step 3.2)
        2. Bacula FD Password = Director Password (replace the automactically generated one)
        3. Save
      3. Confirm setup client ok
        1. Backup Clients, select client, Show Status
        2. Correct response : Status from <client hostname> : <Client name>-fd Version: <bareos version>
    2. Setup job to backup files on the client 
      1. Backup Jobs, Add a new backup job
      2. Enter job name: eg hostname-files
      3. Set "Inherit defaults" to "DefaultJob"
      4. Set Client to backup = Client name
      5. Set File Set to backup = SelfTest
      6. Set Destination Storage = <storage> e.g. "File"
  5. Test backup
    1. Backup Jobs, select Job name
    2. click Run Now
    3. Messages will appear. Test successful when the last message is "Termination: Backup OK"
  6. Create a backup job for the client with the correct fileset.
More information: Official Documentation