# Bacula Installation Guide ## For Calypso Backup Appliance **Version:** 1.0 **Based on:** [Bacula Community Installation Guide](https://www.bacula.org/whitepapers/CommunityInstallationGuide.pdf) **Target OS:** Ubuntu Server 24.04 LTS **Database:** PostgreSQL 14+ --- ## 1. Introduction This guide explains how to install and configure Bacula Community edition on the Calypso backup appliance. Bacula is used for backup job management, scheduling, and integration with the Calypso control plane. **Note:** This installation is integrated with Calypso's PostgreSQL database and management system. --- ## 2. Prerequisites ### 2.1 System Requirements - Ubuntu Server 24.04 LTS (or compatible Debian-based system) - PostgreSQL 14+ (already installed by Calypso installer) - Root or sudo access - Network connectivity to download packages ### 2.2 Pre-Installation Checklist - [ ] PostgreSQL is installed and running - [ ] Calypso database is configured - [ ] Network access to Bacula repositories - [ ] Backup existing Bacula configuration (if upgrading) --- ## 3. Installation Methods ### 3.1 Method 1: Using Calypso Installer (Recommended) The Calypso installer includes Bacula installation: ```bash sudo ./installer/alpha/install.sh ``` Bacula will be installed automatically. Skip to **Section 5: Configuration** after installation. ### 3.2 Method 2: Manual Installation If installing manually or Bacula was skipped during Calypso installation: --- ## 4. Manual Installation Steps ### 4.1 Install Required Packages ```bash # Update package lists sudo apt-get update # Install transport for HTTPS repositories sudo apt-get install -y apt-transport-https ``` ### 4.2 Import GPG Key Bacula packages are signed with a GPG key. Import it: ```bash cd /tmp wget https://www.bacula.org/downloads/Bacula-4096-Distribution-Verification-key.asc sudo apt-key add Bacula-4096-Distribution-Verification-key.asc rm Bacula-4096-Distribution-Verification-key.asc ``` **Note:** For newer Ubuntu versions, you may need to use: ```bash # For Ubuntu 24.04+ wget -qO - https://www.bacula.org/downloads/Bacula-4096-Distribution-Verification-key.asc | \ sudo gpg --dearmor -o /usr/share/keyrings/bacula-archive-keyring.gpg ``` ### 4.3 Configure Bacula Repository Create repository configuration file: ```bash sudo nano /etc/apt/sources.list.d/Bacula-Community.list ``` Add the following (replace placeholders): ```bash # Bacula Community Repository deb [arch=amd64] https://www.bacula.org/packages/@access-key@/debs/@bacula-version@ @ubuntu-version@ main ``` **Example for Ubuntu 24.04 (Noble) with Bacula 13.0.1:** ```bash # Bacula Community Repository deb [arch=amd64] https://www.bacula.org/packages/YOUR_ACCESS_KEY/debs/13.0.1 noble main ``` **Where:** - `@access-key@` - Your personalized access key from Bacula registration - `@bacula-version@` - Bacula version (e.g., 13.0.1) - `@ubuntu-version@` - Ubuntu codename (e.g., `noble` for 24.04) **Note:** You need to register at [Bacula.org](https://www.bacula.org) to get your access key. ### 4.4 Alternative: Using Distribution Packages If you don't have a Bacula access key, you can use Ubuntu's default repository: ```bash # Add to /etc/apt/sources.list.d/Bacula-Community.list deb http://archive.ubuntu.com/ubuntu noble universe ``` Then install from Ubuntu repository: ```bash sudo apt-get update sudo apt-get install -y bacula-postgresql ``` **Note:** Ubuntu repository may have older versions. For latest features, use official Bacula repository. ### 4.5 Update Package Lists ```bash sudo apt-get update ``` ### 4.6 Install PostgreSQL (if not installed) Calypso installer should have already installed PostgreSQL. If not: ```bash sudo apt-get install -y postgresql postgresql-client postgresql-contrib sudo systemctl enable postgresql sudo systemctl start postgresql ``` ### 4.7 Install Bacula Packages Install Bacula with PostgreSQL backend: ```bash sudo apt-get install -y bacula-postgresql ``` During installation, you'll be prompted: - **Configure database for bacula-postgresql with dbconfig-common?** → Choose **Yes** - Enter and confirm database password This will: - Create Bacula database - Create Bacula database user - Initialize database schema - Configure basic Bacula services ### 4.8 Install Additional Components (Optional) ```bash # Install Bacula client (for local backups) sudo apt-get install -y bacula-client # Install Bacula console (management tool) sudo apt-get install -y bacula-console # Install Bacula Storage Daemon sudo apt-get install -y bacula-sd # Install aligned plugin (for ZFS deduplication) sudo apt-get install -y bacula-aligned ``` --- ## 5. Post-Installation Configuration ### 5.1 Verify Installation Check installed packages: ```bash dpkg -l | grep bacula ``` Check services: ```bash sudo systemctl status bacula-dir sudo systemctl status bacula-sd sudo systemctl status bacula-fd ``` ### 5.2 Directory Structure Bacula installs to `/opt/bacula/`: ``` /opt/bacula/ bin/ - Bacula binaries etc/ - Configuration files lib/ - Shared libraries plugins/ - Plugins (bpipe, aligned, etc.) scripts/ - Helper scripts working/ - Temporary files, PID files ``` ### 5.3 Configuration Files Main configuration files: - `/opt/bacula/etc/bacula-dir.conf` - Director configuration - `/opt/bacula/etc/bacula-sd.conf` - Storage Daemon configuration - `/opt/bacula/etc/bacula-fd.conf` - File Daemon configuration - `/opt/bacula/etc/bconsole.conf` - Console configuration ### 5.4 Database Configuration Bacula uses PostgreSQL database. Verify connection: ```bash # Check database exists sudo -u postgres psql -l | grep bacula # Connect to Bacula database sudo -u postgres psql -d bacula # List tables \dt # Exit \q ``` ### 5.5 Test Configuration Test each component: ```bash # Test Director configuration sudo /opt/bacula/bin/bacula-dir -t -u bacula -g bacula # Test Storage Daemon configuration sudo /opt/bacula/bin/bacula-sd -t -u bacula -g bacula # Test File Daemon configuration sudo /opt/bacula/bin/bacula-fd -t -u bacula -g bacula ``` --- ## 6. Integration with Calypso ### 6.1 Database Integration Calypso can access Bacula database directly. Ensure Calypso database user has access: ```bash # Grant access to Calypso user (if using separate databases) sudo -u postgres psql -c "GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA public TO calypso;" bacula ``` ### 6.2 bconsole Integration Calypso uses `bconsole` to execute Bacula commands. Verify bconsole works: ```bash sudo -u bacula /opt/bacula/bin/bconsole ``` In bconsole, test commands: ``` * status director * show jobs * quit ``` ### 6.3 Service Management Bacula services are managed via systemd: ```bash # Start services sudo systemctl start bacula-dir sudo systemctl start bacula-sd sudo systemctl start bacula-fd # Enable on boot sudo systemctl enable bacula-dir sudo systemctl enable bacula-sd sudo systemctl enable bacula-fd # Check status sudo systemctl status bacula-dir ``` --- ## 7. Basic Configuration ### 7.1 Director Configuration Edit `/opt/bacula/etc/bacula-dir.conf`: ```bash sudo nano /opt/bacula/etc/bacula-dir.conf ``` Key sections to configure: - **Director** - Director name and password - **Catalog** - Database connection - **Storage** - Storage daemon connection - **Pool** - Backup pool configuration - **Schedule** - Backup schedules - **Client** - Client definitions ### 7.2 Storage Daemon Configuration Edit `/opt/bacula/etc/bacula-sd.conf`: ```bash sudo nano /opt/bacula/etc/bacula-sd.conf ``` Key sections: - **Storage** - Storage daemon name - **Director** - Director connection - **Device** - Storage devices (disk, tape, etc.) ### 7.3 File Daemon Configuration Edit `/opt/bacula/etc/bacula-fd.conf`: ```bash sudo nano /opt/bacula/etc/bacula-fd.conf ``` Key sections: - **Director** - Director connection - **FileDaemon** - File daemon settings ### 7.4 Reload Configuration After editing configuration: ```bash # Test configuration first sudo /opt/bacula/bin/bacula-dir -t -u bacula -g bacula # If test passes, reload via bconsole sudo -u bacula /opt/bacula/bin/bconsole * reload * quit # Or restart service sudo systemctl restart bacula-dir ``` --- ## 8. Storage Device Configuration ### 8.1 Disk Storage Configure disk-based storage in `bacula-sd.conf`: ``` Device { Name = FileStorage Media Type = File Archive Device = /srv/calypso/backups LabelMedia = yes Random Access = yes AutomaticMount = yes RemovableMedia = no AlwaysOpen = no } ``` ### 8.2 Tape Storage For physical tape libraries: ``` Device { Name = TapeDrive-0 Media Type = LTO-8 Archive Device = /dev/nst0 AutomaticMount = yes AlwaysOpen = no RemovableMedia = yes RandomAccess = no MaximumFileSize = 10GB MaximumBlockSize = 524288 MaximumOpenWait = 10 min MaximumRewindWait = 2 min MaximumOpenVolumes = 1 LabelMedia = yes AutoChanger = yes ChangerDevice = /dev/sg0 ChangerCommand = "/opt/bacula/scripts/mtx-changer %c %o %S %a %d" } ``` --- ## 9. Client Configuration ### 9.1 Adding a Client in Director Edit `/opt/bacula/etc/bacula-dir.conf` and add: ``` Client { Name = client-fd Address = client.example.com FDPort = 9102 Catalog = MyCatalog Password = "client-password" File Retention = 60 days Job Retention = 6 months AutoPrune = yes } ``` ### 9.2 Installing File Daemon on Client On the client machine: ```bash # Install client package sudo apt-get install -y bacula-client # Edit configuration sudo nano /opt/bacula/etc/bacula-fd.conf ``` Configure: ``` Director { Name = bacula-dir Password = "client-password" } FileDaemon { Name = client-fd FDport = 9102 WorkingDirectory = /opt/bacula/working Pid Directory = /opt/bacula/working Maximum Concurrent Jobs = 2 Plugin Directory = /opt/bacula/plugins } Messages { Name = Standard director = bacula-dir = all, !skipped, !restored } ``` ### 9.3 Test and Start Client ```bash # Test configuration sudo /opt/bacula/bin/bacula-fd -t -u bacula -g bacula # Start service sudo systemctl start bacula-fd sudo systemctl enable bacula-fd ``` --- ## 10. Verification ### 10.1 Check Services ```bash # Check all Bacula services sudo systemctl status bacula-dir sudo systemctl status bacula-sd sudo systemctl status bacula-fd # Check logs sudo journalctl -u bacula-dir -f sudo journalctl -u bacula-sd -f ``` ### 10.2 Test with bconsole ```bash sudo -u bacula /opt/bacula/bin/bconsole ``` Test commands: ``` * status director * status storage * status client=client-fd * show jobs * show pools * show volumes * quit ``` ### 10.3 Run Test Backup Create a test job in Director configuration, then: ```bash sudo -u bacula /opt/bacula/bin/bconsole * run job=TestJob * messages * quit ``` --- ## 11. Upgrade Procedures ### 11.1 Backup Configuration Before upgrading: ```bash # Backup configuration files sudo cp -r /opt/bacula/etc /opt/bacula/etc.backup.$(date +%Y%m%d) # Backup database sudo -u bacula /opt/bacula/scripts/make_catalog_backup.pl MyCatalog sudo cp /opt/bacula/working/bacula.sql /tmp/bacula-backup-$(date +%Y%m%d).sql ``` ### 11.2 Minor Upgrade For minor version upgrades (e.g., 13.0.1 → 13.0.2): ```bash # Update repository version in /etc/apt/sources.list.d/Bacula-Community.list # Update package lists sudo apt-get update # Upgrade packages sudo apt-get upgrade bacula-postgresql ``` ### 11.3 Major Upgrade For major upgrades, follow Bacula's upgrade documentation. Generally: 1. Backup everything 2. Update repository configuration 3. Upgrade packages 4. Run database migration scripts (if provided) 5. Test configuration 6. Restart services --- ## 12. Troubleshooting ### 12.1 Common Issues **Issue: Database connection failed** ```bash # Check PostgreSQL is running sudo systemctl status postgresql # Check database exists sudo -u postgres psql -l | grep bacula # Test connection sudo -u postgres psql -d bacula -c "SELECT version();" ``` **Issue: Service won't start** ```bash # Check configuration syntax sudo /opt/bacula/bin/bacula-dir -t -u bacula -g bacula # Check logs sudo journalctl -u bacula-dir -n 50 # Check permissions ls -la /opt/bacula/working ``` **Issue: bconsole connection failed** ```bash # Check Director is running sudo systemctl status bacula-dir # Check network connectivity telnet localhost 9101 # Verify bconsole.conf cat /opt/bacula/etc/bconsole.conf ``` ### 12.2 Log Locations - **Systemd logs:** `sudo journalctl -u bacula-dir` - **Bacula logs:** `/opt/bacula/working/bacula.log` - **PostgreSQL logs:** `/var/log/postgresql/` --- ## 13. Security Considerations ### 13.1 Passwords - Change default passwords in configuration files - Use strong passwords for Director, Storage, and Client - Store passwords securely (consider using Calypso's secret management) ### 13.2 File Permissions ```bash # Set proper permissions sudo chown -R bacula:bacula /opt/bacula/etc sudo chmod 600 /opt/bacula/etc/*.conf sudo chmod 755 /opt/bacula/bin/* ``` ### 13.3 Network Security - Use firewall rules to restrict access - Consider VPN for remote clients - Use TLS/SSL for network communication (if configured) --- ## 14. Integration with Calypso API ### 14.1 Database Access Calypso can query Bacula database directly: ```sql -- Example: List recent jobs SELECT JobId, Job, Level, JobStatus, StartTime, EndTime FROM Job ORDER BY StartTime DESC LIMIT 10; ``` ### 14.2 bconsole Commands Calypso executes bconsole commands via API: ```bash # Example command execution echo "status director" | sudo -u bacula /opt/bacula/bin/bconsole ``` ### 14.3 Configuration Management Calypso can: - Read Bacula configuration files - Update configuration via API - Apply configuration changes - Monitor Bacula services --- ## 15. Best Practices ### 15.1 Regular Maintenance - **Database backups:** Regular catalog backups - **Log rotation:** Configure log rotation - **Volume management:** Regular volume labeling and testing - **Job monitoring:** Monitor job success/failure rates ### 15.2 Performance Tuning - Adjust concurrent jobs based on system resources - Configure appropriate block sizes for tape devices - Use compression for network backups - Optimize database queries ### 15.3 Monitoring - Set up alerting for failed jobs - Monitor storage capacity - Track backup completion times - Review logs regularly --- ## 16. References - **Official Bacula Documentation:** https://www.bacula.org/documentation/ - **Bacula Community Installation Guide:** https://www.bacula.org/whitepapers/CommunityInstallationGuide.pdf - **Bacula Concept Guide:** https://www.bacula.org/whitepapers/ConceptGuide.pdf - **Bacula Main Manual:** https://www.bacula.org/documentation/documentation/ - **Bacula Support:** https://www.bacula.org/support --- ## 17. Appendix ### 17.1 Default Ports - **Director:** 9101 - **Storage Daemon:** 9103 - **File Daemon:** 9102 - **Console:** Connects to Director on 9101 ### 17.2 Default Users - **System User:** `bacula` - **Database User:** `bacula` - **Database Name:** `bacula` ### 17.3 Important Files - **Configuration:** `/opt/bacula/etc/` - **Binaries:** `/opt/bacula/bin/` - **Working Directory:** `/opt/bacula/working/` - **Logs:** `/opt/bacula/working/bacula.log` - **Scripts:** `/opt/bacula/scripts/` --- ## Document History | Version | Date | Author | Changes | |---------|------|--------|---------| | 1.0 | 2025-01-XX | Development Team | Initial Bacula installation guide for Calypso |