Improve setup scripts

This commit is contained in:
Taylor Helsper 2019-07-01 22:25:05 -05:00
parent 386266edad
commit f34b540b4a
10 changed files with 19 additions and 266 deletions

View File

@ -11,7 +11,7 @@ echo "Step 1: "
echo " Flash SD Card with Raspberry Pi Image: out/base_images/raspi3_base.img.gz" echo " Flash SD Card with Raspberry Pi Image: out/base_images/raspi3_base.img.gz"
echo " OR" echo " OR"
echo " If you would rather create your own base image, follow the" echo " If you would rather create your own base image, follow the"
echo " manual instructions in setup/setup_image_raspi3.txt" echo " manual instructions in setup/setup_base_image_raspi3.txt"
echo "" echo ""
echo "Press a key when complete..." echo "Press a key when complete..."
read -n 1 read -n 1

View File

@ -11,7 +11,7 @@ echo "Step 1: "
echo " Flash SD Card with Raspberry Pi Image: out/base_images/raspi4_base.img.gz" echo " Flash SD Card with Raspberry Pi Image: out/base_images/raspi4_base.img.gz"
echo " OR" echo " OR"
echo " If you would rather create your own base image, follow the" echo " If you would rather create your own base image, follow the"
echo " manual instructions in setup/setup_image_raspi4.txt" echo " manual instructions in setup/setup_base_image_raspi4.txt"
echo "" echo ""
echo "Press a key when complete..." echo "Press a key when complete..."
read -n 1 read -n 1

View File

@ -11,7 +11,7 @@ echo "Step 1: "
echo " Flash SD Card with Rock64 Image: out/base_images/rock64_base.img.gz" echo " Flash SD Card with Rock64 Image: out/base_images/rock64_base.img.gz"
echo " OR" echo " OR"
echo " If you would rather create your own base image, follow the" echo " If you would rather create your own base image, follow the"
echo " manual instructions in setup/setup_image_rock64.txt" echo " manual instructions in setup/setup_base_image_rock64.txt"
echo "" echo ""
echo "Press a key when complete..." echo "Press a key when complete..."
read -n 1 read -n 1

View File

@ -2,12 +2,12 @@
### Setup Base OS ### Setup Base OS
### ###
# After Raspi Flash # MANUAL: After Raspi Flash
# - Touch ssh file on rootfs # - Touch ssh file on rootfs
# Login as pi / raspberry # Login as pi / raspberry
# MANUAL: Run raspi-config # MANUAL: Run sudo raspi-config
Update 8: Get latest configuration tool Update 8: Get latest configuration tool
Network Options 2: Hostname -> myNode Network Options 2: Hostname -> myNode
Boot Options 3: Choose Desktop / CLI -> Console Boot Options 3: Choose Desktop / CLI -> Console
@ -22,6 +22,10 @@
sudo useradd -p $(openssl passwd -1 bolt) -m -s /bin/bash admin sudo useradd -p $(openssl passwd -1 bolt) -m -s /bin/bash admin
sudo adduser admin sudo sudo adduser admin sudo
# Update OS
sudo apt-get update
sudo apt-get -y upgrade
# Reboot # Reboot
sudo reboot sudo reboot
@ -56,4 +60,3 @@ sync
# - Image with SSH access # - Image with SSH access
# - Root user disabled # - Root user disabled
# - Default user admin with password bolt # - Default user admin with password bolt

View File

@ -4,12 +4,12 @@
# TODO: MAY NEED UPDATES - NEED TO TEST # TODO: MAY NEED UPDATES - NEED TO TEST
# After Raspi Flash # MANUAL: After Raspi Flash
# - Touch ssh file on rootfs # - Touch ssh file on rootfs
# Login as pi / raspberry # Login as pi / raspberry
# MANUAL: Run raspi-config # MANUAL: Run sudo raspi-config
Update 8: Get latest configuration tool Update 8: Get latest configuration tool
Network Options 2: Hostname -> myNode Network Options 2: Hostname -> myNode
Boot Options 3: Choose Desktop / CLI -> Console Boot Options 3: Choose Desktop / CLI -> Console
@ -24,6 +24,10 @@
sudo useradd -p $(openssl passwd -1 bolt) -m -s /bin/bash admin sudo useradd -p $(openssl passwd -1 bolt) -m -s /bin/bash admin
sudo adduser admin sudo sudo adduser admin sudo
# Update OS
sudo apt-get update
sudo apt-get -y upgrade
# Reboot # Reboot
sudo reboot sudo reboot
@ -58,4 +62,3 @@ sync
# - Image with SSH access # - Image with SSH access
# - Root user disabled # - Root user disabled
# - Default user admin with password bolt # - Default user admin with password bolt

View File

@ -38,9 +38,12 @@ apt-get -y install --no-install-recommends expect
useradd -m -s /bin/bash bitcoin || true useradd -m -s /bin/bash bitcoin || true
usermod -a -G debian-tor bitcoin usermod -a -G debian-tor bitcoin
# Install python tools (run twice, some broken deps may cause install failures on first try for line 3)
# Install pip packages
pip install setuptools pip install setuptools
pip install --upgrade setuptools
pip install wheel pip install wheel
pip install --upgrade wheel
pip install speedtest-cli transmissionrpc flask python-bitcoinrpc redis prometheus_client requests pip install speedtest-cli transmissionrpc flask python-bitcoinrpc redis prometheus_client requests
pip install python-pam python-bitcoinlib psutil pip install python-pam python-bitcoinlib psutil
pip install grpcio grpcio-tools googleapis-common-protos pip install grpcio grpcio-tools googleapis-common-protos

View File

@ -1,59 +0,0 @@
###
### Setup myNode Specifics
### Start with <device>_standard_layer_2.img
###
# Log in as admin
# Copy myNode rootfs on top of existing image
FOLDER="rootfs_rock64"
which raspi-config
if [ $? = 0 ]; then
FOLDER="rootfs_raspi"
fi
sudo scp -r <username>@<your ip>:~/GitHub/mynode/out/$FOLDER/* /
# Setup myNode Startup Script
sudo systemctl daemon-reload
sudo systemctl enable mynode
sudo systemctl enable quicksync
sudo systemctl enable torrent_check
sudo systemctl enable firewall
sudo systemctl enable bandwidth
sudo systemctl enable www
sudo systemctl enable drive_check
sudo systemctl enable bitcoind
sudo systemctl enable lnd
sudo systemctl enable lnd_unlock
sudo systemctl enable lnd_backup
sudo systemctl enable lnd_admin_files
sudo systemctl enable lndconnect
sudo systemctl enable redis-server
sudo systemctl enable mongodb
#sudo systemctl enable electrs # DISABLED BY DEFAULT
#sudo systemctl enable lndhub # DISABLED BY DEFAULT
#sudo systemctl enable btc_rpc_explorer # DISABLED BY DEFAULT
sudo systemctl enable tls_proxy
sudo systemctl enable rtl
sudo systemctl enable lnd_admin
# Delete junk
sudo rm -rf /home/admin/download
sudo rm -rf /home/admin/.bash_history
sudo rm -rf /home/bitcoin/.bash_history
sudo rm -rf /root/.bash_history
sudo rm -rf /root/.ssh/known_hosts
sudo rm -rf /etc/resolv.conf
sudo rm -rf /tmp/*
sync
### MAKE IMAGE NOW ###
# This prevents auto gen files like certs to be part of the base image
# Must make sure image can boot after this point and fully come up
# Reboot again
sudo reboot

View File

@ -1,69 +0,0 @@
###
### Setup Base OS
### Start with <device>_start.img.gz
###
# Update OS
sudo apt-get update
sudo apt-get -y upgrade
# Install other tools (run section multiple times to make sure success)
sudo apt-get -y install htop git curl bash-completion jq dphys-swapfile lsof libzmq3-dev
sudo apt-get -y install build-essential python-dev python-pip python3-dev python3-pip
sudo apt-get -y install transmission-cli fail2ban ufw tclsh bluez python-bluez redis-server
sudo apt-get -y install mongodb-server clang hitch zlib1g-dev libffi-dev file toilet ncdu
sudo apt-get -y install toilet-fonts avahi-daemon figlet libsecp256k1-dev
sudo apt-get -y install inotify-tools libssl-dev
# Install other things without recommendation
sudo apt-get -y install --no-install-recommends expect
# Add bitcoin users
sudo useradd -m -s /bin/bash bitcoin
# Install python tools (run twice, some broken deps may cause install failures on first try for line 3)
sudo pip install setuptools
sudo pip install wheel
sudo pip install speedtest-cli transmissionrpc flask python-bitcoinrpc redis prometheus_client requests
sudo pip install python-pam python-bitcoinlib psutil
sudo pip install grpcio grpcio-tools googleapis-common-protos
# Update python3 to 3.7.2
mkdir -p download
cd download
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
tar xf Python-3.7.2.tar.xz
cd Python-3.7.2
./configure
make -j4
sudo make install
cd ../
# Install python3 specific tools (run multiple times to make sure success)
sudo pip3 install wheel setuptools
sudo pip3 install bitstring lnd-grpc pycoin aiohttp connectrum python-bitcoinlib
# Install Rust (Interactive)
curl https://sh.rustup.rs -sSf | sh
# Install node
curl -sL https://deb.nodesource.com/setup_11.x | sudo bash -
sudo apt-get install -y nodejs
# Install node packages
sudo npm install -g pug-cli browserify uglify-js babel-cli
# Remove existing MOTD login info
sudo rm -rf /etc/motd
sudo rm -rf /etc/update-motd.d/*
# Reboot
sudo reboot
######################
### MAKE IMAGE NOW ###
######################

View File

@ -1,128 +0,0 @@
###
### Setup myNode Specifics
### Start with <device>_standard_layer_1.img
###
# Log in as admin
# Install Bitcoin
mkdir -p /tmp/download
cd /tmp/download
ARCH="arm-linux-gnueabihf"
uname -a | grep aarch64
if [ $? = 0 ]; then
ARCH="aarch64-linux-gnu"
fi
BTC_UPGRADE_URL=https://bitcoin.org/bin/bitcoin-core-0.18.0/bitcoin-0.18.0-$ARCH.tar.gz
BTC_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.btc_url
wget $BTC_UPGRADE_URL -O bitcoin.tar.gz
tar -xvf bitcoin.tar.gz
mv bitcoin-* bitcoin
sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin/bin/*
bitcoind --version
sudo su - bitcoin
ln -s /mnt/hdd/mynode/bitcoin /home/bitcoin/.bitcoin
ln -s /mnt/hdd/mynode/lnd /home/bitcoin/.lnd
exit
mkdir /home/admin/.bitcoin
sudo mkdir -p /home/bitcoin/.mynode/
echo $BTC_UPGRADE_URL | sudo tee $BTC_UPGRADE_URL_FILE
sudo chown -R bitcoin:bitcoin /home/bitcoin/.mynode/
# Install Lightning
mkdir -p /tmp/download
cd /tmp/download
sudo mkdir -p /home/bitcoin/.mynode/
LND_UPGRADE_URL=https://github.com/lightningnetwork/lnd/releases/download/v0.6.1-beta/lnd-linux-armv7-v0.6.1-beta.tar.gz
LND_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.lnd_url
wget $LND_UPGRADE_URL -O lnd.tar.gz
tar -xzf lnd.tar.gz
mv lnd-* lnd
sudo install -m 0755 -o root -g root -t /usr/local/bin lnd/*
sudo ln -s /bin/ip /usr/bin/ip
lnd --version
echo $LND_UPGRADE_URL | sudo tee $LND_UPGRADE_URL_FILE
cd ~
sudo chown -R bitcoin:bitcoin /home/bitcoin/.mynode/
# Setup "install" location for some apps
sudo mkdir -p /opt/mynode
sudo chown -R bitcoin:bitcoin /opt/mynode
# Install LND Hub
sudo su - bitcoin
cd /opt/mynode
git clone https://github.com/BlueWallet/LndHub.git
cd LndHub
npm install
ln -s /home/bitcoin/.lnd/tls.cert tls.cert
ln -s /home/bitcoin/.lnd/data/chain/bitcoin/mainnet/admin.macaroon admin.macaroon
exit
# Install electrs (only build to save new version, not included in overlay)
#cd /home/admin/download
#wget https://github.com/romanz/electrs/archive/v0.7.0.tar.gz
#tar -xvf v0.7.0.tar.gz
#cd electrs-0.7.0
#cargo build --release
#sudo install -g root -o root target/release/electrs /usr/bin/electrs
#cd ~
# Install RTL
sudo su - bitcoin
cd /opt/mynode
wget https://github.com/ShahanaFarooqui/RTL/archive/v0.3.3.tar.gz -O RTL.tar.gz
tar -xvf RTL.tar.gz
rm RTL.tar.gz
mv RTL-* RTL
cd RTL
npm install
exit
# Install LND Admin
sudo su - bitcoin
cd /opt/mynode
wget https://github.com/janoside/lnd-admin/archive/v0.10.12.tar.gz -O lnd-admin.tar.gz
tar -xvf lnd-admin.tar.gz
rm lnd-admin.tar.gz
mv lnd-* lnd-admin
cd lnd-admin
npm install
exit
# Install Bitcoin RPC Explorer
sudo su - bitcoin
cd /opt/mynode
wget https://github.com/janoside/btc-rpc-explorer/archive/v1.0.3.tar.gz -O btc-rpc-explorer.tar.gz
tar -xvf btc-rpc-explorer.tar.gz
rm btc-rpc-explorer.tar.gz
mv btc-rpc-* btc-rpc-explorer
cd btc-rpc-explorer
npm install
exit
# Install LND Connect
mkdir -p /tmp/download
cd /tmp/download
wget https://github.com/LN-Zap/lndconnect/releases/download/v0.1.0/lndconnect-linux-armv7-v0.1.0.tar.gz -O lndconnect.tar.gz
tar -xvf lndconnect.tar.gz
rm lndconnect.tar.gz
mv lndconnect-* lndconnect
sudo install -m 0755 -o root -g root -t /usr/local/bin lndconnect/*
sync
### MAKE IMAGE NOW ###
# This prevents auto gen files like certs to be part of the base image
# Must make sure image can boot after this point and fully come up