All_installv3.2.sh 5.2 KB

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