Shell Script to automate the installation of programs in Linux

0

I've put some commands in a simple Shell Script to automate the installation of web site hosting, the basics of the basic:

#!/bin/bash
# O Script será automaticamente finalizado se encontrar erros
set -euo pipefail
IFS=$'\n\t'

# Ubuntu 16.04 Dev Server
echo -e "\e[96m Adicionando o PPA .. \e[39m"
sudo add-apt-repository -y ppa:ondrej/apache2
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update

# Redefinir cores
Color_Off='3[0m'       # Redefinir texto

# Cores regulares
Red='3[0;31m'          # Red
Green='3[0;32m'        # Green
Yellow='3[0;33m'       # Yellow
Purple='3[0;35m'       # Purple
Cyan='3[0;36m'         # Cyan

# Atualizar os pacotes e o sistema de atualização
echo -e "$Cyan \n Atualizando os Pacotes do Ubuntu 16.04 .. $Color_Off"
sudo apt-get update -y && sudo apt-get upgrade -y

# Instala o LAMP
echo -e "$Cyan \n Instalando o apache2 .. $Color_Off"
sudo apt-get install apache2 apache2-doc apache2-utils libexpat1 ssl-cert -y

echo -e "$Cyan \n Instalando php & Requisitos .. $Color_Off"
sudo apt-get install libapache2-mod-php5.6 php5.6-common php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-curl php5.6-dev php5-gd -y

echo -e "$Cyan \n Instalando o MySQL .. $Color_Off"
echo "mysql-server-5.7 mysql-server/root_password password 123456789" | sudo debconf-set-selections
echo "mysql-server-5.7 mysql-server/root_password_again password 123456789" | sudo debconf-set-selections
sudo apt-get install mysql-server-5.7 -y

echo -e "$Cyan \n Instalando o phpMyAdmin .. $Color_Off"
sudo debconf-set-selections <<< 'phpmyadmin phpmyadmin/dbconfig-install boolean true'
sudo debconf-set-selections <<< 'phpmyadmin phpmyadmin/app-password-confirm password 123456789'
sudo debconf-set-selections <<< 'phpmyadmin phpmyadmin/mysql/admin-pass password 123456789'
sudo debconf-set-selections <<< 'phpmyadmin phpmyadmin/mysql/app-pass password 123456789'
sudo debconf-set-selections <<< 'phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2'

sudo apt-get install phpmyadmin -y

echo -e "$Cyan \n Verificando instalações .. $Color_Off"
sudo apt-get install apache2 libapache2-mod-php5.6 php5.6 mysql-server php-pear php5.6-mysql mysql-client mysql-server php5.6-mysql -y

# Configurações e Permissões
echo -e "$Cyan \n Permissões para /var/www .. $Color_Off"
sudo chown -R www-data:www-data /var/www
echo -e "$Green \n Todas as permissões foram definidas .. $Color_Off"

# Habilitando Mod Rewrite, necessário para WordPress Permalinks e arquivos .htaccess
echo -e "$Cyan \n Ativando Módulos do PHP e Apache .. $Color_Off"
sudo phpenmod mcrypt
sudo phpenmod curl
sudo a2enmod rewrite

# Reiniciando o Apache
echo -e "$Cyan \n Reiniciando o Apache .. $Color_Off"
sudo service apache2 restart

# Adiciona o IP do servidor no apache2.conf
ipconfig='ifconfig eth0 | grep inet | cut -d ":" -f 2 | tr -d a-z,A-Z," ",- | sed -n 1p'
echo "ServerName $ipconfig" >> /etc/apache2/apache2.conf

# Versão do PHP
php -v

# Versão do Apache
apachectl -v

# Versão do Mysql
mysql --version

# Verifica se o php está funcionando ou não
php -r 'echo "\n Instalação do LAMP finalizada.\n";'

However when I went to install Xenphore 2.0, it returned me some errors, looking at the requirements and possible to figure out the problem.

  

Requirements for XF 2.0 The requirements for running XF 2.0 were   changed since XF 1.5. The recommended requirements are as follows:

     

PHP: 5.4.0+ MySQL: 5.5+ PHP extensions: MySQLi, GD (with JPEG   support, PCRE, SPL, SimpleXML, DOM, JSON, iconv, ctype, cURL

The questions are as follows:

  

What packages are most used in website hosting?

     

Someone would have a script fuller than this, and with all   essential add-ons for creating a website hosting?

I know it depends a lot on hosting for hosting, however I would like to add any add-ons that are available.

Soon I'll add the Scripts to GitHub.

Thank!

    
asked by anonymous 23.03.2018 / 00:29

0 answers