coffeesystem.sh 5.5 KB

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