#!/bin/bash var1="python 3.8" var2="python3-pip" var3="git" var4="wget" var5="grep" var6="tasksel" var7="lamp-server" var8="phpMyAdmin-5.1.0-all-languages.tar.gz" var9="openssl php-common php-curl php-json php-mbstring php-mysql php-xml php-zip" var10="php7.2-mbstring" var11="php7.2-xml" var12="php7.2-mysql" var13="php7.2-common" var14="php7.2-curl" var15="php7.2-json" var16="php7.2-zip" var17="service apache2 start" var18="setting mysql" var19="paho-mqtt" var20="mosquitto" var21="mqtt server file" var22="watchdog file" var23="golang" var24="" var25="flask" var26="Flask-SQLAlchemy" var27="pymysql" var28="flask_mqtt" var29="flask_migrate" var30="flask-jwt-extended" var31="numpy" var32="pandas" var33="opencv-python==4.2.0.34" var34="BeautifulSoup4" var35="selenium" var36="geocoder" var37="AP" var38="chrony ntpdate" var39="deb ros packages and keyserver" var40="update" var41="upgrade" var42="ros-melodic-desktop-full" var43="ros-melodic-rqt*" var44="python-rosdep" var45="python-rosinstall python-rosinstall-generator python-wstool build-essential" var46="ROS ubuntu 18.04 melodic" '-Dividing line-' sudo apt install "$var1" -y sudo apt-get install "$var2" -y sudo apt-get install "$var3" -y sudo apt-get install "$var4" -y sudo apt-get install "$var5" -y #Item2 LAMP echo "start install LAMP" sudo apt install "$var6" -y sudo tasksel install "$var7" echo "install phpmyadmin" cd /tmp/ pwd wget https://files.phpmyadmin.net/phpMyAdmin/5.1.0/"$var8" tar -zxvf phpMyAdmin-5.1.0-all-languages.tar.gz rm phpMyAdmin-5.1.0-all-languages.tar.gz mv phpMyAdmin-5.1.0-all-languages /var/www/html/phpmyadmin cd /var/www/html/phpmyadmin mkdir /tmp cd sudo apt install "$var9" -y #php version sudo apt install "$var10" -y sudo apt install "$var11" -y sudo apt install "$var12" -y sudo apt install "$var13" -y sudo apt install "$var14" -y sudo apt install "$var15" -y sudo apt install "$var16" -y echo "open apache2 " sudo "$var17" 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" #Item3 MQTT # install&setting mqtt server sudo pip3 install "$var19" -y sudo apt-get install "$var20" -y sudo systemctl start mosquitto sudo systemctl enable mosquitto sudo ufw allow 1883/tcp sudo ufw allow 8080/tcp cd / # get mqtt server file mosquitto.conf git clone -b mosquitto --single-branch http://60.250.156.230:3000/fatwolf/mqtt_server_setting.git /mosquitto/ # get mqtt server file passwd.conf git clone -b passwd --single-branch http://60.250.156.230:3000/fatwolf/mqtt_server_setting.git /passwd/ mv /mosquitto/mosquitto.conf /etc/mosquitto/ mv /passwd/passwd /etc/mosquitto/ rm -rf /mosquitto/ rm -rf /passwd/ sudo systemctl restart mosquitto echo "mqtt server file done" # install&setting mqtt client # to be confirm packegs #cd /usr/sbin/ # get mqtt client file aisky.mqttd #git clone http://60.250.156.230:3000/fatwolf/mqtt_server_setting.git #Item4 Watchdog cd / # get watchdog file proc-wdtd.conf git clone -b procwdtdconf --single-branch http://60.250.156.230:3000/fatwolf/proc.git /procwdtdconf/ # get watchdog file proc-wdtd git clone -b procwdtd --single-branch http://60.250.156.230:3000/fatwolf/proc.git /procwdtd/ #maybe use git clone to copy rc.local file? #sudo nano /etc/rc.local/ # get watchdog file rc.local git clone -b rclocal --single-branch http://60.250.156.230:3000/fatwolf/proc.git /rclocal/ mv /procwdtdconf/proc-wdtd.conf /etc/ mv /procwdtd/proc-wdtd /usr/sbin/ mv /rclocal/rc.local /etc/ rm -rf /procwdtdconf/ rm -rf /procwdtd/ rm -rf /rclocal/ sudo systemctl restart rc-local.service echo "watchdog file done" #Item5 Git Server sudo apt-get install "$var23" -y cd /home/username/ git clone --depth 1 https://github.com/gogs/gogs.git gogs cd gogs/ go build -o gogs echo "Git Server done" # ./gogs web #Item6 Python packegs Library sudo pip3 install "$var25" -y sudo pip3 install "$var26" -y sudo pip3 install "$var27" -y sudo pip3 install "$var28" -y sudo pip3 install "$var29" -y sudo pip3 install "$var30" -y sudo pip3 install "$var31" -y sudo pip3 install "$var32" -y sudo pip3 install "$var33" -y sudo pip3 install "$var34" -y sudo pip3 install "$var35" -y sudo pip3 install "$var36" -y #Item7 AP(WebPage) cd / git clone http://60.250.156.230:3000/benson/SixthProject.git /Sixth/ mv /Sixth/Sixth-BBend.tar.gz /etc/Sixth rm -rf /Sixth/ cd /etc/Sixth tar -zxvf Sixth-BBend.tar.gz var0="sudo python3 /etc/Sixth/Sixth-BBend/manage.py" echo "manage.py=$var0" >> /etc/proc-wdtd.conf echo "AP done" #Item8 ROS ubuntu 18.04 melodic #ROS It should be install in user not install in root #install sudo apt-get install -y "$var38" sudo ntpdate -q ntp.ubuntu.com var="deb http://packages.ros.org/ros/ubuntu \$(lsb_release -sc) main" # sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' sudo sh -c "echo $var > /etc/apt/sources.list.d/ros-latest.list" sudo apt-key adv --keyserver "hkp://keyserver.ubuntu.com:80" --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 echo "deb ros packages and keyserver" sudo apt-get "$var40" -y sudo apt-get "$var41" -y sudo apt install "$var42" -y sudo apt-get install "$var43" -y sudo apt-get install "$var44" -y sudo rosdep init rosdep update sudo apt-get install "$var45" -y #setup source /opt/ros/melodic/setup.bash echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc source ~/.bashrc #Create Ros Workspace mkdir -p ~/catkin_ws/src cd ~/catkin_ws/ catkin_make #Setup source ~/catkin_ws/devel/setup.bash echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc source ~/.bashrc # need user name echo $ROS_PACKAGE_PATH /home/youruser/catkin_ws/src:/opt/ros/melodic/share source ~/.bashrc printenv | grep ROS echo "ROS done"