hyperledger-fabric is a free and open-source enterprise blockchain. Fabric provides enterprise-grade permissioned blockchain
1. Prerequisites
2. Supported Operating Systems
This guide supports installation on:
3. Installation
RHEL/CentOS/Rocky Linux/AlmaLinux
# Install EPEL repository if needed
sudo dnf install -y epel-release
# Install hyperledger-fabric
sudo dnf install -y hyperledger_fabric
# Enable and start service
sudo systemctl enable --now hyperledger-fabric
# Configure firewall
sudo firewall-cmd --permanent --add-port=7050/tcp
sudo firewall-cmd --reload
# Verify installation
hyperledger-fabric --version
Debian/Ubuntu
# Update package index
sudo apt update
# Install hyperledger-fabric
sudo apt install -y hyperledger_fabric
# Enable and start service
sudo systemctl enable --now hyperledger-fabric
# Configure firewall
sudo ufw allow 7050
# Verify installation
hyperledger-fabric --version
Arch Linux
# Install hyperledger-fabric
sudo pacman -S hyperledger_fabric
# Enable and start service
sudo systemctl enable --now hyperledger-fabric
# Verify installation
hyperledger-fabric --version
Alpine Linux
# Install hyperledger-fabric
apk add --no-cache hyperledger_fabric
# Enable and start service
rc-update add hyperledger-fabric default
rc-service hyperledger-fabric start
# Verify installation
hyperledger-fabric --version
openSUSE/SLES
# Install hyperledger-fabric
sudo zypper install -y hyperledger_fabric
# Enable and start service
sudo systemctl enable --now hyperledger-fabric
# Configure firewall
sudo firewall-cmd --permanent --add-port=7050/tcp
sudo firewall-cmd --reload
# Verify installation
hyperledger-fabric --version
macOS
# Using Homebrew
brew install hyperledger_fabric
# Start service
brew services start hyperledger_fabric
# Verify installation
hyperledger-fabric --version
FreeBSD
# Using pkg
pkg install hyperledger_fabric
# Enable in rc.conf
echo 'hyperledger-fabric_enable="YES"' >> /etc/rc.conf
# Start service
service hyperledger-fabric start
# Verify installation
hyperledger-fabric --version
Windows
# Using Chocolatey
choco install hyperledger_fabric
# Or using Scoop
scoop install hyperledger_fabric
# Verify installation
hyperledger-fabric --version
Initial Configuration
Basic Configuration
# Create configuration directory
sudo mkdir -p /etc/hyperledger_fabric
# Set up basic configuration
# See official documentation for detailed configuration options
# Test configuration
hyperledger-fabric --version
5. Service Management
systemd (RHEL, Debian, Ubuntu, Arch, openSUSE)
# Enable service
sudo systemctl enable hyperledger-fabric
# Start service
sudo systemctl start hyperledger-fabric
# Stop service
sudo systemctl stop hyperledger-fabric
# Restart service
sudo systemctl restart hyperledger-fabric
# Check status
sudo systemctl status hyperledger-fabric
# View logs
sudo journalctl -u hyperledger-fabric -f
OpenRC (Alpine Linux)
# Enable service
rc-update add hyperledger-fabric default
# Start service
rc-service hyperledger-fabric start
# Stop service
rc-service hyperledger-fabric stop
# Restart service
rc-service hyperledger-fabric restart
# Check status
rc-service hyperledger-fabric status
rc.d (FreeBSD)
# Enable in /etc/rc.conf
echo 'hyperledger-fabric_enable="YES"' >> /etc/rc.conf
# Start service
service hyperledger-fabric start
# Stop service
service hyperledger-fabric stop
# Restart service
service hyperledger-fabric restart
# Check status
service hyperledger-fabric status
launchd (macOS)
# Using Homebrew services
brew services start hyperledger_fabric
brew services stop hyperledger_fabric
brew services restart hyperledger_fabric
# Check status
brew services list | grep hyperledger_fabric
Windows Service Manager
# Start service
net start hyperledger-fabric
# Stop service
net stop hyperledger-fabric
# Using PowerShell
Start-Service hyperledger-fabric
Stop-Service hyperledger-fabric
Restart-Service hyperledger-fabric
# Check status
Get-Service hyperledger-fabric
Advanced Configuration
See the official documentation for advanced configuration options.
Reverse Proxy Setup
nginx Configuration
upstream hyperledger_fabric_backend {
server 127.0.0.1:7050;
}
server {
listen 80;
server_name hyperledger_fabric.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name hyperledger_fabric.example.com;
ssl_certificate /etc/ssl/certs/hyperledger_fabric.example.com.crt;
ssl_certificate_key /etc/ssl/private/hyperledger_fabric.example.com.key;
location / {
proxy_pass http://hyperledger_fabric_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Apache Configuration
<VirtualHost *:80>
ServerName hyperledger_fabric.example.com
Redirect permanent / https://hyperledger_fabric.example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName hyperledger_fabric.example.com
SSLEngine on
SSLCertificateFile /etc/ssl/certs/hyperledger_fabric.example.com.crt
SSLCertificateKeyFile /etc/ssl/private/hyperledger_fabric.example.com.key
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:7050/
ProxyPassReverse / http://127.0.0.1:7050/
</VirtualHost>
HAProxy Configuration
frontend hyperledger_fabric_frontend
bind *:80
bind *:443 ssl crt /etc/ssl/certs/hyperledger_fabric.pem
redirect scheme https if !{ ssl_fc }
default_backend hyperledger_fabric_backend
backend hyperledger_fabric_backend
balance roundrobin
server hyperledger_fabric1 127.0.0.1:7050 check
Security Configuration
Basic Security Setup
# Set appropriate permissions
sudo chown -R hyperledger_fabric:hyperledger_fabric /etc/hyperledger_fabric
sudo chmod 750 /etc/hyperledger_fabric
# Configure firewall
sudo firewall-cmd --permanent --add-port=7050/tcp
sudo firewall-cmd --reload
# Enable SELinux policies (if applicable)
sudo setsebool -P httpd_can_network_connect on
Database Setup
See official documentation for database configuration requirements.
Performance Optimization
System Tuning
# Basic system tuning
echo 'net.core.somaxconn = 65535' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_max_syn_backlog = 65535' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
Monitoring
Basic Monitoring
# Check service status
sudo systemctl status hyperledger-fabric
# View logs
sudo journalctl -u hyperledger-fabric -f
# Monitor resource usage
top -p $(pgrep hyperledger_fabric)
9. Backup and Restore
Backup Script
#!/bin/bash
# Basic backup script
BACKUP_DIR="/backup/hyperledger_fabric"
DATE=$(date +%Y%m%d_%H%M%S)
mkdir -p "$BACKUP_DIR"
tar -czf "$BACKUP_DIR/hyperledger_fabric-backup-$DATE.tar.gz" /etc/hyperledger_fabric /var/lib/hyperledger_fabric
echo "Backup completed: $BACKUP_DIR/hyperledger_fabric-backup-$DATE.tar.gz"
Restore Procedure
# Stop service
sudo systemctl stop hyperledger-fabric
# Restore from backup
tar -xzf /backup/hyperledger_fabric/hyperledger_fabric-backup-*.tar.gz -C /
# Start service
sudo systemctl start hyperledger-fabric
6. Troubleshooting
Common Issues
1. Service won't start:
# Check logs
sudo journalctl -u hyperledger-fabric -n 100
sudo tail -f /var/log/hyperledger_fabric/hyperledger_fabric.log
# Check configuration
hyperledger-fabric --version
# Check permissions
ls -la /etc/hyperledger_fabric
2. Connection issues:
# Check if service is listening
sudo ss -tlnp | grep 7050
# Test connectivity
telnet localhost 7050
# Check firewall
sudo firewall-cmd --list-all
3. Performance issues:
# Check resource usage
top -p $(pgrep hyperledger_fabric)
# Check disk I/O
iotop -p $(pgrep hyperledger_fabric)
# Check connections
ss -an | grep 7050
Integration Examples
Docker Compose Example
version: '3.8'
services:
hyperledger_fabric:
image: hyperledger_fabric:latest
ports:
- "7050:7050"
volumes:
- ./config:/etc/hyperledger_fabric
- ./data:/var/lib/hyperledger_fabric
restart: unless-stopped
Maintenance
Update Procedures
# RHEL/CentOS/Rocky/AlmaLinux
sudo dnf update hyperledger_fabric
# Debian/Ubuntu
sudo apt update && sudo apt upgrade hyperledger_fabric
# Arch Linux
sudo pacman -Syu hyperledger_fabric
# Alpine Linux
apk update && apk upgrade hyperledger_fabric
# openSUSE
sudo zypper update hyperledger_fabric
# FreeBSD
pkg update && pkg upgrade hyperledger_fabric
# Always backup before updates
tar -czf /backup/hyperledger_fabric-pre-update-$(date +%Y%m%d).tar.gz /etc/hyperledger_fabric
# Restart after updates
sudo systemctl restart hyperledger-fabric
Regular Maintenance
# Log rotation
sudo logrotate -f /etc/logrotate.d/hyperledger_fabric
# Clean old logs
find /var/log/hyperledger_fabric -name "*.log" -mtime +30 -delete
# Check disk usage
du -sh /var/lib/hyperledger_fabric
Additional Resources
---
Note: This guide is part of the HowToMgr collection. Always refer to official documentation for the most up-to-date information.