#!/bin/bash # +-------------------------------------------------------------------------+ # | LEMPer.sh is a simple LEMP stack installer for Debian/Ubuntu | # |-------------------------------------------------------------------------+ # | Features : | # | - Nginx latest | # | - MariaDB 10 (MySQL drop-in replacement) | # | - PHP latest | # | - Zend OpCache | # | - Memcached latest | # | - ionCube Loader | # | - SourceGuardian Loader | # | - Adminer (PhpMyAdmin replacement) | # | Min requirement : GNU/Linux Ubuntu 14.04 or Linux Mint 17 | # | Last Update : 10/08/2019 | # | Author : ESLabs.ID (eslabs.id@gmail.com) | # | Version : 1.0.0 | # +-------------------------------------------------------------------------+ # | Copyright (c) 2014-2019 ESLabs (https://eslabs.id/lemper) | # +-------------------------------------------------------------------------+ # | This source file is subject to the GNU General Public License | # | that is bundled with this package in the file LICENSE.md. | # | | # | If you did not receive a copy of the license and are unable to | # | obtain it through the world-wide-web, please send an email | # | to license@eslabs.id so we can send you a copy immediately. | # +-------------------------------------------------------------------------+ # | Authors: Edi Septriyanto | # +-------------------------------------------------------------------------+ # Work even if somebody does "sh lemper.sh". set -e # Try to export global path. if [ -z "${PATH}" ] ; then export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin fi # Get base directory. export BASEDIR && \ BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd ) # Include helper functions. if [ "$(type -t run)" != "function" ]; then . scripts/helper.sh fi # Make sure only root can run this installer script. requires_root # Make sure this script only run on supported distribution. export DISTRIB_NAME && \ DISTRIB_NAME=$(get_distrib_name) export DISTRIB_REPO && \ DISTRIB_REPO=$(get_release_name) if [[ "${DISTRIB_REPO}" == "unsupported" ]]; then warning "This installer only work on Ubuntu 16.04 & 18.04 and LinuxMint 18 & 19." exit 1 else # Get system architecture. export ARCH && \ ARCH=$(uname -p) # Get ethernet interface. export IFACE && \ IFACE=$(find /sys/class/net -type l | grep -e "enp\|eth0" | cut -d'/' -f5) # Get ethernet IP. export IP_SERVER && \ IP_SERVER=$(ifconfig "${IFACE}" | grep "inet " | cut -d: -f2 | awk '{print $2}') fi # Init log. run init_log ### Main ### case "${1}" in "--install") header_msg echo "Starting LEMP stack installation..." echo "Please ensure that you're on a fresh install!" echo "" read -t 10 -rp "Press [Enter] to continue..." > lemper.log fi echo " See the log file (lemper.log) for more information. Now, you can reboot your server and enjoy it!" ;; "--remove"|"--uninstall") header_msg echo "" echo "Are you sure to remove LEMP stack installation?" echo "Please ensure that you've back up your critical data!" echo "" read -rt 10 -p "Press [Enter] to continue..."