fix storage

This commit is contained in:
2026-01-09 16:54:39 +00:00
parent dcb54c26ec
commit 7b91e0fd24
37 changed files with 3283 additions and 1227 deletions

View File

@@ -1,443 +0,0 @@
# Bacula Configuration Guide
## For Calypso Backup Appliance
**Version:** 1.0
**Target OS:** Ubuntu Server 24.04 LTS
---
## 1. Overview
This guide covers advanced configuration of Bacula for integration with Calypso backup appliance, including storage pools, schedules, clients, and job definitions.
---
## 2. Configuration Files
### 2.1 Main Configuration Files
- **Director:** `/opt/bacula/etc/bacula-dir.conf`
- **Storage Daemon:** `/opt/bacula/etc/bacula-sd.conf`
- **File Daemon:** `/opt/bacula/etc/bacula-fd.conf`
- **Console:** `/opt/bacula/etc/bconsole.conf`
### 2.2 Configuration File Structure
Each configuration file contains:
- **Resource definitions** (Director, Storage, Client, etc.)
- **Directives** (settings and options)
- **Comments** (documentation)
---
## 3. Director Configuration
### 3.1 Director Resource
```conf
Director {
Name = bacula-dir
DIRport = 9101
QueryFile = "/opt/bacula/scripts/query.sql"
WorkingDirectory = "/opt/bacula/working"
PidDirectory = "/opt/bacula/working"
Maximum Concurrent Jobs = 10
Password = "director-password"
Messages = Daemon
}
```
### 3.2 Catalog Resource
```conf
Catalog {
Name = MyCatalog
dbname = "bacula"
dbuser = "bacula"
dbpassword = "bacula-db-password"
dbaddress = "localhost"
dbport = 5432
}
```
### 3.3 Storage Resource
```conf
Storage {
Name = FileStorage
Address = localhost
SDPort = 9103
Password = "storage-password"
Device = FileStorage
Media Type = File
}
```
### 3.4 Pool Resource
```conf
Pool {
Name = DefaultPool
Pool Type = Backup
Recycle = yes
AutoPrune = yes
Volume Retention = 365 days
Maximum Volume Bytes = 50G
Maximum Volumes = 100
Label Format = "Volume-"
}
```
### 3.5 Schedule Resource
```conf
Schedule {
Name = WeeklyCycle
Run = Full 1st sun at 2:05
Run = Differential 2nd-5th sun at 2:05
Run = Incremental mon-sat at 2:05
}
```
### 3.6 Client Resource
```conf
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
}
```
### 3.7 Job Resource
```conf
Job {
Name = "BackupClient"
Type = Backup
Client = client-fd
FileSet = "Full Set"
Schedule = WeeklyCycle
Storage = FileStorage
Pool = DefaultPool
Messages = Standard
Priority = 10
Write Bootstrap = "/opt/bacula/working/BackupClient.bsr"
}
```
### 3.8 FileSet Resource
```conf
FileSet {
Name = "Full Set"
Include {
Options {
signature = MD5
compression = GZIP
}
File = /home
File = /etc
File = /var
}
Exclude {
File = /tmp
File = /proc
File = /sys
File = /.snapshot
}
}
```
---
## 4. Storage Daemon Configuration
### 4.1 Storage Resource
```conf
Storage {
Name = FileStorage
WorkingDirectory = "/opt/bacula/working"
Pid Directory = "/opt/bacula/working"
Maximum Concurrent Jobs = 20
}
```
### 4.2 Director Resource (in SD)
```conf
Director {
Name = bacula-dir
Password = "storage-password"
}
```
### 4.3 Device Resource (Disk)
```conf
Device {
Name = FileStorage
Media Type = File
Archive Device = /srv/calypso/backups
LabelMedia = yes
Random Access = yes
AutomaticMount = yes
RemovableMedia = no
AlwaysOpen = no
Maximum Concurrent Jobs = 5
}
```
### 4.4 Device Resource (Tape)
```conf
Device {
Name = TapeDrive-0
Media Type = LTO-8
Archive Device = /dev/nst0
AutomaticMount = yes
AlwaysOpen = no
RemovableMedia = yes
RandomAccess = no
MaximumFileSize = 10GB
MaximumBlockSize = 524288
AutoChanger = yes
ChangerDevice = /dev/sg0
ChangerCommand = "/opt/bacula/scripts/mtx-changer %c %o %S %a %d"
}
```
---
## 5. File Daemon Configuration
### 5.1 Director Resource (in FD)
```conf
Director {
Name = bacula-dir
Password = "client-password"
}
```
### 5.2 FileDaemon Resource
```conf
FileDaemon {
Name = client-fd
FDport = 9102
WorkingDirectory = /opt/bacula/working
Pid Directory = /opt/bacula/working
Maximum Concurrent Jobs = 2
Plugin Directory = /opt/bacula/plugins
}
```
### 5.3 Messages Resource
```conf
Messages {
Name = Standard
director = bacula-dir = all, !skipped, !restored
}
```
---
## 6. Integration with Calypso Storage
### 6.1 Using Calypso ZFS Datasets
Configure Bacula to use ZFS datasets managed by Calypso:
```conf
Device {
Name = ZFSStorage
Media Type = File
Archive Device = /srv/calypso/backups/zfs-pool
LabelMedia = yes
Random Access = yes
AutomaticMount = yes
}
```
### 6.2 Using Calypso Storage Repositories
```conf
Device {
Name = CalypsoRepo
Media Type = File
Archive Device = /srv/calypso/backups/repository-1
LabelMedia = yes
Random Access = yes
}
```
---
## 7. Advanced Configuration
### 7.1 Compression
Enable compression in FileSet:
```conf
FileSet {
Name = "Compressed Set"
Include {
Options {
compression = GZIP9
signature = MD5
}
File = /data
}
}
```
### 7.2 Deduplication
For ZFS with deduplication, use aligned plugin:
```conf
FileSet {
Name = "Deduplicated Set"
Include {
Options {
plugin = "aligned"
}
File = /data
}
}
```
### 7.3 Encryption
Enable encryption (requires encryption plugin):
```conf
FileSet {
Name = "Encrypted Set"
Include {
Options {
encryption = AES256
}
File = /sensitive-data
}
}
```
---
## 8. Job Scheduling
### 8.1 Daily Incremental
```conf
Schedule {
Name = DailyIncremental
Run = Incremental daily at 02:00
}
```
### 8.2 Weekly Full
```conf
Schedule {
Name = WeeklyFull
Run = Full weekly on Sunday at 02:00
}
```
### 8.3 Monthly Archive
```conf
Schedule {
Name = MonthlyArchive
Run = Full 1st sun at 01:00
Run = Incremental 2nd-4th sun at 01:00
}
```
---
## 9. Testing Configuration
### 9.1 Test Director
```bash
sudo /opt/bacula/bin/bacula-dir -t -u bacula -g bacula
```
### 9.2 Test Storage Daemon
```bash
sudo /opt/bacula/bin/bacula-sd -t -u bacula -g bacula
```
### 9.3 Test File Daemon
```bash
sudo /opt/bacula/bin/bacula-fd -t -u bacula -g bacula
```
### 9.4 Reload Configuration
After testing, reload:
```bash
sudo -u bacula /opt/bacula/bin/bconsole
* reload
* quit
```
Or restart services:
```bash
sudo systemctl restart bacula-dir
sudo systemctl restart bacula-sd
```
---
## 10. Monitoring and Maintenance
### 10.1 Job Status
```bash
sudo -u bacula /opt/bacula/bin/bconsole
* status director
* show jobs
* messages
```
### 10.2 Volume Management
```bash
* list volumes
* label
* delete volume=Volume-001
```
### 10.3 Database Maintenance
```bash
# Vacuum database
sudo -u postgres psql -d bacula -c "VACUUM ANALYZE;"
# Check database size
sudo -u postgres psql -d bacula -c "SELECT pg_size_pretty(pg_database_size('bacula'));"
```
---
## References
- Bacula Main Manual: https://www.bacula.org/documentation/
- Configuration Examples: `/opt/bacula/etc/` (after installation)

View File

@@ -1,743 +0,0 @@
# 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 |

View File

@@ -0,0 +1,153 @@
# Bacula Installation and Configuration Guide for Ubuntu 24.04
## 1. Introduction
This guide provides step-by-step instructions for installing and configuring Bacula on Ubuntu 24.04. The configuration files will be moved to a custom directory: `/opt/calypso/conf/bacula`.
## 2. Installation
First, update the package lists and install the Bacula components and a PostgreSQL database backend.
```bash
sudo apt-get update
sudo apt-get install -y bacula-director bacula-sd bacula-fd postgresql
```
During the installation, you may be prompted to configure a mail server. You can choose "No configuration" for now.
### 2.1. Install Bacula Console
Install the Bacula console, which provides the `bconsole` command-line utility for interacting with the Bacula Director.
```bash
sudo apt-get install -y bacula-console
```
## 3. Database Configuration
Create the Bacula database and user.
```bash
sudo -u postgres createuser -P bacula
sudo -u postgres createdb -O bacula bacula
```
When prompted, enter a password for the `bacula` user. You will need this password later.
Now, grant privileges to the `bacula` user on the `bacula` database.
```bash
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE bacula TO bacula;"
```
Bacula provides scripts to create the necessary tables in the database.
```bash
sudo /usr/share/bacula-director/make_postgresql_tables.sql | sudo -u postgres psql bacula
```
## 4. Configuration File Migration
Create the new configuration directory and copy the default configuration files.
```bash
sudo mkdir -p /opt/calypso/conf/bacula
sudo cp /etc/bacula/* /opt/calypso/conf/bacula/
sudo chown -R bacula:bacula /opt/calypso/conf/bacula
```
## 5. Systemd Service Configuration
Create override files for the `bacula-director` and `bacula-sd` services to point to the new configuration file locations.
### 5.1. Bacula Director
```bash
sudo mkdir -p /etc/systemd/system/bacula-director.service.d
sudo bash -c 'cat > /etc/systemd/system/bacula-director.service.d/override.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/sbin/bacula-dir -f -c /opt/calypso/conf/bacula/bacula-dir.conf
EOF'
```
### 5.2. Bacula Storage Daemon
```bash
sudo mkdir -p /etc/systemd/system/bacula-sd.service.d
sudo bash -c 'cat > /etc/systemd/system/bacula-sd.service.d/override.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/sbin/bacula-sd -f -c /opt/calypso/conf/bacula/bacula-sd.conf
EOF'
```
### 5.3. Bacula File Daemon
```bash
sudo mkdir -p /etc/systemd/system/bacula-fd.service.d
sudo bash -c 'cat > /etc/systemd/system/bacula-fd.service.d/override.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/sbin/bacula-fd -f -c /opt/calypso/conf/bacula/bacula-fd.conf
EOF'
```
Reload the systemd daemon to apply the changes.
```bash
sudo systemctl daemon-reload
```
## 6. Bacula Configuration
Update the `bacula-dir.conf` and `bacula-sd.conf` files to use the new paths and settings.
### 6.1. Bacula Director Configuration
Edit `/opt/calypso/conf/bacula/bacula-dir.conf` and make the following changes:
* In the `Storage` resource, update the `address` to point to the correct IP address or hostname.
* In the `Catalog` resource, update the `dbuser` and `dbpassword` with the values you set in step 3.
* Update any other paths as necessary.
### 6.2. Bacula Storage Daemon Configuration
Edit `/opt/calypso/conf/bacula/bacula-sd.conf` and make the following changes:
* In the `Storage` resource, update the `SDAddress` to point to the correct IP address or hostname.
* Create a directory for the storage device and set the correct permissions.
```bash
sudo mkdir -p /var/lib/bacula/storage
sudo chown -R bacula:tape /var/lib/bacula/storage
```
* In the `Device` resource, update the `Archive Device` to point to the storage directory you just created. For example:
```
Device {
Name = FileStorage
Media Type = File
Archive Device = /var/lib/bacula/storage
LabelMedia = yes;
Random Access = Yes;
AutomaticMount = yes;
RemovableMedia = no;
AlwaysOpen = no;
}
```
## 7. Starting and Verifying Services
Start the Bacula services and check their status.
```bash
sudo systemctl start bacula-director bacula-sd bacula-fd
sudo systemctl status bacula-director bacula-sd bacula-fd
```
## 8. SELinux/AppArmor
If you are using SELinux or AppArmor, you may need to adjust the security policies to allow Bacula to access the new configuration directory and storage directory. The specific steps will depend on your security policy.

View File

@@ -0,0 +1,102 @@
# ClamAV Installation and Configuration Guide for Ubuntu 24.04
## 1. Introduction
This guide provides step-by-step instructions for installing and configuring ClamAV on Ubuntu 24.04. The configuration files will be moved to a custom directory: `/opt/calypso/conf/clamav`.
## 2. Installation
First, update the package lists and install the `clamav` and `clamav-daemon` packages.
```bash
sudo apt-get update
sudo apt-get install -y clamav clamav-daemon
```
## 3. Configuration File Migration
Create the new configuration directory and copy the default configuration files.
```bash
sudo mkdir -p /opt/calypso/conf/clamav
sudo cp /etc/clamav/clamd.conf /opt/calypso/conf/clamav/clamd.conf
sudo cp /etc/clamav/freshclam.conf /opt/calypso/conf/clamav/freshclam.conf
```
Change the ownership of the new directory to the `clamav` user and group.
```bash
sudo chown -R clamav:clamav /opt/calypso/conf/clamav
```
## 4. Systemd Service Configuration
Create override files for the `clamav-daemon` and `clamav-freshclam` services to point to the new configuration file locations.
### 4.1. clamav-daemon Service
```bash
sudo mkdir -p /etc/systemd/system/clamav-daemon.service.d
sudo bash -c 'cat > /etc/systemd/system/clamav-daemon.service.d/override.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/sbin/clamd --foreground=true --config-file=/opt/calypso/conf/clamav/clamd.conf
EOF'
```
### 4.2. clamav-freshclam Service
```bash
sudo mkdir -p /etc/systemd/system/clamav-freshclam.service.d
sudo bash -c 'cat > /etc/systemd/system/clamav-freshclam.service.d/override.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/bin/freshclam -d --foreground=true --config-file=/opt/calypso/conf/clamav/freshclam.conf
EOF'
```
Reload the systemd daemon to apply the changes.
```bash
sudo systemctl daemon-reload
```
## 5. AppArmor Configuration
By default, AppArmor restricts ClamAV from accessing files outside of its default directories. You need to create local AppArmor override files to allow access to the new configuration directory.
### 5.1. freshclam AppArmor Profile
```bash
sudo echo "/opt/calypso/conf/clamav/freshclam.conf r," > /etc/apparmor.d/local/usr.bin.freshclam
```
### 5.2. clamd AppArmor Profile
```bash
sudo echo "/opt/calypso/conf/clamav/clamd.conf r," > /etc/apparmor.d/local/usr.sbin.clamd
```
You also need to grant execute permissions to the parent directory for the clamav user to be able to traverse it.
```bash
sudo chmod o+x /opt/calypso/conf
```
Reload the AppArmor profiles to apply the changes.
```bash
sudo systemctl reload apparmor
```
## 6. Starting and Verifying Services
Restart the ClamAV services and check their status to ensure they are using the new configuration file.
```bash
sudo systemctl restart clamav-daemon clamav-freshclam
sudo systemctl status clamav-daemon clamav-freshclam
```
You should see that both services are `active (running)`.

View File

@@ -0,0 +1,90 @@
# mhvtl Installation and Configuration Guide
This guide details the steps to install and configure the `mhvtl` (Virtual Tape Library) on this system, including compiling from source and setting up custom paths.
## 1. Prerequisites
Ensure the necessary build tools are installed on the system.
```bash
sudo apt-get update
sudo apt-get install -y git make gcc
```
## 2. Download and Compile Source Code
First, clone the `mhvtl` source code from the official repository and then compile and install both the kernel module and the user-space utilities.
```bash
# Create a directory for the build process
mkdir /src/calypso/mhvtl_build
# Clone the source code
git clone https://github.com/markh794/mhvtl.git /src/calypso/mhvtl_build
# Compile and install the kernel module
cd /src/calypso/mhvtl_build/kernel
make
sudo make install
# Compile and install user-space daemons and utilities
cd /src/calypso/mhvtl_build
make
sudo make install
```
## 3. Configure Custom Paths
By default, `mhvtl` uses `/etc/mhvtl` for configuration and `/opt/mhvtl` for media. The following steps reconfigure the installation to use custom paths located in `/opt/calypso/`.
### a. Create Custom Directories
Create the directories for the custom configuration and media paths.
```bash
sudo mkdir -p /opt/calypso/conf/vtl/ /opt/calypso/data/vtl/media/
```
### b. Relocate Configuration Files
Copy the default configuration files generated during installation to the new location. Then, update the `device.conf` file to point to the new media directory. Finally, replace the original configuration directory with a symbolic link.
```bash
# Copy default config files to the new directory
sudo cp -a /etc/mhvtl/* /opt/calypso/conf/vtl/
# Update the Home directory path in the new device.conf
sudo sed -i 's|Home directory: /opt/mhvtl|Home directory: /opt/calypso/data/vtl/media|g' /opt/calypso/conf/vtl/device.conf
# Replace the original config directory with a symlink
sudo rm -rf /etc/mhvtl
sudo ln -s /opt/calypso/conf/vtl /etc/mhvtl
```
### c. Relocate Media Data
Move the default media files to the new location and replace the original data directory with a symbolic link.
```bash
# Move the media contents to the new directory
sudo mv /opt/mhvtl/* /opt/calypso/data/vtl/media/
# Replace the original media directory with a symlink
sudo rmdir /opt/mhvtl
sudo ln -s /opt/calypso/data/vtl/media /opt/mhvtl
```
## 4. Start and Verify Services
With the installation and configuration complete, start the `mhvtl` services and verify that they are running correctly.
```bash
# Load the kernel module (this service should now work)
sudo systemctl start mhvtl-load-modules.service
# Start the main mhvtl target, which starts all related daemons
sudo systemctl start mhvtl.target
# Verify the status of the main services
systemctl status mhvtl.target vtllibrary@10.service vtltape@11.service
```

View File

@@ -0,0 +1,102 @@
# mhvtl Installation and Configuration Guide for Ubuntu 24.04
## 1. Introduction
This guide provides step-by-step instructions for installing the mhvtl (Virtual Tape Library) from source on Ubuntu 24.04. The configuration files will be moved to a custom directory: `/opt/calypso/conf/mhvtl`.
**Disclaimer:** Installing `mhvtl` involves compiling a kernel module. This process is complex and can be risky. If your kernel is updated, you will need to recompile and reinstall the `mhvtl` kernel module. Proceed with caution and at your own risk.
## 2. Prerequisites
First, update your package lists and install the necessary build tools and libraries.
```bash
sudo apt-get update
sudo apt-get install -y git build-essential lsscsi sg3-utils zlib1g-dev liblzo2-dev linux-headers-$(uname -r)
```
## 3. Shell Environment
Ubuntu uses `dash` as the default shell, which can cause issues during the `mhvtl` compilation. Temporarily switch to `bash`.
```bash
sudo rm /bin/sh
sudo ln -s /bin/bash /bin/sh
```
## 4. Download and Compile
### 4.1. Download the Source Code
Clone the `mhvtl` repository from GitHub.
```bash
git clone https://github.com/markh794/mhvtl.git
cd mhvtl
```
### 4.2. Compile and Install the Kernel Module
```bash
cd kernel
make
sudo make install
sudo depmod -a
sudo modprobe mhvtl
```
### 4.3. Compile and Install User-Space Daemons
```bash
cd ..
make
sudo make install
```
## 5. Configuration
### 5.1. Create the Custom Configuration Directory
Create the new configuration directory and move the default configuration files.
```bash
sudo mkdir -p /opt/calypso/conf/mhvtl
sudo mv /etc/mhvtl/* /opt/calypso/conf/mhvtl/
sudo rm -rf /etc/mhvtl
```
### 5.2. Systemd Service Configuration
The `mhvtl` installation includes a systemd service file. We need to create an override file to tell the service to use the new configuration directory. The `mhvtl` service file typically uses an environment variable `VTL_CONFIG_PATH` to specify the configuration path.
```bash
sudo mkdir -p /etc/systemd/system/mhvtl.service.d
sudo bash -c 'cat > /etc/systemd/system/mhvtl.service.d/override.conf <<EOF
[Service]
Environment="VTL_CONFIG_PATH=/opt/calypso/conf/mhvtl"
EOF'
```
## 6. Starting and Verifying Services
Reload the systemd daemon, start the `mhvtl` services, and check their status.
```bash
sudo systemctl daemon-reload
sudo systemctl enable mhvtl.target
sudo systemctl start mhvtl.target
sudo systemctl status mhvtl.target
```
You can also use `lsscsi -g` to see if the virtual tape library is recognized.
## 7. Reverting Shell
After the installation is complete, you can revert the shell back to `dash`.
```bash
sudo dpkg-reconfigure dash
```
Select "No" when asked to use `dash` as the default shell.

