Installing Bacula on NethServer


(Alessio Fattorini) #1

Continuing the discussion from What is the most awesome module/feature for NethServer, that does not yet exist?:

That’s an amazing work! Just created a new topic about it!
Can you track here your achievements? In the end, you could write down an amazing howto about your experiments
:smile:
I’m really curious


(Phil Parker) #2

I will get that to you very soon, it was a long install due to lots of dependency issues and files that had to be remapped.


(Alessio Fattorini) #3

Don’t give up man! If you need help our “HowToMaster” @AbsyntH could give you some advices :wink:


(Phil Parker) #4

I got it i was waiting on the developer of bacula-web to get back to me, i never give up :slight_smile: … there were some issues with the interface install and i have to get the kinks out before i give you all a tutorial,eventually all this needs to be mapped into the NethServer interface each one of these modules im testing, so its a total install right from the dashboard.


(Phil Parker) #5

Bacula did install using this as a reference point follow along (the prompts have been omitted) as your reading this:

I had a lot of modification due using the remi repo,tons of dependency issues,it was asking for the MySql-Devel package which needed the MySql-Server 5.1.73-3.el6_5.i686 i am on x86_64(strange) installed, as a workaround I uninstalled My-Sql Client and MySql-Libs then installed Percona Server which allowed me to install the My-SQL-Devel package after and continue to the finish. It is stable alongside NethServer I have interface via Webmin, and i am working to use Bacula-Web as the GUI as I feel this could intergrate well with the NethServer Distro. The install documentation is translated over and missing files so this will take a bit, for now Bacula is able to be used via Webmin for GUI. This not for the faint of heart, to develop this package into this distro will take a lot of work, at this point, yes it is powerful, and you can backup to Tape,DVD,and Hard Drive Arrays, but the bugs would need to get worked out to become a viable solution.I will keep at it and keep installing material to test for stability.

Here are the things I did to get Bacula installed, this is only working on the backside right now on Webmin, and will be implemented into NethServer in the future.

This was the reference point:

Please note the following:
f you have a older Red Hat Linux system running the 2.4.x kernel and you have the directory /lib/tls installed on your system (normally by default), bacula will NOT run. This is the new pthreads library and it is defective. You must remove this directory prior to running Bacula, or you can simply change the name to /lib/tls-broken) then you must reboot your machine (one of the few times Linux must be rebooted). If you are not able to remove/rename /lib/tls, an alternative is to set the environment variable “LD_ASSUME_KERNEL=2.4.19″ prior to executing Bacula. For this option, you do not need to reboot, and all programs other than Bacula will continue to use /lib/tls. The above mentioned /lib/tls problem does not occur with Linux 2.6 kernels.

to check your running kernel:
Type at the #uname -r

When u start the first line:

yum install bacula-director-mysql bacula-console bacula-client bacula-storage-mysql my-sql server mysql-devel

If you are on x86-64: The following may occur if you have remi as a repository, or EPEL

my install showed i needed a few dependencies, which included my-sql server and my-sql-dev the problem is if you are on x86-64 it asks for the i686 version file mysql 5.1.73-3.el6_5 this gets to be a huge issue as you cannot install it from your repository, on my machine it did not allow it, yours it may, you need the mysql-server and mysql-devel files installed. I had to resolve the dependency by uninstalling mysql-client and mysql-libs and i installed Percona-Server 5.5

located here:
http://blogs.reliablepenguin.com/2015/01/24/install-percona-server-5-5-centos-6-5

This mainly occurred since i had remi for my repository after that i installed the packages one by one to make sure there were no dependency issues:

yum install bacula-director-mysql bacula-console bacula-client bacula-storage-mysql my-sql server mysql-devel

ie: yum install bacula-director-mysql
yum install bacula-console

Next it asks to start service mysqld start,chkconfig, set password…this should be already installed

service mysqld start
chkconfig mysqld on
mysqladmin -u root password centos

Next create database for bacula,and tables if you have your own password it will prompt for it, if not in NethServer look for the password in /etc/my.pwd using vi (already installed) or nano, I prefer nano, so at the prompt to install nano,

yum install nano

This creates the database and tables:
/usr/libexec/bacula/create_mysql_database -u root -p
/usr/libexec/bacula/make_mysql_tables -u root -p
/usr/libexec/bacula/grant_bacula_privileges -u root -

it will then prompt you to set bacula password

mysql -u root -p

this enters into mysql

if this does not work check to make sure the service is on
type:
service mysql start

if you cannot get in still use at the prompt

mysql -p

you should see this:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 67
Server version: 5.5.35 MySQL Community Server (GPL) by Remi

Copyright © 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> UPDATE mysql.user SET password=PASSWORD(“centos”) WHERE user=‘bacula’;
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql> exit
Bye

Pay attention to this line which you will enter in: do not use the password that is current as it will leave you vulnerable to an attack choose a strong password and write it down nearby:

mysql> UPDATE mysql.user SET password=PASSWORD(“centos”) WHERE user=‘bacula’;

after that:

FLUSH PRIVILEGES;

EXIT;

your done with MySQL now continue on:

Next

Update Bacula Director

Edit file /etc/bacula/bacula-dir.conf,

You can use vi or nano

cd /etc/bacula/

vi bacula-dir.conf
OR
nano bacula-dir.conf

Take warning of the following:

1.The Password line uses the password you wrote down
2.IP Address uses the local machine the Primary IP connected to NethServer

[…]
Director { # define myself
Name = bacula-dir
DIRport = 9101 # where we listen for UA connections
QueryFile = "/usr/libexec/bacula/query.sql"
WorkingDirectory = "/var/spool/bacula"
PidDirectory = "/var/run"
Maximum Concurrent Jobs = 1
Password = “centos” # Console password
Messages = Daemon

[…]

Client (File Services) to backup
Client {
Name = bacula-fd
Address = 192.168.1.101
FDPort = 9102
Catalog = MyCatalog
Password = “centos” # password for FileDaemon
File Retention = 30 days # 30 days
Job Retention = 6 months # six months
AutoPrune = yes # Prune expired Jobs/Files
}

[…]
Definition of file storage device
Storage {
Name = File
Do not use “localhost” here
Address = 192.168.1.101 # N.B. Use a fully qualified name here
SDPort = 9103
Password = "centos"
Device = FileStorage
Media Type = File
}

[…]
Generic catalog service
Catalog {
Name = MyCatalog
Uncomment the following line if you want the dbi driver
dbdriver = “dbi:sqlite3”; dbaddress = 127.0.0.1; dbport =
dbname = “bacula”; dbuser = “bacula”; dbpassword = “centos”
}

[…]

Console {
Name = bacula-mon
Password = "centos"
CommandACL = status, .status
}

Save the script

After you finish that, continue on to

Update Storage Daemon

Edit file: /etc/bacula/bacula-sd.conf,

Use Vi or nano editor

vi /etc/bacula/bacula-sd.conf

or

nano /etc/bacula/bacula-sd.conf

you should see:

The following applies:

  1. Use the password again that you wrote down where password lines apply
  2. The Archive device line you can use what is listed or use any directory you please.I kept it the same for simplicity I can change it later on.

Delete the following lines (Do not uncomment). As i installed centos minimal server, i don’t have a GUI mode, so that i deleted the following section##

[…]
Director {
Name = bacula-dir
Password = “centos”
}

Delete the following lines (Do not uncomment). As i installed centos minimal server, i don’t have a GUI mode, so that i deleted the following section##

Restricted Director, used by tray-monitor to get the
status of the storage daemon

Director {
Name = bacula-mon
Password = "@@MON_SD_PASSWORD@@"
Monitor = yes
}

[…]

Device {
Name = FileStorage
Media Type = File
Archive Device = /mybackup
LabelMedia = yes; # lets Bacula label unlabeled media
Random Access = Yes;
AutomaticMount = yes; # when device opened, read it
RemovableMedia = no;
AlwaysOpen = no;
}
[…]

save the script

Continue on:

Update file daemon

Edit file /etc/bacula/bacula-fd.conf,

Use nano or vi editor:

vi /etc/bacula/bacula-fd.conf

you should see:

This applies here:

  1. Use the password you wrote down in the password fields.

List Directors who are permitted to contact this File daemon

Director {
Name = bacula-dir
Password = “centos”
}

Delete (do not uncomment) these lines if you only using CUI mode in Backup server

Restricted Director, used by tray-monitor to get the
status of the storage daemon

Director {
Name = bacula-mon
Password = "@@MON_SD_PASSWORD@@"
Monitor = yes
}

Save the script

Continue on

Create a directory as shown or whatever you used as your backup directory,run Chown as showen

As i mentioned in the above configuration, my archive device path is “/mybackup”. So let me create a directory called “mybackup”.

mkdir /mybackup
chown bacula /mybackup

Now follow this:

Now we finished all passwords and address modifications. Next restart all bacula daemons and make them to start automatically on every reboot.

service bacula-dir start
service bacula-fd start
service bacula-sd start
chkconfig bacula-dir on
chkconfig bacula-fd on
chkconfig bacula-sd on

Bacula has been successfully installed and configured. You can now add clients, jobs and volumes by updating the bacula config files. Alternatively you can use webmin to make the work more simple. It is quite easier then updating the config files manually.

Webmin install if you choose:check for latest version on the webmin site located at:

http://www.webmin.com/download.html

use wget to link your version for download, on their website find the download and hover over it and right-click and copy link address

then at your command prompt
wget right click paste the link from their website

wget http://sourceforge.net/projects/webadmin/files/webmin/1.660/webmin-1.660-1.noarch.rpm

Substitute what version you downloaded from the website using wget modify the .rpm to match
follow the remaining lines for Service, Chkconfig

rpm -Uvh webmin-1.660-1.noarch.rpm
service webmin start
chkconfig webmin on

Moving on:

Adjust Firewall/Router using iptables:

iptables is located at /etc/sysconfig/
nano or vi iptables

nano iptables

add these lines

-A INPUT -m state --state NEW -m tcp -p tcp --dport 10000 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 9101 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 9102 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 9103 -j ACCEPT

Then:save script

Restart iptables at the command prompt:

service iptables restart

Access Webmin

Now you can login through webmin by “//http://server-ip-address:10000″ or “http://domain-name:10000/”.

You should be all set for bacula on webmin for now I am working on Bacula-Web for intergration into NethServer at this time.

Further instructions should follow:

Note: If you have problems with Webmin check that webmin is started

at the prompt:
service webmin start

if you still have issues rpc may be blocking it, i had to move my webmin to 10001

I can assist you if that should happen

Note:If you have trouble updating after using Percona Server

do this at the prompt:

cd /etc/yum.repos.d/

nano or vi
nano percona-release.repo

Set all lines under repositories to
enabled=0

Yum remove Percona-Server-Client55
then
Yum install mysql-devel

and you should be good to go!

Watch uninstalling Percona-Server as it can cause you to loose mysql and the tables you created for bacula, it just happened to me all for one file, which you could not get to…MySQL-Devel which you need to install Percona-Server to get and its dependencies,this package broke my yum update i removed it and lost mysql in the process and installed it back on, now you might need to rebuild the tables to bacula to get it to run once more. This is a awful bug on NethServer, or CentOs as it does not allow you to install the i686 mysql and its dependencies you need to run around the “block” to correct it… as shown. I am rebuilding the tables and will report back if it is completely stable.

I have reninstalled Mysql as shown and am recreating the tables now, most of the files were intact this just needed to be redone:

Had to redo:

Now set bacula user password on MySQL. To do that, log in to your MySQL server with command:

mysql -u root -p

Or mysql -p

Your password for mysql should still be there… mine was…

And set password as shown below:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 67
Server version: 5.5.35 MySQL Community Server (GPL) by Remi

Copyright © 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> UPDATE mysql.user SET password=PASSWORD(“centos”) WHERE user=‘bacula’;
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql> exit
Bye

Reconfigured:

mkdir /mybackup
chown bacula /mybackup

Then finally

service bacula-dir start
service bacula-fd start
service bacula-sd start
chkconfig bacula-dir on
chkconfig bacula-fd on
chkconfig bacula-sd on

Backup and running !!

Phil


(Phil Parker) #6

Please move to appropriate Directory :smile:


(Alessio Fattorini) #7

Impressive work man! Just 2 advices:

  1. can you try to use “code” markup?

  2. [quote=“PParker, post:5, topic:459”]
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 10000 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 9101 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 9102 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 9103 -j ACCEPT
    [/quote]

To do this take a look at:
http://docs.nethserver.org/projects/nethserver-devel/en/latest/services.html#add-a-new-network-service


(Phil Parker) #8

I had not gotten to that part as up yet on the code markup…I will modify it as needed… :slight_smile: I will also add bacula-web, I had wrote until the meantime you had webmin to control it.

You should be all set for bacula on webmin for now I am working on Bacula-Web for intergration into NethServer at this time.

"Further instructions should follow:

Note: If you have problems with Webmin check that webmin is started

at the prompt:
service webmin start

if you still have issues rpc may be blocking it, i had to move my webmin to 10001

I can assist you if that should happen"


(Phil Parker) #9

Taken care of:

config set bacula service status enabled TCPPort 9101 9102 9103 10001 private signal-event firewall adjust
output…
/sbin/e-smith/db dbfile set key type [prop1 val1] [prop2 val2] …

others will use 10000 for Webmin i changed mine to 10001 as RPC had consumed that port for me…

all ports that were applicable were opened in iptables… located at
/etc/sysconfig/

nano iptables

or

vi iptables

-A INPUT -p tcp -m tcp --dport 10001 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 9101 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 9102 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 9103 -j ACCEPT

Now adding Bacula-Web for GUI Reporting

Screenshots:http://www.bacula-web.org/gallery.html
located here:

http://www.bacula-web.org/docs/installing/installing-on-redhat-centos-fedora.html

Install:

Follow:

Install required packages on RedHat / Centos / Fedora
Install Apache web server if you havent already, make sure all commands are ran follow with the link open along with this:

$ sudo yum install httpd
$ sudo chkconfig httpd on
$ sudo service httpd start

$ sudo yum install httpd
$ sudo chkconfig httpd on
$ sudo service httpd start

Install PHP

Install PHP and PHP support for the database you’ve installed for Bacula

with MySQL database support

$ sudo yum install php php-gd php-gettext php-mysql php-pdo

go to this page next:

http://www.bacula-web.org/docs/installing/downloading.html

Follow

Move into Apache directory
On RedHat / Centos
cd /var/www/html

Download the source tarball
curl -O http://www.bacula-web.org/files/bacula-web.org/downloads/bacula-web-latest.tgz

Then go to this page:

http://www.bacula-web.org/docs/installing/configuring.html

Follow:

Configuring Bacula-Web

From Bacula-Web root folder, copy the file config.php.sample as below

Please note that since version 5.1.0, the config file is a PHP script.
cd application/config

cp -v config.php.sample config.php

chown -v apache: config.php

Go to the Bottom:

Here’s the tricky part

Here’s below how your configuration file (config.php) could look like change to this:

<?php // Language $config[0]['language'] = 'en_EN'; // Show inactive clients $config['show_inactive_clients'] = false; // Hide empty pools $config['hide_empty_pools'] = true; //MySQL bacula catalog (note:make sure you uncomment all the config statements below, take off the // at the beginning and pull the statement flush as shown) $config[0]['label'] = 'Backup Server'; $config[0]['host'] = 'localhost'; $config[0]['login'] = 'baculaweb'; (>>>>>this becomes root) $config[0]['password'] = 'password'; (>>>this becomes your main mysql password) $config[0]['db_name'] = 'bacula'; $config[0]['db_type'] = 'mysql'; $config[0]['db_port'] = '3306'; save the script Then to this page: mine was already setup no changes but just incase: http://www.bacula-web.org/docs/installing/configuring-the-web-server.html Modify PHP configuration file File: /etc/php.ini For *BSD users, the file is located /usr/local/etc/php.ini Locate and modify the line below date.timezone = with this value (for example) date.timezone = Europe/Zurich Then Reload Apache configuration sudo service httpd reload || sudo /etc/init.d/httpd reload or service httpd restart Lastly Secure your web server This file does is not there, you must create a new one: sudo vim /etc/httpd/conf.d/bacula-web.conf or nano /etc/httpd/conf.d/bacula-web-conf and add the content below AllowOverride All then save as bacula-web-conf Next Restart Apache service httpd restart After installing and configuring Bacula-Web, just ensure that Bacula-Web will work fine. A test page exist for this purpose that check the following items required package are succesfully installed smarty template cache good permissions php modules are installed and properly configured *****To test your installation of Bacula-Web, follow this link http://yourserveroripaddress/bacula-web/test.php your dash should look like the webpage located at: http://www.bacula-web.org/docs/installing/testing-the-installation.html at the bottom: