1.下载源码包
以root目录为例:
cd ~ # 下载安装包 wget http://nginx.org/download/nginx-1.17.2.tar.gz # nginx wget https://www.php.net/distributions/php-7.3.7.tar.gz # phpwget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.16-2.el7.x86_64.rpm-bundle.tar # mysql# 解压tar zxvf mysql-8.0.16-2.el7.x86_64.rpm-bundle.tartar zxvf php-7.3.7.tar.gztar zxvf nginx-1.17.2.tar.gz
# 安装cmake
yum install -y gcc gcc-c++ make automake# 下载 cmakewget https://github.com/Kitware/CMake/releases/download/v3.15.1/cmake-3.15.1.tar.gztar zxvf cmake-3.15.1.tar.gzcd cmake-3.15.1./configure --prefix=/usr/local/cmakemake && make install创建 cmake的软连接ln -s /usr/local/cmake/bin/cmake /usr/bin/cmake
- 软连接 软链接仅仅包含所链接文件的路径名,因此能链接目录文件,也可以跨越文件系统进行链接。但是,当原始文件被删除后,链接文件也将失效。
- 硬链接 可以将它理解为一个“指向原始文件inode的指针”,系统不为它分配独立的inode和文件。所以,硬链接文件与原始文件其实是同一个文件,只不过是不同的名字而已。我们每添加一个硬链接,该文件的inode链接数就会增加1;而且只有当该文件的inode连接数为0时,才算彻底将它删除。
2.安装
mysql 参考链接
# 卸载自带的 Mariadbrpm -qa|grep mariadb # 查看当前系统自带的Mariadbrpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64
# 创建用户组
groupadd mysql
# 创建mysql用户,属于mysql组
useradd -g mysql mysql
# 安装
# 安装依赖 yum install -y libaio rpm -ivh mysql-community-common-8.0.16-2.el7.x86_64.rpm --nodeps --force # 安装common rpm -ivh mysql-community-libs-8.0.16-2.el7.x86_64.rpm --nodeps --force # 安装libs rpm -ivh mysql-community-client-8.0.16-2.el7.x86_64.rpm --nodeps --force # 安装client rpm -ivh mysql-community-server-8.0.16-2.el7.x86_64.rpm --nodeps --force #安装server # 修改组 chown mysql:mysql /var/lib/mysql -R # 启动 systemctl start mysqld.service # 开机自启 systemctl enable mysqld # 查看默认密码cat /var/log/mysqld.log | grep password # 修改密码 alter user ‘root‘@‘localhost‘ identified by ‘123456‘;
PHP 参考连接
# 安装依赖
yum install screen gcc git openssl curl yum install gmp-devel libc-client-devel bzip2-devel enchant-devel libwebp-devel libXpm-devel openldap openldap-devel php-pspell aspell-devel readline-devel libtidy-devel libxslt-devel libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel autoconf
如果 提示Please reinstall the libzip distribution
# 先卸载原先的 libzip
yum remove libzip
# 下载 libzip 源码(去网站选择合适的版本)
wget https://libzip.org/download/libzip-1.5.1.tar.gz
# 解压
tar -zxvf libzip-1.5.1.tar.gzcd libzip--1.5.1# 配置
./configure
# 编译 & 安装
make & make install
# 编译安装
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/conf.d --with-sqlite3 --with-pdo-sqlite --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-posix --enable-pcntl --enable-shmop --enable-sysvshm --enable-sysvsem --enable-sysvmsg --enable-phar --enable-zip --with-zlib --with-zlib-dir --with-bz2 --with-gd --enable-gd-jis-conv --with-webp-dir --with-jpeg-dir --with-png-dir --with-xpm-dir --with-freetype-dir --enable-exif --enable-json --enable-libxml --with-libxml-dir --enable-xml --enable-xmlreader --enable-xmlwriter --enable-simplexml --with-pear --with-xsl --enable-dom --enable-soap --enable-wddx --with-xmlrpc --enable-ctype --enable-filter --with-pcre-regex --with-pcre-jit --with-enchant --with-pspell --enable-fileinfo --enable-mbstring --with-iconv --enable-hash --with-openssl --enable-bcmath --with-gmp --enable-session --enable-sockets --enable-ftp --with-curl --with-ldap --with-ldap-sasl --with-imap --with-kerberos --with-imap-ssl --enable-calendar --with-gettext --with-tidy --with-readline --enable-tokenizer --enable-opcache --enable-cli --enable-cgi --enable-fpm --enable-phpdbg # 提示 libc-client 和 libldap 问题 重新./configure ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so cp -frp /usr/lib64/libldap* /usr/lib/ # 编译 collect2: error: ld returned 1 exit status 在PHP源码目录下 vi Makefile 找到 EXTRA_LIBS 行,在行末添加 ‘ -llber ‘ 保存退出再次make即可 # 安装 make -j `grep processor /proc/cpuinfo | wc -l` && make install
# 拷贝配置文件
cp php.ini-production /usr/local/php/etc/php.ini cd /usr/local/php/etc/ cp php-fpm.conf.default ./php-fpm.conf cd php-fpm.d/ cp www.conf.default www.conf
# 启动php-fpm,nginx需要将.php文件交给php-fpm处理
/usr/loca/php/sbin/php-fpm
Nginx安装
cd ~/nginx-1.17.2 ./configure --prefix=/usr/local/nginx make && make install# 启动cd /usr/local/nginx/# 查看是否成功安装curl 127.0.0.1 # 有welcome nginx即成功
# 修改配置vim ./conf/nginx.conf # 修改如下
location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /$document_root$fastcgi_script_name; include fastcgi_params; }
# 重启
./sbin/nginx -s reload
安装完毕!
原文地址:https://www.cnblogs.com/fuyunqishi/p/11261689.html
时间: 2024-10-04 11:37:51