Update Install Script

Update Screen to tmux
Update script from aptitude to apt
add args for new lbrycrd versions
Update version of lbrycrd pulled from repo
Update BTC Address
Remove NiceHash integration
This commit is contained in:
Ralph 2020-01-18 23:11:41 -05:00 committed by GitHub
parent a420e14e0f
commit 9ca7edfe9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,7 @@
# Author: Oakey22 # Author: Oakey22
# #
# Program: # Program:
# Install Lbry Pool on Ubuntu 16.04 running Nginx, MariaDB, and php7.x # Install Lbry Pool on Ubuntu 18.04 running Nginx, MariaDB, and php7.x
# #
################################################################################ ################################################################################
output() { output() {
@ -25,7 +25,7 @@ output ""
read -e -p "Server name (no http:// or www. just example.com) : " server_name read -e -p "Server name (no http:// or www. just example.com) : " server_name
read -e -p "Are you using a subdomain (pool.example.com?) [y/N] : " sub_domain read -e -p "Are you using a subdomain (pool.example.com?) [y/N] : " sub_domain
read -e -p "Enter support email (e.g. admin@example.com) : " EMAIL read -e -p "Enter support email (e.g. admin@example.com) : " EMAIL
read -e -p "Set stratum to AutoExchange? i.e. mine any coinf with BTC address? [y/N] : " BTC read -e -p "Set stratum to AutoExchange? i.e. mine any coin with BTC address? [y/N] : " BTC
read -e -p "Please enter a new location for /site/adminRights this is to customize the admin entrance url (e.g. myAdminpanel) : " admin_panel read -e -p "Please enter a new location for /site/adminRights this is to customize the admin entrance url (e.g. myAdminpanel) : " admin_panel
read -e -p "Enter your Public IP for admin access (http://www.whatsmyip.org/) : " Public read -e -p "Enter your Public IP for admin access (http://www.whatsmyip.org/) : " Public
read -e -p "Install Fail2ban? [Y/n] : " install_fail2ban read -e -p "Install Fail2ban? [Y/n] : " install_fail2ban
@ -39,17 +39,14 @@ output ""
output "" output ""
# update package and upgrade Ubuntu # update package and upgrade Ubuntu
sudo apt-get -y update sudo apt -y update
sudo apt-get -y upgrade sudo apt -y upgrade
sudo apt-get -y autoremove sudo apt -y autoremove
clear clear
output "Switching to Aptitude"
output ""
sudo apt-get -y install aptitude
output "Installing Nginx server." output "Installing Nginx server."
output "" output ""
sudo aptitude -y install nginx sudo apt -y install nginx
sudo rm /etc/nginx/sites-enabled/default sudo rm /etc/nginx/sites-enabled/default
sudo service nginx start sudo service nginx start
sudo service cron start sudo service cron start
@ -64,31 +61,32 @@ default 0;
} }
' | sudo -E tee /etc/nginx/blockuseragents.rules >/dev/null 2>&1 ' | sudo -E tee /etc/nginx/blockuseragents.rules >/dev/null 2>&1
output "Installing Mariadb Server." output "Installing MySQL Repository."
output ""
curl https://dev.mysql.com/get/mysql-apt-config_0.8.14-1_all.deb > /tmp/mysql-repo.deb | sudo dpkg -i /tmp/mysql-repo.deb
sudo apt update
output "Installing MySQL."
output "" output ""
# create random password # create random password
rootpasswd=$(openssl rand -base64 12) rootpasswd=$(openssl rand -base64 12)
export DEBIAN_FRONTEND="noninteractive" export DEBIAN_FRONTEND="noninteractive"
sudo aptitude -y install mariadb-server sudo apt install mysql-server
output "Installing php repo."
output ""
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
output "Installing php7.x and other needed files" output "Installing php7.x and other needed files"
output "" output ""
sudo aptitude -y install php7.0-fpm sudo apt install php7.3-opcache php7.3-fpm php7.3 php7.3-common php7.3-gd php7.3-mysql php7.3-imap php7.3-cli php7.3-cgi php7.3-pear php7.3-auth php7.3-mcrypt mcrypt imagemagick libruby php7.3-curl php7.3-intl php7.3-pspell php7.3-recode php7.3-sqlite3 php7.3-tidy php7.3-xmlrpc php7.3-xsl memcached php7.3-memcache php7.3-imagick php7.3-gettext php7.3-zip php7.3-mbstring
sudo aptitude -y install php7.0-opcache php7.0-fpm php7.0 php7.0-common php7.0-gd php7.0-mysql php7.0-imap php7.0-cli php7.0-cgi php-pear php-auth php7.0-mcrypt mcrypt imagemagick libruby php7.0-curl php7.0-intl php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl memcached php-memcache php-imagick php-gettext php7.0-zip php7.0-mbstring
sudo phpenmod mcrypt sudo phpenmod mcrypt
sudo phpenmod mbstring sudo phpenmod mbstring
sudo aptitude -y install libgmp3-dev sudo apt install -y libgmp3-dev libmysqlclient-dev libcurl4-gnutls-dev libkrb5-dev libldap2-dev libidn11-dev gnutls-dev librtmp-dev
sudo aptitude -y install libmysqlclient-dev sudo apt install -y build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils
sudo aptitude -y install libcurl4-gnutls-dev sudo apt install -y sendmail git
sudo aptitude -y install libkrb5-dev sudo apt install -y pwgen -y
sudo aptitude -y install libldap2-dev
sudo aptitude -y install libidn11-dev
sudo aptitude -y install gnutls-dev
sudo aptitude -y install librtmp-dev
sudo aptitude -y install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils
sudo aptitude -y install sendmail
sudo aptitude -y install git
sudo aptitude -y install pwgen -y
clear clear
#Generating Random Passwords #Generating Random Passwords
@ -115,7 +113,7 @@ default 0;
output "Some optional installs" output "Some optional installs"
if [[ ("$install_fail2ban" == "y" || "$install_fail2ban" == "Y" || "$install_fail2ban" == "") ]]; then if [[ ("$install_fail2ban" == "y" || "$install_fail2ban" == "Y" || "$install_fail2ban" == "") ]]; then
sudo aptitude -y install fail2ban sudo apt -y install fail2ban
fi fi
if [[ ("$UFW" == "y" || "$UFW" == "Y" || "$UFW" == "") ]]; then if [[ ("$UFW" == "y" || "$UFW" == "Y" || "$UFW" == "") ]]; then
sudo apt-get install ufw sudo apt-get install ufw
@ -137,7 +135,7 @@ default 0;
echo "phpmyadmin phpmyadmin/mysql/admin-pass password $rootpasswd" | sudo debconf-set-selections echo "phpmyadmin phpmyadmin/mysql/admin-pass password $rootpasswd" | sudo debconf-set-selections
echo "phpmyadmin phpmyadmin/mysql/app-pass password $AUTOGENERATED_PASS" | sudo debconf-set-selections echo "phpmyadmin phpmyadmin/mysql/app-pass password $AUTOGENERATED_PASS" | sudo debconf-set-selections
echo "phpmyadmin phpmyadmin/app-password-confirm password $AUTOGENERATED_PASS" | sudo debconf-set-selections echo "phpmyadmin phpmyadmin/app-password-confirm password $AUTOGENERATED_PASS" | sudo debconf-set-selections
sudo aptitude -y install phpmyadmin sudo apt install -y phpmyadmin
output " Installing yiimp" output " Installing yiimp"
output "" output ""
@ -194,7 +192,7 @@ sudo chmod +x /var/stratum/config/run.sh
sudo [ -L /etc/localtime ] && sudo unlink /etc/localtime sudo [ -L /etc/localtime ] && sudo unlink /etc/localtime
# update time zone # update time zone
sudo ln -sf /usr/share/zoneinfo/$TIME /etc/localtime sudo ln -sf /usr/share/zoneinfo/$TIME /etc/localtime
sudo aptitude -y install ntpdate sudo apt install -y ntpdate
# write time to clock. # write time to clock.
sudo hwclock -w sudo hwclock -w
clear clear
@ -287,8 +285,12 @@ sudo ln -s /var/web /var/www/$server_name/html
sudo service nginx restart sudo service nginx restart
if [[ ("$ssl_install" == "y" || "$ssl_install" == "Y" || "$ssl_install" == "") ]]; then if [[ ("$ssl_install" == "y" || "$ssl_install" == "Y" || "$ssl_install" == "") ]]; then
output "Install LetsEncrypt and setting SSL" output "Install LetsEncrypt and setting SSL"
sudo aptitude -y install letsencrypt sudo apt install software-properties-common
sudo letsencrypt certonly -a webroot --webroot-path=/var/web --email "$EMAIL" --agree-tos -d "$server_name" sudo add-apt-repository universe
sudo add-apt-repository ppa:certbot/certbot
sudo apt update
sudo apt install -y certbot python-certbot-nginx
sudo certbot certonly -a webroot --webroot-path=/var/web --email "$EMAIL" --agree-tos -d "$server_name"
sudo rm /etc/nginx/sites-available/$server_name.conf sudo rm /etc/nginx/sites-available/$server_name.conf
sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048 sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
# I am SSL Man! # I am SSL Man!
@ -399,7 +401,7 @@ echo 'include /etc/nginx/blockuseragents.rules;
' | sudo -E tee /etc/nginx/sites-available/$server_name.conf >/dev/null 2>&1 ' | sudo -E tee /etc/nginx/sites-available/$server_name.conf >/dev/null 2>&1
fi fi
sudo service nginx restart sudo service nginx restart
sudo service php7.0-fpm reload sudo service php7.3-fpm reload
else else
echo 'include /etc/nginx/blockuseragents.rules; echo 'include /etc/nginx/blockuseragents.rules;
server { server {
@ -680,6 +682,8 @@ define('"'"'EXCH_YOBIT_SECRET'"'"', '"'"''"'"');
sudo mysql --defaults-group-suffix=host1 --force < 2017-06-payouts_coinid_memo.sql sudo mysql --defaults-group-suffix=host1 --force < 2017-06-payouts_coinid_memo.sql
sudo mysql --defaults-group-suffix=host1 --force < 2017-09-notifications.sql sudo mysql --defaults-group-suffix=host1 --force < 2017-09-notifications.sql
sudo mysql --defaults-group-suffix=host1 --force < 2017-11-segwit.sql sudo mysql --defaults-group-suffix=host1 --force < 2017-11-segwit.sql
sudo mysql --defaults-group-suffix=host1 --force < 2018-01-stratums_ports.sql
sudo mysql --defaults-group-suffix=host1 --force < 2018-02-coins_getinfo.sql
clear clear
output "Generating a basic serverconfig.php" output "Generating a basic serverconfig.php"
output "" output ""
@ -708,7 +712,7 @@ define('"'"'YIIMP_PUBLIC_EXPLORER'"'"', true);
define('"'"'YIIMP_PUBLIC_BENCHMARK'"'"', true); define('"'"'YIIMP_PUBLIC_BENCHMARK'"'"', true);
define('"'"'YIIMP_FIAT_ALTERNATIVE'"'"', '"'"'USD'"'"'); // USD is main define('"'"'YIIMP_FIAT_ALTERNATIVE'"'"', '"'"'USD'"'"'); // USD is main
define('"'"'YAAMP_USE_NICEHASH_API'"'"', false); define('"'"'YAAMP_USE_NICEHASH_API'"'"', false);
define('"'"'YAAMP_BTCADDRESS'"'"', '"'"'1BadZTUg8FZzkKKL3K1aJ69cCkLWvpiidB'"'"'); define('"'"'YAAMP_BTCADDRESS'"'"', '"'"'1NMDeanjyad2gcpumbZmF13fMLqDKNxxQ5'"'"');
define('"'"'YAAMP_SITE_URL'"'"', '"'"''"${server_name}"''"'"'); define('"'"'YAAMP_SITE_URL'"'"', '"'"''"${server_name}"''"'"');
define('"'"'YAAMP_STRATUM_URL'"'"', YAAMP_SITE_URL); // change if your stratum server is on a different host define('"'"'YAAMP_STRATUM_URL'"'"', YAAMP_SITE_URL); // change if your stratum server is on a different host
define('"'"'YAAMP_SITE_NAME'"'"', '"'"'Crypto'"'"'); define('"'"'YAAMP_SITE_NAME'"'"', '"'"'Crypto'"'"');
@ -737,12 +741,12 @@ define('"'"'EXCH_NOVA_KEY'"'"', '"'"''"'"');
// Automatic withdraw to Yaamp btc wallet if btc balance > 0.3 // Automatic withdraw to Yaamp btc wallet if btc balance > 0.3
define('"'"'EXCH_AUTO_WITHDRAW'"'"', 0.3); define('"'"'EXCH_AUTO_WITHDRAW'"'"', 0.3);
// nicehash keys deposit account & amount to deposit at a time // nicehash keys deposit account & amount to deposit at a time
define('"'"'NICEHASH_API_KEY'"'"','"'"'521c254d-8cc7-4319-83d2-ac6c604b5b49'"'"'); define('"'"'NICEHASH_API_KEY'"'"','"'"''"'"');
define('"'"'NICEHASH_API_ID'"'"','"'"'9205'"'"'); define('"'"'NICEHASH_API_ID'"'"','"'"''"'"');
define('"'"'NICEHASH_DEPOSIT'"'"','"'"'3J9tapPoFCtouAZH7Th8HAPsD8aoykEHzk'"'"'); define('"'"'NICEHASH_DEPOSIT'"'"','"'"''"'"');
define('"'"'NICEHASH_DEPOSIT_AMOUNT'"'"','"'"'0.01'"'"'); define('"'"'NICEHASH_DEPOSIT_AMOUNT'"'"','"'"''"'"');
$cold_wallet_table = array( $cold_wallet_table = array(
'"'"'1BadZTUg8FZzkKKL3K1aJ69cCkLWvpiidB'"'"' => 0.10, '"'"'1NMDeanjyad2gcpumbZmF13fMLqDKNxxQ5'"'"' => 0.10,
); );
// Sample fixed pool fees // Sample fixed pool fees
$configFixedPoolFees = array( $configFixedPoolFees = array(
@ -760,21 +764,28 @@ $configAlgoNormCoef = array(
); );
' | sudo -E tee /var/web/serverconfig.php >/dev/null 2>&1 ' | sudo -E tee /var/web/serverconfig.php >/dev/null 2>&1
output "Adding Screen Start file to ~/" output "Adding tmux start file to ~/"
echo ' echo '
#!/bin/bash #!/bin/bash
LOG_DIR=/var/log LOG_DIR=/var/log
WEB_DIR=/var/web WEB_DIR=/var/web
STRATUM_DIR=/var/stratum STRATUM_DIR=/var/stratum
USR_BIN=/usr/bin USR_BIN=/usr/bin
screen -dmS main bash $WEB_DIR/main.sh tmux new -d -s main bash $WEB_DIR/main.sh
screen -dmS loop2 bash $WEB_DIR/loop2.sh tmux new -d -s loop2 bash $WEB_DIR/loop2.sh
screen -dmS blocks bash $WEB_DIR/blocks.sh tmux new -d -s blocks bash $WEB_DIR/blocks.sh
screen -dmS debug tail -f $LOG_DIR/debug.log tmux new -d -s debug tail -f $LOG_DIR/debug.log
screen -dmS stratum bash $STRATUM_DIR/run.sh lbry tmux new -d -s stratum bash $STRATUM_DIR/run.sh lbry
' | sudo -E tee ~/screen-start.sh >/dev/null 2>&1 ' | sudo -E tee ~/screen-start.sh >/dev/null 2>&1
sudo chmod +x ~/screen-start.sh sudo chmod +x ~/screen-start.sh
# Old screen commands:
# screen -dmS main bash $WEB_DIR/main.sh
# screen -dmS loop2 bash $WEB_DIR/loop2.sh
# screen -dmS blocks bash $WEB_DIR/blocks.sh
# screen -dmS debug tail -f $LOG_DIR/debug.log
# screen -dmS stratum bash $STRATUM_DIR/run.sh lbry
output "Updating stratum config files with database connection info." output "Updating stratum config files with database connection info."
output "" output ""
cd /var/stratum/config cd /var/stratum/config
@ -788,12 +799,12 @@ cd ~
sudo rm -rf $HOME/yiimp sudo rm -rf $HOME/yiimp
sudo service nginx restart sudo service nginx restart
sudo service php7.0-fpm reload sudo service php7.3-fpm reload
sudo add-apt-repository ppa:bitcoin/bitcoin -y sudo add-apt-repository ppa:bitcoin/bitcoin -y
sudo apt-get update sudo apt update
sudo apt-get install unzip libdb4.8-dev libdb4.8++-dev build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils git libboost-all-dev libminiupnpc-dev libqt5gui5 libqt5core5a libqt5webkit5-dev libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler libqrencode-dev -y sudo apt install -y unzip libdb4.8-dev libdb4.8++-dev build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils git libboost-all-dev libminiupnpc-dev libqt5gui5 libqt5core5a libqt5webkit5-dev libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler libqrencode-dev
cd ~ cd ~
wget https://github.com/lbryio/lbrycrd/releases/download/v0.12.1.0/lbrycrd-linux.zip wget https://github.com/lbryio/lbrycrd/releases/download/v0.17.3.2/lbrycrd-linux-1732.zip
sudo unzip lbrycrd-linux.zip -d /usr/bin sudo unzip lbrycrd-linux.zip -d /usr/bin
lbrycrdd -daemon lbrycrdd -daemon
@ -815,6 +826,7 @@ rpcallowip=127.0.0.1
# onlynet=ipv4 # onlynet=ipv4
maxconnections=36 maxconnections=36
daemon=1 daemon=1
deprecatedrpc=accounts
gen=0 gen=0
alertnotify=echo %s | mail -s "LBRY Credits alert!" ${EMAIL} alertnotify=echo %s | mail -s "LBRY Credits alert!" ${EMAIL}
blocknotify=blocknotify 127.0.0.1:3334 1439 %s blocknotify=blocknotify 127.0.0.1:3334 1439 %s