Skip to content

Instantly share code, notes, and snippets.

@tosin2013
Created June 3, 2026 18:58
Show Gist options
  • Select an option

  • Save tosin2013/cddf61d19cb1bca8c44e0e9eeaa4502c to your computer and use it in GitHub Desktop.

Select an option

Save tosin2013/cddf61d19cb1bca8c44e0e9eeaa4502c to your computer and use it in GitHub Desktop.
pmb_centos10_setup.sh
#!/usr/bin/env bash
# PMB (Personal Memory Brain) Deployment Script for CentOS 10 Stream
# This script sets up the host environment, clones PMB, installs it into a venv,
# and configures a systemd service to run the PMB dashboard.
set -euo pipefail
echo "======================================================="
echo " Starting PMB Setup for CentOS 10 Stream"
echo "======================================================="
# Ensure script is run as root for system-wide configurations
if [ "$EUID" -ne 0 ]; then
echo "Please run as root or using sudo."
exit 1
fi
# 1. Update system and install dependencies
echo ">>> Updating system packages and installing dependencies..."
dnf update -y
dnf install -y git python3 python3-pip python3-devel gcc make
# Verify python3 version
PYTHON_VERSION=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
echo ">>> Python $PYTHON_VERSION installed."
# 2. Setup user and directories
PMB_USER="pmb"
if ! id "$PMB_USER" &>/dev/null; then
echo ">>> Creating user $PMB_USER..."
useradd -m -s /bin/bash "$PMB_USER"
fi
INSTALL_DIR="/opt/pmb"
echo ">>> Setting up installation directory at $INSTALL_DIR..."
mkdir -p "$INSTALL_DIR"
chown "$PMB_USER:$PMB_USER" "$INSTALL_DIR"
# 3. Clone repository and set up virtual environment
echo ">>> Cloning PMB repository and setting up Python virtual environment..."
su - "$PMB_USER" -c "
if [ ! -d \"$INSTALL_DIR/.git\" ]; then
git clone https://github.com/oleksiijko/pmb.git \"$INSTALL_DIR\"
else
cd \"$INSTALL_DIR\" && git pull
fi
cd \"$INSTALL_DIR\"
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -e \".[all]\"
"
# 4. Create a system-wide symlink so 'pmb' and 'pmb-mcp' are on PATH for all users
echo ">>> Creating system-wide symlinks for pmb commands..."
ln -sf "$INSTALL_DIR/.venv/bin/pmb" /usr/local/bin/pmb
ln -sf "$INSTALL_DIR/.venv/bin/pmb-mcp" /usr/local/bin/pmb-mcp
# 5. Configure Systemd Service for Dashboard
SERVICE_FILE="/etc/systemd/system/pmb-dashboard.service"
echo ">>> Creating systemd service for PMB Dashboard at $SERVICE_FILE..."
cat > "$SERVICE_FILE" <<EOF
[Unit]
Description=PMB Dashboard Service
After=network.target
[Service]
Type=simple
User=$PMB_USER
Group=$PMB_USER
WorkingDirectory=$INSTALL_DIR
Environment="PMB_HOME=/home/$PMB_USER/.pmb"
ExecStart=$INSTALL_DIR/.venv/bin/pmb dashboard --host 0.0.0.0 --port 8765
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable pmb-dashboard
systemctl start pmb-dashboard
# 6. Configure Firewalld (if active)
echo ">>> Configuring firewall to open port 8765..."
if systemctl is-active --quiet firewalld; then
firewall-cmd --permanent --add-port=8765/tcp
firewall-cmd --reload
echo ">>> Port 8765 opened in firewalld."
else
echo ">>> Firewalld is not active, skipping firewall configuration."
fi
echo "======================================================="
echo " PMB Setup Complete!"
echo ""
echo " The 'pmb' command is now available system-wide."
echo " Run it as any user (no sudo needed for normal use):"
echo ""
echo " pmb doctor # verify installation"
echo " pmb stats # show memory workspace stats"
echo " pmb connect claude # wire into Claude Code"
echo " pmb tui # open the terminal UI"
echo " pmb dashboard # open web UI on :8765"
echo ""
echo " The PMB dashboard service is running at:"
echo " http://<your-server-ip>:8765"
echo ""
echo " Service management:"
echo " sudo systemctl status pmb-dashboard"
echo " sudo journalctl -u pmb-dashboard -f"
echo "======================================================="
@tosin2013

tosin2013 commented Jun 3, 2026

Copy link
Copy Markdown
Author
curl -OL https://gist.githubusercontent.com/tosin2013/cddf61d19cb1bca8c44e0e9eeaa4502c/raw/62ab8c3568a7ec121499a69073166f0cdacec5b4/pmb_centos10_setup.sh
chmod +x pmb_centos10_setup.sh
sudo ./pmb_centos10_setup.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment