hyperledger-fabric Installation Guide

hyperledger-fabric is a free and open-source enterprise blockchain. Fabric provides enterprise-grade permissioned blockchain

Miscellaneous🟡 intermediate7 min⏱️ 15-30 minutes

hyperledger-fabric is a free and open-source enterprise blockchain. Fabric provides enterprise-grade permissioned blockchain

1. Prerequisites

  • Hardware Requirements:
  • CPU: 4+ cores
  • RAM: 8GB minimum
  • Storage: 50GB for ledger
  • Network: gRPC/REST
  • Operating System:
  • Linux: Any modern distribution (RHEL, Debian, Ubuntu, CentOS, Fedora, Arch, Alpine, openSUSE)
  • macOS: 10.14+ (Mojave or newer)
  • Windows: Windows Server 2016+ or Windows 10
  • FreeBSD: 11.0+
  • Network Requirements:
  • Port 7050 (default hyperledger-fabric port)
  • Various services
  • Dependencies:
  • See official documentation for specific requirements
  • System Access: root or sudo privileges required
  • 2. Supported Operating Systems

    This guide supports installation on:

  • RHEL 8/9 and derivatives (CentOS Stream, Rocky Linux, AlmaLinux)
  • Debian 11/12
  • Ubuntu 20.04/22.04/24.04 LTS
  • Arch Linux (rolling release)
  • Alpine Linux 3.18+
  • openSUSE Leap 15.5+ / Tumbleweed
  • SUSE Linux Enterprise Server (SLES) 15+
  • macOS 12+ (Monterey and later)
  • FreeBSD 13+
  • Windows 10/11/Server 2019+ (where applicable)
  • 3. Installation

    RHEL/CentOS/Rocky Linux/AlmaLinux

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

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

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

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

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

    bash
    # Using Homebrew
    brew install hyperledger_fabric
    
    # Start service
    brew services start hyperledger_fabric
    
    # Verify installation
    hyperledger-fabric --version

    FreeBSD

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

    bash
    # Using Chocolatey
    choco install hyperledger_fabric
    
    # Or using Scoop
    scoop install hyperledger_fabric
    
    # Verify installation
    hyperledger-fabric --version

    Initial Configuration

    Basic Configuration

    bash
    # 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)

    bash
    # 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)

    bash
    # 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)

    bash
    # 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)

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

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

    nginx
    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

    apache
    <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

    haproxy
    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

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

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

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

    bash
    #!/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

    bash
    # 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:

    bash
    # 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:

    bash
    # 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:

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

    yaml
    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

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

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

  • Official Documentation: https://docs.hyperledger_fabric.org/
  • GitHub Repository: https://github.com/hyperledger_fabric/hyperledger_fabric
  • Community Forum: https://forum.hyperledger_fabric.org/
  • Best Practices Guide: https://docs.hyperledger_fabric.org/best-practices
  • ---

    Note: This guide is part of the HowToMgr collection. Always refer to official documentation for the most up-to-date information.