diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index fa64b7c5..b2c7d456 --- a/install.sh +++ b/install.sh @@ -1,14 +1,6 @@ #!/bin/bash -################################################################################ -# Author: -# -# Web: blocksuckernation.com -# -# Program: -# Install yiimp on Ubuntu 16.04 running Nginx, MariaDB, and php7.x -# BTC Donation: -# -################################################################################ +# vim:ts=4:sw=4:ai:et:si:sts=4 + output() { printf "\E[0;33;40m" echo $1 @@ -21,26 +13,18 @@ displayErr() { echo exit 1; } -clear -output "Make sure you double check before hitting enter! Only one shot at these!" -output "" - read -e -p "Enter time zone (e.g. America/New_York) : " TIME - 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 "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 "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 "Install Fail2ban? [Y/n] : " install_fail2ban - read -e -p "Install UFW and configure ports? [Y/n] : " UFW - read -e -p "Install LetsEncrypt SSL? IMPORTANT! You MUST have your domain name pointed to this server prior to running the script!! [Y/n]: " ssl_install - - clear - output "If you found this helpful, please donate to BTC Donation: " - output "" - output "Updating system and installing required packages." - output "" - + +export TERM=vt100 +TIME="America/Los_Angeles" +server_name=pool.mycryptocoins.net +sub_domain=y +EMAIL=gjhurlbu@gmail.com +admin_panel=adminPanel +install_fail2ban=y +UFW=n +ssl_install=y +send_email=n + # update package and upgrade Ubuntu sudo apt-get -y update sudo apt-get -y upgrade @@ -67,31 +51,40 @@ default 0; } ' | sudo -E tee /etc/nginx/blockuseragents.rules >/dev/null 2>&1 - output "Installing Mariadb Server." + output "Installing MySQL Server." output "" # create random password rootpasswd=$(openssl rand -base64 12) + echo "mysql-server-5.7 mysql-server/root_password password ${rootpasswd}" | sudo debconf-set-selections + echo "mysql-server-5.7 mysql-server/root_password_again password ${rootpasswd}" | sudo debconf-set-selections export DEBIAN_FRONTEND="noninteractive" - sudo aptitude -y install mariadb-server + sudo -E aptitude -y install mysql-server output "Installing php7.x and other needed files" output "" - sudo aptitude -y install php7.0-fpm - 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 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-sasl 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 php7.0-mbstring sudo phpenmod mcrypt sudo phpenmod mbstring - sudo aptitude -y install libgmp3-dev - sudo aptitude -y install libmysqlclient-dev - sudo aptitude -y install libcurl4-gnutls-dev - sudo aptitude -y install libkrb5-dev - 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 + sudo aptitude -y install libgmp3-dev \ + libmysqlclient-dev \ + libcurl4-gnutls-dev \ + libkrb5-dev \ + libldap2-dev \ + libidn11-dev \ + libidn2-0-dev \ + libpsl-dev \ + gnutls-dev \ + librtmp-dev \ + build-essential libtool autotools-dev automake pkg-config \ + libssl-dev libevent-dev bsdmainutils \ + sendmail \ + git \ + pwgen clear #Generating Random Passwords @@ -166,6 +159,7 @@ default 0; 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/app-password-confirm password $AUTOGENERATED_PASS" | sudo debconf-set-selections + sudo service mysql restart sudo aptitude -y install phpmyadmin output " Installing yiimp" @@ -217,7 +211,6 @@ exec bash ' | sudo -E tee /var/stratum/config/run.sh >/dev/null 2>&1 sudo chmod +x /var/stratum/config/run.sh output "Update default timezone." - output "Thanks for using this installation script. Donations welcome" # check if link file sudo [ -L /etc/localtime ] && sudo unlink /etc/localtime # update time zone @@ -240,8 +233,8 @@ echo 'include /etc/nginx/blockuseragents.rules; if ($request_method !~ ^(GET|HEAD|POST)$) { return 444; } - listen 80; - listen [::]:80; + listen 8088; + listen [::]:8088; server_name '"${server_name}"'; root "/var/www/'"${server_name}"'/html/web"; index index.html index.htm index.php; @@ -328,8 +321,8 @@ echo 'include /etc/nginx/blockuseragents.rules; if ($request_method !~ ^(GET|HEAD|POST)$) { return 444; } - listen 80; - listen [::]:80; + listen 8088; + listen [::]:8088; server_name '"${server_name}"'; # enforce https return 301 https://$server_name$request_uri; @@ -437,8 +430,8 @@ echo 'include /etc/nginx/blockuseragents.rules; if ($request_method !~ ^(GET|HEAD|POST)$) { return 444; } - listen 80; - listen [::]:80; + listen 8088; + listen [::]:8088; server_name '"${server_name}"' www.'"${server_name}"'; root "/var/www/'"${server_name}"'/html/web"; index index.html index.htm index.php; @@ -525,8 +518,8 @@ echo 'include /etc/nginx/blockuseragents.rules; if ($request_method !~ ^(GET|HEAD|POST)$) { return 444; } - listen 80; - listen [::]:80; + listen 8088; + listen [::]:8088; server_name '"${server_name}"'; # enforce https return 301 https://$server_name$request_uri; @@ -628,18 +621,6 @@ sudo service php7.0-fpm reload fi clear output "Now for the database fun!" - # create database - Q1="CREATE DATABASE IF NOT EXISTS yiimpfrontend;" - Q2="GRANT ALL ON *.* TO 'panel'@'localhost' IDENTIFIED BY '$password';" - Q3="FLUSH PRIVILEGES;" - SQL="${Q1}${Q2}${Q3}" - sudo mysql -u root -p="" -e "$SQL" - # create stratum user - Q1="GRANT ALL ON *.* TO 'stratum'@'localhost' IDENTIFIED BY '$password2';" - Q2="FLUSH PRIVILEGES;" - SQL="${Q1}${Q2}" - sudo mysql -u root -p="" -e "$SQL" - #Create my.cnf echo ' @@ -659,6 +640,21 @@ password='"${rootpasswd}"' ' | sudo -E tee ~/.my.cnf >/dev/null 2>&1 sudo chmod 0600 ~/.my.cnf + # create database + Q1="CREATE DATABASE IF NOT EXISTS yiimpfrontend;" + Q2="GRANT ALL ON *.* TO 'panel'@'localhost' IDENTIFIED BY '$password';" + Q3="FLUSH PRIVILEGES;" + SQL="${Q1}${Q2}${Q3}" + #sudo mysql -u root -p="" -e "$SQL" + sudo mysql -e "$SQL" + # create stratum user + Q1="GRANT ALL ON *.* TO 'stratum'@'localhost' IDENTIFIED BY '$password2';" + Q2="FLUSH PRIVILEGES;" + SQL="${Q1}${Q2}" + #sudo mysql -u root -p="" -e "$SQL" + sudo mysql -e "$SQL" + + #Create keys file echo '