#!/bin/bash #Item1 Common Command sudo apt-get install python3.8 -y sudo apt-get install python3-pip -y sudo pip3 install cryptography==3.3.2 sudo -H pip3 install --upgrade pip sudo apt-get install grep -y sudo apt-get install git -y sudo pip3 install gitpython sudo apt-get install python3-tk -y sudo apt-get install wget -y sudo apt-get install python3-dev -y sudo apt-get install default-libmysqlclient-dev -y sudo apt-get install build-essential -y #Item2 LAMP echo "start install LAMP" sudo apt-get install tasksel -y sudo DEBIAN_FRONTEND=noninteractive tasksel install lamp-server echo "install phpmyadmin" cd /tmp/;pwd;sudo wget https://files.phpmyadmin.net/phpMyAdmin/5.1.0/phpMyAdmin-5.1.0-all-languages.tar.gz -q;tar -zxvf phpMyAdmin-5.1.0-all-languages.tar.gz;sudo rm phpMyAdmin-5.1.0-all-languages.tar.gz;sudo mv phpMyAdmin-5.1.0-all-languages /var/www/html/phpmyadmin cd /var/www/html/phpmyadmin;pwd;mkdir tmp; cd;pwd; echo "install phpmyadmin done" sudo apt-get install openssl -y sudo apt-get install php-common -y sudo apt-get install php-curl -y sudo apt-get install php-json -y sudo apt-get install php-mbstring -y sudo apt-get install php-mysql -y sudo apt-get install php-xml -y sudo apt-get install php-zip -y #php version sudo apt-get install php7.2-mbstring -y sudo apt-get install php7.2-xml -y sudo apt-get install php7.2-mysql -y sudo apt-get install php7.2-common -y sudo apt-get install php7.2-curl -y sudo apt-get install php7.2-json -y sudo apt-get install php7.2-zip -y echo "open apache2 " sudo service apache2 start echo "setting mysql pass" sudo mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Gold@53743001';" #user='root' #ip='localhost' #pwd='Gold@53743001' #sudo mysql -u root -e "ALTER USER $user@$ip IDENTIFIED WITH mysql_native_password BY $pwd;" echo "setting mysql done" #Item4 Watchdog # get watchdog file proc-wdtd.conf # get watchdog file proc-wdtd # get watchdog file rc.local cd /home/使用者;pwd;sudo git clone -b procwdtdconf --single-branch http://60.250.156.230:3000/fatwolf/proc.git /home/使用者/procwdtdconf/;sudo git clone -b procwdtd --single-branch http://60.250.156.230:3000/fatwolf/proc.git /home/使用者/procwdtd/;sudo git clone -b rclocal --single-branch http://60.250.156.230:3000/fatwolf/proc.git /home/使用者/rclocal/;sudo mv /home/使用者/procwdtdconf/proc-wdtd.conf /etc/;sudo mv /home/使用者/procwdtd/proc-wdtd /usr/sbin/;sudo mv /home/使用者/rclocal/rc.local /etc/;sudo rm -rf /home/使用者/procwdtdconf/;sudo rm -rf /home/使用者/procwdtd/;sudo rm -rf /home/使用者/rclocal/ sudo chmod +x /usr/sbin/proc-wdtd sudo chmod +x /etc/rc.local sudo systemctl restart rc-local.service echo "watchdog file done" #Item6 Python packegs Library cd /home/使用者;pwd;git clone -b package --single-branch http://60.250.156.230:3000/Automatic_build_system/Automatically_install_files.git;cd Automatically_install_files/;pwd;sudo pip3 install -r requirements.txt sudo rm -rf /home/使用者/Automatically_install_files/ #Item7 AP(WebPage) cd /home/使用者;pwd;sudo git clone http://60.250.156.230:3000/rita/CoffeeProject.git /home/使用者/CoffeeProject/ username=使用者;sudo echo 'coffee_manage.py = "sudo python3 /home/'$username'/CoffeeProject/coffee_manage.py"'>>/etc/proc-wdtd.conf cd /home/使用者;pwd;sudo git clone http://60.250.156.230:3000/rita/BBend-Test-JWT.git /home/使用者/BBend-Test-JWT/ username=使用者;sudo echo 'BBend_manage.py = "sudo python3 /home/'$username'/BBend-Test-JWT/manage.py"'>>/etc/proc-wdtd.conf cd /home/使用者;pwd;sudo git clone http://60.250.156.230:3000/Automatic_build_system/Coffee_MySQL.git /home/使用者/Coffee_MySQL/ mysql -u root -pGold@53743001 < "/home/使用者/Coffee_MySQL/Coffee_MySQL.sql"; sudo rm -rf /home/使用者/Coffee_MySQL/ echo "AP done" sudo reboot