All_installv3.sh 4.2 KB

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