SHARE
TWEET

Untitled

dymbaun Oct 3rd, 2017 21 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env bash
  2. apt-get install -qq lsb-release curl -y
  3. rm -f domain.txt domain-tanpa-titik.txt db_name.txt db_name1.txt u_name.txt u_name1.txt versi{1..4}.txt versi.txt /var/www/html/info.php
  4. printf "\n\n\nMau tambah domain ga usah bingung lagi\nYang perlu Anda masukkan hanya nama domain\nyang ingin ditambahkan ke VPS.\n\nKalo ada yang kurang jelas, silahkan hubungi saya.\n\n\nSkrip ini juga bisa digunakan untuk menginstall sub domain.\nYang perlu diinput nanti bukan nama domain, melainkan dengan sub domainnya\n\nMisal domainnya bernama example.com, maka kalo mau install subdomain\ninput full URL sub domainnya, misalnya sub.example.com\n\n\nSilahkan masukan nama domain\n"
  5. while true
  6. do
  7.         read -p "Tanpa www dan tanpa http, misal example.com: " domain
  8.         echo
  9.         read -p "Masukan nama domain (sekali lagi): " domain2
  10.         echo
  11.         [ "$domain" = "$domain2" ] && break
  12.         echo
  13.         echo "Nama domain ga cocok, ulang lagi ya!"
  14.         echo
  15. done
  16. echo $domain >> domain.txt
  17. clean_domain_1=`sed 's/[^a-zA-Z0-9]//g'  domain.txt > domain-tanpa-titik.txt`
  18. untuk_db=`cat domain-tanpa-titik.txt`
  19. echo $untuk_db >> db_name1.txt
  20. echo $untuk_db >> u_name1.txt
  21. sed 's/^/db_/' db_name1.txt > db_name.txt
  22. sed 's/^/u_/' u_name1.txt > u_name.txt
  23. db_name=`cat db_name.txt`
  24. u_name=`cat u_name.txt`
  25. rm -f domain.txt domain-tanpa-titik.txt db_name.txt db_name1.txt u_name.txt u_name1.txt
  26. file="/root/.pwdmysql"
  27. if [ -f "$file" ]
  28. then
  29.         echo
  30. else
  31.         printf "Sorry, skrip ini hanya bekerja di VPS yang di setting Hardinal\ninfo lanjut silahkan email ke jasa@hardinal.com\n\n"
  32.         exit 1
  33. fi
  34. echo
  35. printf "Sip, udah semua..\nTekan 'y' untuk melanjutkan (tunggu maks. 1 menit)\n"
  36. read -p "Atau 't' untuk membatalkan ... <y/t> ?" tanya
  37. echo
  38. if [[ $tanya == "y" || $tanya == "Y" || $tanya == "yes" || $tanya == "Yes" || $tanya == "Ya" || $tanya == "ya" ]]
  39. then
  40.     echo "Mohon tunggu..."
  41.         echo
  42.         password_root_mysql=`cat /root/.pwdmysql`
  43.         password_wp_config=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 12 | head -n 1`
  44.         mysql -uroot -p$password_root_mysql -e "CREATE DATABASE $db_name /*\!40100 DEFAULT CHARACTER SET utf8 */;"
  45.         mysql -uroot -p$password_root_mysql -e "CREATE USER $u_name@localhost IDENTIFIED BY '$password_wp_config';"
  46.         mysql -uroot -p$password_root_mysql -e "GRANT ALL PRIVILEGES ON $db_name.* TO '$u_name'@'localhost';"
  47.         mysql -uroot -p$password_root_mysql -e "FLUSH PRIVILEGES;"
  48.         echo -e '<?php phpinfo(); ?>' >> /var/www/html/info.php
  49.         chown www-data:www-data /var/www/html/info.php
  50.         debversion=`lsb_release -sc`
  51.         IP=$(wget -qO- ipv4.icanhazip.com)
  52.         wget --quiet $IP/info.php -O versi.txt
  53.         sed '/h1 class/!d' versi.txt > versi1.txt
  54.         sed 's/PHP Version /\'$'\n/g' versi1.txt > versi2.txt
  55.         sed '2! d' versi2.txt > versi3.txt
  56.         cut -c -1 versi3.txt > versi4.txt
  57.         versi4=`cat versi4.txt`
  58.         rm -f versi{1..4}.txt versi.txt /var/www/html/info.php
  59.         wget -q --no-check-certificate https://www.dropbox.com/s/pzevpqa0hxscxvn/master.vhost?dl=0 -O master.vhost
  60.         if [ "$debversion" = "jessie" ]; then
  61.                 if [ $versi4 = 5 ]
  62.                 then
  63.                         sed -i 's/xGANTIx/unix:\/var\/run\/php5-fpm.sock/g' master.vhost
  64.                 else
  65.                         sed -i 's/xGANTIx/unix:\/run\/php\/php7.0-fpm.sock/g' master.vhost
  66.                 fi
  67.         elif [ "$debversion" = "stretch" ]; then
  68.                 if [ $versi4 = 5 ]
  69.                 then
  70.                         sed -i 's/xGANTIx/unix:\/run\/php\/php5.6-fpm.sock/g' master.vhost
  71.                 else
  72.                         sed -i 's/xGANTIx/unix:\/run\/php\/php7.1-fpm.sock/g' master.vhost
  73.                 fi
  74.         else
  75.                 sed -i 's/xGANTIx/unix:\/var\/run\/php5-fpm.sock/g' master.vhost
  76.         fi
  77.         sed -i "s/xDOMAINx/$domain/g" master.vhost
  78.         mv master.vhost /etc/nginx/sites-available/$domain
  79.         ln -sf /etc/nginx/sites-available/$domain /etc/nginx/sites-enabled/
  80.         mkdir -p /etc/nginx/untuk_cache/$domain
  81.         service nginx reload
  82.         curl -L -# -k --connect-timeout 5 --retry 1 'https://wordpress.org/latest.zip' -o latest.zip
  83.         unzip -qq latest.zip
  84.         rm -f latest.zip
  85.         mv wordpress /var/www/html/$domain
  86.         mv /var/www/html/$domain/wp-config-sample.php /var/www/html/$domain/wp-config.php
  87.         sed -i "s/database_name_here/$db_name/g" /var/www/html/$domain/wp-config.php
  88.         sed -i "s/username_here/$u_name/g" /var/www/html/$domain/wp-config.php
  89.         sed -i "s/password_here/$password_wp_config/g" /var/www/html/$domain/wp-config.php
  90.         chown -R www-data:www-data /var/www/html/$domain
  91.         rm -f latest.zip
  92.         printf "_________________\n"
  93.         printf "\nSelamat, domain $domain baru saja ditambahkan ke VPS ini\nSilahkan daftarkan dan ganti NS ke Cloudflare, lalu tunggu +/- 30 menit supaya domain bisa diakses.\n\n"
  94.         printf "Materi Cloudflare bisa Anda baca di blog saya\n\nhttps://www.hardinal.com/blog/cara-menggunakan-dns-cloudflare-lengkap-dengan-gambar/\n\n"
  95.         printf "_________________\n\n\n"
  96.         printf "Setelah menunggu 30 menit-an, silahkan kunjungi:\n\n"
  97.         printf "http://$domain\n\n"
  98.         printf "Atau kalo ingin pake www kunjungi\n\nhttp://www.$domain\n\n"
  99.         printf "Anda nanti akan dibawa ke proses instalasi Wordpress\n\n"
  100.         printf "_________________\n\n\n"
  101.         printf "Oia, Jika Anda perlu rincian database, silahkan gunakan rincian di bawah ini\n"
  102.         printf "\nDATABASE: $db_name\nUSERNAME: $u_name\nPASSWORD: $password_wp_config\n\n"
  103. else
  104.         rm -f db_name1.txt  db_name.txt  domain-tanpa-titik.txt  domain.txt  u_name1.txt  u_name.txt info.php
  105.         exit 0
  106. fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top