Skip to content

Instantly share code, notes, and snippets.

@zeusintuivo
Last active April 16, 2016 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeusintuivo/29be664812e326f8603cc487ad1aa9bd to your computer and use it in GitHub Desktop.
Save zeusintuivo/29be664812e326f8603cc487ad1aa9bd to your computer and use it in GitHub Desktop.
Desktop Automated Setup. This script allows you to setup your working environment with what I consider to be minimum development requirements version on Ubuntu 16.04 LTS Xenial
#!/bin/bash
# @author Zeus Intuivo (zeus AT intuivo DOT com)
#
# intoostation_xenial_setup.sh
# This script allows you to setup your working environment with what I consider to be minimum requirements
# version on
# Ubuntu 15.04 LTS or Ubuntu 14.04 LTS or Debian wheezy/sid
#
# Optional Requires:
# install_sublime_text.sh -> https://gist.github.com/askmatey/c4fcbf37b598aee180bb
# for sublime.
#
# To execute the script:
# 1. Open Terminal
# 2. Change to the download folder
# 3. Make the script executable with chmod +x ( chmod +x intoostation_xenial_setup.sh )
# 4. Run it with ./nineteen.sh
#
# Feel free to use this script as you see fit.
run_update(){
touch "updated_${1}.lock"
# if file does not exist
if [[ ! -f "updated.lock" ]] ; then
{
msg_green " Already updated."
}
else
{
sudo apt update -y
}
fi
rm "updated_${1}.lock"
}
# VARIABLES
bld="\e[1m" # Bold text.
bdr="\e[1;31m" # Bold red text.
bdg="\e[1;32m" # Bold green text.
bdy="\e[1;33m" # Bold yellow text.
off="\e[0m" # Turn off ansi colors.
msg_bold () {
printf "\n${bld}%s ${off}%s\n" "$@"
}
msg_red () {
printf "\n${bdr}%s ${off}%s\n" "$@"
}
msg_green () {
printf "\n${bdg}%s ${off}%s\n" "$@"
}
msg_yellow () {
printf "\n${bdy}%s ${off}%s\n" "$@"
}
trap '{ msg_red " KEYBOARD INTERRUPT."; exit 130; }' INT
PREFIX="/usr/local"
export PATH="${PREFIX}/bin:${PATH}"
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}"
export LD_LIBRARY_PATH="${PREFIX}/lib:${LD_LIBRARY_PATH}"
export CFLAGS="-O2 -ffast-math -march=native -g -ggdb3"
export CPPFLAGS="-I/usr/local/include -I${PREFIX}/include"
export LDFLAGS="-L/usr/local/lib -L${PREFIX}/lib"
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:${PREFIX}/lib/pkgconfig"
export CC="ccache gcc"
export CXX="ccache g++"
NCPU=$(getconf _NPROCESSORS_ONLN)
NJOBS=$((NCPU*2))
export MAKE="make -j ${NJOBS}"
#DOWNLOADS="${HOME}/Downloads/"
#TITLE="wmctrl -r :ACTIVE: -N"
GEN="./autogen.sh --prefix=${PREFIX}"
RELEASE="$(lsb_release -sc)"
CODE="$(locale | grep 'LANG=' | cut -d= -f2 | cut -d_ -f1)"
#DROPB="https://dl.dropboxusercontent.com/u/"
NO_NLS=0
DOCUDIR=$(test -f ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs && \
source ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs
echo ${XDG_DOCUMENTS_DIR:-$HOME})
DEPS_EN="aspell-${CODE} manpages git ruby gawk ack-grep \
silversearcher-ag tree rlwrap xbacklight \
mysql-server libapache2-mod-auth-mysql php7.0-mysql gksu gedit \
sni-qt:i386 linux-tools-common linux-tools-generic
"
#TRIM_EN="${DEPS_EN:46}"
DEPS="aspell-${CODE} manpages.${CODE} git ruby gawk ack-grep \
silversearcher-ag tree rlwrap xbacklight \
mysql-server libapache2-mod-auth-mysql php7.0-mysql gksu gedit \
sni-qt:i386 linux-tools-common linux-tools-generic
"
#TRIM="${DEPS:48}"
#ALTSQL="git clone git://github.com/ewaters/altsql-shell.git"
#tmp_count=0
#EPROG_COUNT=$(for i in $(echo ${EPROG}); do tmp_count=$((tmp_count+1)); done && echo ${tmp_count})
unset tmp_count
# Enable this option to force messages to display in English
# during the build process (bug reporting):
# export LC_ALL=C
# TESTS
msg_bold "SYSTEM REQUIREMENTS CHECK..."; sleep 1
if [ "${RELEASE}" == "xenial" ]; then
msg_green "Ubuntu ${RELEASE}... OK"; sleep 1
else
msg_red " UNSUPPORTED VERSION."
exit 1
fi
dpkg -l | egrep 'google-chrome' &>/dev/null
if [ $? == 0 ]; then
msg_green " google-chrome INSTALLED."
else
msg_red " NEED TO INSTALL google-chrome."
msg_red " MORE INFO: http://askubuntu.com/questions/79280/how-to-install-chrome-browser-properly-via-command-line "
msg_red " PRESS ENTER."
sudo apt install libxss1 libappindicator1 libindicator7 -fy
deb http://dl.google.com/linux/deb/ stable non-free main
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
run_update "chrome"
//wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
//sudo dpkg -i google-chrome*.deb -fy &>/dev/null
sudo apt install google-chrome-stable -fy &>/dev/null
if [ $? == 0 ]; then
sudo apt install -fy
//sudo dpkg -i google-chrome*.deb -fy
sudo apt install google-chrome-stable -fy
fi
fi
find ~/.dropbox-dist/dropboxd | egrep 'dropboxd' &>/dev/null
if [ $? == 0 ]; then
msg_green " dropbox INSTALLED."
else
msg_red " NEED TO INSTALL dropbox."
msg_red " MORE INFO: https://www.dropbox.com/en/install?os=lnx "
msg_red " PRESS ENTER."
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
~/.dropbox-dist/dropboxd
echo fs.inotify.max_user_watches=100000 | sudo tee -a /etc/sysctl.conf; sudo sysctl -p
dropbox stop
dropbox status
dropbox start
dropbox starttus
fi
dpkg -l | egrep ' curl ' &>/dev/null
if [ $? == 0 ]; then
msg_green " curl INSTALLED."
else
msg_red " NEED TO INSTALL curl."
msg_red " PRESS ENTER."
sudo apt install curl -fy
fi
dpkg -l | egrep ' grc ' &>/dev/null
if [ $? == 0 ]; then
msg_green " grcat INSTALLED."
else
msg_red " NEED TO INSTALL grcat."
msg_red " PRESS ENTER."
sudo apt install grc -fy
fi
dpkg -l | egrep ' scite ' &>/dev/null
if [ $? == 0 ]; then
msg_green " scite INSTALLED."
else
msg_red " NEED TO INSTALL scite."
msg_red " PRESS ENTER."
sudo apt install scite -fy
fi
dpkg -l | egrep ' apt-file ' &>/dev/null
if [ $? == 0 ]; then
msg_green " apt-file INSTALLED."
else
msg_red " NEED TO INSTALL apt-file."
msg_red " PRESS ENTER."
sudo apt install apt-file -fy
apt-file update
fi
dpkg -l | egrep 'libcurses' &>/dev/null
if [ $? == 0 ]; then
msg_green " libcurses INSTALLED."
else
msg_red " NEED TO INSTALL libcurses."
msg_red " PRESS ENTER."
sudo apt install -fy lib32ncurses5-dev
sudo apt install -fy libcurses-ocaml-dev
sudo apt install -fy libncurses5-dev
sudo apt install -fy libx32ncurses5-dev
fi
find ~/bin/cpanm | egrep 'cpanm' &>/dev/null
if [ $? == 0 ]; then
msg_green " cpanm INSTALLED."
else
msg_red " NEED TO INSTALL cpanm."
msg_red " MORE INFO: http://search.cpan.org/~miyagawa/App-cpanminus-1.7039/lib/App/cpanminus.pm#INSTALLATION "
msg_red " PRESS ENTER."
mkdir -p ~/bin
cd ~/bin
#curl -LO http://xrl.us/cpanm
#chmod +x cpanm
curl -L https://cpanmin.us/ -o cpanm
chmod +x cpanm
# ~/bin/cpanm --local-lib=~/perl5 local::lib
#eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
#echo 'eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)' >> ~/.bashrc
#perl -I$HOME/perl5/lib/perl5 -Mlocal::lib >> ~/.cshrcx cpanm
fi
find /usr/local/bin/altsql | egrep 'altsql' &>/dev/null
if [ $? == 0 ]; then
msg_green " altsql INSTALLED."
else
msg_red " NEED TO INSTALL altsql."
msg_red " MORE INFO: https://github.com/ewaters/altsql-shell/blob/master/INSTALL "
msg_red " PRESS ENTER."
# ERROR ! Configure failed for DBD-mysql-4.031. See /home/user/.cpanm/work/1437441176.14856/build.log for details.
# ! Installing the dependencies failed: Module 'DBD::mysql' is not installed
# ! Bailing out the installation for App-AltSQL-0.05.
# Fix with this update first
sudo apt install -fy libdbd-mysql-perl
# Then install
cpanm --local-lib=~/perl5 local::lib && eval "$(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)"
sudo ~/bin/cpanm App::AltSQL
fi
find /usr/local/bin/phpunit | egrep 'phpunit' &>/dev/null
if [ $? == 0 ]; then
msg_green " phpunit INSTALLED."
else
msg_red " NEED TO INSTALL phpunit."
msg_red " MORE INFO: https://phpunit.de/manual/current/en/installation.html "
msg_red " PRESS ENTER."
wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
sudo mv phpunit.phar /usr/local/bin/phpunit
sudo apt install phpunit -fy
phpunit --version
fi
dpkg -l | egrep 'filezilla' &>/dev/null
if [ $? == 0 ]; then
msg_green " filezilla INSTALLED."
else
msg_red " NEED TO INSTALL filezilla."
sudo apt install -fy filezilla
fi
dpkg -l | egrep 'sublime' &>/dev/null
if [ $? == 0 ]; then
msg_green " sublime INSTALLED."
else
msg_red " NEED TO INSTALL sublime."
msg_red " PRESS ENTER."
find install_sublime_text.sh | egrep 'install_sublime_text' &>/dev/null
if [ $? == 0 ]; then
msg_yellow " INSTALL BASED ON: http://www.simonewebdesign.it/install-sublime-text-3-on-linux/ "
curl -L git.io/sublimetext | sh
else
msg_yellow " INSTALL BASED ON: http://www.simonewebdesign.it/install-sublime-text-3-on-linux/ "
./install_sublime_text.sh
fi
# if still it did not install
dpkg -l | egrep 'sublime' &>/dev/null
if [ $? == 0 ]; then
msg_green " sublime HAS BEEN INSTALLED."
else
msg_yellow " INSTALL WITH REPO MORE INFO: https://gist.github.com/kuhnroyal/36255e1cd206fd683549 "
sudo add-apt-repository ppa:webupd8team/sublime-text-3
run_update "sublime"
sudo apt install -fy sublime-text-installer
fi
fi
dpkg -l | egrep ' git ' &>/dev/null
if [ $? == 0 ]; then
msg_green " git INSTALLED."
else
msg_red " NEED TO INSTALL git."
msg_red " MORE INFO: https://gist.github.com/kuhnroyal/36255e1cd206fd683549 "
msg_red " PRESS ENTER."
sudo add-apt-repository ppa:git-core/ppa
run_update "git"
sudo apt install -fy git
fi
dpkg -l | egrep 'xclip' &>/dev/null
if [ $? == 0 ]; then
msg_green " xclip INSTALLED."
else
msg_red " NEED TO INSTALL xclip"
msg_red " PRESS ENTER."
sudo apt install -fy xclip
fi
dpkg -l | egrep ' gimp ' &>/dev/null
if [ $? == 0 ]; then
msg_green " gimp INSTALLED."
else
msg_red " NEED TO INSTALL gimp."
msg_red " MORE INFO: https://gist.github.com/kuhnroyal/36255e1cd206fd683549 "
msg_red " PRESS ENTER."
sudo apt install -fy gimp
fi
dpkg -l | egrep 'nodejs' &>/dev/null
if [ $? == 0 ]; then
msg_green " npm (NODEJS) INSTALLED."
else
msg_red " NEED TO INSTALL npm (NODEJS)."
msg_red " MORE INFO: https://gist.github.com/kuhnroyal/36255e1cd206fd683549 "
msg_red " PRESS ENTER."
curl -sL https://deb.nodesource.com/setup | sudo bash
sudo apt install -fy nodejs build-essential
# Now run Bower. Note that some Linux distributions install nodejs not as “node” executable but as “nodejs”. This can throw the following error when running Bower.
# /usr/bin/env: node: No such file or directory
# This caused some wasted time, however some searching around found a fix. In this case you can do an easy symlink. For Linux distributions which install package binaries to /usr/bin you can do the following.
# REF: http://www.codediesel.com/javascript/installing-bower-on-ubuntu-14-04-lts/
sudo ln -s /usr/bin/nodejs /usr/bin/node
fi
dpkg -l | egrep 'npm' &>/dev/null
if [ $? == 0 ]; then
msg_green " npm INSTALLED."
else
msg_red " NEED TO INSTALL npm."
# msg_red " MORE INFO: "
msg_red " PRESS ENTER."
sudo apt install -fy npm
sudo npm install -g bower yo grunt-cli jasmine octopus
sudo npm install --global gulp
fi
dpkg -l | egrep 'skype' &>/dev/null
if [ $? == 0 ]; then
msg_green " skype INSTALLED."
else
msg_red " NEED TO INSTALL skype."
msg_red " MORE INFO: https://help.ubuntu.com/community/Skype "
msg_red " PRESS ENTER."
msg_red " Users of 64-bit Ubuntu, should enable MultiArch if it isn't already enabled by running the command."
sudo dpkg --add-architecture i386
sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
run_update "skype"
sudo apt install skype pulseaudio:i386 -fy
msg_red " Instal Skype Applet for Ubuntu 64 bits."
sudo apt install -fy sni-qt:i386
fi
dpkg -l | egrep 'gpg' &>/dev/null
if [ $? == 0 ]; then
msg_green " gpg INSTALLED."
else
msg_red " NEED TO INSTALL gpg."
# msg_red " MORE INFO: "
msg_red " PRESS ENTER."
sudo apt install -fy gpg
fi
find ~/.rvm/scripts/rvm | egrep 'rvm' &>/dev/null
if [ $? == 0 ]; then
msg_green " rvm INSTALLED."
else
msg_red " NEED TO INSTALL rvm."
msg_red " MORE INFO: https://rvm.io/rvm/install"
msg_red " PRESS ENTER."
sudo apt install -fy git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable --ruby --rails
fi
find ~/.rvm/scripts/rvm | egrep 'rvm' &>/dev/null
if [ $? == 0 ]; then
msg_green " rvm INSTALLED."
else
msg_red " NEED TO INSTALL rvm."
msg_red " MORE INFO: https://rvm.io/rvm/install"
msg_red " PRESS ENTER."
sudo apt install -fy git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable --ruby --rails
fi
which rails | egrep 'rails' &>/dev/null
if [ $? == 0 ]; then
msg_green " rails INSTALLED."
else
msg_red " NEED TO INSTALL rails."
msg_red " MORE INFO: https://gorails.com/setup/ubuntu/14.04"
msg_red " PRESS ENTER."
#Now we tell Rubygems not to install the documentation for each package locally and then install Bundler
#echo "gem: --no-ri --no-rdoc" > ~/.gemrc
gem install bundler
gem install rails
fi
dpkg -l | egrep 'postgresql' &>/dev/null
if [ $? == 0 ]; then
msg_green " postgresql INSTALLED."
else
msg_red " NEED TO INSTALL postgresql."
msg_red " MORE INFO: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-14-04 "
msg_red " MORE INFO:https://marcinkubala.wordpress.com/2013/11/11/postgresql-on-os-x-mavericks/"
msg_red " PRESS ENTER."
sudo apt install -fy postgresql postgresql-contrib postgresql-common libpq-dev postgresql-client-common
#sudo apt install -fy postgres-xc
# Feel free to replace root with your username.
sudo -u postgres createuser root -s
# If you would like to set a password for the user, you can do the following
msg_red "postgres=# \password root. PRESS ENTER"
msg_red "postgres=# \q. TO QUIT AND PRESS ENTER"
sudo -u postgres psql
#postgres=# \password chris
msg_red "LOGGING INTO sudo -i -u postgres. type 'exit' TO QUIT AND PRESS ENTER"
sudo -i -u postgres
fi
which composer | egrep 'composer' &>/dev/null
if [ $? == 0 ]; then
msg_green " composer INSTALLED."
else
msg_red " NEED TO INSTALL composer."
msg_red " MORE INFO: https://getcomposer.org/doc/00-intro.md#using-the-installer "
msg_red " PRESS ENTER."
mkdir -p ~/bin
cd ~/bin
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
fi
find ~/.composer/vendor/bin/laravel | egrep 'laravel' &>/dev/null
if [ $? == 0 ]; then
msg_green " laravel 5.0 INSTALLED."
else
msg_red " NEED TO INSTALL laravel 5.0."
msg_yellow " MORE INFO: http://laravel.com/docs/5.0/install "
msg_red " PRESS ENTER."
msg_red " NEED TO INSTALL ext-gmp"
# Fix for composer global require "ext-gmp"
sudo apt --reinstall install php7.0-gmp -fy
composer global require "laravel/installer=~1.1"
composer global require "symfony/event-dispatcher"
composer global require "symfony/dependency-injection"
composer global require "symfony/http-kernel"
composer global require "symfony/yaml"
composer global require "symfony/config"
composer global require "symfony/proxy-manager-bridge"
composer global require "psr/log"
# Fix to get ext-curl working
msg_red " NEED TO INSTALL ext-curl"
msg_yellow " MORE INFO: http://stackoverflow.com/questions/19335305/composer-install-error-requires-ext-curl-when-its-actualy-enabled "
# http://stackoverflow.com/questions/19335305/composer-install-error-requires-ext-curl-when-its-actualy-enabled
sudo apt --reinstall install -fy php7.0-curl
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
composer global require "ext-curl"
composer global require "symfony/browser-kit"
composer global require "symfony/css-selector"
composer global require "symfony/class-loader"
composer global require "symfony/config"
composer global require "symfony/finder"
composer global require "symfony/var-dumper"
composer global require "zendframework/zend-serializer"
composer global require "zendframework/zend-servicemanager"
composer global require "zendframework/zend-filter"
composer global require "doctrine/common=~2.1"
composer global require "ocramius/generated-hydrator"
composer global require "zendframework/zend-xmlrpc"
composer global require "zendframework/zend-json"
composer global require "zendframework/zend-soap"
composer global require "ircmaxell/random-lib"
composer global require "zendframework/zend-http"
composer global require "zendframework/zend-server"
composer global require "zendframework/zendxml"
composer global require "zendframework/zend-di"
msg_red " mcrypt support => enabling "
msg_red " You need Apache for mcrypt extension to work "
msg_yellow " Installing Apache2 "
sudo apt -fy install apache2 php7.0-fpm php-pear php7.0-dev dh-make
sudo apt --reinstall install mcrypt php7.0-mcrypt -fy
sudo unlink /etc/php/7.0/cli/conf.d/20-mcrypt.ini
sudo unlink /etc/php/7.0/apache2/conf.d/20-mcrypt.ini
cd /etc/php/7.0/mods-available
sudo unlink mcrypt.ini
sudo mv mcrypt.ini.dpkg-new mcrypt.ini
# Create symbol links now
sudo php7.0enmod mcrypt
# This process ^ has to have created the following symlinks
#
# ln -s /etc/php/7.0/mods-available/mcrypt.ini /etc/php/7.0/cli/conf.d/20-mcrypt.ini
# ln -s /etc/php/7.0/mods-available/mcrypt.ini /etc/php/7.0/apache2/conf.d/20-mcrypt.ini
sudo service php7.0-fpm restart
# Checking
ls -al /etc/php/7.0/cli/conf.d/20-mcrypt.ini
ls -al /etc/php/7.0/apache2/conf.d/20-mcrypt.ini
egrep 'mcrypt' /etc/php/7.0/cli/conf.d/20-mcrypt.ini &>/dev/null
if [ $? == 0 ]; then
msg_green " mcrypt support => Enabled ! "
else
msg_red " mcrypt support => FAILED ! -- /etc/php/7.0/cli/conf.d/20-mcrypt.ini missing "
printf "\n%s\n\n" " Check that there is this file there ... /etc/php/7.0/mods-available/mcrypt.ini "
printf "\n%s\n\n" " then restart this process again."
exit 1
fi
egrep 'mcrypt' /etc/php/7.0/apache2/conf.d/20-mcrypt.ini &>/dev/null
if [ $? == 0 ]; then
msg_green " mcrypt support => Enabled ! "
else
msg_red " mcrypt support => FAILED ! --/etc/php/7.0/apache2/conf.d/20-mcrypt.ini missing "
printf "\n%s\n\n" " Check that there is this file there ... /etc/php/7.0/mods-available/mcrypt.ini "
printf "\n%s\n\n" " then restart this process again."
exit 1
fi
php -i | egrep mcrypt | egrep 'mcrypt' &>/dev/null
if [ $? == 0 ]; then
msg_green " php show mcrypt support => Enabled ! "
else
msg_red " php DOES NOT show mcrypt support => FAILED ! "
printf "\n%s\n\n" " php -i | egrep mcrypt "
printf "\n%s\n\n" " Fix ... then restart this process again."
php -i | egrep mcrypt
exit 1
fi
composer global require "zendframework/zend-crypt"
composer global require "zendframework/zend-i18n"
composer global require "zendframework/zend-uri"
composer global require "zendframework/zend-db"
composer global require "zendframework/zend-i18n-resources"
msg_red " NEED TO INSTALL ext-apcu"
sudo apt --reinstall install php7.0-apcu -fy
msg_red " NEED TO INSTALL ext-memcache"
sudo apt --reinstall install php7.0-memcache -fy
msg_red " NEED TO INSTALL ext-memcached"
sudo apt --reinstall install php7.0-memcached -fy
msg_red " NEED TO INSTALL ext-mongo"
sudo apt --reinstall install php7.0-mongo -fy
# composer global require "mongofill/mongofill"
msg_red " NEED TO INSTALL ext-redis"
sudo apt --reinstall install php7.0-redis -fy
msg_red " NEED TO INSTALL ext-wincache -This is only for windows "
msg_yellow " GOTO: http://www.microsoft.com/web/gallery/install.aspx "
msg_yellow " If you are on windows and if you need it "
msg_red " NEED TO INSTALL ext-xcache "
sudo apt --reinstall install php7.0-xcache -fy
# Fix for composer global require "ext-gmp"
composer global require "zendframework/zend-cache"
composer global require "zendframework/zend-session"
# Check for the composer execuatble in the PATH
cat ~/.bashrc ~/.bash_profile | egrep 'composer' &>/dev/null
if [ $? == 0 ]; then
export PATH=~/.composer/vendor/bin:$PATH
msg_green " Composer Bin the PATH -- CORRECT "
else
# Not Found then add it
msg_red " Composer Bin the PATH -- NOT FOUND !... Fixing "
echo "export PATH=~/.composer/vendor/bin:$PATH" >> ~/.bashrc
echo "" >> ~/.bashrc
# Check again
egrep 'composer' ~/.bashrc &>/dev/null
if [ $? == 0 ]; then
export PATH=~/.composer/vendor/bin:$PATH
msg_green " Composer Bin the PATH -- FIXED "
else
msg_red " Composer Bin the PATH -- CANT'T FIX "
printf "\n%s\n\n" " Please add this to your /.bash_profile (or ~/.bashrc) like this: "
printf "\n%s\n\n" " export PATH=~/.composer/vendor/bin:$PATH ."
printf "\n%s\n\n" " Fix ... then restart this process again."
exit 1
fi
fi
fi
php -i | egrep 'mcrypt' &>/dev/null
if [ $? == 0 ]; then
msg_green " mcrypt INSTALLED."
else
msg_red " mcrypt support => enabling "
msg_red " You need Apache for mcrypt extension to work "
msg_yellow " Installing Apache2 "
sudo apt -fy --reinstall install apache2 php7.0-fpm php-pear php7.0-dev dh-make
sudo apt -fy --reinstall install mcrypt php7.0-mcrypt
sudo unlink /etc/php/7.0/cli/conf.d/20-mcrypt.ini
sudo unlink /etc/php/7.0/apache2/conf.d/20-mcrypt.ini
cd /etc/php/7.0/mods-available
sudo unlink mcrypt.ini
sudo mv mcrypt.ini.dpkg-new mcrypt.ini
# Create symbol links now
sudo php7.0enmod mcrypt
# This process ^ has to have created the following symlinks
#
# ln -s /etc/php/7.0/mods-available/mcrypt.ini /etc/php/7.0/cli/conf.d/20-mcrypt.ini
# ln -s /etc/php/7.0/mods-available/mcrypt.ini /etc/php/7.0/apache2/conf.d/20-mcrypt.ini
sudo service php7.0-fpm restart
# Checking
ls -al /etc/php/7.0/cli/conf.d/20-mcrypt.ini
ls -al /etc/php/7.0/apache2/conf.d/20-mcrypt.ini
find /etc/php/7.0/cli/conf.d/20-mcrypt.ini | egrep 'mcrypt' &>/dev/null
if [ $? == 0 ]; then
msg_green " mcrypt support => Enabled ! "
else
msg_red " mcrypt support => FAILED ! -- /etc/php/7.0/cli/conf.d/20-mcrypt.ini missing "
printf "\n%s\n\n" " Check that there is this file there ... /etc/php/7.0/mods-available/mcrypt.ini "
printf "\n%s\n\n" " then restart this process again."
#exit 1
fi
find /etc/php/7.0/apache2/conf.d/20-mcrypt.ini | egrep 'mcrypt' &>/dev/null
if [ $? == 0 ]; then
msg_green " mcrypt support => Enabled ! "
else
msg_red " mcrypt support => FAILED ! --/etc/php/7.0/apache2/conf.d/20-mcrypt.ini missing "
printf "\n%s\n\n" " Check that there is this file there ... /etc/php/7.0/mods-available/mcrypt.ini "
printf "\n%s\n\n" " then restart this process again."
#exit 1
fi
php -i | egrep mcrypt | egrep 'mcrypt' &>/dev/null
if [ $? == 0 ]; then
msg_green " mcrypt support => Enabled ! "
else
# cat `php -i | grep \/php.ini` | egrep mcrypt.so
sudo sed -i 's/^;extension=mcrypt.so//' "$(php --ini | grep Loaded | cut -d':' -f2)"
sudo sed -i 's/^extension=mcrypt.so//' "$(php --ini | grep Loaded | cut -d':' -f2)"
sudo sed -i 's/^;extension=mcrypt.so/extension=mcrypt.so/' "$(php --ini | grep Loaded | cut -d':' -f2)"
sudo echo -e "\nextension=mcrypt.so\n" | sudo tee -a /etc/php/7.0/cli/php.ini
fi
php -i | egrep mcrypt | egrep 'mcrypt' &>/dev/null
if [ $? == 0 ]; then
msg_green " php show mcrypt support => Enabled ! "
else
msg_red " php DOES NOT show mcrypt support => FAILED ! "
printf "\n%s\n\n" " php -i | egrep mcrypt "
printf "\n%s\n\n" " Fix ... then restart this process again."
php -i | egrep mcrypt
exit 1
fi
fi
dpkg -l | egrep 'mysql-common' &>/dev/null
if [ $? == 0 ]; then
msg_green " mysql INSTALLED."
else
msg_red " NEED TO INSTALL mysql."
msg_red " MORE INFO: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu "
msg_red " PRESS ENTER."
ifconfig eth0 | grep inet | awk '{ print $2 }'
sudo apt --reinstall install mysql-server libapache2-mod-auth-mysql php7.0-mysql -fy
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation
fi
dpkg -l | egrep 'php7.0' &>/dev/null
if [ $? == 0 ]; then
msg_green " php7.0 INSTALLED."
else
msg_red " NEED TO INSTALL php7.0."
msg_red " MORE INFO: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu "
msg_red " PRESS ENTER."
sudo apt install php7.0 libapache2-mod-php7.0 php7.0-mcrypt -fy
apt-cache search php7.0- | egrep 'php7.0'
fi
dpkg -l | egrep 'touchpad-indicator' &>/dev/null
if [ $? == 0 ]; then
msg_green " touchpad-indicator INSTALLED."
else
msg_red " NEED TO INSTALL touchpad-indicator."
msg_red " MORE INFO: http://askubuntu.com/questions/58584/can-i-automatically-deactivate-my-touchpad-when-a-usb-mouse-is-connected "
msg_red " PRESS ENTER."
sudo add-apt-repository ppa:atareao/atareao
run_update "touchpad-indicator"
sudo apt install touchpad-indicator -fy
fi
dpkg -l | egrep 'oracle-java|jdk' &>/dev/null
if [ $? == 0 ]; then
msg_green " JAVA INSTALLED."
else
msg_red " NEED TO INSTALL JAVA ORACLE."
msg_red " PRESS ENTER."
sudo add-apt-repository ppa:webupd8team/java
run_update "oracle"
sudo apt install oracle-java7-installer -fy
fi
#http://www.webupd8.org/2013/10/install-nemo-with-unity-patches-and.html
dpkg -l | egrep 'nemo' &>/dev/null
if [ $? == 0 ]; then
msg_green " NEMO INSTALLED."
else
msg_red " NEED TO INSTALL NEMO T W E A K E D FOR UBUNTU."
msg_red " MORE INFO: http://www.webupd8.org/2013/10/install-nemo-with-unity-patches-and.html "
msg_red " PASSWORD THEN PRESS ENTER, THEN ENTER."
sudo add-apt-repository ppa:webupd8team/nemo
run_update "memo"
sudo apt install nemo nemo-fileroller -fy
sudo apt install nemo-compare nemo-dropbox nemo-media-columns nemo-pastebin nemo-seahorse nemo-share nemo-emblems nemo-image-converter -fy
sudo apt install nemo-terminal -fy
fi
#http://www.webupd8.org/2014/04/prevent-your-laptop-from-overheating.html
#cat /etc/default/grub | egrep 'intel_pstate' &>/dev/null
#if [ $? == 0 ]; then
# msg_green " intel_pstate INSTALLED."
# msg_yellow " CHECKING IT. "
# msg_yellow " This should return 'intel_pstate'. "
# cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver
#
#else
# msg_red " NEED TO INSTALL intel_pstate ."
# msg_red " MORE INFO: http://www.webupd8.org/2014/04/prevent-your-laptop-from-overheating.html "
# msg_red " And for GRUB_CMDLINE_LINUX_DEFAULT= (it's on line 11 on my system), add \"intel_pstate=enable\", like this:"
# msg_red " GRUB_CMDLINE_LINUX_DEFAULT=\"quiet splash intel_pstate=enable\""
# #gksu gedit /etc/default/grub
# sudo sed -i 's/^.*\bGRUB_CMDLINE_LINUX_DEFAULT\b.*$/GRUB_CMDLINE_LINUX_DEFAULT=\"quiet splash intel_pstate=enable\"/' /etc/default/grub
# sudo update-grub
#
#
#fi
#
# FUNCTIONS
warn () {
zenity --no-wrap --info --text "
If you proceed with the installation,\n\
nearly 100MB of additional disk space\n\
will be used.\n
Bear in mind that running other applications\n\
during the build process will affect\n\
compilation time."
sleep 1
}
should_we_disable_nls () {
if [ ${NO_NLS} -eq 1 ]; then
GEN=$(${GEN} --disable-nls)
msg_green "Building with NLS disabled!"
else
msg_green "Building with NLS enabled!"
fi
}
bin_deps () {
# sudo apt update && sudo apt dist-upgrade --yes
if [ ! -f "${DOCUDIR}/installed.txt" ]; then
dpkg --get-selections > "${DOCUDIR}/installed.txt"
sed -i '/linux-headers*/d' "${DOCUDIR}/installed.txt"
sed -i '/linux-image*/d' "${DOCUDIR}/installed.txt"
sed -i '/linux-generic*/d' "${DOCUDIR}/installed.txt"
sed -i '/linux-signed*/d' "${DOCUDIR}/installed.txt"
fi
if [ "${CODE}" == "en" ]; then
sudo apt install --yes "${DEPS_EN}"
sleep 1
else
sudo apt install --yes "${DEPS}"
sleep 1
fi
}
ls_ppa () {
local PPA="$(awk '$1 == "Package:" { print $2 }' \
/var/lib/apt/lists/*ppa*Packages)"
for i in $(echo "${PPA}" | xargs -n1 | sort -u); do
dpkg-query "-Wf${db:Status-abbrev}" "${i}" &>/dev/null
if [ $? == 0 ]; then
sed -i "/${i}/d" "${DOCUDIR}/installed.txt"
fi
done
}
msg_bold "Proceeding to install All kinds of Needed libraries ..."
if grep -q ppa /var/lib/apt/lists/*ppa* &>/dev/null; then
bin_deps
ls_ppa
else
unset -f ls_ppa
bin_deps
fi
#REINTALL MYSQL
#irst remove MySQL:
#udo apt remove --purge mysql-server mysql-client mysql-common
#udo apt autoremove
#udo apt autoclean
#hen reinstall:
#udo apt update
#udo apt install mysql-server
#udo mysql_install_db
#udo /usr/bin/mysql_secure_installation
#
#
#
# END
#
#
#
rm updated.lock
printf "\n%s\n\n" " You need to reboot your system..."
printf "\n%s\n\n" " do "
printf "\n%s\n\n" " shutdown -r now "
printf "\n%s\n\n" " or "
printf "\n%s\n\n" " systemctl reboot "
printf "\n%s\n\n" " That's All Folks..."
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment