Bacula-users

[Bacula-users] HowTo Install Bacula 7 on CentOS 7 - Fresh install

2014-09-29 13:12:06
Subject: [Bacula-users] HowTo Install Bacula 7 on CentOS 7 - Fresh install
From: Rickinfl <bacula-forum AT backupcentral DOT com>
To: bacula-users AT lists.sourceforge DOT net
Date: Mon, 29 Sep 2014 10:09:29 -0700
Install CentOS 7 and run update.

Next you'll need epel 7 

 wget 
http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-1.noarch.rpm 

Install it 

 yum install epel-release-7-1.noarch.rpm

Go ahead and do 

 yum update

Ok now we need Bacula's 7 repo which is located here: (Note I just saved it in 
the /etc/yum.repos/  folder

 https://repos.fedorapeople.org/repos/slaanesh/bacula7/

Or you can just download it (right click and save as in the folder 
/etc/yum.repos/)

 https://repos.fedorapeople.org/repos/slaanesh/bacula7/epel-bacula7.repo

Once we got this done. Lets test it and see what version of Bacula we can 
download!

 yum list bacula*

You should see Bacula 7 show up. If not backup and see what went wrong.

Ok lets install everything. 

Install MySQL

Next is to install the MySQL on the Linux, now it is a MariaDB package. For 
some reason I just installed the mariadb and it didn't work seemed to be 
missing things. So that's why I installed the mysql stuff and it took off 
working. So I just installed both.


 yum install mariadb mariadb-server bacula-director-mysql bacula-console 
bacula-client bacula-storage-mysql mysql-server mysql-devel

Start MySQL server.

 systemctl start mariadb.service

Step 3: To make the MySQL to start during the every boot, Type the following on 
terminal and hit Enter.

 systemctl enable mariadb.service

Nex is to make the MariaDB secure by using the mysql_secure_installation 
command.

This program enables you to improve the security of your MariaDB installation 
in the following ways:

*    You can set a password for root accounts.
*    You can remove root accounts that are accessible from outside the local 
host.
*    You can remove anonymous-user accounts.
*    You can remove the test database (which by default can be accessed by all 
users, even anonymous users), and privileges that permit anyone to access 
databases with names that start with test_. 

 mysql_secure_installation

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):  <? Enter Current root 
password
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   <? Set root password
New password:   <? Enter root password
Re-enter new password:     <? Re enter root 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    <? Remove anonymous user
? 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    <? root remote login
? Success!


Ok 

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   <? Remove the test database
- 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   <? Save the changes
? 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!


Ok lets create the bacula user. Change the centos to what you want the password 
to be.

 mysql -u root -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.1.67 Source distribution

Copyright (c) 2000, 2012, 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.

 UPDATE mysql.user SET password=PASSWORD("centos") WHERE user='bacula';

Query OK, 2 rows affected (0.01 sec)
Rows matched: 2  Changed: 2  Warnings: 0

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

mysql> quit



Now this I had to learn the hard way would get an error on creating the 
databases, but some guy figured it out! So now do this:

Stop your bacula services 

 systemctl stop bacula-dir 

 systemctl stop bacula-sd 

Change the bacula catalogue lib to use the mysql shared object:


 su -c 'alternatives --config libbaccats.so'


It'll show:

Code: Select all

   There are 3 programs which provide 'libbaccats.so'.

     Selection    Command
   -----------------------------------------------
      1           /usr/lib64/libbaccats-mysql.so
      2           /usr/lib64/libbaccats-sqlite3.so
   *+ 3           /usr/lib64/libbaccats-postgresql.so

   Enter to keep the current selection[+], or type selection number:


(hey look! postgresql is selected by default)

 1 and hit enter. 

Start Your Bacula services back up

 systemctl start bacula-dir 

 systemctl start bacula-sd 

Now!!! We can create the Databases

 /usr/libexec/bacula/grant_mysql_privileges -u root -p

 /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 -p

Now update all the configuration files with new password and addresses as shown 
below.

Update Bacula director remember to leave the " at each end. example 
"mypassword" for address you don't need the " example 127.0.0.1. 

Also for some really strange reason that I've never figured out. Bacula doesn't 
put in @@PASSWORD@@ in one spot and only "" and it's really hard to find the 
rest are marked with @@PASSWORD@@. Trust me this has kicked my butt a couple of 
times now I know exactly where to change it. 


 vi /etc/bacula/bacula-dir.conf 

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 = "CHANGE THIS"         # Console password
  Messages = Daemon

# Client (File Services) to backup
Client {
  Name = bacula-fd
  Address = CHANGE THIS
  FDPort = 9102
  Catalog = MyCatalog
  Password = "CHANGE THIS"          # 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 = CHANGE THIS                # N.B. Use a fully qualified name here
  SDPort = 9103
  Password = "CHANGE THIS"
  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 = "PUT PASSWORD HERE"  # 
HARD TO FIND THIS ENTRY PUT PASSWORD BETWEEN THE "
}

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

Update Bacula console


 vi /etc/bacula/bacula-sd.conf 

Director {
  Name = bacula-dir
  Password = "CHANGE THIS"
}

##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;
}

Update the file daemon


 vi /etc/bacula/bacula-fd.conf

# List Directors who are permitted to contact this File daemon
#
Director {
Name = bacula-dir
Password = "CHANGE THIS"
}

##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
}



As i mentioned in the above configuration that my archive data path is 
?/mybackup?. So lets create a directory called ?mybackup?

 mkdir /mybackup

 chown bacula /mybackup

Now we finished all passwords and address modifications. Next restart all 
bacula daemons.

Now you have Bacula 7x running on CentOS 7x  Took me sometime to get this and 
putting a lot of pieces together because I wanted to move over to CentOS 7 and 
bacula was stopping me. 

Now you can install Webmin to control it. :)

Create repo for webmin.

 vi /etc/yum.repos.d/webmin.repo

Place the following content.

 [Webmin]
 name=Webmin Distribution Neutral
 #baseurl=http://download.webmin.com/download/yum
 mirrorlist=http://download.webmin.com/download/yum/mirrorlist
 enabled=1

Download webmin gpg key.

 wget http://www.webmin.com/jcameron-key.asc

Import key.

 rpm --import jcameron-key.asc

Install webmin.

 yum -y install webmin

Start the webmin.

 /etc/init.d/webmin start

Auto start webmin at system startup.

 chkconfig webmin on

Webmin listens on port 10000, allow it on firewall. 

 firewall-cmd --permanent --zone=public --add-port=10000/tcp
 firewall-cmd --reload

Now access webmin

 http://youripaddress.com:10000

+----------------------------------------------------------------------
|This was sent by hahajunkemail AT gmail DOT com via Backup Central.
|Forward SPAM to abuse AT backupcentral DOT com.
+----------------------------------------------------------------------



------------------------------------------------------------------------------
Slashdot TV.  Videos for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users