Linux58期-集群第一阶段-day46-16-LNMP Web服务搭建
老男孩教育_Linux58期-集群第一阶段-day46-16-LNMP Web服务搭建
1、JAVA Web环境(企业更多)
[tomcat(jvm)]、resin、jboss、Weblogic
配合nginx proxy_pass代理功能
2、Python Web环境
配合nginx uwsgi_pass代理功能
3、PHP Web环境(也会用,二三四五线)
配合nginx fastcgi_pass代理功能
4、GO 语言环境
#1、创建用户 useradd mysql -s /sbin/nologin -M id mysql #2、创建目录上传软件 mkdir -p /server/tools cd /server/tools rz #上传数据库安装文件 #3、解压安装 tar xf mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz mkdir -p /application mv mysql-5.7.28-linux-glibc2.12-x86_64 /application/mysql-5.7.28 ln -s /application/mysql-5.7.28/ /application/mysql #4、配置配置文件 rpm -e --nodeps mariadb-libs cat >/etc/my.cnf<<EOF [mysqld] basedir = /application/mysql/ datadir = /application/mysql/data socket = /tmp/mysql.sock server_id = 1 port = 3306 log_error = /application/mysql/data/jiayi_mysql.err [mysql] socket = /tmp/mysql.sock prompt = jiayi [\\d]> EOF #5、初始化数据库 rpm -qa mariadb-libs yum install libaio-devel -y mkdir -p /application/mysql/data chown -R mysql.mysql /application/mysql/ /application/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=/application/mysql/ --datadir=/application/mysql/data 6、配置启动 cat >/etc/systemd/system/mysqld.service<<EOF [Unit] Description=MySQL Server by jiayi Documentation=man:mysqld(8) Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html After=network.target After=syslog.target [Install] WantedBy=multi-user.target [Service] User=mysql Group=mysql ExecStart=/application/mysql/bin/mysqld --defaults-file=/etc/my.cnf LimitNOFILE = 5000 EOF systemctl start mysqld systemctl enable mysqld netstat -lntup|grep mysql #7、登录测试 echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile . /etc/profile mysql quit
数据库产品:
MySQL(mariadb)、Oracle、SQL SERVER、PGSQL
单机安装LNMP
先装数据库:
1、创建用户
[root@web01 ~]# useradd mysql -s /sbin/nologin -M [root@web01 ~]# id mysql uid=1001(mysql) gid=1001(mysql) 组=1001(mysql) [root@web01 ~]#
2、上传软件到指定的目录
[root@web01 ~]# cd /server/tools/ [root@web01 tools]#wget http://mirrors.163.com/mysql/Downloads/MySQL-5.7/mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz [root@web01 tools]# ls -lsh 总用量 693M 8.0K -r-------- 1 root root 4.8K 6月 7 22:14 jiantousheji.zip 692M -rw-r--r-- 1 root root 692M 9月 27 2019 mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz 4.0K drwxr-xr-x 9 mysql mysql 4.0K 6月 2 23:05 nginx-1.18.0 1016K -rw-r--r-- 1 root root 1016K 4月 21 22:33 nginx-1.18.0.tar.gz [root@web01 tools]# tar -xf mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz [root@web01 tools]# ls jiantousheji.zip mysql-5.7.28-linux-glibc2.12-x86_64 mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz nginx-1.18.0 nginx-1.18.0.tar.gz [root@web01 tools]# mv mysql-5.7.28-linux-glibc2.12-x86_64 /application/mysql-5.7.28 [root@web01 tools]# ln -s /application/mysql-5.7.28/ /application/mysql [root@web01 tools]# ll /application/ 总用量 12 -rw-r--r-- 1 root root 612 6月 2 23:12 index.html lrwxrwxrwx 1 root root 26 6月 12 23:05 mysql -> /application/mysql-5.7.28/ drwxr-xr-x 9 root root 4096 6月 12 23:03 mysql-5.7.28 lrwxrwxrwx 1 root root 26 6月 2 23:36 nginx -> /application/nginx-1.18.0/ drwxr-xr-x 11 root root 4096 6月 2 23:37 nginx-1.18.0
相当于完成以下三步了。
./configure;make;make install [root@web02 /server/tools]# ls /application/mysql/ bin COPYING docs include lib man README share support-files
3、配置配置文件/etc/my.cnf[root@web01 /server/tools]# ls -l /etc/my.cnf #yum安装mariadb的默认的my.cnf
-rw-r--r--. 1 root root 570 8月 16 2018 /etc/my.cnf rpm -e --nodeps mariadb-libs 慎用 #yum remove mariadb 卸载依赖包。 [root@web01 /server/tools]# rpm -e --nodeps mariadb-libs [root@web01 /server/tools]# ls -l /etc/my.cnf ls: 无法访问/etc/my.cnf: 没有那个文件或目录 [root@web01 /server/tools]# vim /etc/my.cnf [root@web01 tools]# cat /etc/my.cnf [mysqld] basedir = /application/mysql/
datadir = /application/mysql/data
socket = /tmp/mysql.sock server_id = 1 port = 3306 log_error = /application/mysql/data/jiayi_mysql.err [mysql] socket = /tmp/mysql.sock prompt = jiayi [\\d]> [root@web01 tools]#
4、初始化数据库
[root@web01 /server/tools]# rpm -qa mariadb-libs [root@web01 /server/tools]# yum install libaio-devel -y [root@web01 /server/tools]# mkdir -p /application/mysql/data [root@web01 /server/tools]# chown -R mysql.mysql /application/mysql/ [root@web01 /server/tools]# /application/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=/application/mysql/ --datadir=/application/mysql/data 当初始化失败提示时执行以下步骤 error类似的字符串。。。 cd /application/mysql/data rm -fr *


5、配置启动服务
[root@web01 tools]# cd /application/mysql/support-files/ [root@web01 support-files]# ls magic mysqld_multi.server mysql-log-rotate mysql.server [root@web01 support-files]# vim /etc/systemd/system/mysqld.service [root@web01 support-files]# [root@web01 support-files]# cat /etc/systemd/system/mysqld.service [Unit] Description=MySQL Server by jiayi Documentation=man:mysqld(8) Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html After=network.target After=syslog.target [Install] WantedBy=multi-user.target [Service] User=mysql Group=mysql ExecStart=/application/mysql/bin/mysqld --defaults-file=/etc/my.cnf LimitNOFILE = 5000 [root@web01 support-files]#
启动:
[root@web01 data]# systemctl start mysqld [root@web01 data]# systemctl enable mysqld Created symlink from /etc/systemd/system/multi-user.target.wants/mysqld.service to /etc/systemd/system/mysqld.service. [root@web01 data]# systemctl status mysqld ● mysqld.service - MySQL Server by jiayi Loaded: loaded (/etc/systemd/system/mysqld.service; disabled; vendor preset: disabled) Active: active (running) since 六 2020-06-13 01:00:53 CST; 9s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Main PID: 8510 (mysqld) CGroup: /system.slice/mysqld.service └─8510 /application/mysql/bin/mysqld --defaults-file=/etc/my.cnf 6月 13 01:00:53 web01 systemd[1]: Started MySQL Server by jiayi. 6月 13 01:00:53 web01 systemd[1]: Starting MySQL Server by jiayi...
[root@web01 data]# netstat -lntup|grep mysql tcp6 0 0 :::3306 :::* LISTEN 8510/mysqld [root@web01 data]# ps -ef|grep mysql|grep -v grep mysql 8510 1 0 01:00 ? 00:00:00 /application/mysql/bin/mysqld --defaults-file=/etc/my.cnf
6、配置环境变量登录
[root@web01 /application/mysql/support-files]# echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile [root@web01 /application/mysql/support-files]# tail -1 /etc/profile export PATH=/application/mysql/bin:$PATH [root@web01 /application/mysql/support-files]# . /etc/profile [root@web01 /application/mysql/support-files]#source /etc/profile [root@web01 /application/mysql/support-files]# echo $PATH /application/mysql/bin:/application/nginx/sbin:/application/nginx/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@web01 data]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.28 MySQL Community Server (GPL) Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. jiayi [(none)]> jiayi [(none)]> jiayi [(none)]> jiayi [(none)]>exit Bye
如果出错就看错误日志:
日志文件
cat /application/mysql/data/oldboy_mysql.err
7、修改密码
[root@web01 data]# mysqladmin -u root password 'jiayi123' mysqladmin: [Warning] Using a password on the command line interface can be insecure. Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
重新登录:
交互式登录: [root@web02 ~]# mysql -uroot -p Enter password: 非交互登录: mysql -uroot -poldboy123
课程:
期中架构以后会有10-15数据库讲解
周末班 专业DBA课程。
数据库要学的东西很少,而且变化慢:
1、mysql,orcale,redis,mongodb,ELK
2、差异化自己,工资更高。
FastCGI

安装PHP:
YUM安装:简单、方便、高效。
编译安装PHP
1、安装PHP调用的库
yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel -y yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel -y cd /server/tools/ 上传libiconv-1.16.tar.gz tar zxf libiconv-1.16.tar.gz cd libiconv-1.16 ./configure --prefix=/application/libiconv make make install cd ../ yum install libmcrypt-devel -y yum install mhash -y yum install mcrypt -y
[root@web01 ~]# yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel -y 已加载插件:fastestmirror Loading mirror speeds from cached hostfile base | 3.6 kB 00:00:00 epel | 4.7 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 软件包 zlib-devel-1.2.7-18.el7.x86_64 已安装并且是最新版本 没有可用软件包 libiconv-devel。 正在解决依赖关系 --> 正在检查事务 ---> 软件包 libjpeg-turbo-devel.x86_64.0.1.2.90-8.el7 将被 安装 --> 正在处理依赖关系 libjpeg-turbo(x86-64) = 1.2.90-8.el7,它被软件包 libjpeg-turbo-devel-1.2.90-8.el7.x86_64 需要 --> 正在处理依赖关系 libjpeg.so.62()(64bit),它被软件包 libjpeg-turbo-devel-1.2.90-8.el7.x86_64 需要 ---> 软件包 libxml2-devel.x86_64.0.2.9.1-6.el7.4 将被 安装 --> 正在处理依赖关系 libxml2 = 2.9.1-6.el7.4,它被软件包 libxml2-devel-2.9.1-6.el7.4.x86_64 需要 --> 正在处理依赖关系 xz-devel,它被软件包 libxml2-devel-2.9.1-6.el7.4.x86_64 需要 --> 正在检查事务 ---> 软件包 libjpeg-turbo.x86_64.0.1.2.90-8.el7 将被 安装 ---> 软件包 libxml2.x86_64.0.2.9.1-6.el7_2.3 将被 升级 ---> 软件包 libxml2.x86_64.0.2.9.1-6.el7.4 将被 更新 ---> 软件包 xz-devel.x86_64.0.5.2.2-1.el7 将被 安装 --> 解决依赖关系完成 依赖关系解决 ======================================================================================================================================================================================================= Package 架构 版本 源 大小 ======================================================================================================================================================================================================= 正在安装: libjpeg-turbo-devel x86_64 1.2.90-8.el7 base 99 k libxml2-devel x86_64 2.9.1-6.el7.4 base 1.0 M 为依赖而安装: libjpeg-turbo x86_64 1.2.90-8.el7 base 135 k xz-devel x86_64 5.2.2-1.el7 base 46 k 为依赖而更新: libxml2 x86_64 2.9.1-6.el7.4 base 668 k 事务概要 ======================================================================================================================================================================================================= 安装 2 软件包 (+2 依赖软件包) 升级 ( 1 依赖软件包) 总下载量:2.0 M Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. (1/5): libjpeg-turbo-devel-1.2.90-8.el7.x86_64.rpm | 99 kB 00:00:00 (2/5): libjpeg-turbo-1.2.90-8.el7.x86_64.rpm | 135 kB 00:00:00 (3/5): libxml2-2.9.1-6.el7.4.x86_64.rpm | 668 kB 00:00:00 (4/5): xz-devel-5.2.2-1.el7.x86_64.rpm | 46 kB 00:00:00 (5/5): libxml2-devel-2.9.1-6.el7.4.x86_64.rpm | 1.0 MB 00:00:00 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 总计 19 MB/s | 2.0 MB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在更新 : libxml2-2.9.1-6.el7.4.x86_64 1/6 正在安装 : xz-devel-5.2.2-1.el7.x86_64 2/6 正在安装 : libjpeg-turbo-1.2.90-8.el7.x86_64 3/6 正在安装 : libjpeg-turbo-devel-1.2.90-8.el7.x86_64 4/6 正在安装 : libxml2-devel-2.9.1-6.el7.4.x86_64 5/6 清理 : libxml2-2.9.1-6.el7_2.3.x86_64 6/6 验证中 : libjpeg-turbo-1.2.90-8.el7.x86_64 1/6 验证中 : xz-devel-5.2.2-1.el7.x86_64 2/6 验证中 : libjpeg-turbo-devel-1.2.90-8.el7.x86_64 3/6 验证中 : libxml2-devel-2.9.1-6.el7.4.x86_64 4/6 验证中 : libxml2-2.9.1-6.el7.4.x86_64 5/6 验证中 : libxml2-2.9.1-6.el7_2.3.x86_64 6/6 已安装: libjpeg-turbo-devel.x86_64 0:1.2.90-8.el7 libxml2-devel.x86_64 0:2.9.1-6.el7.4 作为依赖被安装: libjpeg-turbo.x86_64 0:1.2.90-8.el7 xz-devel.x86_64 0:5.2.2-1.el7 作为依赖被升级: libxml2.x86_64 0:2.9.1-6.el7.4 完毕! [root@web01 ~]# yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel -y 已加载插件:fastestmirror Loading mirror speeds from cached hostfile 正在解决依赖关系 --> 正在检查事务 ---> 软件包 freetype-devel.x86_64.0.2.8-14.el7 将被 安装 --> 正在处理依赖关系 freetype = 2.8-14.el7,它被软件包 freetype-devel-2.8-14.el7.x86_64 需要 ---> 软件包 gd-devel.x86_64.0.2.0.35-26.el7 将被 安装 --> 正在处理依赖关系 gd = 2.0.35-26.el7,它被软件包 gd-devel-2.0.35-26.el7.x86_64 需要 --> 正在处理依赖关系 libXpm-devel,它被软件包 gd-devel-2.0.35-26.el7.x86_64 需要 --> 正在处理依赖关系 libX11-devel,它被软件包 gd-devel-2.0.35-26.el7.x86_64 需要 --> 正在处理依赖关系 fontconfig-devel,它被软件包 gd-devel-2.0.35-26.el7.x86_64 需要 --> 正在处理依赖关系 libgd.so.2()(64bit),它被软件包 gd-devel-2.0.35-26.el7.x86_64 需要 ---> 软件包 libcurl-devel.x86_64.0.7.29.0-57.el7 将被 安装 base/7/x86_64/filelists_db | 7.1 MB 00:00:00 --> 正在处理依赖关系 libcurl = 7.29.0-57.el7,它被软件包 libcurl-devel-7.29.0-57.el7.x86_64 需要 ---> 软件包 libpng-devel.x86_64.2.1.5.13-7.el7_2 将被 安装 --> 正在处理依赖关系 libpng(x86-64) = 2:1.5.13-7.el7_2,它被软件包 2:libpng-devel-1.5.13-7.el7_2.x86_64 需要 --> 正在处理依赖关系 libpng15.so.15()(64bit),它被软件包 2:libpng-devel-1.5.13-7.el7_2.x86_64 需要 ---> 软件包 libxslt-devel.x86_64.0.1.1.28-5.el7 将被 安装 --> 正在处理依赖关系 libxslt = 1.1.28-5.el7,它被软件包 libxslt-devel-1.1.28-5.el7.x86_64 需要 --> 正在处理依赖关系 libgcrypt-devel,它被软件包 libxslt-devel-1.1.28-5.el7.x86_64 需要 --> 正在处理依赖关系 libxslt.so.1()(64bit),它被软件包 libxslt-devel-1.1.28-5.el7.x86_64 需要 --> 正在处理依赖关系 libexslt.so.0()(64bit),它被软件包 libxslt-devel-1.1.28-5.el7.x86_64 需要 --> 正在检查事务 ---> 软件包 fontconfig-devel.x86_64.0.2.13.0-4.3.el7 将被 安装 --> 正在处理依赖关系 fontconfig(x86-64) = 2.13.0-4.3.el7,它被软件包 fontconfig-devel-2.13.0-4.3.el7.x86_64 需要 --> 正在处理依赖关系 pkgconfig(uuid),它被软件包 fontconfig-devel-2.13.0-4.3.el7.x86_64 需要 --> 正在处理依赖关系 pkgconfig(expat),它被软件包 fontconfig-devel-2.13.0-4.3.el7.x86_64 需要 --> 正在处理依赖关系 libfontconfig.so.1()(64bit),它被软件包 fontconfig-devel-2.13.0-4.3.el7.x86_64 需要 ---> 软件包 freetype.x86_64.0.2.4.11-15.el7 将被 升级 ---> 软件包 freetype.x86_64.0.2.8-14.el7 将被 更新 ---> 软件包 gd.x86_64.0.2.0.35-26.el7 将被 安装 --> 正在处理依赖关系 libXpm.so.4()(64bit),它被软件包 gd-2.0.35-26.el7.x86_64 需要 --> 正在处理依赖关系 libX11.so.6()(64bit),它被软件包 gd-2.0.35-26.el7.x86_64 需要 ---> 软件包 libX11-devel.x86_64.0.1.6.7-2.el7 将被 安装 --> 正在处理依赖关系 pkgconfig(xcb) >= 1.11.1,它被软件包 libX11-devel-1.6.7-2.el7.x86_64 需要 --> 正在处理依赖关系 pkgconfig(xproto),它被软件包 libX11-devel-1.6.7-2.el7.x86_64 需要 --> 正在处理依赖关系 pkgconfig(xcb),它被软件包 libX11-devel-1.6.7-2.el7.x86_64 需要 --> 正在处理依赖关系 pkgconfig(kbproto),它被软件包 libX11-devel-1.6.7-2.el7.x86_64 需要 ---> 软件包 libXpm-devel.x86_64.0.3.5.12-1.el7 将被 安装 --> 正在处理依赖关系 libXt.so.6()(64bit),它被软件包 libXpm-devel-3.5.12-1.el7.x86_64 需要 --> 正在处理依赖关系 libXext.so.6()(64bit),它被软件包 libXpm-devel-3.5.12-1.el7.x86_64 需要 ---> 软件包 libcurl.x86_64.0.7.29.0-46.el7 将被 升级 --> 正在处理依赖关系 libcurl = 7.29.0-46.el7,它被软件包 curl-7.29.0-46.el7.x86_64 需要 ---> 软件包 libcurl.x86_64.0.7.29.0-57.el7 将被 更新 --> 正在处理依赖关系 nss-pem(x86-64) >= 1.0.3-5,它被软件包 libcurl-7.29.0-57.el7.x86_64 需要 --> 正在处理依赖关系 libssh2(x86-64) >= 1.8.0,它被软件包 libcurl-7.29.0-57.el7.x86_64 需要 ---> 软件包 libgcrypt-devel.x86_64.0.1.5.3-14.el7 将被 安装 --> 正在处理依赖关系 libgpg-error-devel,它被软件包 libgcrypt-devel-1.5.3-14.el7.x86_64 需要 ---> 软件包 libpng.x86_64.2.1.5.13-7.el7_2 将被 安装 ---> 软件包 libxslt.x86_64.0.1.1.28-5.el7 将被 安装 --> 正在检查事务 ---> 软件包 curl.x86_64.0.7.29.0-46.el7 将被 升级 ---> 软件包 curl.x86_64.0.7.29.0-57.el7 将被 更新 ---> 软件包 expat-devel.x86_64.0.2.1.0-11.el7 将被 安装 --> 正在处理依赖关系 expat = 2.1.0-11.el7,它被软件包 expat-devel-2.1.0-11.el7.x86_64 需要 ---> 软件包 fontconfig.x86_64.0.2.13.0-4.3.el7 将被 安装 --> 正在处理依赖关系 fontpackages-filesystem,它被软件包 fontconfig-2.13.0-4.3.el7.x86_64 需要 --> 正在处理依赖关系 dejavu-sans-fonts,它被软件包 fontconfig-2.13.0-4.3.el7.x86_64 需要 ---> 软件包 libX11.x86_64.0.1.6.7-2.el7 将被 安装 --> 正在处理依赖关系 libX11-common >= 1.6.7-2.el7,它被软件包 libX11-1.6.7-2.el7.x86_64 需要 --> 正在处理依赖关系 libxcb.so.1()(64bit),它被软件包 libX11-1.6.7-2.el7.x86_64 需要 ---> 软件包 libXext.x86_64.0.1.3.3-3.el7 将被 安装 ---> 软件包 libXpm.x86_64.0.3.5.12-1.el7 将被 安装 ---> 软件包 libXt.x86_64.0.1.1.5-3.el7 将被 安装 --> 正在处理依赖关系 libSM.so.6()(64bit),它被软件包 libXt-1.1.5-3.el7.x86_64 需要 --> 正在处理依赖关系 libICE.so.6()(64bit),它被软件包 libXt-1.1.5-3.el7.x86_64 需要 ---> 软件包 libgpg-error-devel.x86_64.0.1.12-3.el7 将被 安装 ---> 软件包 libssh2.x86_64.0.1.4.3-10.el7_2.1 将被 升级 ---> 软件包 libssh2.x86_64.0.1.8.0-3.el7 将被 更新 ---> 软件包 libuuid-devel.x86_64.0.2.23.2-63.el7 将被 安装 --> 正在处理依赖关系 libuuid = 2.23.2-63.el7,它被软件包 libuuid-devel-2.23.2-63.el7.x86_64 需要 ---> 软件包 libxcb-devel.x86_64.0.1.13-1.el7 将被 安装 --> 正在处理依赖关系 pkgconfig(xau) >= 0.99.2,它被软件包 libxcb-devel-1.13-1.el7.x86_64 需要 ---> 软件包 nss-pem.x86_64.0.1.0.3-4.el7 将被 升级 ---> 软件包 nss-pem.x86_64.0.1.0.3-7.el7 将被 更新 ---> 软件包 xorg-x11-proto-devel.noarch.0.2018.4-1.el7 将被 安装 --> 正在检查事务 ---> 软件包 dejavu-sans-fonts.noarch.0.2.33-6.el7 将被 安装 --> 正在处理依赖关系 dejavu-fonts-common = 2.33-6.el7,它被软件包 dejavu-sans-fonts-2.33-6.el7.noarch 需要 ---> 软件包 expat.x86_64.0.2.1.0-10.el7_3 将被 升级 ---> 软件包 expat.x86_64.0.2.1.0-11.el7 将被 更新 ---> 软件包 fontpackages-filesystem.noarch.0.1.44-8.el7 将被 安装 ---> 软件包 libICE.x86_64.0.1.0.9-9.el7 将被 安装 ---> 软件包 libSM.x86_64.0.1.2.2-2.el7 将被 安装 ---> 软件包 libX11-common.noarch.0.1.6.7-2.el7 将被 安装 ---> 软件包 libXau-devel.x86_64.0.1.0.8-2.1.el7 将被 安装 --> 正在处理依赖关系 libXau = 1.0.8-2.1.el7,它被软件包 libXau-devel-1.0.8-2.1.el7.x86_64 需要 --> 正在处理依赖关系 libXau.so.6()(64bit),它被软件包 libXau-devel-1.0.8-2.1.el7.x86_64 需要 ---> 软件包 libuuid.x86_64.0.2.23.2-52.el7_5.1 将被 升级 --> 正在处理依赖关系 libuuid = 2.23.2-52.el7_5.1,它被软件包 libblkid-2.23.2-52.el7_5.1.x86_64 需要 --> 正在处理依赖关系 libuuid = 2.23.2-52.el7_5.1,它被软件包 libmount-2.23.2-52.el7_5.1.x86_64 需要 --> 正在处理依赖关系 libuuid = 2.23.2-52.el7_5.1,它被软件包 util-linux-2.23.2-52.el7_5.1.x86_64 需要 ---> 软件包 libuuid.x86_64.0.2.23.2-63.el7 将被 更新 ---> 软件包 libxcb.x86_64.0.1.13-1.el7 将被 安装 --> 正在检查事务 ---> 软件包 dejavu-fonts-common.noarch.0.2.33-6.el7 将被 安装 ---> 软件包 libXau.x86_64.0.1.0.8-2.1.el7 将被 安装 ---> 软件包 libblkid.x86_64.0.2.23.2-52.el7_5.1 将被 升级 ---> 软件包 libblkid.x86_64.0.2.23.2-63.el7 将被 更新 ---> 软件包 libmount.x86_64.0.2.23.2-52.el7_5.1 将被 升级 ---> 软件包 libmount.x86_64.0.2.23.2-63.el7 将被 更新 ---> 软件包 util-linux.x86_64.0.2.23.2-52.el7_5.1 将被 升级 ---> 软件包 util-linux.x86_64.0.2.23.2-63.el7 将被 更新 --> 正在处理依赖关系 libsmartcols = 2.23.2-63.el7,它被软件包 util-linux-2.23.2-63.el7.x86_64 需要 --> 正在处理依赖关系 libsmartcols.so.1(SMARTCOLS_2.25)(64bit),它被软件包 util-linux-2.23.2-63.el7.x86_64 需要 --> 正在处理依赖关系 libsmartcols.so.1()(64bit),它被软件包 util-linux-2.23.2-63.el7.x86_64 需要 --> 正在检查事务 ---> 软件包 libsmartcols.x86_64.0.2.23.2-63.el7 将被 安装 --> 解决依赖关系完成 依赖关系解决 ======================================================================================================================================================================================================= Package 架构 版本 源 大小 ======================================================================================================================================================================================================= 正在安装: freetype-devel x86_64 2.8-14.el7 base 447 k gd-devel x86_64 2.0.35-26.el7 base 79 k libcurl-devel x86_64 7.29.0-57.el7 base 303 k libpng-devel x86_64 2:1.5.13-7.el7_2 base 122 k libxslt-devel x86_64 1.1.28-5.el7 base 309 k 为依赖而安装: dejavu-fonts-common noarch 2.33-6.el7 base 64 k dejavu-sans-fonts noarch 2.33-6.el7 base 1.4 M expat-devel x86_64 2.1.0-11.el7 base 57 k fontconfig x86_64 2.13.0-4.3.el7 base 254 k fontconfig-devel x86_64 2.13.0-4.3.el7 base 138 k fontpackages-filesystem noarch 1.44-8.el7 base 9.9 k gd x86_64 2.0.35-26.el7 base 146 k libICE x86_64 1.0.9-9.el7 base 66 k libSM x86_64 1.2.2-2.el7 base 39 k libX11 x86_64 1.6.7-2.el7 base 607 k libX11-common noarch 1.6.7-2.el7 base 164 k libX11-devel x86_64 1.6.7-2.el7 base 981 k libXau x86_64 1.0.8-2.1.el7 base 29 k libXau-devel x86_64 1.0.8-2.1.el7 base 14 k libXext x86_64 1.3.3-3.el7 base 39 k libXpm x86_64 3.5.12-1.el7 base 55 k libXpm-devel x86_64 3.5.12-1.el7 base 36 k libXt x86_64 1.1.5-3.el7 base 173 k libgcrypt-devel x86_64 1.5.3-14.el7 base 129 k libgpg-error-devel x86_64 1.12-3.el7 base 16 k libpng x86_64 2:1.5.13-7.el7_2 base 213 k libsmartcols x86_64 2.23.2-63.el7 base 142 k libuuid-devel x86_64 2.23.2-63.el7 base 92 k libxcb x86_64 1.13-1.el7 base 214 k libxcb-devel x86_64 1.13-1.el7 base 1.1 M libxslt x86_64 1.1.28-5.el7 base 242 k xorg-x11-proto-devel noarch 2018.4-1.el7 base 280 k 为依赖而更新: curl x86_64 7.29.0-57.el7 base 270 k expat x86_64 2.1.0-11.el7 base 81 k freetype x86_64 2.8-14.el7 base 380 k libblkid x86_64 2.23.2-63.el7 base 182 k libcurl x86_64 7.29.0-57.el7 base 223 k libmount x86_64 2.23.2-63.el7 base 184 k libssh2 x86_64 1.8.0-3.el7 base 88 k libuuid x86_64 2.23.2-63.el7 base 83 k nss-pem x86_64 1.0.3-7.el7 base 74 k util-linux x86_64 2.23.2-63.el7 base 2.0 M 事务概要 ======================================================================================================================================================================================================= 安装 5 软件包 (+27 依赖软件包) 升级 ( 10 依赖软件包) 总下载量:11 M Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. (1/42): dejavu-fonts-common-2.33-6.el7.noarch.rpm | 64 kB 00:00:00 (2/42): curl-7.29.0-57.el7.x86_64.rpm | 270 kB 00:00:00 (3/42): expat-2.1.0-11.el7.x86_64.rpm | 81 kB 00:00:00 (4/42): expat-devel-2.1.0-11.el7.x86_64.rpm | 57 kB 00:00:00 (5/42): fontconfig-2.13.0-4.3.el7.x86_64.rpm | 254 kB 00:00:00 (6/42): fontconfig-devel-2.13.0-4.3.el7.x86_64.rpm | 138 kB 00:00:00 (7/42): fontpackages-filesystem-1.44-8.el7.noarch.rpm | 9.9 kB 00:00:00 (8/42): dejavu-sans-fonts-2.33-6.el7.noarch.rpm | 1.4 MB 00:00:00 (9/42): freetype-2.8-14.el7.x86_64.rpm | 380 kB 00:00:00 (10/42): freetype-devel-2.8-14.el7.x86_64.rpm | 447 kB 00:00:00 (11/42): gd-2.0.35-26.el7.x86_64.rpm | 146 kB 00:00:00 (12/42): gd-devel-2.0.35-26.el7.x86_64.rpm | 79 kB 00:00:00 (13/42): libICE-1.0.9-9.el7.x86_64.rpm | 66 kB 00:00:00 (14/42): libSM-1.2.2-2.el7.x86_64.rpm | 39 kB 00:00:00 (15/42): libX11-common-1.6.7-2.el7.noarch.rpm | 164 kB 00:00:00 (16/42): libX11-1.6.7-2.el7.x86_64.rpm | 607 kB 00:00:00 (17/42): libXau-1.0.8-2.1.el7.x86_64.rpm | 29 kB 00:00:00 (18/42): libX11-devel-1.6.7-2.el7.x86_64.rpm | 981 kB 00:00:00 (19/42): libXau-devel-1.0.8-2.1.el7.x86_64.rpm | 14 kB 00:00:00 (20/42): libXext-1.3.3-3.el7.x86_64.rpm | 39 kB 00:00:00 (21/42): libXpm-3.5.12-1.el7.x86_64.rpm | 55 kB 00:00:00 (22/42): libXpm-devel-3.5.12-1.el7.x86_64.rpm | 36 kB 00:00:00 (23/42): libXt-1.1.5-3.el7.x86_64.rpm | 173 kB 00:00:00 (24/42): libblkid-2.23.2-63.el7.x86_64.rpm | 182 kB 00:00:00 (25/42): libcurl-7.29.0-57.el7.x86_64.rpm | 223 kB 00:00:00 (26/42): libgcrypt-devel-1.5.3-14.el7.x86_64.rpm | 129 kB 00:00:00 (27/42): libgpg-error-devel-1.12-3.el7.x86_64.rpm | 16 kB 00:00:00 (28/42): libmount-2.23.2-63.el7.x86_64.rpm | 184 kB 00:00:00 (29/42): libpng-1.5.13-7.el7_2.x86_64.rpm | 213 kB 00:00:00 (30/42): libpng-devel-1.5.13-7.el7_2.x86_64.rpm | 122 kB 00:00:00 (31/42): libsmartcols-2.23.2-63.el7.x86_64.rpm | 142 kB 00:00:00 (32/42): libssh2-1.8.0-3.el7.x86_64.rpm | 88 kB 00:00:00 (33/42): libuuid-2.23.2-63.el7.x86_64.rpm | 83 kB 00:00:00 (34/42): libuuid-devel-2.23.2-63.el7.x86_64.rpm | 92 kB 00:00:00 (35/42): libxcb-1.13-1.el7.x86_64.rpm | 214 kB 00:00:00 (36/42): libxcb-devel-1.13-1.el7.x86_64.rpm | 1.1 MB 00:00:00 (37/42): libxslt-1.1.28-5.el7.x86_64.rpm | 242 kB 00:00:00 (38/42): libxslt-devel-1.1.28-5.el7.x86_64.rpm | 309 kB 00:00:00 (39/42): nss-pem-1.0.3-7.el7.x86_64.rpm | 74 kB 00:00:00 (40/42): util-linux-2.23.2-63.el7.x86_64.rpm | 2.0 MB 00:00:00 (41/42): xorg-x11-proto-devel-2018.4-1.el7.noarch.rpm | 280 kB 00:00:00 (42/42): libcurl-devel-7.29.0-57.el7.x86_64.rpm | 303 kB 00:00:00 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 总计 17 MB/s | 11 MB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在更新 : libuuid-2.23.2-63.el7.x86_64 1/52 正在安装 : 2:libpng-1.5.13-7.el7_2.x86_64 2/52 正在更新 : freetype-2.8-14.el7.x86_64 3/52 正在安装 : 2:libpng-devel-1.5.13-7.el7_2.x86_64 4/52 正在安装 : freetype-devel-2.8-14.el7.x86_64 5/52 正在更新 : libblkid-2.23.2-63.el7.x86_64 6/52 正在更新 : expat-2.1.0-11.el7.x86_64 7/52 正在安装 : libXau-1.0.8-2.1.el7.x86_64 8/52 正在安装 : libxcb-1.13-1.el7.x86_64 9/52 正在安装 : libICE-1.0.9-9.el7.x86_64 10/52 正在安装 : xorg-x11-proto-devel-2018.4-1.el7.noarch 11/52 正在安装 : fontpackages-filesystem-1.44-8.el7.noarch 12/52 正在安装 : dejavu-fonts-common-2.33-6.el7.noarch 13/52 正在安装 : dejavu-sans-fonts-2.33-6.el7.noarch 14/52 正在安装 : fontconfig-2.13.0-4.3.el7.x86_64 15/52 正在安装 : libXau-devel-1.0.8-2.1.el7.x86_64 16/52 正在安装 : libxcb-devel-1.13-1.el7.x86_64 17/52 正在安装 : libSM-1.2.2-2.el7.x86_64 18/52 正在安装 : expat-devel-2.1.0-11.el7.x86_64 19/52 正在更新 : libmount-2.23.2-63.el7.x86_64 20/52 正在安装 : libuuid-devel-2.23.2-63.el7.x86_64 21/52 正在安装 : fontconfig-devel-2.13.0-4.3.el7.x86_64 22/52 正在安装 : libgpg-error-devel-1.12-3.el7.x86_64 23/52 正在安装 : libgcrypt-devel-1.5.3-14.el7.x86_64 24/52 正在安装 : libsmartcols-2.23.2-63.el7.x86_64 25/52 正在安装 : libxslt-1.1.28-5.el7.x86_64 26/52 正在更新 : nss-pem-1.0.3-7.el7.x86_64 27/52 正在安装 : libX11-common-1.6.7-2.el7.noarch 28/52 正在安装 : libX11-1.6.7-2.el7.x86_64 29/52 正在安装 : libXpm-3.5.12-1.el7.x86_64 30/52 正在安装 : libX11-devel-1.6.7-2.el7.x86_64 31/52 正在安装 : gd-2.0.35-26.el7.x86_64 32/52 正在安装 : libXext-1.3.3-3.el7.x86_64 33/52 正在安装 : libXt-1.1.5-3.el7.x86_64 34/52 正在安装 : libXpm-devel-3.5.12-1.el7.x86_64 35/52 正在更新 : libssh2-1.8.0-3.el7.x86_64 36/52 正在更新 : libcurl-7.29.0-57.el7.x86_64 37/52 正在安装 : libcurl-devel-7.29.0-57.el7.x86_64 38/52 正在更新 : curl-7.29.0-57.el7.x86_64 39/52 正在安装 : gd-devel-2.0.35-26.el7.x86_64 40/52 正在安装 : libxslt-devel-1.1.28-5.el7.x86_64 41/52 正在更新 : util-linux-2.23.2-63.el7.x86_64 42/52 清理 : util-linux-2.23.2-52.el7_5.1.x86_64 43/52 清理 : libmount-2.23.2-52.el7_5.1.x86_64 44/52 清理 : libblkid-2.23.2-52.el7_5.1.x86_64 45/52 清理 : curl-7.29.0-46.el7.x86_64 46/52 清理 : libcurl-7.29.0-46.el7.x86_64 47/52 清理 : libssh2-1.4.3-10.el7_2.1.x86_64 48/52 清理 : libuuid-2.23.2-52.el7_5.1.x86_64 49/52 清理 : expat-2.1.0-10.el7_3.x86_64 50/52 清理 : nss-pem-1.0.3-4.el7.x86_64 51/52 清理 : freetype-2.4.11-15.el7.x86_64 52/52 验证中 : libXext-1.3.3-3.el7.x86_64 1/52 验证中 : fontconfig-2.13.0-4.3.el7.x86_64 2/52 验证中 : libxslt-devel-1.1.28-5.el7.x86_64 3/52 验证中 : libXt-1.1.5-3.el7.x86_64 4/52 验证中 : libcurl-devel-7.29.0-57.el7.x86_64 5/52 验证中 : libssh2-1.8.0-3.el7.x86_64 6/52 验证中 : 2:libpng-1.5.13-7.el7_2.x86_64 7/52 验证中 : freetype-2.8-14.el7.x86_64 8/52 验证中 : expat-devel-2.1.0-11.el7.x86_64 9/52 验证中 : fontpackages-filesystem-1.44-8.el7.noarch 10/52 验证中 : libmount-2.23.2-63.el7.x86_64 11/52 验证中 : libcurl-7.29.0-57.el7.x86_64 12/52 验证中 : fontconfig-devel-2.13.0-4.3.el7.x86_64 13/52 验证中 : curl-7.29.0-57.el7.x86_64 14/52 验证中 : xorg-x11-proto-devel-2018.4-1.el7.noarch 15/52 验证中 : libXpm-devel-3.5.12-1.el7.x86_64 16/52 验证中 : util-linux-2.23.2-63.el7.x86_64 17/52 验证中 : libX11-1.6.7-2.el7.x86_64 18/52 验证中 : libX11-common-1.6.7-2.el7.noarch 19/52 验证中 : nss-pem-1.0.3-7.el7.x86_64 20/52 验证中 : freetype-devel-2.8-14.el7.x86_64 21/52 验证中 : libblkid-2.23.2-63.el7.x86_64 22/52 验证中 : libXpm-3.5.12-1.el7.x86_64 23/52 验证中 : 2:libpng-devel-1.5.13-7.el7_2.x86_64 24/52 验证中 : gd-devel-2.0.35-26.el7.x86_64 25/52 验证中 : libxcb-1.13-1.el7.x86_64 26/52 验证中 : libxslt-1.1.28-5.el7.x86_64 27/52 验证中 : dejavu-sans-fonts-2.33-6.el7.noarch 28/52 验证中 : libICE-1.0.9-9.el7.x86_64 29/52 验证中 : gd-2.0.35-26.el7.x86_64 30/52 验证中 : libgcrypt-devel-1.5.3-14.el7.x86_64 31/52 验证中 : libuuid-2.23.2-63.el7.x86_64 32/52 验证中 : libxcb-devel-1.13-1.el7.x86_64 33/52 验证中 : libXau-1.0.8-2.1.el7.x86_64 34/52 验证中 : libSM-1.2.2-2.el7.x86_64 35/52 验证中 : libX11-devel-1.6.7-2.el7.x86_64 36/52 验证中 : expat-2.1.0-11.el7.x86_64 37/52 验证中 : libsmartcols-2.23.2-63.el7.x86_64 38/52 验证中 : libuuid-devel-2.23.2-63.el7.x86_64 39/52 验证中 : libgpg-error-devel-1.12-3.el7.x86_64 40/52 验证中 : dejavu-fonts-common-2.33-6.el7.noarch 41/52 验证中 : libXau-devel-1.0.8-2.1.el7.x86_64 42/52 验证中 : libblkid-2.23.2-52.el7_5.1.x86_64 43/52 验证中 : nss-pem-1.0.3-4.el7.x86_64 44/52 验证中 : freetype-2.4.11-15.el7.x86_64 45/52 验证中 : libuuid-2.23.2-52.el7_5.1.x86_64 46/52 验证中 : libssh2-1.4.3-10.el7_2.1.x86_64 47/52 验证中 : libcurl-7.29.0-46.el7.x86_64 48/52 验证中 : curl-7.29.0-46.el7.x86_64 49/52 验证中 : libmount-2.23.2-52.el7_5.1.x86_64 50/52 验证中 : util-linux-2.23.2-52.el7_5.1.x86_64 51/52 验证中 : expat-2.1.0-10.el7_3.x86_64 52/52 已安装: freetype-devel.x86_64 0:2.8-14.el7 gd-devel.x86_64 0:2.0.35-26.el7 libcurl-devel.x86_64 0:7.29.0-57.el7 libpng-devel.x86_64 2:1.5.13-7.el7_2 libxslt-devel.x86_64 0:1.1.28-5.el7 作为依赖被安装: dejavu-fonts-common.noarch 0:2.33-6.el7 dejavu-sans-fonts.noarch 0:2.33-6.el7 expat-devel.x86_64 0:2.1.0-11.el7 fontconfig.x86_64 0:2.13.0-4.3.el7 fontconfig-devel.x86_64 0:2.13.0-4.3.el7 fontpackages-filesystem.noarch 0:1.44-8.el7 gd.x86_64 0:2.0.35-26.el7 libICE.x86_64 0:1.0.9-9.el7 libSM.x86_64 0:1.2.2-2.el7 libX11.x86_64 0:1.6.7-2.el7 libX11-common.noarch 0:1.6.7-2.el7 libX11-devel.x86_64 0:1.6.7-2.el7 libXau.x86_64 0:1.0.8-2.1.el7 libXau-devel.x86_64 0:1.0.8-2.1.el7 libXext.x86_64 0:1.3.3-3.el7 libXpm.x86_64 0:3.5.12-1.el7 libXpm-devel.x86_64 0:3.5.12-1.el7 libXt.x86_64 0:1.1.5-3.el7 libgcrypt-devel.x86_64 0:1.5.3-14.el7 libgpg-error-devel.x86_64 0:1.12-3.el7 libpng.x86_64 2:1.5.13-7.el7_2 libsmartcols.x86_64 0:2.23.2-63.el7 libuuid-devel.x86_64 0:2.23.2-63.el7 libxcb.x86_64 0:1.13-1.el7 libxcb-devel.x86_64 0:1.13-1.el7 libxslt.x86_64 0:1.1.28-5.el7 xorg-x11-proto-devel.noarch 0:2018.4-1.el7 作为依赖被升级: curl.x86_64 0:7.29.0-57.el7 expat.x86_64 0:2.1.0-11.el7 freetype.x86_64 0:2.8-14.el7 libblkid.x86_64 0:2.23.2-63.el7 libcurl.x86_64 0:7.29.0-57.el7 libmount.x86_64 0:2.23.2-63.el7 libssh2.x86_64 0:1.8.0-3.el7 libuuid.x86_64 0:2.23.2-63.el7 nss-pem.x86_64 0:1.0.3-7.el7 util-linux.x86_64 0:2.23.2-63.el7 完毕! [root@web01 ~]# rpm -qa zlib-devel libxml2-devel libjpeg-turbo-devel libiconv-devel zlib-devel-1.2.7-18.el7.x86_64 libjpeg-turbo-devel-1.2.90-8.el7.x86_64 libxml2-devel-2.9.1-6.el7.4.x86_64 [root@web01 ~]# rpm -qa freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel-1.1.28-5.el7.x86_64 gd-devel-2.0.35-26.el7.x86_64 libpng-devel-1.5.13-7.el7_2.x86_64 libcurl-devel-7.29.0-57.el7.x86_64 freetype-devel-2.8-14.el7.x86_64 [root@web01 ~]#
安装yum无法安装的 libiconv 库
[root@web01 ~]# cd /server/tools/ [root@web01 tools]# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz [root@web01 tools]# ll 总用量 713768 -r-------- 1 root root 4825 6月 7 22:14 jiantousheji.zip -rw-r--r-- 1 root root 5166734 4月 27 2019 libiconv-1.16.tar.gz -rw-r--r-- 1 root root 724672294 9月 27 2019 mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz drwxr-xr-x 9 mysql mysql 4096 6月 2 23:05 nginx-1.18.0 -rw-r--r-- 1 root root 1039530 4月 21 22:33 nginx-1.18.0.tar.gz [root@web01 tools]# tar zxf libiconv-1.16.tar.gz [root@web01 tools]# ls jiantousheji.zip libiconv-1.16 libiconv-1.16.tar.gz mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz nginx-1.18.0 nginx-1.18.0.tar.gz [root@web01 tools]# cd libiconv-1.16 [root@web01 libiconv-1.16]# ls ABOUT-NLS build-aux configure COPYING.LIB doc HACKING INSTALL.windows m4 man os2 src tests windows aclocal.m4 ChangeLog configure.ac DEPENDENCIES extras include lib Makefile.devel NEWS po srclib THANKS woe32dll AUTHORS config.h.in COPYING DESIGN gnulib-local INSTALL.generic libcharset Makefile.in NOTES README srcm4 tools [root@web01 libiconv-1.16]# ./configure -prefix=/application/libiconv [root@web01 tools]# make [root@web01 tools]# make install [root@web01 tools]# cd ../
[root@web01 tools]# yum install libmcrypt-devel mhash mcrypt -y 已加载插件:fastestmirror Loading mirror speeds from cached hostfile 正在解决依赖关系 --> 正在检查事务 ---> 软件包 libmcrypt-devel.x86_64.0.2.5.8-13.el7 将被 安装 --> 正在处理依赖关系 libmcrypt = 2.5.8-13.el7,它被软件包 libmcrypt-devel-2.5.8-13.el7.x86_64 需要 --> 正在处理依赖关系 libmcrypt.so.4()(64bit),它被软件包 libmcrypt-devel-2.5.8-13.el7.x86_64 需要 ---> 软件包 mcrypt.x86_64.0.2.6.8-11.el7 将被 安装 ---> 软件包 mhash.x86_64.0.0.9.9.9-10.el7 将被 安装 --> 正在检查事务 ---> 软件包 libmcrypt.x86_64.0.2.5.8-13.el7 将被 安装 --> 解决依赖关系完成 依赖关系解决 ======================================================================================================================================================================================================= Package 架构 版本 源 大小 ======================================================================================================================================================================================================= 正在安装: libmcrypt-devel x86_64 2.5.8-13.el7 epel 13 k mcrypt x86_64 2.6.8-11.el7 epel 85 k mhash x86_64 0.9.9.9-10.el7 epel 106 k 为依赖而安装: libmcrypt x86_64 2.5.8-13.el7 epel 99 k 事务概要 ======================================================================================================================================================================================================= 安装 3 软件包 (+1 依赖软件包) 总下载量:303 k 安装大小:735 k Downloading packages: (1/4): libmcrypt-2.5.8-13.el7.x86_64.rpm | 99 kB 00:00:00 (2/4): libmcrypt-devel-2.5.8-13.el7.x86_64.rpm | 13 kB 00:00:00 (3/4): mcrypt-2.6.8-11.el7.x86_64.rpm | 85 kB 00:00:00 (4/4): mhash-0.9.9.9-10.el7.x86_64.rpm | 106 kB 00:00:00 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 总计 1.3 MB/s | 303 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安装 : libmcrypt-2.5.8-13.el7.x86_64 1/4 正在安装 : mhash-0.9.9.9-10.el7.x86_64 2/4 正在安装 : mcrypt-2.6.8-11.el7.x86_64 3/4 正在安装 : libmcrypt-devel-2.5.8-13.el7.x86_64 4/4 验证中 : libmcrypt-devel-2.5.8-13.el7.x86_64 1/4 验证中 : libmcrypt-2.5.8-13.el7.x86_64 2/4 验证中 : mhash-0.9.9.9-10.el7.x86_64 3/4 验证中 : mcrypt-2.6.8-11.el7.x86_64 4/4 已安装: libmcrypt-devel.x86_64 0:2.5.8-13.el7 mcrypt.x86_64 0:2.6.8-11.el7 mhash.x86_64 0:0.9.9.9-10.el7 作为依赖被安装: libmcrypt.x86_64 0:2.5.8-13.el7 完毕!
2、安装PHP
php 下载地址:http://mirrors.sohu.com/php/
[root@web01 ~]# cd /server/tools [root@web01 tools]# [root@web01 tools]# wget -q http://mirrors.sohu.com/php/php-7.3.5.tar.gz [root@web01 tools]# tar xzvf php-7.3.5.tar.gz [root@web01 tools]# cd php-7.3.5 [root@web01 php-7.3.5]# ./configure \ --prefix=/application/php-7.3.5 \ --enable-mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/application/libiconv \ --with-freetype-dir \ --with-jpeg-dir \ --with-png-dir \ --with-zlib \ --with-libxml-dir=/usr \ --enable-xml \ --disable-rpath \ --enable-bcmath \ --enable-shmop \ --enable-sysvsem \ --enable-inline-optimization \ --with-curl \ --enable-mbregex \ --enable-fpm \ --enable-mbstring \ --with-gd \ --with-openssl \ --with-mhash \ --enable-pcntl \ --enable-sockets \ --with-xmlrpc \ --enable-soap \ --enable-short-tags \ --enable-static \ --with-xsl \ --with-fpm-user=nginx \ --with-fpm-group=nginx \ --enable-ftp \ --enable-opcache=no [root@web01 php-7.3.5]# echo $? 0 [root@web01 php-7.3.5]# make && make install [root@web01 php-7.3.5]# echo $? 0
7.2 抛弃了。
--with-mysql=/application/mysql 编译PHP时候使用mysql软件下面的库文件。
--enable-mysqlnd 带mysql库文件
[root@web01 php-7.3.5]# nginx -V nginx version: nginx/1.18.0 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: --user=www --group=www --prefix=/application/nginx-1.18.0/ --with-http_stub_status_module --with-http_ssl_module --with-pcre [root@web01 php-7.3.5]# id nginx id: nginx: no such user [root@web01 php-7.3.5]# useradd nginx -u 1111 -s /sbin/nologin -m [root@web01 php-7.3.5]# id nginx uid=1111(nginx) gid=1111(nginx) 组=1111(nginx) [root@web01 php-7.3.5]# vim /application/nginx/conf/nginx.conf [root@web01 php-7.3.5]# vim /application/nginx/conf/nginx.conf.default [root@web01 php-7.3.5]# vim /application/nginx/conf/nginx.conf [root@web01 php-7.3.5]# nginx -s reload 将nginx的用户和PHP的用户统一:nginx [root@web02 /server/tools/php-7.3.5]# useradd nginx -u 1111 -s /sbin/nologin -M [root@web02 /server/tools/php-7.3.5]# id nginx uid=1111(nginx) gid=1111(nginx) 组=1111(nginx) [root@web02 /server/tools/php-7.3.5]# vim /application/nginx/conf/nginx.conf worker_processes 1; user nginx nginx; (编译的时候就改用nginx)
[root@web01 php-7.3.5]# ln -s /application/php-7.3.5/ /application/php [root@web01 php-7.3.5]# ls /application/php bin etc include lib php sbin var
3、配置php.ini(PHP解析器配置文件)
[root@web01 php]# cd /server/tools/php-7.3.5 [root@web01 php-7.3.5]# ls acinclude.m4 config.nice footer LICENSE Makefile.objects php.ini-development README.REDIST.BINS sapi UPGRADING aclocal.m4 config.status generated_lists ltmain.sh missing php.ini-production README.RELEASE_PROCESS scripts UPGRADING.INTERNALS appveyor config.sub genfiles main mkinstalldirs README.EXT_SKEL README.SELF-CONTAINED-EXTENSIONS server-tests-config.php vcsclean build configure header makedist modules README.GIT-RULES README.STREAMS server-tests.php win32 buildconf configure.ac include Makefile NEWS README.input_filter README.SUBMITTING_PATCH snapshot Zend buildconf.bat CONTRIBUTING.md INSTALL Makefile.frag pear README.MAILINGLIST_RULES README.TESTING stamp-h.in CODING_STANDARDS CREDITS install-sh Makefile.fragments php7.spec README.md README.UNIX-BUILD-SYSTEM tests config.guess ext libs Makefile.gcov php7.spec.in README.NEW-OUTPUT-API README.WIN32-BUILD-SYSTEM travis config.log EXTENSIONS libtool Makefile.global php.gif README.PARAMETER_PARSING_API run-tests.php TSRM [root@web01 php-7.3.5]# ls php.ini-* php.ini-development php.ini-production [root@web01 php-7.3.5]# vim vim vimdiff vimtutor [root@web01 php-7.3.5]# vimdiff php.ini- php.ini-development php.ini-production [root@web01 php-7.3.5]# vimdiff php.ini-development php.ini-production [root@web01 php-7.3.5]# cp php.ini-development /application/php/lib/php.ini [root@web01 php-7.3.5]# ls /application/php php/ php-7.3.5/ [root@web01 php-7.3.5]# ls /application/php/lib/php.ini /application/php/lib/php.ini
4、配置PHP FPM
[root@web01 php-7.3.5]# cd /application/php/etc/ [root@web01 etc]# ls pear.conf php-fpm.conf.default php-fpm.d [root@web01 etc]# cp php-fpm.conf.default php-fpm.conf [root@web01 etc]# cd php-fpm.d [root@web01 php-fpm.d]# ls www.conf.default [root@web01 php-fpm.d]# cp www.conf.default www.conf [root@web01 php-fpm.d]# ls www.conf www.conf.default
5、启动PHP服务
[root@web01 php-fpm.d]# /application/php/sbin/php-fpm [root@web01 php-fpm.d]# netstat -lntp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 17885/php-fpm: mast tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1421/nginx: master tcp 0 0 0.0.0.0:81 0.0.0.0:* LISTEN 1421/nginx: master tcp 0 0 0.0.0.0:82 0.0.0.0:* LISTEN 1421/nginx: master tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1211/sshd tcp6 0 0 :::3306 :::* LISTEN 806/mysqld [root@web01 php-fpm.d]# netstat -lntup Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 17885/php-fpm: mast tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1421/nginx: master tcp 0 0 0.0.0.0:81 0.0.0.0:* LISTEN 1421/nginx: master tcp 0 0 0.0.0.0:82 0.0.0.0:* LISTEN 1421/nginx: master tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1211/sshd tcp6 0 0 :::3306 :::* LISTEN 806/mysqld udp 0 0 127.0.0.1:323 0.0.0.0:* 474/chronyd udp 0 0 0.0.0.0:68 0.0.0.0:* 743/dhclient udp6 0 0 ::1:323 :::* 474/chronyd [root@web01 php-fpm.d]# netstat -lntup|grep php-fpm tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 17885/php-fpm: mast
6、开机自启动
[root@web01 php-fpm.d]# vim /etc/rc.local [root@web01 php-fpm.d]# cat /etc/rc.local #!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES # # It is highly advisable to create own systemd services or udev rules # to run scripts during boot instead of using this file. # # In contrast to previous versions due to parallel execution during boot # this script will NOT be run after all other services. # # Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure # that this script will be executed during boot. touch /var/lock/subsys/local /application/nginx/sbin/nginx /application/php/sbin/php-fpm
[root@web01 php-fpm.d]# tail -2 /etc/rc.local /application/nginx/sbin/nginx /application/php/sbin/php-fpm
7、配置nginx转发PHP请求
location ~ .*\.(php|php5)?$ { root html/blog; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; }
[root@web01 conf]# cat nginx.conf worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; location / { root html; index index.html index.htm; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
8、测试NGINX连接PHP
编写测试文件
[root@web01 html]# echo "<?php phpinfo(); ?>" > /application/nginx/html/test_info.php [root@web01 html]# cat test_info.php <?php phpinfo(); ?> [root@web01 html]# /application/php/bin/php /application/nginx/html/test_info.php phpinfo() PHP Version => 7.3.5
成功的配置:
[root@web01 html]# vim /application/nginx/conf/nginx.conf [root@web01 html]# cat /application/nginx/conf/nginx.conf worker_processes 1; user nginx nginx; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; location / { root html; index index.html index.htm; } location ~ \.(php|php5)?$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
错误的配置
[root@web02 /application/nginx/conf/extra]# cat 03_blog.conf.ori
server {
listen 80;
server_name blog.etiantian.org;
root html/blog;
location / {
index index.html index.htm;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
}
[root@web02 /application/nginx/conf]# nginx -t
nginx: the configuration file /application/nginx-1.16.0//conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.16.0//conf/nginx.conf test is successful
[root@web02 /application/nginx/conf]# nginx -s reload
9、测试PHP连接mysql
[root@web01 html]# vun /application/nginx/html/test_mysql.php
[root@web01 html]# cat test_mysql.php <?php //$link_id=mysqli_connect('主机名','用户','密码'); $link_id=mysqli_connect('localhost','root','jiayi123') or mysql_error(); if($link_id){ echo "mysql successful by jiayi.\n"; }else{ echo mysql_error(); } ?> [root@web01 html]# /application/php/bin/php /application/nginx/html/blog/test_mysql.php Could not open input file: /application/nginx/html/blog/test_mysql.php [root@web01 html]# /application/php/bin/php /application/nginx/html/test_mysql.php mysql successful by oldboy. [root@web01 html]# vim test_mysql.php [root@web01 html]# [root@web01 html]# nginx -s reload [root@web01 html]# /application/php/bin/php /application/nginx/html/test_mysql.php mysql successful by jiayi.
LNMP环境搭建成功。
3个作业:
搭建BLOG(www.wordpress.org),BBS(discuz www.discuz.net ),DEDECMS(www.dedecms.com)
搭建网盘
《跟老男孩学习Linux运维:Web集群实战》
可道云网盘项目
https://kodcloud.com/
下节内容:
1)搭建BLOG(www.wordpress.org),BBS(discuz www.discuz.net )
2)LNMP数据库分离
3)NFS存储分离。
4)反向代理初步。
浙公网安备 33010602011771号