Skip to content

Instantly share code, notes, and snippets.

@Domin8-IPTV
Created January 8, 2020 20:47
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 Domin8-IPTV/3f4404a1b5e5b91668c01f7b0b921439 to your computer and use it in GitHub Desktop.
Save Domin8-IPTV/3f4404a1b5e5b91668c01f7b0b921439 to your computer and use it in GitHub Desktop.
lamp on ubuntu 18.04
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
sudo apt-get install -y software-properties-common
# For Ubuntu 16.04 Run - bash lamp18.sh Script should auto terminate on errors
echo -e "\e[96m ADDING PPA \e[39m"
sudo add-apt-repository -y ppa:ondrej/apache2
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update
echo -e "\e[96m INSTALL APACHE \e[39m"
sudo apt-get -y install apache2
echo -e "\e[96m INSTALL PHP \e[39m"
sudo apt-get -y install php7.1 libapache2-mod-php7.1
# INSTALL PHP EXT
sudo apt-get -y install curl mcrypt php7.1-mysql php7.1-mcrypt php7.1-curl php7.1-json php7.1-mbstring php7.1-gd php7.1-intl php7.1-xml php7.1-zip php-gettext php7.1-pgsql
#sudo apt-get -y install php-xdebug
sudo phpenmod mcrypt
sudo phpenmod curl
# ENABLE MODS
sudo a2enmod rewrite
#sudo a2enmod headers
echo -e "\e[96m RESTART APACHE TO APPLY CHANGES \e[39m"
sudo service apache2 restart
echo -e "\e[96m Installing mysql server \e[39m"
echo -e "\e[93m User: root, Password: root \e[39m"
# Install MySQL Server in a Non-Interactive mode. Default root password will be "root"
echo "mysql-server-5.7 mysql-server/root_password password root" | sudo debconf-set-selections
echo "mysql-server-5.7 mysql-server/root_password_again password root" | sudo debconf-set-selections
sudo apt-get -y install mysql-server-5.7
### Run next command on production server
#sudo mysql_secure_installation
# COMPOSER
echo -e "\e[96m INSTALLING COMPOSER \e[39m"
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
# CHECK PHP
php -v
# CHECK APACHE
apachectl -v
# CHECK MYSQL
mysql --version
# CHECK PHP STATUS
php -r 'echo "\nPHP INSTALL IS UP AND RUNNING.\n";'
# SET COMPOSER PERMISSIONS
#sudo chown -R $USER $HOME/.composer
# CHECK COMPOSER
composer --version
echo -e "\e[92m Open http://localhost/ to check if apache is working or not. \e[39m"
# CLEAN CASHE
sudo apt-get clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment