How to install BareOS in CentOS

To install Bareos in CentOS

BareOS is a free-ware, multi platform application for taking backups with the graphical front end. It creates backup and restores it. This tool can be configured and can be used to add the backups in any centralized medium. Installation of Bareos is explained in this article.

To install Bareos

Utilize the following command to download and add the Bareos repositories from it’ s official website.

[root@linuxhelp ~]# wget -O /etc/yum.repos.d/bareos.repo  
http://download.bareos.org/bareos/release/latest/CentOS_7/bareos.repo
--2016-09-22 00:12:53--  http://download.bareos.org/bareos/release/latest/CentOS_7/bareos.repo
Resolving download.bareos.org (download.bareos.org)... 81.173.212.161
Connecting to download.bareos.org (download.bareos.org)|81.173.212.161|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 266 [text/plain]
Saving to: ‘ /etc/yum.repos.d/bareos.repo’ 

100%[===================================================================================================================================================> ] 266         --.-K/s   in 0s      

2016-09-22 00:12:54 (4.93 MB/s) - ‘ /etc/yum.repos.d/bareos.repo’  saved [266/266]


After adding the repositories, start installing Bareos.

[root@linuxhelp ~]# yum install bareos bareos-database-mysql -y 
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
 * base: mirror.fibergrid.in
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
bareos_bareos-15.2                                                                                                                                                                     41/41
Resolving Dependencies
-->  Running transaction check
--->  Package bareos.x86_64 0:15.2.2-37.1.el7 will be installed
-->  Processing Dependency: bareos-storage = 15.2.2 for package: bareos-15.2.2-37.1.el7.x86_64
-->  Processing Dependency: bareos-client = 15.2.2 for package: bareos-15.2.2-37.1.el7.x86_64
-->  Processing Dependency: bareos-director = 15.2.2 for package: bareos-15.2.2-37.1.el7.x86_64
--->  Package bareos-database-mysql.x86_64 0:15.2.2-37.1.el7 will be installed
.
.
.
Installed:
  bareos.x86_64 0:15.2.2-37.1.el7                                                       bareos-database-mysql.x86_64 0:15.2.2-37.1.el7                                                      
Dependency Installed:
  bareos-bconsole.x86_64 0:15.2.2-37.1.el7         bareos-client.x86_64 0:15.2.2-37.1.el7     bareos-common.x86_64 0:15.2.2-37.1.el7       bareos-database-common.x86_64 0:15.2.2-37.1.el7  
  bareos-database-tools.x86_64 0:15.2.2-37.1.el7   bareos-director.x86_64 0:15.2.2-37.1.el7   bareos-filedaemon.x86_64 0:15.2.2-37.1.el7   bareos-storage.x86_64 0:15.2.2-37.1.el7          
  libfastlz.x86_64 0:0.1-7.1.el7                  
Complete!


Setup the database for Bareos. Lets start with the installation of MariaDB and configure it.

[root@linuxhelp ~]# yum install mariadb-server -y 
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.fibergrid.in
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Resolving Dependencies
-->  Running transaction check
--->  Package mariadb-server.x86_64 1:5.5.50-1.el7_2 will be installed
-->  Processing Dependency: mariadb-libs(x86-64) = 1:5.5.50-1.el7_2 for package: 1:mariadb-server-5.5.50-1.el7_2.x86_64
-->  Processing Dependency: mariadb(x86-64) = 1:5.5.50-1.el7_2 for package: 1:mariadb-server-5.5.50-1.el7_2.x86_64
-->  Processing Dependency: perl-DBI for package: 1:mariadb-server-5.5.50-1.el7_2.x86_64
-->  Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.50-1.el7_2.x86_64
.
.
.
Dependency Installed:
  mariadb.x86_64 1:5.5.50-1.el7_2          perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7        perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7        perl-DBD-MySQL.x86_64 0:4.023-5.el7       
  perl-DBI.x86_64 0:1.627-4.el7            perl-Data-Dumper.x86_64 0:2.145-3.el7               perl-IO-Compress.noarch 0:2.061-2.el7              perl-Net-Daemon.noarch 0:0.48-5.el7       
  perl-PlRPC.noarch 0:0.2020-14.el7       

Dependency Updated:
  mariadb-libs.x86_64 1:5.5.50-1.el7_2                                                                                                                                                       
Complete!


Start and enable the MariaDB services.

[root@linuxhelp ~]# systemctl start mariadb
[root@linuxhelp ~]# systemctl enable mariadb 
ln -s ' /usr/lib/systemd/system/mariadb.service'  ' /etc/systemd/system/multi-user.target.wants/mariadb.service' 
[root@linuxhelp ~]# mysql_secure_installation 
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we' ll need the current
password for the root user.  If you' ve just installed MariaDB, and
you haven' t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from ' localhost' .  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named ' test'  that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you' ve completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!


Edit the my.cnf file and append the following lines to it. This settings allows you to access the local Mysql server.

[root@linuxhelp ~]# vim /etc/my.cnf 
[client]
host=localhost
user=root
password=root


Setup the Bareos database and tables by running the following commands.

[root@linuxhelp ~]# /usr/lib/bareos/scripts/create_bareos_database 
Creating mysql database
Creating of bareos database succeeded.
[root@linuxhelp ~]# /usr/lib/bareos/scripts/make_bareos_tables 
Making mysql tables
Creation of Bareos MySQL tables succeeded.
[root@linuxhelp ~]# /usr/lib/bareos/scripts/grant_bareos_privileges 
Granting mysql tables
Privileges for user bareos granted ON database bareos.


Start the services for BareOS daemons by running the following command.

[root@linuxhelp ~]# systemctl start bareos-dir
[root@linuxhelp ~]# systemctl start bareos-sd
[root@linuxhelp ~]# systemctl start bareos-fd 


Utilize the following command to enable the ports in firewall.

[root@linuxhelp ~]# firewall-cmd --permanent --add-port=9101-9103/tcp 
success
[root@linuxhelp ~]# firewall-cmd --reload  
success


Run the following commands to test Bareos director access.

[root@linuxhelp ~]# bconsole  
Connecting to Director linuxhelp:9101


Install apache and php package by using the following command.

[root@linuxhelp ~]# yum install httpd php php-cli php-common -y 
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.fibergrid.in
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Resolving Dependencies
-->  Running transaction check
--->  Package httpd.x86_64 0:2.4.6-40.el7.centos.4 will be installed
-->  Processing Dependency: httpd-tools = 2.4.6-40.el7.centos.4 for package: httpd-2.4.6-40.el7.centos.4.x86_64
-->  Processing Dependency: /etc/mime.types for package: httpd-2.4.6-40.el7.centos.4.x86_64
-->  Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-40.el7.centos.4.x86_64
-->  Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-40.el7.centos.4.x86_64
--->  Package php.x86_64 0:5.4.16-36.3.el7_2 will be installed
--->  Package php-cli.x86_64 0:5.4.16-36.3.el7_2 will be installed
--->  Package php-common.x86_64 0:5.4.16-36.3.el7_2 will be installed
.
.
.


Run the following command to install the epel repository as shown below.

[root@linuxhelp ~]# yum install epel-release -y 
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.fibergrid.in
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Resolving Dependencies
-->  Running transaction check
--->  Package epel-release.noarch 0:7-6 will be installed
-->  Finished Dependency Resolution
.
.
.
Running transaction
  Installing : epel-release-7-6.noarch                                                                                                                                                   1/1 
  Verifying  : epel-release-7-6.noarch                                                                                                                                                   1/1 

Installed:
  epel-release.noarch 0:7-6                                                                                                                                                                  

Complete


Then start installing the BareOS webui by running the following command.

[root@linuxhelp ~]# yum install bareos-webui -y 
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.fibergrid.in
 * epel: mirror01.idc.hinet.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Resolving Dependencies
-->  Running transaction check
--->  Package bareos-webui.noarch 0:15.2.2-41.1.el7 will be installed
-->  Processing Dependency: php-ZendFramework2 > = 2.2.0 for package: bareos-webui-15.2.2-41.1.el7.noarch
-->  Running transaction check
--->  Package php-ZendFramework2.noarch 0:2.4.10-1.el7 will be installed
-->  Processing Dependency: php-composer(zendframework/zend-xmlrpc) = 2.4.10 for package: php-ZendFramework2-2.4.10-1.el7.noarch
-->  Processing Dependency: php-composer(zendframework/zend-view) = 2.4.10 for package: php-ZendFramework2-2.4.10-1.el7.noarch
-->  Processing Dependency: php-composer(zendframework/zend-version) = 2.4.10 for package: php-ZendFramework2-2.4.10-1.el7.noarch
.
.
.
php-phpunit-PHP-Timer.noarch 0:1.0.6-1.el7                    php-phpunit-PHP-TokenStream.noarch 0:1.4.8-1.el7               php-phpunit-PHPUnit.noarch 0:4.8.27-1.el7                   
  php-phpunit-PHPUnit-MockObject.noarch 0:2.3.8-1.el7           php-phpunit-Text-Template.noarch 0:1.2.0-5.el7                 php-phpunit-Version.noarch 0:1.0.5-1.el7                    
  php-phpunit-comparator.noarch 0:1.2.0-1.el7                   php-phpunit-diff.noarch 0:1.4.1-1.el7                          php-phpunit-environment.noarch 0:1.3.2-1.el7                
  php-phpunit-exporter.noarch 0:1.2.2-1.el7                     php-process.x86_64 0:5.4.16-36.3.el7_2                         php-sebastian-global-state.noarch 0:1.1.1-1.el7             
  php-sebastian-recursion-context.noarch 0:1.0.2-1.el7          php-soap.x86_64 0:5.4.16-36.3.el7_2                            php-symfony-class-loader.noarch 0:2.8.9-1.el7               
  php-symfony-common.noarch 0:2.8.9-1.el7                       php-symfony-yaml.noarch 0:2.8.9-1.el7                          php-tidy.x86_64 0:5.4.16-4.el7                              
  php-xml.x86_64 0:5.4.16-36.3.el7_2                            php-zendframework-zendxml.noarch 0:1.0.2-2.el7                 t1lib.x86_64 0:5.1.2-14.el7                                 

Complete!


Open the Bareos-webui configuration file and add the following lines into it.

[root@linuxhelp ~]# vim /etc/bareos/bareos-dir.conf 
@/etc/bareos/bareos-dir.d/webui-consoles.conf
@/etc/bareos/bareos-dir.d/webui-profiles.conf


Also open and check the “ webui-consoles.conf” and “ webui-profiles.conf” files.

vim /etc/bareos/bareos-dir.d/webui-consoles.conf
vim /etc/bareos/bareos-dir.d/webui-profiles.conf 


Configure the Bareos login by changing the username and password in the file “ webui-consoles.conf

Now view the configuration file “ directories.ini” , it should look similar as shown below.

  Section localhost-dir
 
[localhost-dir]

  Enable or disable section. Possible values are “ yes”  or “ no” , the default is “ yes” .
enabled = “ yes” 
  Fill in the IP-Address or FQDN of you director.
diraddress = “ localhost” 
  Default value is 9101
dirport = 9101
  Section another-host-dir
 
[another-host-dir]
enabled = “ no” 
diraddress = “ ” 
dirport = 9101


Run the following command to restart the services.

[root@linuxhelp ~]# systemctl restart httpd
[root@linuxhelp ~]# systemctl restart bareos-dir 


Set selinux Boolean value as shown below.

[root@linuxhelp ~]# setsebool -P httpd_can_network_connect on 

Open the browser and point to the URL http://< IP address> /bareos-webui/


Tag : Bareos
Comment
mguevara
Jun 24 2018
Hi, thanks for your great contribution. I have a question, i'm stopped in these steps: [root@linuxhelp ~]# vim /etc/bareos/bareos-dir.conf vim /etc/bareos/bareos-dir.d/webui-consoles.conf vim /etc/bareos/bareos-dir.d/webui-profiles.conf because those files don't exist in my system after execute the installation of bareos-gui [root@sv-bkp01-srv bareos]# uname -a Linux sv-bkp01-srv.cdsoftca.net 3.10.0-862.3.3.el7.x86_64 #1 SMP Fri Jun 15 04:15:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux [root@sv-bkp01-srv bareos]# more /etc/redhat-release CentOS Linux release 7.5.1804 (Core) [root@sv-bkp01-srv bareos]# [root@sv-bkp01-srv etc]# rpm -qa | grep bareos bareos-common-17.2.4-9.1.el7.x86_64 bareos-database-common-17.2.4-9.1.el7.x86_64 bareos-tools-17.2.4-9.1.el7.x86_64 bareos-filedaemon-17.2.4-9.1.el7.x86_64 bareos-client-17.2.4-9.1.el7.x86_64 bareos-director-17.2.4-9.1.el7.x86_64 bareos-webui-17.2.4-15.1.el7.noarch bareos-database-mysql-17.2.4-9.1.el7.x86_64 bareos-database-tools-17.2.4-9.1.el7.x86_64 bareos-storage-17.2.4-9.1.el7.x86_64 bareos-bconsole-17.2.4-9.1.el7.x86_64 bareos-17.2.4-9.1.el7.x86_64
jagannatharumugam
Feb 10 2017
May I know, On which Version of CentOS you have used...??? To know, run the below command # cat /etc/redhat-release
moserwi
Feb 04 2017
[root@nas etc]# service bareos-dir start Checking Configuration and Database connection ... Starting Bareos Director services: [ OK ] [root@nas etc]# service bareos-sd start Starting Bareos Storage services: 05-Feb 03:43 bareos-sd: ERROR TERMINATION at parse_conf.c:182 Config error: Cannot open config file "/etc/bareos/bareos-sd.conf": No such file or directory [FAILED] [root@nas etc]# cd /etc/bareos [root@nas bareos]# ls bareos-dir.conf [root@nas bareos]# mc [root@nas bareos]# service bareos-fd start Starting Bareos File services: 05-Feb 03:46 bareos-fd: ERROR TERMINATION at parse_conf.c:182 Config error: Cannot open config file "/etc/bareos/bareos-fd.conf": No such file or directory [FAILED] [root@nas bareos]#
Add a comment
FAQ
Q
What does the Bareos VMware Backup Plugin do?
A
The Bareos VMware Backup Plugin triggers a snapshot of a running or suspended virtual machine and makes a backup of this snapshot.
Q
How can I downgrade from Bareos back to Bacula?
A
It is technically not impossible but we haven't tried nor do we intend to write a downgrade script.
Q
How can I export all tapes involved in a particular backup job?
A
Run this command for the following
RunScript {
Console = "export storage=my_storage_name volume=%V"
RunsWhen = After
RunsOnClient = no
}
Q
Why does it require Mariadb in bareos?
A
Yes, It saves the backup in the form of DB in bareos.
Q
Shall I allow remote login in Bareos?
A
Yes, you can allow that iss based on your preference and security