Buscar este blog

jueves, 11 de agosto de 2011

Ping Range using fping

Fping is a tool that allows you to list a network quickly and specify network range are determined which are active ip in that range.
Get a version and download
http://rpm.pbone.net/index.php3/stat/3/srodzaj/1/search/fping

In Centos 5 download.
#wget centos.karan.org/el5/extras/testing/i386/RPMS/fping-2.4b2-7.el5.kb.i386.rpm

Install 
#rpm -i fping-2.4b2-7.el5.kb.i386.rpm

In our institution we use this tool to find the IP addresses teams are active and are active.
#Fping-a-g [host]                  that we do for the entire network
Example
#fping -s -g 192.168.1.1 192.168.1.254

jueves, 4 de agosto de 2011

Installing Bacula on CentOS 6

under construction
 
Installing Bacula on CentOS 6 with Webmin interface quick start guide. The assumption for this CentOS 6 tutorial is that you are running as root and have a basic understanding of the software required but if you follow this tutorial you should be able to complete the task successfully.

1.How To Install and Configure MySql for bacula.

# yum -y install mysql-server.i686

#/etc/rc.d/init.d/mysqld start
Iniciando base de datos MySQL:  WARNING: The host 'bacula' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h bacula password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

                                                          [  OK  ]
Iniciando mysqld:                                [  OK  ]
[root@bacula ~]# 

Enabling MySQL services during start up in Linux.

#chkconfig mysqld on


Show user info and enabling MySQL Password.
#mysql -u root mysql 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

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

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

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

mysql> 

mysql> select user,host,password from mysql.user;
+------+-----------+----------+
| user | host      | password |
+------+-----------+----------+
| root | localhost |          |
| root | bacula    |          |
| root | 127.0.0.1 |          |
|        | localhost |          |
|        | bacula    |          |
+------+-----------+----------+
5 rows in set (0.00 sec)

mysql> 

 
Set password for root@localhos
mysql> set password for root@localhost=password('password');
Query OK, 0 rows affected (0.00 sec)
Set password for root@'127.0.0.1
mysql> set password for root@'127.0.0.1'=password('password');
Query OK, 0 rows affected (0.00 sec)

Set password for root@bacula

mysql> set password for root@'bacula'=password('password');
Query OK, 0 rows affected (0.00 sec)

Delete anonymous user

mysql> delete from mysql.user where user='';
Query OK, 2 rows affected (0.00 sec)


mysql> select user,host,password from mysql.user;

mysql> select user,host,password from mysql.user;
+------+-----------+-----------------------------------------------------------+
| user | host      | password                                                                  |
+------+-----------+-----------------------------------------------------------+
| root | localhost | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19   |
| root | bacula    | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19    |
| root | 127.0.0.1 | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19  |
+------+-----------+-------------------------------------------+
3 rows in set (0.00 sec)
Ready new password.
Exit for MySql
mysql> exit
Bye
[root@bacula ~]# 

2. Install Director and Storage component on Bacula Management Server and Configure MySql for bacula.
Install Director and Storage component on Bacula Management Server. 
[root@bacula ~]# yum -y install bacula-director-mysql bacula-storage-mysql bacula-console 
Complete!
Create a database for Bacula ans password
[root@bacula ~]# cd /usr/libexec/bacula/
[root@bacula bacula]#  

[root@bacula bacula]# ./grant_mysql_privileges -p
Enter password: password
Host    User    Password        Select_priv     Insert_priv     Update_priv     Delete_priv     Create_priv     Drop_priv       Reload_priv     Shutdown_priv   Process_priv      File_priv       Grant_priv      References_priv Index_priv      Alter_priv      Show_db_priv    Super_priv      Create_tmp_table_priv   Lock_tables_priv  Execute_priv    Repl_slave_priv Repl_client_priv        Create_view_priv        Show_view_priv  Create_routine_priv     Alter_routine_priv      Create_user_priv  Event_priv      Trigger_priv    ssl_type        ssl_cipher      x509_issuer     x509_subject    max_questions   max_updates     max_connections max_user_connections
localhost       root    *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19       Y       Y       Y       Y       Y       Y       Y       Y       Y       Y       Y       Y0
bacula  root    *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19       Y       Y       Y       Y       Y       Y       Y       Y       Y       Y       Y       Y       Y0
127.0.0.1       root    *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19       Y       Y       Y       Y       Y       Y       Y       Y       Y       Y       Y       Y0
localhost       bacula          N       N       N       N       N       N       N       N       N       N       N       N       N       N       N       N       N0
%       bacula          N       N       N       N       N       N       N       N       N       N       N       N       N       N       N       N       N       N0
Privileges for user bacula granted on database bacula.

