Last active
February 28, 2024 16:54
-
-
Save Pymmdrza/cb57c611604e858936a7af3ce3ca0ab0 to your computer and use it in GitHub Desktop.
Blockbook Install in Debian Auto install Bitcoin Explorer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fallocate -l 16G /swapfile | |
chmod 600 /swapfile | |
mkswap /swapfile | |
swapon /swapfile | |
echo “/swapfile swap swap sw 0 0” >> /etc/fstab | |
sysctl vm.swappiness=12&&echo “vm.swappiness = 12” >> /etc/sysctl.conf | |
# // Install Package's and Set Repo | |
apt-get install build-essential libssl-dev libboost-all-dev libdb5.3 libdb5.3-dev libdb5.3++-dev ufw libtool automake libevent-dev bsdmainutils git ntp make g++ gcc autoconf cpp ngrep iftop sysstat autotools-dev pkg-config libminiupnpc-dev libzmq3-dev apt-transport-https ca-certificates curl gnupg2 software-properties-common -y | |
# // Install Auto Docker and Set | |
curl -s https://download.docker.com/linux/debian/gpg | apt-key add && add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | |
apt-get update&&apt-get install docker-ce -y | |
ufw status | |
ufw disable | |
ufw allow 5223/tcp | |
ufw allow 8333/tcp | |
ufw allow 9130/tcp | |
git clone https://github.com/trezor/blockbook.git && cd blockbook | |
make all-bitcoin | |
cd build | |
# set permission | |
chown _apt /root/blockbook/build/backend-bitcoin_26.0-satoshilabs-1_amd64.deb | |
chgrp _apt /root/blockbook/build/backend-bitcoin_26.0-satoshilabs-1_amd64.deb | |
chown _apt /root/blockbook/build/blockbook-bitcoin_0.4.0_amd64.deb | |
chgrp _apt /root/blockbook/build/blockbook-bitcoin_0.4.0_amd64.deb | |
# latest version | |
apt install ./blockbook-bitcoin_0.4.0_amd64.deb ./backend-bitcoin_26.0-satoshilabs-1_amd64.deb -y | |
# start service and enable | |
systemctl start backend-bitcoin | |
systemctl enable backend-bitcoin | |
systemctl start blockbook-bitcoin | |
systemctl enable blockbook-bitcoin | |
systemctl status backend-bitcoin | |
# After Install For See Log's Sync Block Data Can Follow This Command | |
tail -f /opt/coins/data/bitcoin/backend/debug.log | |
# ---------------------------------- | |
apt-get install haproxy | |
nano /etc/haproxy/haproxy.cfg | |
# past in file: | |
frontend haproxynode | |
bind *:80 | |
default_backend backendnodes | |
backend backendnodes | |
server node1 127.0.0.1:9155 ssl verify none | |
# --------------------------------------- | |
# https://github.com/trezor/blockbook/blob/master/docs/ports.md | |
# --------------------------------------- | |
systemctl start haproxy | |
systemctl enable haproxy | |
# install certbot | |
apt-get install certbot -y | |
certbot certonly --standalone -d YOUR_DOMAIN.OR_SUB.DOMAIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
# check if the current user is root | |
if [ "$(id -u)" != "0" ]; then | |
echo "Error: you must be root to execute this script" >&2 | |
exit 1 | |
fi | |
# check if is Mac OS | |
if [ "$(uname)" = "Darwin" ]; then | |
echo "Error: MacOS is not supported" >&2 | |
exit 1 | |
fi | |
# check if is running inside a container | |
if [ -f /.dockerenv ]; then | |
echo "Error: running inside a container is not supported" >&2 | |
exit 1 | |
fi | |
command_exists() { | |
command -v "$@" > /dev/null 2>&1 | |
} | |
if command_exists docker; then | |
echo "Docker already installed" | |
else | |
curl -sSL https://get.docker.com | sh | |
fi | |
docker swarm leave --force 1> /dev/null 2> /dev/null || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get install build-essential -y | |
apt-get install libssl-dev -y | |
apt-get install libboost-all-dev -y | |
apt-get install libdb5.3 -y | |
apt-get install libdb5.3-dev -y | |
apt-get install libdb5.3++-dev -y | |
apt-get install libtool -y | |
apt-get install automake -y | |
apt-get install libevent-dev -y | |
apt-get install bsdmainutils -y | |
apt-get install git -y | |
apt-get install ntp -y | |
apt-get install make -y | |
apt-get install g++ -y | |
apt-get install gcc -y | |
apt-get install autoconf -y | |
apt-get install cpp -y | |
apt-get install ngrep -y | |
apt-get install iftop -y | |
apt-get install sysstat -y | |
apt-get install autotools-dev -y | |
apt-get install pkg-config -y | |
apt-get install libminiupnpc-dev -y | |
apt-get install libzmq3-dev -y | |
apt-get install apt-transport-https -y | |
apt-get install python3-pip -y | |
apt-get install ca-certificates -y | |
apt-get install curl -y | |
apt-get install gnupg2 -y | |
apt-get install software-properties-common -y | |
apt-get install cmake -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git clone https://github.com/trezor/blockbook.git | |
cd blockbook | |
echo -e "\e[90m *** \e[0m Choice Make and Install Node\e[32m Blockchain\e[0m ?" | |
echo -e "\e[90m [\e[32m 1 \e[0m\e[90m]\e[0m Bitcoin\e[90m Make all-bitcoin\e[0m " | |
echo -e "\e[90m [\e[32m 2 \e[0m\e[90m]\e[0m Ethereum\e[90m Make all-ethereum\e[0m " | |
echo -e "\e[90m [\e[32m 3 \e[0m\e[90m]\e[0m Dogecoin\e[90m Make all-dogecoin\e[0m " | |
echo -e "\e[90m [\e[32m 4 \e[0m\e[90m]\e[0m Dash\e[90m Make all-dash\e[0m " | |
echo -e "\e[90m [\e[32m 5 \e[0m\e[90m]\e[0m Litecoin\e[90m Make all-litecoin\e[0m " | |
echo -e "\e[90m [\e[32m 6 \e[0m\e[90m]\e[0m Digibyte\e[90m Make all-digibyte\e[0m " | |
echo -e "\e[90m [\e[32m 7 \e[0m\e[90m]\e[0m Bitcoin Cash\e[90m Make all-bitcoin-cash\e[0m " | |
echo -e "\e[90m [\e[32m 8 \e[0m\e[90m]\e[0m Bitcoin Gold\e[90m Make all-bitcoingold\e[0m " | |
echo -e "\e[90m [\e[32m 9 \e[0m\e[90m]\e[0m BNB\e[90m Make all-binancecoin\e[0m " | |
read -p "Enter your choice: " choice | |
if [ "$choice" == "1" ]; then | |
make all-bitcoin | |
cd build | |
chown _apt backend-bitcoin_26.0-satoshilabs-1_amd64.deb | |
chgrp _apt backend-bitcoin_26.0-satoshilabs-1_amd64.deb | |
chown _apt blockbook-bitcoin_0.4.0_amd64.deb | |
chgrp _apt blockbook-bitcoin_0.4.0_amd64.deb | |
apt install ./blockbook-bitcoin_0.4.0_amd64.deb ./backend-bitcoin_26.0-satoshilabs-1_amd64.deb -y | |
if [ $? -eq 0 ]; then | |
echo "Bitcoin installation successful." | |
iptables -A INPUT -p tcp --dport 9130 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 9030 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 38330 -j ACCEPT | |
if [ ! -d "/etc/iptables" ]; then | |
mkdir -p /etc/iptables | |
touch /etc/iptables/rules.v4 | |
iptables-save > /etc/iptables/rules.v4 | |
systemctl restart iptables | |
fi | |
fi | |
elif [ "$choice" == "2" ]; then | |
make ethereum-all | |
else | |
echo "Invalid choice!" | |
fi | |
if ! command -v ufw &> /dev/null; then | |
apt-get update | |
apt-get install ufw -y | |
fi | |
ufw allow 9130 | |
ufw allow 9030 | |
ufw allow 38330 | |
ufw enable | |
systemctl start backend-bitcoin && echo -e "\e[90m$(date '+%Y-%m-%d %H:%M:%S')\e[0m Starting \e[32mBackend Bitcoin\e[0m Service..." | |
systemctl enable backend-bitcoin && echo -e "\e[90m$(date '+%Y-%m-%d %H:%M:%S')\e[0m Enabled \e[32mBackend Bitcoin\e[0m Service..." | |
systemctl start blockbook-bitcoin && echo -e "\e[90m$(date '+%Y-%m-%d %H:%M:%S')\e[0m Starting \e[32mBlockbook Bitcoin\e[0m Service..." | |
systemctl enable blockbook-bitcoin && echo -e "\e[90m$(date '+%Y-%m-%d %H:%M:%S')\e[0m Enabled \e[32mBlockbook Bitcoin\e[0m Service..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment