自用easyswoole 环境部署shell脚本
温馨提示:
本文最后更新于 2021年02月24日,已超过 1,323 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我。
用于在纯净的centos系统上迅速部署一个easyswoole程序,还支持git代码拉取
##!/usr/bin/env bash
#PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
#export PATH;
installPhp() {
yum install -y php php-devel php-gd php-xml php-json php-mbstring # 安装php,扩展
}
installSwoole() {
swooleVesrionDefualt="4.4.23"
swooleBuildConfigureDefualt="--enable-openssl"
phpIniPathDefualt="/etc/php.ini"
echo -n "请输入swoole版本 [${swooleVesrionDefualt}] :"
read swooleVesrion
if [ ! $swooleVersion ]; then
swooleVesrion=$swooleVesrionDefualt
fi
echo $swooleVesrion
echo -n "请输入 configure 参数[${swooleBuildConfigureDefualt}] :"
read swooleBuildConfigure
if [ ! $swooleBuildConfigure ]; then
swooleBuildConfigure=$swooleBuildConfigureDefualt
fi
echo $swooleBuildConfigure
echo -n "请输入 phpini 路径 [${phpIniPathDefualt}] :"
read phpInitPath
if [ ! $phpInitPath ]; then
phpInitPath=$phpIniPathDefualt
fi
echo $phpInitPath
cd /tmp
wget "https://github.com/swoole/swoole-src/archive/v${swooleVesrion}.tar.gz" # 下载swoole
tar -zvxf v${swooleVesrion}.tar.gz swoole-src-${swooleVesrion}/
cd swoole-src-${swooleVesrion}/
phpize
./configure $swooleBuildConfigure
make && make install
sed -i "2i extension=swoole.so" $phpInitPath
}
installMysql() {
yum install -y mysql mysql-server mysql-devel # 安装mysql
}
installOpenssl() {
yum install -y openssl openssl-devel # 安装openssl
}
installGit() {
yum install git -y # git
}
installNginx() {
yum install nginx -y # nginx
}
installNodejs() {
yum install nodejs -y # nodejs
npm install -g yarn # nodejs yarn
}
installComposer() {
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
}
initEasyswooleProject(){
echo -n "请输入 git 地址:"
read gitUrl;
echo -n "请输入项目名:"
read projectName
echo -n "是否保存git用户名密码: [y/N]"
read isSavePassword
if [ $isSavePassword = "y" ]; then
git config --global credential.helper store
fi
git clone $gitUrl $projectName
cd $projectName
composer up
php ./vendor/bin/easyswoole install
php easyswoole server start
}
echo "欢迎使用tioncico php swoole 安装程序"
echo "1:php"
echo "2:swoole"
echo "3:mysql"
echo "4:openssl"
echo "5:git"
echo "6:nginx"
echo "7:nodejs"
echo "8:composer"
echo "9:initEasyswooleProject"
echo "n:exit"
while [ 1 ]; do
read num
case $num in
1)
installPhp
;;
2)
installSwoole
;;
3)
installMysql
;;
4)
installOpenssl
;;
5)
installGit
;;
6)
installNginx
;;
7)
installNodejs
;;
8)
installComposer
;;
9)
initEasyswooleProject
;;
*)
break
;;
esac
done
正文到此结束
- 本文标签: 服务架构
- 本文链接: https://www.php20.cn/article/272
- 版权声明: 本文由仙士可原创发布,转载请遵循《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权