centos nginx+php7.4+npm运行环境安装脚本 - 道与

/ 0评 / 0

需要先安装lrzsz 用于上传脚本~

#!/bin/bash #! /bin/sh

#安装rz上传文件
## yum install lrzsz -y

#新增Remi repository
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install epel-release
yum -y install git yum-utils

#安装nginx
yum -y install nginx
systemctl enable nginx
systemctl start nginx

#安装php7.4
#开启PHP7.4
yum-config-manager --enable remi-php74

#安装常用PHP扩展
yum -y install php php-cli  php-devel  php-fpm  php-mbstring php-redis  php-mysqlnd php-pdo  php-bcmath  php-curl php-json php-xml php-gd php-gmp php-igbinary php-imagick php-mcrypt  php-pdo_mysql php-posix php-simplexml php-opcache php-xsl php-xmlwriter php-xmlreader php-swoole php-zip php-yaml php-uuid

#更改php-fpm用户组为nginx
sed -i 's/user\ =\ apache/user\ =\ nginx/g' /etc/php-fpm.d/www.conf
sed -i 's/group\ =\ apache/group\ =\ nginx/g' /etc/php-fpm.d/www.conf
systemctl enable php-fpm
systemctl start php-fpm

#初始化web目录
mkdir -p /var/www
chown -R nginx:nginx /var/www

#安装composer
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
chmod +x /usr/local/bin/composer
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

#安装LTS NPM
git clone git://github.com/creationix/nvm.git ~/nvm && echo "source ~/nvm/nvm.sh" >> ~/.bashrc && source ~/.bashrc && nvm install --lts

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注