💾Installation
Lighthouse client installation guide.
Create Aliases
echo "alias lighthouse-version-current='/usr/local/bin/lighthouse --version'" >> ~/.bashrc
echo "alias lighthouse-build='~/lighthouse-build.sh'" >> ~/.bashrc
echo "alias lighthouse-version-new='~/.cargo/bin/lighthouse --version'" >> ~/.bashrc
echo "alias lighthouse-deploy='~/lighthouse-deploy.sh'" >> ~/.bashrc
echo "alias lighthouse-beacon-log='journalctl -f -u lighthousebeacon.service -o cat | ccze -A'" >> ~/.bashrc
echo "alias lighthouse-beacon-start='sudo systemctl start lighthousebeacon.service'" >> ~/.bashrc
echo "alias lighthouse-beacon-stop='sudo systemctl stop lighthousebeacon.service'" >> ~/.bashrc
echo "alias lighthouse-beacon-restart='sudo systemctl restart lighthousebeacon.service'" >> ~/.bashrc
echo "alias lighthouse-beacon-status='sudo systemctl status lighthousebeacon.service'" >> ~/.bashrc
echo "alias lighthouse-beacon-config='sudo vim /etc/systemd/system/lighthousebeacon.service'" >> ~/.bashrc
echo "alias lighthouse-beacon-enable='sudo systemctl enable lighthousebeacon.service'" >> ~/.bashrc
echo "alias lighthouse-beacon-disable='sudo systemctl disable lighthousebeacon.service'" >> ~/.bashrc
echo "alias lighthouse-beacon-delete-data='sudo rm -rf /var/lib/lighthouse/beacon; sudo mkdir -p /var/lib/lighthouse/beacon; sudo chown -R lighthousebeacon:lighthousebeacon /var/lib/lighthouse/beacon'" >> ~/.bashrc
source ~/.bashrc
Dependency - Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
<1>
<ENTER>
source $HOME/.cargo/env
Make sure protoc
is installed otherwise the build will fail.
sudo apt-get install -y protobuf-compiler
protoc --version
Lighthouse - Install
Build the latest version of Lighthouse
.
LIGHTHOUSE_VERSION_COMMIT_HASH= # e.g.441fc16
cd ~
git clone https://github.com/sigp/lighthouse.git
cd ~/lighthouse
git checkout ${LIGHTHOUSE_VERSION_COMMIT_HASH}
make
Move the compiled Lighthouse
build to a new directory.
sudo cp ~/.cargo/bin/lighthouse /usr/local/bin
Check version.
/usr/local/bin/lighthouse --version
Create Lighthouse
directory.
sudo mkdir -p /var/lib/lighthouse
Firewall Configuration
Lighthouse BN - Configure Service
Create lighthousebeacon
user and set permissions.
sudo useradd --no-create-home --shell /bin/false lighthousebeacon
sudo mkdir -p /var/lib/lighthouse/beacon
sudo chown -R lighthousebeacon:lighthousebeacon /var/lib/lighthouse/beacon
Configure lighthousebeacon
service using the command line flags.
sudo vim /etc/systemd/system/lighthousebeacon.service
lighthousebeacon.service
[Unit]
Description=Lighthouse Ethereum Client - Beacon Node
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=lighthousebeacon
Group=lighthousebeacon
Restart=always
RestartSec=5
EnvironmentFile=/etc/default/beacon-variables.env
ExecStart=/usr/local/bin/lighthouse bn \
--network ${NETWORK} \
--datadir /var/lib/lighthouse \
--jwt-secrets="/var/lib/jwtsecret" \
--execution-endpoints ${BEACON_EXECUTION_ENDPOINTS} \
--port ${BEACON_P2P_PORT} \
\
--http \
--http-address=${BEACON_HTTP_ADDRESS} \
--http-port=${BEACON_HTTP_PORT} \
--http-allow-origin "*" \
\
--metrics \
--metrics-address ${BEACON_METRICS_ADDR} \
--metrics-port ${BEACON_METRICS_PORT} \
--metrics-allow-origin "*" \
--validator-monitor-auto \
\
--suggested-fee-recipient ${BEACON_SUGGESTED_FEE_RECIPIENT} \
--checkpoint-sync-url ${BEACON_CHECKPOINT_SYNC_URL} \
--builder ${BEACON_BUILDER} \
--reconstruct-historic-states
[Install]
WantedBy=multi-user.target
Start the service and check it's working as expected.
Command Aliases
daemon-reload # Reload any changes made to the lighthousebeacon.service
lighthouse-beacon-enable # Enable the lighthousebeacon.service
lighthouse-beacon-start # Start the lighthousebeacon.service
lighthouse-beacon-status # View the status of the lighthousebeacon.service
lighthouse-beacon-log # View the lighthousebeacon.service logs
Lighthouse - Update Scripts
Create Lighthouse
build script.
vim ~/lighthouse-build.sh
~/lighthouse-build.sh
#!/bin/bash
set -e
cd ~/lighthouse
read -p "Enter the commit hash you want to checkout: " commit_hash
git fetch
git checkout $commit_hash
echo
echo "********************"
echo "Making Lighthouse..."
echo "********************"
make
Create Lighthouse
deploy script.
vim ~/lighthouse-deploy.sh
~/lighthouse-deploy.sh
#!/bin/bash
# set -e # This isn't working correctly, so comment out for now
while true; do
read -p "Are you sure you want to deploy Lighthouse? (Y/N) " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer Y or N.";;
esac
done
# Check if the services exist before checking their status
if systemctl list-units --full -all | grep -Fq lighthousebeacon.service; then
beacon_status=$(sudo systemctl is-active lighthousebeacon.service)
else
beacon_status="not_installed"
fi
if systemctl list-units --full -all | grep -Fq lighthousevalidator.service; then
validator_status=$(sudo systemctl is-active lighthousevalidator.service)
else
validator_status="not_installed"
fi
echo "**********************"
if [ "$beacon_status" = "active" ]; then
echo "Stopping Lighthouse Beacon..."
sudo systemctl stop lighthousebeacon.service
elif [ "$beacon_status" = "not_installed" ]; then
echo "Warning: Lighthouse Beacon service is not installed."
fi
if [ "$validator_status" = "active" ]; then
echo "Stopping Lighthouse Validator..."
sudo systemctl stop lighthousevalidator.service
elif [ "$validator_status" = "not_installed" ]; then
echo "Warning: Lighthouse Validator service is not installed."
fi
echo "Replacing previous version..."
# Check if the file exists before trying to remove it
if [ -f /usr/local/bin/lighthouse ]; then
sudo rm /usr/local/bin/lighthouse
fi
# Check if the source file exists before copying
if [ -f ~/.cargo/bin/lighthouse ]; then
sudo cp ~/.cargo/bin/lighthouse /usr/local/bin
else
echo "Error: Source file does not exist. Installation aborted."
exit 1
fi
if [ "$beacon_status" = "active" ]; then
echo "Restarting Lighthouse Beacon..."
sudo systemctl start lighthousebeacon.service
fi
if [ "$validator_status" = "active" ]; then
echo "Restarting Lighthouse Validator..."
sudo systemctl start lighthousevalidator.service
fi
Make all scripts executable.
chmod u+x ~/lighthouse-build.sh
chmod u+x ~/lighthouse-deploy.sh
Last updated