setenforce 0
systemctl stop firewalld
function httpd_install(){
if [[ “$1” -eq “1” ]]; then
yum install httpd -y
if [ $? -eq 0 ]; then
echo -e “ Install Successs “
else
echo -e “Installation failed!”
fi
fi
systemctl start httpd
systemctl enable httpd
rpm -qa | grep httpd
ps -ef | grep httpd
}
function mysql_install(){
if [[ “$1” -eq “2” ]]; then
yum install wget -y
sudo wget -c https://repo.mysql.com//mysql80-community-release-el7-2.noarch.rpm
sudo rpm -Uvh mysql80-community-release-el7-2.noarch.rpm
yum repolist all | grep mysql
yum -y install yum-utils
sudo yum-config-manager —disable mysql80-community #禁用
sudo yum-config-manager —enable mysql57-community #启用
sudo yum install mysql-community-server -y
if [ $? -eq 0 ]; then
echo -e “Install Successs !”
else
echo -e “Installation failed!”
fi
fi
sudo systemctl start mysqld.service
sudo systemctl status mysqld.service
sudo systemctl enable mysqld.service
mysql -u root -p 123456
}
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
if [ $? -eq 0 ]; then
echo -e “Successful implementation !”
else
yum clean all&&yum makecache
yum search php
fi
if [ $? -eq 0 ]; then
echo -e “Install Successs !!”
else
echo -e “Installation failed!”
fi
fi
yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml
systemctl enable php-fpm.service
systemctl start php-fpm.service
yum search all php72w
yum install php72w-pecl-redis.x86_64
}
function redis_install(){
if [[ “$1” -eq “4” ]]; then
wget -c http://download.redis.io/releases/redis-4.0.12.tar.gz
tar zxvf redis-4.0.12.tar.gz -C /usr/local/
ln -sv /usr/local/redis-4.0.12/ /usr/local/redis
chmod 777 /usr/local/redis -R
cd /usr/local/redis
yum groupinstall “Development tools”
yum install -y tcl
if [[ “$?” -eq “0” ]]; then
make
else
echo -e “Installation failed!”
cd src
make install
sed -i ‘s/bind 127.0.0.1/#bind 127.0.0.1/g’ /etc/redis/redis.conf
systemctl start redis-server
fi
git clone https://github.com/phpredis/phpredis.git
yum -y install php72w-devel
whereis phpize
/usr/bin/phpize
./configure
make
make install
make distclean
sed -i ‘s/extension/#redis.so/g’ /etc/php.ini
fi
}
systemctl start httpd
PS3=”Please enter you select install menu:”
select i in http mysql php redis zabbix quit
do
case $i in
http)
httpd_install 1
;;
mysql)
mysql_install 2
;;
php)
php_install 3
;;
redis)
redis_install 4
;;
quit)
exit
esac
done
欢迎评论
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!