[root@bacula bacula]#  
[root@bacula bacula]# ./create_mysql_database -p
Enter password:
password
Creation of bacula database succeeded.
[root@bacula bacula]#./make_mysql_tables -p
Enter password:
password
Creation of Bacula MySQL tables succeeded.

set password Mysql for Bacula 

[root@bacula bacula]# mysql -u root -p
Enter password: password
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.1.52 Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

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

mysql> 

mysql> set password for bacula=password('password');
Query OK, 0 rows affected (0.00 sec)


mysql> set password for bacula@localhost=password('password');
Query OK, 0 rows affected (0.00 sec)


Show permission.

 mysql> select user,host,password from mysql.user;
+--------+-----------+-------------------------------------------+
| user   | host      | password                                  |
+--------+-----------+-------------------------------------------+
| root   | localhost | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root   | bacula    | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| root   | 127.0.0.1 | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| bacula | localhost | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| bacula | %         | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
+--------+-----------+-------------------------------------------+
5 rows in set (0.00 sec)


Show databases
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| bacula             |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)


Select Database:
mysql> use bacula;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed


Show tables

mysql> show tables;
+------------------+
| Tables_in_bacula |
+------------------+
| BaseFiles        |
| CDImages         |
| Client           |
| Counters         |
| Device           |
| File             |
| FileSet          |
| Filename         |
| Job              |
| JobHisto         |
| JobMedia         |
| Location         |
| LocationLog      |
| Log              |
| Media            |
| MediaType        |
| Path             |
| PathHierarchy    |
| PathVisibility   |
| Pool             |
| Status           |
| Storage          |
| UnsavedFiles     |
| Version          |
+------------------+
24 rows in set (0.01 sec)



exit
Bye
[root@bacula bacula]#



3.Configure MySql for bacula. 

Edit files config Bacula. Configure Bacula Director
[root@bacula bacula]# 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 = "password"         # Console password
  Messages = Daemon
}


FileSet {
  Name = "Full Set"
  Include {
    Options {
      signature = MD5
        Compression = GZIP
    }
#
#  Put your list of files here, preceded by 'File =', one per line
#    or include an external list with:
#
#    File = <file-name
#
#  Note: / backs up everything on the root partition.
#    if you have other partitions such as /usr or /home
#    you will probably want to add them too.
#
#  By default this is defined to point to the Bacula binary
#    directory to give a reasonable FileSet to backup to
#    disk storage during initial testing.
#
    File = /usr/sbin #Patch for backup
  }

#
# If you backup the root directory, the following two excluded
#   files can be useful
#
  Exclude {
    File = /var/spool/bacula
    File = /tmp
    File = /proc
    File = /tmp
    File = /.journal
    File = /.fsck
  }
}


# Client (File Services) to backup
Client {
  Name = bacula-fd
  Address = bacula
  FDPort = 9102
  Catalog = MyCatalog
  Password = "password"          # 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 = bacula                # N.B. Use a fully qualified name here (Bacula is my name server)
  SDPort = 9103
  Password = "password"
  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 = "password"
}

# Default pool definition
Pool {
  Name = Default
  Pool Type = Backup
  Recycle = yes                       # Bacula can automatically recycle Volumes
  AutoPrune = yes                     # Prune expired volumes
  Volume Retention =  120 days        # one year
  Maximum Volume Jobs = 1
  Label Format = Vol-
}

Make them comments:

#
# Restricted console used by tray-monitor to get the status of the director
#
#Console {
#  Name = bacula-mon
#  Password = "@@MON_DIR_PASSWORD@@"
#  CommandACL = status, .status
#}

Write and exit from vi edtitor.

Edit make_catalog_backup.pl

#vi /usr/libexec/bacula/make_catalog_backup.pl
Search line add test ( because "MyCatalog" does not work )

exec("HOME='$wd' mysqldump -f -u$args{db_user} -p$args{db_password} --opt $args{db_name} > '$wd/$args{db_name}.sql'");


Write and exit.

Start Service.
[root@bacula /]# /etc/rc.d/init.d/bacula-dir start
Starting bacula-dir:                                       [  OK  ]


Edit files config Bacula.  Configure Bacula Storage