coffeesystem.sh 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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/;pwd;sudo wget https://files.phpmyadmin.net/phpMyAdmin/5.1.0/phpMyAdmin-5.1.0-all-languages.tar.gz -q;tar -zxvf phpMyAdmin-5.1.0-all-languages.tar.gz;sudo rm phpMyAdmin-5.1.0-all-languages.tar.gz;sudo mv phpMyAdmin-5.1.0-all-languages /var/www/html/phpmyadmin
  18. cd /var/www/html/phpmyadmin;pwd;mkdir tmp;
  19. cd;pwd;
  20. echo "install phpmyadmin done"
  21. sudo apt-get install openssl -y
  22. sudo apt-get install php-common -y
  23. sudo apt-get install php-curl -y
  24. sudo apt-get install php-json -y
  25. sudo apt-get install php-mbstring -y
  26. sudo apt-get install php-mysql -y
  27. sudo apt-get install php-xml -y
  28. sudo apt-get install php-zip -y
  29. #php version
  30. sudo apt-get install php7.2-mbstring -y
  31. sudo apt-get install php7.2-xml -y
  32. sudo apt-get install php7.2-mysql -y
  33. sudo apt-get install php7.2-common -y
  34. sudo apt-get install php7.2-curl -y
  35. sudo apt-get install php7.2-json -y
  36. sudo apt-get 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 -H pip3 install paho-mqtt
  49. sudo apt-get install mosquitto -y
  50. sudo systemctl start mosquitto
  51. sudo ufw allow 1883/tcp
  52. sudo ufw allow 8080/tcp
  53. # get mqtt server file mosquitto.conf
  54. # get mqtt server file passwd.conf
  55. cd /home/使用者;sudo git clone -b mosquitto --single-branch http://60.250.156.230:3000/fatwolf/mqtt_server_setting.git /home/使用者/mosquitto/;sudo git clone -b passwd --single-branch http://60.250.156.230:3000/fatwolf/mqtt_server_setting.git /home/使用者/passwd/;sudo mv /home/使用者/mosquitto/mosquitto.conf /etc/mosquitto/;sudo mv /home/使用者/passwd/passwd /etc/mosquitto/;sudo rm -rf /home/使用者/mosquitto/;sudo rm -rf /home/使用者/passwd/
  56. sudo systemctl restart mosquitto
  57. echo "mqtt server file done"
  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. # get watchdog file proc-wdtd.conf
  65. # get watchdog file proc-wdtd
  66. # get watchdog file rc.local
  67. cd /home/使用者;pwd;sudo git clone -b procwdtdconf --single-branch http://60.250.156.230:3000/fatwolf/proc.git /home/使用者/procwdtdconf/;sudo git clone -b procwdtd --single-branch http://60.250.156.230:3000/fatwolf/proc.git /home/使用者/procwdtd/;sudo git clone -b rclocal --single-branch http://60.250.156.230:3000/fatwolf/proc.git /home/使用者/rclocal/;sudo mv /home/使用者/procwdtdconf/proc-wdtd.conf /etc/;sudo mv /home/使用者/procwdtd/proc-wdtd /usr/sbin/;sudo mv /home/使用者/rclocal/rc.local /etc/;sudo rm -rf /home/使用者/procwdtdconf/;sudo rm -rf /home/使用者/procwdtd/;sudo rm -rf /home/使用者/rclocal/
  68. sudo chmod +x /usr/sbin/proc-wdtd
  69. sudo chmod +x /etc/rc.local
  70. sudo systemctl restart rc-local.service
  71. echo "watchdog file done"
  72. #Item5 Git Server
  73. sudo apt-get install golang -y
  74. cd /home/使用者;pwd;git clone http://60.250.156.230:3000/fatwolf/gogsfile.git /home/使用者/gogs;sudo mv /home/使用者/gogs/gogs_0.12.3_linux_amd64.tar.gz /home/使用者/;sudo rm -rf /home/使用者/gogs/;tar -C /home/使用者 -zxvf gogs_0.12.3_linux_amd64.tar.gz
  75. echo "Git Server done"
  76. # ./gogs web
  77. #Item6 Python packegs Library
  78. cd /home/使用者;pwd;git clone -b package --single-branch http://60.250.156.230:3000/Automatic_build_system/Automatically_install_files.git;cd Automatically_install_files/;pwd;sudo pip3 install -r requirements.txt
  79. #Item7 AP(WebPage)
  80. cd /home/使用者;pwd;sudo git clone http://60.250.156.230:3000/rita/CoffeeProject.git /home/使用者/CoffeeProject/
  81. echo "AP done"
  82. #Item8 ROS ubuntu 18.04 melodic
  83. #ROS It should be install in user not install in root
  84. #install
  85. sudo apt-get install -y chrony ntpdate
  86. sudo ntpdate -q ntp.ubuntu.com
  87. #var="deb http://packages.ros.org/ros/ubuntu \$(lsb_release -sc) main"
  88. sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
  89. #sudo sh -c "echo $var > /etc/apt/sources.list.d/ros-latest.list"
  90. sudo apt-key adv --keyserver "hkp://keyserver.ubuntu.com:80" --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
  91. echo "deb ros packages and keyserver"
  92. sudo apt-get update -y
  93. #sudo apt-get upgrade -y
  94. sudo apt install ros-melodic-desktop-full -y
  95. sudo apt-get install ros-melodic-rqt* -y
  96. sudo apt-get install python-rosdep -y
  97. sudo rosdep init
  98. rosdep update
  99. sudo apt-get install python-rosinstall -y
  100. sudo apt-get install python-rosinstall-generator -y
  101. sudo apt-get install python-wstool -y
  102. sudo apt-get install build-essential -y
  103. #setup
  104. source /opt/ros/melodic/setup.bash
  105. echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
  106. source ~/.bashrc
  107. #Create Ros Workspace
  108. cd /home/使用者;pwd;mkdir -p ~/catkin_ws/src;pwd;cd /home/使用者/catkin_ws/;pwd;catkin_make
  109. #Setup
  110. source ~/catkin_ws/devel/setup.bash
  111. echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
  112. source ~/.bashrc
  113. # need user name
  114. echo $ROS_PACKAGE_PATH /home/使用者/catkin_ws/src:/opt/ros/melodic/share
  115. source ~/.bashrc
  116. printenv | grep ROS
  117. echo "ROS done"