coffeesystem00.sh 5.5 KB

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