All_installv3.2.sh 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. #!/bin/bash
  2. sudo apt-get install python3.8 -y
  3. sudo apt-get install python3-pip -y
  4. sudo apt-get install git -y
  5. sudo apt-get install wget -y
  6. sudo apt-get install grep -y
  7. #Item2 LAMP
  8. echo "start install LAMP"
  9. sudo apt-get install tasksel -y
  10. sudo DEBIAN_FRONTEND=noninteractive tasksel install lamp-server
  11. echo "install phpmyadmin"
  12. cd /tmp/
  13. pwd
  14. sudo wget https://files.phpmyadmin.net/phpMyAdmin/5.1.0/phpMyAdmin-5.1.0-all-languages.tar.gz
  15. echo "install phpmyadmin done"
  16. tar -zxvf phpMyAdmin-5.1.0-all-languages.tar.gz
  17. sudo rm phpMyAdmin-5.1.0-all-languages.tar.gz
  18. sudo mv phpMyAdmin-5.1.0-all-languages /var/www/html/phpmyadmin
  19. cd /var/www/html/phpmyadmin
  20. mkdir tmp
  21. cd
  22. sudo apt-get install openssl -y
  23. sudo apt-get install php-common -y
  24. sudo apt-get install php-curl -y
  25. sudo apt-get install php-json -y
  26. sudo apt-get install php-mbstring -y
  27. sudo apt-get install php-mysql -y
  28. sudo apt-get install php-xml -y
  29. sudo apt-get install php-zip -y
  30. #php version
  31. sudo apt-get install php7.2-mbstring -y
  32. sudo apt-get install php7.2-xml -y
  33. sudo apt-get install php7.2-mysql -y
  34. sudo apt-get install php7.2-common -y
  35. sudo apt-get install php7.2-curl -y
  36. sudo apt-get install php7.2-json -y
  37. sudo apt-get install php7.2-zip -y
  38. echo "open apache2 "
  39. sudo service apache2 start
  40. echo "setting mysql pass"
  41. sudo mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Gold@53743001';"
  42. #user='root'
  43. #ip='localhost'
  44. #pwd='Gold@53743001'
  45. #sudo mysql -u root -e "ALTER USER $user@$ip IDENTIFIED WITH mysql_native_password BY $pwd;"
  46. echo "setting mysql done"
  47. #Item3 MQTT
  48. # install&setting mqtt server
  49. sudo -H pip3 install paho-mqtt
  50. sudo apt-get install mosquitto -y
  51. sudo systemctl start mosquitto
  52. sudo systemctl enable mosquitto
  53. sudo ufw allow 1883/tcp
  54. sudo ufw allow 8080/tcp
  55. cd /home/使用者
  56. # get mqtt server file mosquitto.conf
  57. sudo git clone -b mosquitto --single-branch http://60.250.156.230:3000/fatwolf/mqtt_server_setting.git /mosquitto/
  58. # get mqtt server file passwd.conf
  59. sudo git clone -b passwd --single-branch http://60.250.156.230:3000/fatwolf/mqtt_server_setting.git /passwd/
  60. sudo mv /mosquitto/mosquitto.conf /etc/mosquitto/
  61. sudo mv /passwd/passwd /etc/mosquitto/
  62. sudo rm -rf /mosquitto/
  63. sudo rm -rf /passwd/
  64. sudo systemctl restart mosquitto
  65. echo "mqtt server file done"
  66. # install&setting mqtt client
  67. # to be confirm packegs
  68. #cd /usr/sbin/
  69. # get mqtt client file aisky.mqttd
  70. #git clone http://60.250.156.230:3000/fatwolf/mqtt_server_setting.git
  71. #Item4 Watchdog
  72. cd /home/使用者
  73. # get watchdog file proc-wdtd.conf
  74. sudo git clone -b procwdtdconf --single-branch http://60.250.156.230:3000/fatwolf/proc.git /procwdtdconf/
  75. # get watchdog file proc-wdtd
  76. sudo git clone -b procwdtd --single-branch http://60.250.156.230:3000/fatwolf/proc.git /procwdtd/
  77. #maybe use git clone to copy rc.local file?
  78. #sudo nano /etc/rc.local/
  79. # get watchdog file rc.local
  80. sudo git clone -b rclocal --single-branch http://60.250.156.230:3000/fatwolf/proc.git /rclocal/
  81. sudo mv /procwdtdconf/proc-wdtd.conf /etc/
  82. sudo mv /procwdtd/proc-wdtd /usr/sbin/
  83. sudo mv /rclocal/rc.local /etc/
  84. sudo rm -rf /procwdtdconf/
  85. sudo rm -rf /procwdtd/
  86. sudo rm -rf /rclocal/
  87. sudo systemctl restart rc-local.service
  88. echo "watchdog file done"
  89. #Item5 Git Server
  90. sudo apt-get install golang -y
  91. cd /home/使用者
  92. git clone --depth 1 https://github.com/gogs/gogs.git gogs
  93. cd gogs/
  94. go build -o gogs
  95. echo "Git Server done"
  96. # ./gogs web
  97. #Item6 Python packegs Library
  98. sudo -H pip3 install flask
  99. sudo -H pip3 install Flask-SQLAlchemy
  100. sudo -H pip3 install pymysql
  101. sudo -H pip3 install flask_mqtt
  102. sudo -H pip3 install flask_migrate
  103. sudo -H pip3 install flask-jwt-extended
  104. sudo -H pip3 install numpy
  105. sudo -H pip3 install pandas
  106. sudo -H pip3 install opencv-python==4.2.0.34
  107. sudo -H pip3 install BeautifulSoup4
  108. sudo -H pip3 install selenium
  109. sudo -H pip3 install geocoder
  110. #Item7 AP(WebPage)
  111. cd /home/使用者
  112. sudo git clone http://60.250.156.230:3000/benson/SixthProject.git /Sixth/
  113. sudo mv /Sixth/BBend-Test-JWT.tar.gz /etc/Sixth
  114. sudo rm -rf /Sixth/
  115. cd /etc/Sixth
  116. tar -zxvf BBend-Test-JWT.tar.gz
  117. #var0="sudo python3 /etc/Sixth/BBend-Test-JWT/manage.py"
  118. sudo echo "manage.py=sudo python3 /etc/Sixth/BBend-Test-JWT/manage.py" >> /etc/proc-wdtd.conf
  119. echo "AP done"
  120. #Item8 ROS ubuntu 18.04 melodic
  121. #ROS It should be install in user not install in root
  122. #install
  123. sudo apt-get install -y chrony ntpdate
  124. sudo ntpdate -q ntp.ubuntu.com
  125. #var="deb http://packages.ros.org/ros/ubuntu \$(lsb_release -sc) main"
  126. sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
  127. #sudo sh -c "echo $var > /etc/apt/sources.list.d/ros-latest.list"
  128. sudo apt-key adv --keyserver "hkp://keyserver.ubuntu.com:80" --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
  129. echo "deb ros packages and keyserver"
  130. sudo apt-get update -y
  131. #sudo apt-get upgrade -y
  132. sudo apt install ros-melodic-desktop-full -y
  133. sudo apt-get install ros-melodic-rqt* -y
  134. sudo apt-get install python-rosdep -y
  135. sudo rosdep init
  136. rosdep update
  137. sudo apt-get install python-rosinstall -y
  138. sudo apt-get install python-rosinstall-generator -y
  139. sudo apt-get install python-wstool -y
  140. sudo apt-get install build-essential -y
  141. #setup
  142. source /opt/ros/melodic/setup.bash
  143. echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
  144. source ~/.bashrc
  145. #Create Ros Workspace
  146. mkdir -p ~/catkin_ws/src
  147. cd ~/catkin_ws/
  148. catkin_make
  149. #Setup
  150. source ~/catkin_ws/devel/setup.bash
  151. echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
  152. source ~/.bashrc
  153. # need user name
  154. echo $ROS_PACKAGE_PATH /home/使用者/catkin_ws/src:/opt/ros/melodic/share
  155. source ~/.bashrc
  156. printenv | grep ROS
  157. echo "ROS done"