分享一些脚本

分享一些脚本,欢迎各位踊跃补充
!/bin/bash
Auto lamp
By author FEATHER
date: 2019/12/26
Version: 1.1.0

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
}

  1. function php_install(){
  2. if[["$1"-eq "3"]];then
  3. yum -y remove php*
  4. cd /etc/yum.repos.d
  5. sudo mv CentOS-Base.repo CentOS-Base.repo.bak
  6. sudo wget -c http://mirrors.aliyun.com/repo/
  7. sudo wget -c http://mirrors.aliyun.com/repo/Centos-7.repo
  8. yum clean all
  9. yum makecache

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

php -m
yum -y install php71w-xxx #####安装其他需要的拓展模块

}

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

yum install -y tcl

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






欢迎评论

  • 发表于 2019-12-26 16:43
  • 阅读 ( 885 )
  • 分类:大数据

你可能感兴趣的文章

相关问题

0 条评论

请先 登录 后评论
不写代码的码农
FEATHER

4 篇文章

作家榜 »

  1. FEATHER 4 文章
  2. 常耀斌 3 文章
  3. zero 3 文章
  4. roc 1 文章
  5. 钱女士 0 文章
  6. yang 0 文章
  7. 李金友 0 文章
  8. 贾立 0 文章