Last active
          March 26, 2018 11:24 
        
      - 
      
 - 
        
Save hrshadhin/23dce325519e1b54fd0302b198de9b4d to your computer and use it in GitHub Desktop.  
    simple vps setup script
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/bash | |
| #date: 20/02/2017 | |
| #this script will install basic server package,php,composer,mysql,webserver etc | |
| #this script has code for install php 5 | |
| #this script has code for install apache2 but default is apache2 | |
| #check if script run by Mr.Root :P | |
| set -eu | |
| if [ "$(id -u)" != "0" ]; then | |
| echo "Sorry man, you are not Mr.Root !" | |
| exit 1 | |
| fi | |
| printout (){ | |
| echo '######################################################' | |
| echo "## $1 ##" | |
| echo '######################################################' | |
| } | |
| #now system update | |
| apt update | |
| apt dist-upgrade -y | |
| printout "System Uptodate " | |
| #locale problem fixer | |
| echo "export LANGUAGE=en_US.UTF-8 | |
| export LANG=en_US.UTF-8 | |
| export LC_ALL=en_US.UTF-8">> ~/.bash_profile | |
| source ~/.bash_profile | |
| printout "Locale problem fixed!" | |
| #apt progress bar for new ubuntu 14.04 version | |
| echo 'Dpkg::Progress-Fancy "1";' > /etc/apt/apt.conf.d/99progressbar | |
| #basic package installation | |
| apt-get install htop fail2ban git unzip -y | |
| printout "Basic package installation complete" | |
| #apache install | |
| apt install apache2 libapache2-mod-php5 -y | |
| apache2ctl configtest | |
| a2enmod rewrite | |
| service apache2 restart | |
| printout "apache installation complete " | |
| #php5 install | |
| apt-get install php5 php5-intl php5-cli php5-fpm php5-json php5-mcrypt php5-geoip php5-gd php5-dev php5-curl php5-mysql php-pear php5-imagick php5-imap php5-memcache php5-pspell php5-recode php5-tidy php5-xmlrpc php5-xsl php-gettext -y | |
| printout "Php Installed!" | |
| #composer | |
| curl -sS https://getcomposer.org/installer | php | |
| mv composer.phar /usr/local/bin/composer | |
| printout "composer installation complete" | |
| apt-get install mysql-server mysql-client libmysqlclient-dev -y | |
| printout "MySQL installation complete" | |
| #Mysql Secure | |
| mysql_secure_installation | |
| #timezone settings | |
| dpkg-reconfigure tzdata | |
| printout "All Done . Check If There Is Any Err." | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment