安装前准备
更新yum
安装额外资源库
安装nginx
安装
启动nginx
设置为开机启动
检查开机自动是否设置成功
注:
nginx
默认配置文件是/etc/nginx/nginx.conf
安装mysql
由于
Laravel 5.4
以后,数据库默认使用utf8mb64,
MySQL
版本太低时,在运行php artisan migrate
会报错,原因就是utf8
和utf8mb4
造成的
MySQL 5.7
以后的版本没有utf8
和utf8mb64
的问题
安装步骤可以参考 https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/#repo-qg-yum-fresh-install
添加MySQL Yum存储库
查看所有MySQL版本
查看当前启用的MySQL版本
安装MySQL
启动MySQL
检查MySQL启动状态
设置mysqld服务开机自启动
检查mysqld开机自启动是否设置成功
查看初始密码(如无内容直接跳过)
修改MySQL root密码
安装PHP7(7.4)
创建 www 用户用于
php-fpm
,并且不允许登陆和不创建主目录
安装php74的源
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
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
安装php74
yum -y install php74 php74-php-fpm php74-php-bcmath php74-php-mbstring php74-php-mcrypt php74-php-mysqlnd php74-php-pdo php74-php-xml php74-php-gd php74-php-snmp php74-php-soap php74-php-pecl-crypto php74-php-opcache php74-php-pecl-memcached php74-php-pecl-redis5
设置 PHP
查找安装包:
rpm -qa | grep 'php'
php74-php-json-7.4.0-1.el7.remi.x86_64
php74-php-pdo-7.4.0-1.el7.remi.x86_64
php74-php-pecl-mcrypt-1.0.3-1.el7.remi.x86_64
php74-php-pecl-memcached-3.1.4-1.el7.remi.x86_64
php74-php-bcmath-7.4.0-1.el7.remi.x86_64
php74-runtime-1.0-1.el7.remi.x86_64
php74-php-common-7.4.0-1.el7.remi.x86_64
php74-1.0-1.el7.remi.x86_64
php74-php-pecl-igbinary-3.0.1-5.el7.remi.x86_64
php74-php-mbstring-7.4.0-1.el7.remi.x86_64
php74-php-gd-7.4.0-1.el7.remi.x86_64
php74-php-snmp-7.4.0-1.el7.remi.x86_64
php74-php-pecl-redis5-5.1.1-1.el7.remi.x86_64
php74-php-xml-7.4.0-1.el7.remi.x86_64
php74-php-opcache-7.4.0-1.el7.remi.x86_64
php74-php-fpm-7.4.0-1.el7.remi.x86_64
php74-php-cli-7.4.0-1.el7.remi.x86_64
php74-php-pecl-msgpack-2.0.3-3.el7.remi.x86_64
php74-php-mysqlnd-7.4.0-1.el7.remi.x86_64
php74-php-pecl-crypto-0.3.1-9.el7.remi.x86_64
php74-php-soap-7.4.0-1.el7.remi.x86_64
找到:php74-php-fpm-7.4.0-1.el7.remi.x86_64
安装位置
rpm -ql grep php74-php-fpm-7.4.0-1.el7.remi.x86_64
/bin/egrep
/bin/fgrep
/bin/grep
/etc/GREP_COLORS
/etc/profile.d/colorgrep.csh
/etc/profile.d/colorgrep.sh
/usr/libexec/grepconf.sh
/usr/share/doc/grep-2.20
/usr/share/doc/grep-2.20/ABOUT-NLS
/usr/share/doc/grep-2.20/AUTHORS
/usr/share/doc/grep-2.20/COPYING
/usr/share/doc/grep-2.20/ChangeLog
/usr/share/doc/grep-2.20/NEWS
/usr/share/doc/grep-2.20/README
/usr/share/doc/grep-2.20/THANKS
/usr/share/doc/grep-2.20/TODO
/usr/share/info/grep.info.gz
/usr/share/locale/af/LC_MESSAGES/grep.mo
/usr/share/locale/be/LC_MESSAGES/grep.mo
/usr/share/locale/bg/LC_MESSAGES/grep.mo
/usr/share/locale/ca/LC_MESSAGES/grep.mo
/usr/share/locale/cs/LC_MESSAGES/grep.mo
/usr/share/locale/da/LC_MESSAGES/grep.mo
/usr/share/locale/de/LC_MESSAGES/grep.mo
/usr/share/locale/el/LC_MESSAGES/grep.mo
/usr/share/locale/eo/LC_MESSAGES/grep.mo
/usr/share/locale/es/LC_MESSAGES/grep.mo
/usr/share/locale/et/LC_MESSAGES/grep.mo
/usr/share/locale/eu/LC_MESSAGES/grep.mo
/usr/share/locale/fi/LC_MESSAGES/grep.mo
/usr/share/locale/fr/LC_MESSAGES/grep.mo
/usr/share/locale/ga/LC_MESSAGES/grep.mo
/usr/share/locale/gl/LC_MESSAGES/grep.mo
/usr/share/locale/he/LC_MESSAGES/grep.mo
/usr/share/locale/hr/LC_MESSAGES/grep.mo
/usr/share/locale/hu/LC_MESSAGES/grep.mo
/usr/share/locale/id/LC_MESSAGES/grep.mo
/usr/share/locale/it/LC_MESSAGES/grep.mo
/usr/share/locale/ja/LC_MESSAGES/grep.mo
/usr/share/locale/ko/LC_MESSAGES/grep.mo
/usr/share/locale/ky/LC_MESSAGES/grep.mo
/usr/share/locale/lt/LC_MESSAGES/grep.mo
/usr/share/locale/nb/LC_MESSAGES/grep.mo
/usr/share/locale/nl/LC_MESSAGES/grep.mo
/usr/share/locale/pa/LC_MESSAGES/grep.mo
/usr/share/locale/pl/LC_MESSAGES/grep.mo
/usr/share/locale/pt/LC_MESSAGES/grep.mo
/usr/share/locale/pt_BR/LC_MESSAGES/grep.mo
/usr/share/locale/ro/LC_MESSAGES/grep.mo
/usr/share/locale/ru/LC_MESSAGES/grep.mo
/usr/share/locale/sk/LC_MESSAGES/grep.mo
/usr/share/locale/sl/LC_MESSAGES/grep.mo
/usr/share/locale/sr/LC_MESSAGES/grep.mo
/usr/share/locale/sv/LC_MESSAGES/grep.mo
/usr/share/locale/th/LC_MESSAGES/grep.mo
/usr/share/locale/tr/LC_MESSAGES/grep.mo
/usr/share/locale/uk/LC_MESSAGES/grep.mo
/usr/share/locale/vi/LC_MESSAGES/grep.mo
/usr/share/locale/zh_CN/LC_MESSAGES/grep.mo
/usr/share/locale/zh_TW/LC_MESSAGES/grep.mo
/usr/share/man/man1/egrep.1.gz
/usr/share/man/man1/fgrep.1.gz
/usr/share/man/man1/grep.1.gz
/etc/logrotate.d/php74-php-fpm
/etc/opt/remi/php74/php-fpm.conf
/etc/opt/remi/php74/php-fpm.d
/etc/opt/remi/php74/php-fpm.d/www.conf
/etc/opt/remi/php74/sysconfig/php-fpm
/etc/systemd/system/php74-php-fpm.service.d
/opt/remi/php74/root/usr/sbin/php-fpm
/opt/remi/php74/root/usr/share/doc/php74-php-fpm-7.4.0
/opt/remi/php74/root/usr/share/doc/php74-php-fpm-7.4.0/php-fpm.conf.default
/opt/remi/php74/root/usr/share/doc/php74-php-fpm-7.4.0/www.conf.default
/opt/remi/php74/root/usr/share/fpm
/opt/remi/php74/root/usr/share/fpm/status.html
/opt/remi/php74/root/usr/share/licenses/php74-php-fpm-7.4.0
/opt/remi/php74/root/usr/share/licenses/php74-php-fpm-7.4.0/fpm_LICENSE
/opt/remi/php74/root/usr/share/man/man8/php-fpm.8.gz
/usr/lib/systemd/system/php74-php-fpm.service
/var/opt/remi/php74/lib/php/opcache
/var/opt/remi/php74/lib/php/session
/var/opt/remi/php74/lib/php/wsdlcache
/var/opt/remi/php74/log/php-fpm
/var/opt/remi/php74/run/php-fpm
查找php.ini位置:
验证php是否安装成功
验证对应的扩展是否安装成功
设置 php 软链接
启动php-fpm
设置开机自启动
检查开机自启动是否设置成功
查找 php-fpm 配置文件
rpm -ql php74-php-fpm
/etc/logrotate.d/php74-php-fpm
/etc/opt/remi/php74/php-fpm.conf
/etc/opt/remi/php74/php-fpm.d
/etc/opt/remi/php74/php-fpm.d/www.conf
/etc/opt/remi/php74/sysconfig/php-fpm
/etc/systemd/system/php74-php-fpm.service.d
/opt/remi/php74/root/usr/sbin/php-fpm
/opt/remi/php74/root/usr/share/doc/php74-php-fpm-7.4.0
/opt/remi/php74/root/usr/share/doc/php74-php-fpm-7.4.0/php-fpm.conf.default
/opt/remi/php74/root/usr/share/doc/php74-php-fpm-7.4.0/www.conf.default
/opt/remi/php74/root/usr/share/fpm
/opt/remi/php74/root/usr/share/fpm/status.html
/opt/remi/php74/root/usr/share/licenses/php74-php-fpm-7.4.0
/opt/remi/php74/root/usr/share/licenses/php74-php-fpm-7.4.0/fpm_LICENSE
/opt/remi/php74/root/usr/share/man/man8/php-fpm.8.gz
/usr/lib/systemd/system/php74-php-fpm.service
/var/opt/remi/php74/lib/php/opcache
/var/opt/remi/php74/lib/php/session
/var/opt/remi/php74/lib/php/wsdlcache
/var/opt/remi/php74/log/php-fpm
/var/opt/remi/php74/run/php-fpm
vim /etc/opt/remi/php74/php-fpm.d/www.conf
,修改如下配置:
user = www
group = wheel
listen = /var/run/php-fpm.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0660
重新加载php
安装Composer
php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer
# 切换到 laravel-china 镜像
composer config -g repo.packagist composer https://packagist.laravel-china.org
安装redis
安装Remi的软件源
安装redis
启动redis
设置开机自启动
查看下redis安装时创建的相关文件
5
3
很好的
哈哈哈
哈哈哈