All_installv3.2.sh 4.9 KB

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