Skip to content

Instantly share code, notes, and snippets.

@wschwab
Last active October 18, 2023 16:58
Show Gist options
  • Save wschwab/e83452d43c9c6a2e1a8239c8c656b518 to your computer and use it in GitHub Desktop.
Save wschwab/e83452d43c9c6a2e1a8239c8c656b518 to your computer and use it in GitHub Desktop.
Fresh Lighthouse install
# modified from https://gist.github.com/quickchase/0a1145ba42ffa414fd06f27234a50eac
# use at your own risk since I am not very experienced at this
# ASSUMING YOU ARE ROOT
# Install needed stuff
apt update && apt install -y wget ufw bash-completion htop net-tools
# Turn on a firewall, open the peering port
ufw allow ssh
ufw allow 9000
echo "y" | ufw enable
# Create a user (e.g. eth)
USERNAME=eth
adduser --system --group ${USERNAME}
# Make lighthouse folder
sudo -u ${USERNAME} mkdir /home/${USERNAME}/lighthouse
cd /home/${USERNAME}/lighthouse
# Download lighthouse
RELEASE=v4.5.0
DOWNLOADURL="https://github.com/sigp/lighthouse/releases/download/${RELEASE}/lighthouse-${RELEASE}-x86_64-unknown-linux-gnu.tar.gz"
sudo -u eth wget -q --show-progress -O ./lighthouse.tar.gz ${DOWNLOADURL}
# Extract and move lighthouse
sudo -u eth tar -xzf lighthouse.tar.gz
mv lighthouse /usr/local/bin/
cat << EOF > /etc/systemd/system/lighthouse.service
[Unit]
Description=Lighthouse Node
Documentation=https://lighthouse-book.sigmaprime.io/
After=network.target
[Service]
User=${USERNAME}
Group=${USERNAME}
WorkingDirectory=/home/${USERNAME}/lighthouse
Restart=on-failure
LimitNOFILE=1000000
ExecStart=/usr/local/bin/lighthouse beacon_node \\
--network="mainnet" \\
--datadir="/home/${USERNAME}/lighthouse/data" \\
--execution-endpoint="http://localhost:8551" \\
--execution-jwt="/home/${USERNAME}/jwtsecret" \\
--http \\
--http-address="0.0.0.0" \\
--http-allow-origin="*" \\
--metrics \\
--metrics-address="0.0.0.0" \\
--metrics-allow-origin="*"
[Install]
WantedBy=default.target
EOF
systemctl enable lighthouse.service
systemctl start lighthouse.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment