Advertisement
shutdown57

c9 auto installer

Nov 5th, 2020 (edited)
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.13 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #
  4. # c9 Installer for debian/ubuntu famil
  5. # Author : shutdown57 < indonesianpeople.shutdown57@gmail.com >
  6. # Date   : 5 Nov 2020
  7. # Tested ubuntu 18.04 LTS
  8.  
  9. m="\033[1;31m"
  10. k="\033[1;33m"
  11. h="\033[1;32m"
  12. b="\033[1;34m"
  13. bl="\033[0;34m"
  14. n="\033[1;0m"
  15.  
  16. x_banner(){
  17. cat <<EOF
  18.        ________  .__                 __         .__  .__                
  19.   ____/   __   \ |__| ____   _______/  |______  |  | |  |   ___________
  20. _/ ___\____    / |  |/    \ /  ___/\   __\__  \ |  | |  | _/ __ \_  __ \\
  21. \  \___  /    /  |  |   |  \\\\___ \  |  |  / __ \|  |_|  |_\  ___/|  | \/
  22.  \___  >/____/   |__|___|  /____  > |__| (____  /____/____/\___  >__|  
  23.      \/                  \/     \/            \/               \/      
  24.  
  25. EOF
  26. echo -e $h" =======[ shutdown57 "$n
  27. echo -e $k" =======[ c9 Installer for VPS ubuntu"$n
  28. echo ""
  29. echo -e $b"Please wait ...................."
  30. sleep 2
  31. }
  32.  
  33. x_install(){
  34. apt-get update -y && sudo apt-get -y install curl git build-essential
  35. curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
  36. apt-get install gcc g++ make -y
  37. curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
  38. echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
  39. apt-get update -y ; apt-get install yarn -y
  40. apt-get install nodejs -y
  41.  
  42. echo -e $k"[~] create user for running c9 (c9user) ...."$n
  43. sleep 1
  44. adduser c9user
  45. sudo usermod -aG sudo c9user
  46.  
  47. echo -e -n $k"[~] Move to /home/c9user/ ...."$n
  48. sleep 1
  49. cd /home/c9user/
  50. if [[ `pwd` == '/home/c9user' ]]; then
  51.     echo -e $h"[OK]"$n
  52. else
  53.     echo -e $m"[FAILED]"$n
  54.     exit
  55. fi
  56.  
  57. echo -e -n $k"[~] Cloning c9 source from github ...."$n
  58. git clone git://github.com/c9/core.git c9 > /dev/null 2>&1
  59. if [[ -d c9 ]]; then
  60.     echo -e $h"[OK]"$n
  61. else
  62.     echo -e $m"[FAILED]"$n
  63.     exit
  64. fi
  65.  
  66. echo -e  $k"[~] RUnning install-sdk.sh from c9 source ..."$n
  67. c9/scripts/install-sdk.sh
  68.  
  69. sleep 1
  70.  
  71. echo -e -n $k"[~] Create directory /home/c9user/my-projects ..."$n
  72. mkdir /home/c9user/my-projects
  73.  
  74. if [[ -d /home/c9user/my-projects ]]; then
  75.     echo -e $h"[OK]"$n
  76. else
  77.     echo -e $m"[FAILED]"$n
  78.     exit
  79. fi
  80. sleep 1
  81.  
  82. echo -e -n $k"[~] adding SystemD c9 services ..."$n
  83. wget -q https://pastebin.com/raw/Zy5qKHdg -O /lib/systemd/system/c9.service
  84.  
  85. if [[ -f /lib/systemd/system/c9.service ]]; then
  86.     echo -e $h"[OK]"$n
  87. else
  88.     echo -e $m"[FAILED]"$n
  89.     exit
  90. fi
  91. echo -e $k"[~] SETTING USERNAME PASSWORD AND PORT FOR ACCESS [~]"$n
  92. echo ""
  93. read -p "Username :" username
  94. read -p "Password :" password
  95. read -p "Port     :" port
  96.  
  97. sed -i "s|{username}|${username}|g" /lib/systemd/system/c9.service
  98. sed -i "s|{password}|${password}|g" /lib/systemd/system/c9.service
  99. sed -i "s|{port}|${port}|g" /lib/systemd/system/c9.service
  100.  
  101. sleep 1
  102. echo -e $k"[~] Enabling c9 service ..."$n
  103. systemctl enable c9.service
  104. systemctl daemon-reload
  105.  
  106. echo -e $k"[~] Starting c9 service ..."$n
  107. service c9 start
  108. service c9 status
  109.  
  110. echo -e $h"DONE...................... now you can access c9 "$b" http://YourServer:Port "$n
  111.  
  112. }
  113.  
  114. if [[ `whoami` != 'root' ]]; then
  115.     echo -e $m"You must access this file with root ( superuser )"
  116.     exit
  117. else
  118.     x_banner
  119.     x_install
  120. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement