#!/bin/bash
# Check if user is root
cur_dir=$(pwd)
host=$(hostname)
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root to install lnmp"
exit 1
fi
yum -y install redhat-lsb-core
if lsb_release -r -s | grep 7; then
chmod 777 /etc/rc.d/rc.local
systemctl enable rc-local.service
systemctl --system daemon-reload
systemctl start rc-local.service
systemctl status rc-local.service
systemctl stop firewalld.service
systemctl disable firewalld.service
echo -e "========================================================================= "
else
service iptables stop
chkconfig --level 2345 iptables off
echo -e "========================================================================= "
fi
echo -e "#SELINUX=enforcing #SELINUXTYPE=targeted SELINUX=disabled SETLOCALDEFS=0" > /etc/selinux/config
sleep 1
echo -e "========================================================================= "
rm -rf /etc/my.cnf
rm -rf /etc/init.d/mysql*
rm -rf /etc/init.d/php*
rm -rf /etc/init.d/http*
rm -rf /etc/php.ini
sleep 1
yum -y remove httpd
yum -y remove http
yum -y remove php
yum -y remove mysql
yum -y remove mysqld
yum -y remove mariadb
echo -e "=========================================================================
"
sleep 1
echo "========================================================================="
echo " "
echo " Yum Installation "
echo " "
echo -e "=========================================================================
"
sleep 1
echo -e "========================================================================= "
if lsb_release -r -s | grep 7; then
yum -y install readline* net-tools icu perl-DBI perl-Net-Daemon perl-PlRPC libcap-devel lynx perl-DBD-MySQL readline-devel net-tools* dos2unix gcc* xmlto yum* screen vim* psmisc wget lrzsz pcre-devel iptraf sysstat libevent libevent-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker tar rrdtool ntp* dos2unix setup* net-snmp-utils net-snmp-devel ruby ruby-devel php-snmp cmake net-snmp-perl net-snmp net-snmp-libs wget elinks make autoconf213 m4 gcc gcc-c++ automake autoconf fontconfig fontconfig-devel libjpeg libjpeg* libjpeg-devel libpng libpng-devel freetype freetype* freetype-devel libxml2 libxml2-devel libdhash libdhash-devel libxslt* zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2* libicu libicu-devel ncurses ncurses-devel xmlrpc-c xmlrpc-c-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel openldap-clients openldap-servers gd gd-devel pam* gettext gettext-devel keyutils compat* mpfr cpp libgomp libstdc++-devel keyutils-libs-devel libcom_err-devel libsepol-devel libXpm* php-gd ncurses* libtool* patch unzip bison-devel bison libcom_err-devel libsepol-devel gtk* libselinux-devel libtiff* php-common policycoreutils telnet t1lib t1lib* nasm nasm*
echo "=================================yum 7 end ========================================"
sleep 1
else
yum -y install readline* gcc* xmlto kernel-devel yum* screen vim* psmisc wget lrzsz pcre-devel libtidy libtidy-devel iptraf sysstat libevent libevent-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker tar rrdtool ntp* dos2unix setup* net-snmp-utils net-snmp-devel ruby ruby-devel php-snmp cmake net-snmp-perl net-snmp net-snmp-libs wget elinks make autoconf213 m4 gcc gcc-c++ automake autoconf fontconfig fontconfig-devel libjpeg libjpeg* libjpeg-devel libpng libpng-devel freetype freetype* freetype-devel libxml2 libxml2-devel libdhash libdhash-devel libxslt* zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2* libc-client libc-client-devel libicu-devel ncurses ncurses-devel xmlrpc-c xmlrpc-c-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel openldap-clients openldap-servers gd gd-devel pam* gettext gettext-devel keyutils compat* mpfr cpp libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libXpm* php-gd ncurses* libtool* patch unzip bison-devel bison libcom_err-devel libsepol-devel gtk* libselinux-devel libtiff libtiff* php-common policycoreutils telnet t1lib t1lib* nasm nasm*
echo "=================================yum 6 end ========================================"
fi
sleep 1
cd $cur_dir/nginx
yum -y install libtidy*.rpm
sleep 1
echo -e "========================================================================= "