setupvnstat.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/bash
  2. # go to root
  3. cd
  4. # update
  5. apt-get update
  6. apt-get -y upgrade
  7. # install webserver
  8. apt-get -y install nginx php5-fpm php5-cli
  9. # install essential package
  10. apt-get -y install nmap nano iptables sysv-rc-conf openvpn vnstat apt-file
  11. apt-get -y install libexpat1-dev libxml-parser-perl
  12. apt-get -y install build-essential
  13. # update apt-file
  14. apt-file update
  15. # Setting Vnstat
  16. vnstat -u -i eth0
  17. chown -R vnstat:vnstat /var/lib/vnstat
  18. service vnstat restart
  19. # Install Web Server
  20. cd
  21. rm /etc/nginx/sites-enabled/default
  22. rm /etc/nginx/sites-available/default
  23. wget -O /etc/nginx/nginx.conf "https://raw.githubusercontent.com/muchigo/VPS/master/conf/nginx.conf"
  24. mkdir -p /home/vps/public_html
  25. echo "<pre>Setup by Kiellez</pre>" > /home/vps/public_html/index.html
  26. echo "<?php phpinfo(); ?>" > /home/vps/public_html/info.php
  27. wget -O /etc/nginx/conf.d/vps.conf "https://raw.githubusercontent.com/muchigo/VPS/master/conf/vps.conf"
  28. sed -i 's/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g' /etc/php5/fpm/pool.d/www.conf
  29. service php5-fpm restart
  30. service nginx restart
  31. # install vnstat gui
  32. cd /home/vps/public_html/
  33. wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz
  34. tar xf vnstat_php_frontend-1.5.1.tar.gz
  35. rm vnstat_php_frontend-1.5.1.tar.gz
  36. mv vnstat_php_frontend-1.5.1 vnstat
  37. cd vnstat
  38. sed -i "s/\$iface_list = array('eth0', 'sixxs');/\$iface_list = array('eth0');/g" config.php
  39. sed -i "s/\$language = 'nl';/\$language = 'en';/g" config.php
  40. sed -i 's/Internal/Internet/g' config.php
  41. sed -i '/SixXS IPv6/d' config.php
  42. sed -i "s/\$locale = 'en_US.UTF-8';/\$locale = 'en_US.UTF+8';/g" config.php
  43. cd
  44. # Restart Service
  45. chown -R www-data:www-data /home/vps/public_html
  46. service nginx start
  47. service php-fpm start
  48. service vnstat restart
  49. echo "==============================================="
  50. echo "vnstat : http://$MYIP:81/vnstat/"
  51. echo "==============================================="