coffeesystem.sh 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. #!/bin/bash
  2. #item1 common command
  3. step1_t1=$(date +"%s")
  4. sudo apt-get install python3.8 -y
  5. sudo apt-get install python3-pip -y
  6. sudo pip3 install cryptography==3.3.2
  7. sudo -H pip3 install --upgrade pip
  8. sudo apt-get install grep -y
  9. sudo apt-get install git -y
  10. sudo pip3 install gitpython
  11. sudo apt-get install python3-tk -y
  12. sudo apt-get install wget -y
  13. sudo apt-get install python3-dev default-libmysqlclient-dev build-essential -y
  14. step1_t2=$(date +"%s")
  15. echo 'step1花費時間:' $((step1_t2-step1_t1)) '秒' >>test.log
  16. #Item2 LAMP
  17. echo "start install LAMP"
  18. sudo apt-get install tasksel -y
  19. sudo DEBIAN_FRONTEND=noninteractive tasksel install lamp-server
  20. echo "install phpmyadmin"
  21. 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
  22. cd /var/www/html/phpmyadmin;pwd;mkdir tmp;
  23. cd;pwd;
  24. echo "install phpmyadmin done"
  25. sudo apt-get install openssl -y
  26. sudo apt-get install php-common -y
  27. sudo apt-get install php-curl -y
  28. sudo apt-get install php-json -y
  29. sudo apt-get install php-mbstring -y
  30. sudo apt-get install php-mysql -y
  31. sudo apt-get install php-xml -y
  32. sudo apt-get install php-zip -y
  33. #php version
  34. sudo apt-get install php7.2-mbstring -y
  35. sudo apt-get install php7.2-xml -y
  36. sudo apt-get install php7.2-mysql -y
  37. sudo apt-get install php7.2-common -y
  38. sudo apt-get install php7.2-curl -y
  39. sudo apt-get install php7.2-json -y
  40. sudo apt-get install php7.2-zip -y
  41. echo "open apache2 "
  42. sudo service apache2 start
  43. echo "setting mysql pass"
  44. sudo mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Gold@53743001';"
  45. #user='root'
  46. #ip='localhost'
  47. #pwd='Gold@53743001'
  48. #sudo mysql -u root -e "ALTER USER $user@$ip IDENTIFIED WITH mysql_native_password BY $pwd;"
  49. echo "setting mysql done"
  50. #Item3 MQTT
  51. # install&setting mqtt server
  52. sudo -H pip3 install paho-mqtt
  53. sudo apt-get install mosquitto -y
  54. sudo systemctl start mosquitto
  55. sudo ufw allow 1883/tcp
  56. sudo ufw allow 8080/tcp
  57. # get mqtt server file mosquitto.conf
  58. # get mqtt server file passwd.conf
  59. cd /home/使用者;pwd;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/;pwd
  60. sudo systemctl restart mosquitto
  61. echo "mqtt server file done"
  62. # install&setting mqtt client
  63. # to be confirm packegs
  64. #cd /usr/sbin/
  65. # get mqtt client file aisky.mqttd
  66. #git clone http://60.250.156.230:3000/fatwolf/mqtt_server_setting.git
  67. #Item4 Watchdog
  68. # get watchdog file proc-wdtd.conf
  69. # get watchdog file proc-wdtd
  70. # get watchdog file rc.local
  71. 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/
  72. sudo chmod +x /usr/sbin/proc-wdtd
  73. sudo chmod +x /etc/rc.local
  74. sudo systemctl restart rc-local.service
  75. echo "watchdog file done"
  76. #Item5 Git Server
  77. sudo apt-get install golang -y
  78. 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
  79. echo "Git Server done"
  80. # ./gogs web
  81. #Item6 Python packegs Library
  82. 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
  83. #Item7 AP(WebPage)
  84. cd /home/使用者;pwd;sudo git clone http://60.250.156.230:3000/rita/CoffeeProject.git /home/使用者/CoffeeProject/
  85. echo "AP done"
  86. #Item8 ROS ubuntu 18.04 melodic
  87. #ROS It should be install in user not install in root
  88. #install
  89. sudo apt-get install -y chrony ntpdate
  90. sudo ntpdate -q ntp.ubuntu.com
  91. #var="deb http://packages.ros.org/ros/ubuntu \$(lsb_release -sc) main"
  92. sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
  93. #sudo sh -c "echo $var > /etc/apt/sources.list.d/ros-latest.list"
  94. sudo apt-key adv --keyserver "hkp://keyserver.ubuntu.com:80" --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
  95. echo "deb ros packages and keyserver"
  96. sudo apt-get update -y
  97. #sudo apt-get upgrade -y
  98. sudo apt install ros-melodic-desktop-full -y
  99. sudo apt-get install ros-melodic-rqt* -y
  100. sudo apt-get install python-rosdep -y
  101. sudo rosdep init
  102. rosdep update
  103. sudo apt-get install python-rosinstall -y
  104. sudo apt-get install python-rosinstall-generator -y
  105. sudo apt-get install python-wstool -y
  106. sudo apt-get install build-essential -y
  107. #setup
  108. source /opt/ros/melodic/setup.bash
  109. echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
  110. source ~/.bashrc
  111. #Create Ros Workspace
  112. cd /home/使用者;pwd;mkdir -p ~/catkin_ws/src;pwd;cd /home/使用者/catkin_ws/;pwd;catkin_make
  113. #Setup
  114. source ~/catkin_ws/devel/setup.bash
  115. echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
  116. source ~/.bashrc
  117. # need user name
  118. echo $ROS_PACKAGE_PATH /home/使用者/catkin_ws/src:/opt/ros/melodic/share
  119. source ~/.bashrc
  120. printenv | grep ROS
  121. echo "ROS done"