View File

@@ -0,0 +1,60 @@
# NFS Service Setup Guide
This document outlines the steps taken to set up the NFS (Network File System) service on this machine, with a custom configuration file location.
## Setup Steps
1. **Install NFS Server Package**
The `nfs-kernel-server` package was installed using `apt-get`:
```bash
sudo apt-get install -y nfs-kernel-server
```
2. **Create Custom Configuration Directory**
A dedicated directory for NFS configuration files was created at `/opt/calypso/conf/nfs/`:
```bash
sudo mkdir -p /opt/calypso/conf/nfs/
```
3. **Handle Default `/etc/exports` File**
The default `/etc/exports` file, which typically contains commented-out examples, was removed to prepare for the custom configuration:
```bash
sudo rm /etc/exports
```
4. **Create Custom `exports` Configuration File**
A new `exports` file was created in the custom directory `/opt/calypso/conf/nfs/exports`. This file will be used to define NFS shares. Initially, it contains a placeholder comment:
```bash
sudo echo "# NFS exports managed by Calypso
# Add your NFS exports below. For example:
# /path/to/share *(rw,sync,no_subtree_check)" > /opt/calypso/conf/nfs/exports
```
**Note:** You should edit this file (`/opt/calypso/conf/nfs/exports`) to define your actual NFS shares.
5. **Create Symbolic Link for `/etc/exports`**
A symbolic link was created from the standard `/etc/exports` path to the custom configuration file. This ensures that the NFS service looks for its configuration in the designated `/opt/calypso/conf/nfs/exports` location:
```bash
sudo ln -s /opt/calypso/conf/nfs/exports /etc/exports
```
6. **Start NFS Kernel Server Service**
The NFS kernel server service was started:
```bash
sudo systemctl start nfs-kernel-server
```
7. **Enable NFS Kernel Server on Boot**
The NFS service was enabled to start automatically every time the system boots:
```bash
sudo systemctl enable nfs-kernel-server
```
## How to Configure NFS Shares
To define your NFS shares, edit the file `/opt/calypso/conf/nfs/exports`. After making changes to this file, you must reload the NFS exports using the command:
```bash
sudo exportfs -ra
```
This ensures that the NFS server recognizes your new or modified shares without requiring a full service restart.

View File

@@ -0,0 +1,67 @@
# Samba Installation and Configuration Guide for Ubuntu 24.04
## 1. Introduction
This guide provides step-by-step instructions for installing and configuring Samba on Ubuntu 24.04. The configuration file will be moved to a custom directory: `/etc/calypso/conf/smb`.
## 2. Installation
First, update the package lists and install the `samba` package.
```bash
sudo apt-get update
sudo apt-get install -y samba
```
## 3. Configuration File Migration
Create the new configuration directory and copy the default configuration file.
```bash
sudo mkdir -p /etc/calypso/conf/smb
sudo cp /etc/samba/smb.conf /etc/calypso/conf/smb/smb.conf
```
## 4. Systemd Service Configuration
Create override files for the `smbd` and `nmbd` services to point to the new configuration file location.
### 4.1. smbd Service
```bash
sudo mkdir -p /etc/systemd/system/smbd.service.d
sudo bash -c 'cat > /etc/systemd/system/smbd.service.d/override.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/sbin/smbd --foreground --no-process-group -s /etc/calypso/conf/smb/smb.conf $SMBDOPTIONS
EOF'
```
### 4.2. nmbd Service
```bash
sudo mkdir -p /etc/systemd/system/nmbd.service.d
sudo bash -c 'cat > /etc/systemd/system/nmbd.service.d/override.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/sbin/nmbd --foreground --no-process-group -s /etc/calypso/conf/smb/smb.conf $NMBDOPTIONS
EOF'
```
Reload the systemd daemon to apply the changes.
```bash
sudo systemctl daemon-reload
```
## 5. Starting and Verifying Services
Restart the Samba services and check their status to ensure they are using the new configuration file.
```bash
sudo systemctl restart smbd nmbd
sudo systemctl status smbd nmbd
```
You should see in the status output that the services are being started with the `-s /etc/calypso/conf/smb/smb.conf` option.

View File

@@ -0,0 +1,75 @@
# ZFS Installation and Basic Configuration Guide for Ubuntu 24.04
## 1. Introduction
This guide provides step-by-step instructions for installing ZFS on Ubuntu 24.04. It also shows how to create a custom directory for configuration files at `/opt/calypso/conf/zfs`.
**Disclaimer:** ZFS is a powerful and complex filesystem. This guide provides a basic installation and a simple example. For production environments, it is crucial to consult the official [OpenZFS documentation](https://openzfs.github.io/openzfs-docs/).
## 2. Installation
First, update your package lists and install the `zfsutils-linux` package.
```bash
sudo apt-get update
sudo apt-get install -y zfsutils-linux
```
## 3. Configuration Directory
ZFS configuration is typically stored in `/etc/zfs/`. We will create a custom directory for ZFS-related scripts or non-standard configuration files.
```bash
sudo mkdir -p /opt/calypso/conf/zfs
```
**Important:** The primary ZFS configuration is managed through `zpool` and `zfs` commands and is stored within the ZFS pools themselves. The `/etc/zfs/` directory mainly contains host-specific pool cache information and other configuration files. Manually moving or modifying these files without a deep understanding of ZFS can lead to data loss.
For any advanced configuration that requires modifying ZFS services or configuration files, please refer to the official OpenZFS documentation.
## 4. Creating a ZFS Pool (Example)
This example demonstrates how to create a simple, file-based ZFS pool for testing purposes. This is **not** recommended for production use.
1. **Create a file to use as a virtual disk:**
```bash
sudo fallocate -l 4G /zfs-disk
```
2. **Create a ZFS pool named `my-pool` using the file:**
```bash
sudo zpool create my-pool /zfs-disk
```
3. **Check the status of the new pool:**
```bash
sudo zpool status my-pool
```
4. **Create a ZFS filesystem in the pool:**
```bash
sudo zfs create my-pool/my-filesystem
```
5. **Mount the new filesystem and check its properties:**
```bash
sudo zfs list
```
You should now have a ZFS pool and filesystem ready for use.
## 5. ZFS Services
ZFS uses several systemd services to manage pools and filesystems. You can list them with:
```bash
systemctl list-units --type=service | grep zfs
```
If you need to customize the behavior of these services, it is recommended to use systemd override files rather than editing the main service files directly.