Skip to content

Instantly share code, notes, and snippets.

@jadsonbr
Created June 12, 2017 18:24
Show Gist options
  • Save jadsonbr/d9b808c1e89b6685accb7a1ac8295f41 to your computer and use it in GitHub Desktop.
Save jadsonbr/d9b808c1e89b6685accb7a1ac8295f41 to your computer and use it in GitHub Desktop.
Verifica e instala os requisitos para o Laravel 5.4
#!/bin/bash
#Criado por: Jadson Bonfim Ribeiro - 2017
#Contato: jadsonbr@outlook.com.br
### Verifica requisitos para deploy do Laravel 5.4
clear
echo "$(tput setaf 3)Verificando requisitos do laravel 5.2$(tput sgr 0)"
##################################################
# Requisitos PHP
##################################################
echo
echo -n "$(tput setaf 3)Verificando ferramentas necessarias para o PHP$(tput sgr 0)"
var1=python-software-properties
pacote1=$(dpkg --get-selections | grep "$var1" )
echo
echo -n "$(tput setaf 3)Verificando se o Pacote [$var1] esta instalado$(tput sgr 0)"
sleep 2
if [ -n "$pacote1"];
then echo
echo "$(tput setaf 3)Pacote $var1 ja instalado$(tput sgr 0)"
else echo
echo "$(tput setaf 3)Pacote $var1 necessario -> Nao instalado$(tput sgr 0)"
echo "Instalando automaticamente pacote [$var1]$(tput sgr 0)"
sudo apt-get install python-software-properties
fi
##################################################
# Adicionando repositorio PHP
##################################################
echo
echo -n "$(tput setaf 3)Adicionando repositorio ppa:ondrej/php$(tput sgr 0)"
sudo add-apt-repository ppa:ondrej/php
echo -n "$(tput setaf 3)Atualizando os repositorios$(tput sgr 0)"
sudo apt-get update
##################################################
# Instalando PHP MCRYPT
##################################################
echo
echo -n "$(tput setaf 3)Verificando o PHP mcrypt 7.1$(tput sgr 0)"
var3=php7.1-mcrypt
pacote3=$(dpkg --get-selections | grep "$var3" )
echo
echo -n "$(tput setaf 3)Verificando se o pacote $var3 esta instalado$(tput sgr 0)"
sleep 2
if [ -n "$pacote3" ];
then echo
echo "$(tput setaf 3)Pacote $var3 ja esta instalado$(tput sgr 0)"
else echo
echo "$(tput setaf 3)Instalando pacote $var3 necessario$(tput sgr 0)"
sudo apt-get install php7.1-mcrypt -y
fi
##################################################
# Instalando PHP CURL
##################################################
echo
echo -n "$(tput setaf 3)Verificando o PHP curl 7.1$(tput sgr 0)"
var3=php7.1-curl
pacote3=$(dpkg --get-selections | grep "$var3" )
echo
echo -n "$(tput setaf 3)Verificando se o pacote $var3 esta instalado$(tput sgr 0)"
sleep 2
if [ -n "$pacote3" ];
then echo
echo "$(tput setaf 3)Pacote $var3 ja esta instalado$(tput sgr 0)"
else echo
echo "$(tput setaf 3)Instalando pacote $var3 necessario$(tput sgr 0)"
sudo apt-get install php7.1-curl -y
fi
##################################################
# Instalando PHP MBSTRING
##################################################
echo
echo -n "$(tput setaf 3)Verificando o PHP mbstring 7.1$(tput sgr 0)"
var3=php7.1-mbstring
pacote3=$(dpkg --get-selections | grep "$var3" )
echo
echo -n "$(tput setaf 3)Verificando se o pacote $var3 esta instalado$(tput sgr 0)"
sleep 2
if [ -n "$pacote3" ];
then echo
echo "$(tput setaf 3)Pacote $var3 ja esta instalado$(tput sgr 0)"
else echo
echo "$(tput setaf 3)Instalando pacote $var3 necessario$(tput sgr 0)"
sudo apt-get install php7.1-mbstring -y
fi
##################################################
# Instalando PHP
##################################################
echo
echo -n "$(tput setaf 3)Verificando o PHP 7.1$(tput sgr 0)"
var3=php7.1
pacote3=$(dpkg --get-selections | grep "$var3" )
echo
echo -n "$(tput setaf 3)Verificando se o pacote $var3 esta instalado$(tput sgr 0)"
sleep 2
if [ -n "$pacote3" ];
then echo
echo "$(tput setaf 3)Pacote $var3 ja esta instalado$(tput sgr 0)"
else echo
echo "$(tput setaf 3)Instalando pacote $var3 necessario$(tput sgr 0)"
sudo apt-get install php7.1 php7.1-fpm -y
fi
##################################################
# Instalando modulo PHP no Apache
##################################################
echo
echo -n "$(tput setaf 3)Verificando o modulo do PHP no Apache$(tput sgr 0)"
var4=libapache2-mod-php7.1
pacote4=$(dpkg --get-selections | grep "$var4" )
echo
echo -n "$(tput setaf 3)Vericando se o modulo PHP no Apache esta instalado$(tput sgr 0)"
sleep 2
if [ -n "$pacote4" ];
then echo
echo "$(tput setaf 3)Pacote $var4 ja esta instalado$(tput sgr 0)"
else echo
echo "$(tput setaf 3)Instalando pacote $var4 necessario$(tput sgr 0)"
sudo apt-get install libapache2-mod-php7.1 -y
fi
##################################################
# Instalando o POSTGRES
##################################################
echo
echo -n "$(tput setaf 3)Verificando PostgreSQL$(tput sgr 0)"
var5=postgresql
pacote5=$(dpkg --get-selections | grep "$var5" )
echo
echo -n "$(tput setaf 3)Vericando se o postgreSQL esta instalado$(tput sgr 0)"
sleep 2
if [ -n "$pacote5" ];
then echo
echo "$(tput setaf 3)Pacote $var5 ja esta instalado$(tput sgr 0)"
else echo
echo "$(tput setaf 3)Instalando pacote $var5 necessario$(tput sgr 0)"
sudo apt-get install postgresql postgresql-contrib -y
fi
##################################################
# InstaLando PDO postgreSQL
##################################################
echo
echo -n "$(tput setaf 3)Verificando o PDO do postgreSQL$(tput sgr 0)"
var6=php7.1-pgsql
pacote6=$(dpkg --get-selections | grep "$var6" )
echo
echo -n "$(tput setaf 3)Vericando se o PDO do postgreSQL esta instalado$(tput sgr 0)"
sleep 2
if [ -n "$pacote6" ];
then echo
echo "$(tput setaf 3)Pacote $var6 ja esta instalado$(tput sgr 0)"
else echo
echo "$(tput setaf 3)Instalando pacote $var6 necessario$(tput sgr 0)"
sudo apt-get install php7.1-pgsql -y
fi
##################################################
# Sair
##################################################
echo
echo
echo -n "$(tput setaf 3)Pressione ENTER para sair...$(tput sgr 0)"
echo
read sair
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment