传统IDC部署网站(六)

26. alias 别名

一条命令的另一个名字,你能够理解为外号。php

[root@localhost /]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 ^C
[root@localhost /]# alias viens0s3='vi /etc/sysconfig/network-scripts/ifcfg-enp0s3'
  • .bashrc 针对当前用户的
[root@localhost ~]# vi .bashrc
插入alias viens0s3='vi /etc/sysconfig/network-scripts/ifcfg-enp0s3'
  • /etc/bashrc 针对所有用户 在文件最后增长别名

27. php编译安装(上)

  • 下载 解压
[root@localhost src]# wget http://cn2.php.net/distributions/php-7.3.0.tar.bz2
[root@localhost src]# tar jxvf php-7.3.0.tar.bz2
[root@localhost src]# tar jxvf php-7.3.0.tar.bz2
tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
[root@localhost src]# yum install bzip2
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.163.com
 * updates: mirrors.aliyun.com
base                                                     | 3.6 kB     00:00
extras                                                   | 3.4 kB     00:00
updates                                                  | 3.4 kB     00:00
extras/7/x86_64/primary_db                                 | 156 kB   00:01
Resolving Dependencies
--> Running transaction check
---> Package bzip2.x86_64 0:1.0.6-13.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package         Arch             Version                  Repository      Size
================================================================================
Installing:
 bzip2           x86_64           1.0.6-13.el7             base            52 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 52 k
Installed size: 82 k
Is this ok [y/d/N]: y
Downloading packages:
bzip2-1.0.6-13.el7.x86_64.rpm                              |  52 kB   00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : bzip2-1.0.6-13.el7.x86_64                                    1/1
  Verifying  : bzip2-1.0.6-13.el7.x86_64                                    1/1

Installed:
  bzip2.x86_64 0:1.0.6-13.el7

Complete!
[root@localhost src]# tar jxvf php-7.3.0.tar.bz2
  • vi 剪切粘贴用法

vi 里面在通常模式下,按DD能够删除行(剪切),5dd(剪切五行),光标挪到要粘贴的位置,按p,操做错误后,想要撤销,能够按u,反撤销能够按ctrl rhtml

  • 编译

编译安装一个软件包的三步骤:python

./configure
make
make install
./configure --preefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl --with-openssl
  • 文件安装路径
--prefix=/usr/local/php-fpm
  • 配置文件安装路径
--with-config-file-path=/usr/local/php-fpm/etc
  • 开启fpm
--enable-fpm
  • 指定用户
--with-fpm-user=php-fpm
  • 指定组
--with-fpm-group=php-fpm
  • 指定MYSQL路径(老版本)
--with-mysql=/usr/local/mysql
  • 指定MYSQL路径(新版本)
--with-mysqli=/usr/local/mysql/bin/mysql_config
  • pdomysql 也是一种mysql的链接方式
--with-pdo-mysql=/usr/local/mysql
  • 指定mysqlsock
--with-mysql-sock=/tmp/mysql.sock
  • PHP的模块
--with-libxml-dir 
--with-gd 
--with-jpeg-dir 
--with-png-dir --with-freetype-dir 
--with-iconv-dir
--with-zlib-dir 
--with-mcrypt 
--enable-soap
--enable-gd-native-ttf 
--enable-ftp 
--enable-mbstring 
--enable-exif 
--with-pear 
--with-curl 
--with-openssl

开始编译

[root@localhost php-7.3.0]# ./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl --with-openssl
configure: WARNING: unrecognized options: --with-mysql, --with-mcrypt, --enable-gd-native-ttf
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for cc... no
checking for gcc... no
configure: error: in `/usr/src/php-7.3.0':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
  • 解决缺乏GCC的错误
[root@localhost php-7.3.0]# yum install -y gcc
  • 解决缺乏某个软件包

查找对应的包后,通常都是安装devel的安装包mysql

configure: error: libxml2 not found. Please check your libxml2 installation.
[root@localhost php-7.3.0]# yum list |grep libxml2
libxml2.x86_64                              2.9.1-6.el7_2.3            @anaconda
libxml2-python.x86_64                       2.9.1-6.el7_2.3            @base
libxml2.i686                                2.9.1-6.el7_2.3            base
libxml2-devel.i686                          2.9.1-6.el7_2.3            base
libxml2-devel.x86_64                        2.9.1-6.el7_2.3            base
libxml2-static.i686                         2.9.1-6.el7_2.3            base
libxml2-static.x86_64                       2.9.1-6.el7_2.3            base
[root@localhost php-7.3.0]# yum install -y libxml2-devel.i686 libxml2-devel.x86_64
  • CURL版本不匹配
checking for cURL 7.15.5 or greater... configure: error: cURL version 7.15.5 or later is required to compile php with cURL support

yum install libcurl-devel.i686 libcurl-devel.x86_64
  • 缺乏jpeglib
configure: error: jpeglib.h not found.

yum -y install libjpeg-devel
  • 缺乏png.sh
configure: error: png.h not found.

yum install -y libpng-devel
  • 找不到freetype-config
configure: error: freetype-config not found.

[root@localhost ~]# yum install -y freetype-devel.i686 freetype-devel.x86_64
  • 错误的mysql library

php 7.3不支持mysql 或者 mariadb 5.6 之后的版本linux

configure: error: wrong mysql library version or lib not found. Check config.log for more information

[root@localhost src]# wget http://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.41-linux-glibc2.12-x86_64.tar.g
tar xzvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.6.39-linux-glibc2.12-x86_64 /usr/local/mysql5.6

改编译参数

./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql5.6 --with-mysqli=/usr/local/mysql5.6/bin/mysql_config --with-pdo-mysql=/usr/local/mysql5.6 --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl --with-openssl
  • 找不到用户
ERROR: [pool www] cannot get uid for user ‘php-fpm’
useradd php-fpm

: 补充:nginx

diff 查看两个文件的差别的,如 diff 1.txt 2.txt 4.28-php编译安装2 4.29-php编译安装3 4.30-编译安装Nginxsql

28. php编译安装(中)

29. php编译安装(下)

30. 编译安装Nginx

官网:http://nginx.org/bash

官方文档:http://nginx.org/en/docs/install.htmldom

  • 下载:
wget http://nginx.org/download/nginx-1.14.2.tar.gz
  • 解压:
tar zxvf nginx-1.14.2.tar.gz
cd nginx-1.14.2
  • 编译:
./configure --prefix=/usr/local/nginx --with-http_ssl_module
make && make install

启动:curl

/usr/local/nginx/sbin/nginx

相关文章
相关标签/搜索