常用的LANMP一键安装包有Oneinstack和LNMP一键安装包,如果遇到新版本的安装问题可以参照一键安装包脚本
安装各必要组件
yum -y install make pcre-devel cmake gcc gcc-c++ flex bison libaio file libtool libtool-libs autoconf kernel-devel patch wget libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel unzip tar bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl libjpeg libjpeg-devel libpng libpng-devel curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal gettext gettext-devel ncurses-devel gmp-devel aspell-devel libcap diffutils net-tools libc-client-devel psmisc libXpm-devel git-core c-ares-devel libicu-devel freetype-devel libxslt libxslt-devel sqlite-devel
编译安装libzip
wget https://nih.at/libzip/libzip-1.2.0.tar.gz
tar -zxvf libzip-1.2.0.tar.gz
cd libzip-1.2.0
./configure --libdir=/lib64
make
make install
编译安装oniguruma
./configure --prefix=/usr --libdir=/lib64
make
make install
编译安装PHP8
./configure --prefix=/opt/php8 --with-config-file-scan-dir=/etc/php8/php.d --with-config-file-path=/etc/php8 --with-curl --with-freetype --enable-gd --with-jpeg --with-gettext --with-kerberos --with-libdir=lib64 --with-libxml --with-mysqli --with-openssl --with-pdo-mysql --with-pdo-sqlite --with-pear --enable-sockets --with-mhash --with-ldap-sasl --with-xsl --with-zlib --with-zip -with-bz2 --with-iconv --enable-fpm --enable-pdo --enable-bcmath --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-cli --enable-opcache --enable-intl --enable-calendar --enable-static --enable-mysqlnd --with-fpm-user=www --with-fpm-group=www
make
make install
* 安装完记得将php.ini移动到指定目录
* 安装完记得修改php-fpm的配置文件
* 安装完记得启动php-fpm
编译安装Tengine
- 编译Tengine
./configure --prefix=/opt/nginx --user=www --group=www --with-http_mp4_module --with-http_flv_module --pid-path=/var/run/nginx.pid --with-http_ssl_module --with-http_realip_module --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module --with-stream_geoip_module=dynamic
- 配置PHP-fastcgi
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;
}
安装MySQL(centos)这里使用Yum安装。
- 获取rpm包地址,并且安装相关yum源【在标准yum源中并没有mysql的rpm包】
** 当前示例只支持64位系统,别的系统的rpm包请去MySQL官网获取
wget http://mirrors.ustc.edu.cn/mysql-repo/mysql80-community-release-el7-1.noarch.rpm
rpm -Uvh mysql80-community-release-el7-1.noarch.rpm
- 移除已有的MariaDB
// 找出maria相关的包
rpm -qa | grep mariadb
// 移除上面找出的mariadb的包
yum erase -y mariadb*
// 最后在检查下还有没有mariadb
rpm -qa | grep mariadb
- 安装MySQL
// 禁用MySQL模块
yum module disable mysql
// 如果出现下载速度慢,可以杀掉进程,重新install,会快很多
yum install mysql-community-server
- 启动MySQL
systemctl start mysqld.service
- 查看默认密码,并且修改MySQL默认密码
# 查看默认密码
grep 'temporary password' /var/log/mysqld.log
# 修改默认密码,先登录再修改
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
- 配置MySQL开机启动
systemctl enable mysqld.service
判断是否编译完成
- 安装过程停止
- 停止后,一页界面中出现error或者warning no
需要注意的
- 在configure检测系统环境和检测lib库文件的时候如果出现缺少组件的情况可以用yum install -devel安装开发包才可以**
- useradd -M -s "/sbin/nologin" www 记得建立相关用户
本文由 陌上花开 创作,采用 知识共享署名4.0 国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
最后编辑时间为: Nov 24, 2021 at 03:40 pm