Advertisement
huutho_96

Master

Dec 31st, 2018
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.42 KB | None | 0 0
  1. apt-get update -y
  2.  
  3. # Setting SSH
  4. mkdir ~/.ssh/
  5. echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCYfyLsgLrESZn8qyJq65RXdV9DVXpYd2IYmQAX5Vz7RlVJ7ttL0O35yz2uMGe+WA1UqmROxBMHtwVyfBFn30/izwyu1lTWFLhjzmC4WzMKMdNPsUHnRXnUmb4quvA5IXWjd1/NZ7oD0+3men8OR0awQi4duVB4yGeCVYAuoQ3HVgkXZ25udJ9Kh5jynx/3YFVk6rjmSgW73epViPRnrZ9IqLtCG55qHbPJAh4y4DpZZBM7TFaqCoaCnL8diDs7uer5kfk8Y1b1zeNvMER+6meI+/7PCcmMz634FgcN7JRJKAGHssMN+AdvLodT69XyQn38cPUq5vThQckgpGKWxxU9SQ2oXBtKlmNiRUq9fEJn2UETEAN9nx3+ceTlXpNfkM7VP1xHr+zI1oQnhmi4K2jd999ErBvZYCu3jYZ9Ud5iBH/5dzailUPNQCVR6EF82JzA6rLQsYKiCWRl687BERriXcwV+Ajaaq7bztvyHaFj2el4hZSMD2oHbtRbATpNZX3a1l8yOA1Q9eUDdAiK8JNsOCsqbRSab8DvfQ5LDuRwSECBljyZnLB/xNJOYAajiI/jm4zEvkDhnKQYimWrmmn2nrCrwOCsa5kVQZku9JROoshrs5f5rowM8UaXzLs5tZN5qnOjw3jRVcq9dlDuDNAh3lt8fgtR8UPsGe9uiFn8VQ== thonh.it@gmail.com" >> ~/.ssh/authorized_keys
  6. echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config
  7. echo "AuthorizedKeysFile .ssh/authorized_keys"  >> /etc/ssh/sshd_config
  8. service sshd restart
  9.  
  10. # Shared storage
  11. ifconfig eth1 up
  12. ip addr add 10.40.96.4/24 dev eth1
  13. apt-get install nfs-kernel-server nfs-common -y
  14.  
  15. mkdir /opt/share
  16. chown nobody:nogroup /opt/share
  17. chmod 755 /opt/share
  18.  
  19. echo "/opt/share           10.40.96.5(rw,sync,no_subtree_check)" >> /etc/exports
  20. echo "/opt/share           10.40.96.6(rw,sync,no_subtree_check)" >> /etc/exports
  21. service nfs-kernel-server restart
  22.  
  23.  
  24.  
  25. # install require package
  26. apt-get update -y
  27. apt-get install build-essential checkinstall -y
  28. apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev -y
  29.  
  30. # download and install Python 3.5.2
  31. cd /usr/src
  32. wget "https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz"
  33. tar xzf Python-3.5.2.tgz
  34.  
  35. cd /usr/src/Python-3.5.2
  36. ./configure
  37. make altinstall
  38. python3.5 -V
  39. pip3.5 -V
  40.  
  41.  
  42. # Install git
  43. apt-get install git -y
  44.  
  45. # Install node
  46. apt-get update
  47. apt-get install curl software-properties-common -y
  48. curl -sL https://deb.nodesource.com/setup_10.x | bash -
  49. apt-get install -y nodejs
  50. node -v
  51.  
  52. # Install bower
  53. npm install bower -g --allow-root
  54.  
  55. # Install pm2
  56. npm install pm2 -g
  57. pm2 list
  58.  
  59.  
  60.  
  61. # Install mongodb
  62. apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
  63. echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list
  64. apt-get update
  65. apt-get install -y mongodb-org
  66. service mongod start
  67. update-rc.d mongod defaults
  68.  
  69. # Install Redis server
  70. apt-get update
  71. apt-get install build-essential -y
  72. apt-get install tcl8.5 -y
  73. wget http://download.redis.io/releases/redis-stable.tar.gz
  74. tar xzf redis-stable.tar.gz
  75. cd redis-stable
  76. make
  77. make test
  78. make install
  79. cd utils
  80. ./install_server.sh
  81. service redis_6379 start
  82. update-rc.d redis_6379 defaults
  83. cd ~
  84.  
  85.  
  86. # chown ubuntu:ubuntu /home/ubuntu/.pm2/rpc.sock /home/ubuntu/.pm2/pub.sock
  87.  
  88.  
  89. # Install nginx
  90. apt-get install nginx -y
  91.  
  92. # Install laravel
  93. cd ~
  94. apt-get install mysql-server -y
  95. apt-get install curl -y
  96. export LANG=C.UTF-8
  97. apt-get install zip unzip -y
  98. apt-get install python-software-properties -y
  99. apt-get install ca-certificates apt-transport-https -y
  100. wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add -
  101. echo "deb https://packages.sury.org/php/ jessie main" | tee /etc/apt/sources.list.d/php.list
  102. apt update -y
  103. apt install php7.2 -y
  104. apt install php7.2-cli php7.2-common php7.2-curl php7.2-gd php7.2-json php7.2-mbstring php7.2-mysql php7.2-xml php7.2-fpm
  105.  
  106. curl -sS https://getcomposer.org/installer | php
  107. mv composer.phar /usr/local/bin/composer
  108.  
  109.  
  110.  
  111.  
  112. mkdir /var/code
  113. # Init git hook GUI
  114. mkdir /var/code/medusa_gui.git -p
  115. mkdir /var/code/medusa_gui_src -p
  116. cd /var/code/medusa_gui.git
  117. git init --bare
  118.  
  119. touch /var/code/medusa_gui.git/hooks/post-receive
  120. chmod 755 /var/code/medusa_gui.git/hooks/post-receive
  121.  
  122. echo "#!/bin/bash" >> /var/code/medusa_gui.git/hooks/post-receive
  123. echo "echo 'post-receive: Triggered.'" >> /var/code/medusa_gui.git/hooks/post-receive
  124. echo "echo 'post-receive: git check out…'" >> /var/code/medusa_gui.git/hooks/post-receive
  125. echo "git --git-dir=/var/code/medusa_gui.git --work-tree=/var/code/medusa_gui_src checkout deploy-gui -f" >> /var/code/medusa_gui.git/hooks/post-receive
  126. echo "echo 'post-receive: install project…'" >> /var/code/medusa_gui.git/hooks/post-receive
  127. echo "cd /var/code/medusa_gui_src/GUI && npm install && bower install --allow-root && pm2 start index.js --name=GUI" >> /var/code/medusa_gui.git/hooks/post-receive
  128.  
  129.  
  130.  
  131. # Init git hook master
  132. mkdir /var/code/medusa_master.git -p
  133. mkdir /var/code/medusa_master_src -p
  134. cd /var/code/medusa_master.git
  135. git init --bare
  136.  
  137. touch /var/code/medusa_master.git/hooks/post-receive
  138. chmod 755 /var/code/medusa_master.git/hooks/post-receive
  139.  
  140. echo "#!/bin/bash" >> /var/code/medusa_master.git/hooks/post-receive
  141. echo "echo 'post-receive: Triggered.'" >> /var/code/medusa_master.git/hooks/post-receive
  142. echo "echo 'post-receive: git check out…'" >> /var/code/medusa_master.git/hooks/post-receive
  143. echo "git --git-dir=/var/code/medusa_master.git --work-tree=/var/code/medusa_master_src checkout deploy-crawler -f" >> /var/code/medusa_master.git/hooks/post-receive
  144. echo "echo 'post-receive: install project…'" >> /var/code/medusa_master.git/hooks/post-receive
  145. echo "cd /var/code/medusa_master_src/Crawler && pip3.5 install --user -r requirement.txt && pm2 del Master --silent && pm2 start master.py --interpreter=python3.5 --name=Master" >> /var/code/medusa_master.git/hooks/post-receive
  146.  
  147.  
  148.  
  149.  
  150. # Init git hook master
  151. mkdir /var/code/medusa_resource.git -p
  152. mkdir /var/code/medusa_resource_src -p
  153. cd /var/code/medusa_resource.git
  154. git init --bare
  155.  
  156. touch /var/code/medusa_resource.git/hooks/post-receive
  157. chmod 755 /var/code/medusa_resource.git/hooks/post-receive
  158.  
  159. echo "#!/bin/bash" >> /var/code/medusa_resource.git/hooks/post-receive
  160. echo "echo 'post-receive: Triggered.'" >> /var/code/medusa_resource.git/hooks/post-receive
  161. echo "echo 'post-receive: git check out…'" >> /var/code/medusa_resource.git/hooks/post-receive
  162. echo "git --git-dir=/var/code/medusa_resource.git --work-tree=/var/code/medusa_resource_src checkout deploy-resource -f" >> /var/code/medusa_resource.git/hooks/post-receive
  163. echo "echo 'post-receive: install project…'" >> /var/code/medusa_resource.git/hooks/post-receive
  164. echo "cd /var/code/medusa_resource_src/File && composer update && php artisan key:generate" >> /var/code/medusa_resource.git/hooks/post-receive
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement