@@ -0,0 +1,90 @@
#! /bin/bash
# date: 20/02/2017
# this script will install basic server package,php,composer,mysql,webserver etc
# this script has code for install both php 5 and 7 but default is 5
# this script has code for install both nginx and 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 zsh ntp libffi-dev vnstat finger htop fail2ban sendmail git nethogs unzip -y
printout " Basic package installation complete"
# nginx installation
# apt install nginx -y
# printout "nginx 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
# php7 install
# apt-get install php7.0 php7.0-mbstring php7.0-pgsql php7.0-fpm php7.0-json php7.0-mcrypt php-geoip php7.0-gd php7.0-dev php7.0-curl php7.0-cli php7.0-mysql php7.0-bcmath php-bcmath -y
printout " Php Installed!"
# composer
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
printout " composer installation complete"
# 1024M swap !
dd if=/dev/zero of=/swapfile bs=256M count=4
mkswap /swapfile
swapon /swapfile
echo " /swapfile none swap sw 0 0 " >> /etc/fstab
echo 0 > /proc/sys/vm/swappiness
chown root:root /swapfile
chmod 0600 /swapfile
printout " Swap configuration 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."