CentOS 7/8 安装 onigurumaoniguruma-devel 。解决 configure: error: Package requirements (oniguruma) were not met: Package 'oniguruma', required by 'virtual:world', not found 问题。

CentOS 7 安装

yum -y install http://mirror.centos.org/centos-7/7.7.1908/cloud/x86_64/openstack-queens/oniguruma-6.7.0-1.el7.x86_64.rpm
yum -y install http://mirror.centos.org/centos-7/7.7.1908/cloud/x86_64/openstack-queens/oniguruma-devel-6.7.0-1.el7.x86_64.rpm

备用下载:

oniguruma:http://down.24kplus.com/linux/oniguruma/oniguruma-6.7.0-1.el7.x86_64.rpm
oniguruma-devel:http://down.24kplus.com/linux/oniguruma/oniguruma-devel-6.7.0-1.el7.x86_64.rpm

CentOS 8 安装

yum config-manager --set-enabled PowerTools
yum -y install oniguruma oniguruma-devel

CentOS 7 源码安装 CMake 3.16.2 最新稳定版。解决 cmake: command not found 问题。

1、准备编译环境

yum -y install gcc gcc-c++ openssl openssl-devel tar

2、获取源码,并解压

wget https://github.com/Kitware/CMake/releases/download/v3.16.2/cmake-3.16.2.tar.gz
tar -zxf cmake-3.16.2.tar.gz
cd cmake-3.16.2

备用下载地址:https://down.24kplus.com/linux/cmake/cmake-3.16.2.tar.gz

3、编译安装

./bootstrap --prefix=/usr --datadir=share/cmake --docdir=doc/cmake && make
sudo make install

4、检查是否正确安装

cmake --version

cmake version 3.16.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Linux 通过 traceroute 我们可以知道信息从你的计算机到互联网另一端的主机是走的什么路径。当然每次数据包由某一同样的出发点(source)到达某一同样的目的地(destination)走的路径可能会不一样,但基本上来说大部分时候所走的路由是相同的。 traceroute 通过发送小的数据包到目的设备直到其返回,来测量其需要多长时间。一条路径上的每个设备 traceroute 要测3次。输出结果中包括每次测试的时间(ms)和设备的名称(如有的话)及其IP地址。

在大多数情况下,我们会在linux主机系统下,直接执行命令行:

traceroute hostname

一、命令格式

traceroute [参数] [主机]

二、 命令功能

traceroute指令让你追踪网络数据包的路由途径,预设数据包大小是40Bytes,用户可另行设置。

具体参数格式:traceroute [-dFlnrvx][-f<存活数值>][-g<网关>…][-i<网络界面>][-m<存活数值>][-p<通信端口>][-s<来源地址>][-t<服务类型>][-w<超时秒数>][主机名称或IP地址][数据包大小]

三、 命令参数

-d 使用Socket层级的排错功能。
-f 设置第一个检测数据包的存活数值TTL的大小。
-F 设置勿离断位。
-g 设置来源路由网关,最多可设置8个。
-i 使用指定的网络界面送出数据包。
-I 使用ICMP回应取代UDP资料信息。
-m 设置检测数据包的最大存活数值TTL的大小。
-n 直接使用IP地址而非主机名称。
-p 设置UDP传输协议的通信端口。
-r 忽略普通的Routing Table,直接将数据包送到远端主机上。
-s 设置本地主机送出数据包的IP地址。
-t 设置检测数据包的TOS数值。
-v 详细显示指令的执行过程。
-w 设置等待远端主机回报的时间。
-x 开启或关闭数据包的正确性检验。

例子:

[root@myvps ~]# traceroute 67.229.29.200
traceroute to 67.229.29.200 (67.229.29.200), 30 hops max, 60 byte packets
 1  172.22.62.200 (172.22.62.200)  14.671 ms  14.597 ms  14.567 ms
 2  172.22.61.48 (172.22.61.48)  12.515 ms  12.500 ms  12.473 ms
 3  lax-dc6-1-1.it7.net (66.165.226.121)  13.803 ms  13.803 ms  13.782 ms
 4  10.253.1.1 (10.253.1.1)  0.241 ms  0.239 ms  0.213 ms
 5  10.254.0.101 (10.254.0.101)  0.319 ms  0.449 ms  0.546 ms
 6  vpls.as35908.any2ix.coresite.com (206.72.210.19)  0.300 ms  0.362 ms  0.234 ms
 7  vlan54.br08.lax10.vpls.net (184.164.193.61)  0.867 ms  0.851 ms vlan11.br7.lax10.vpls.net (184.164.193.237)  0.998 ms
 8  vlan4.hr9.lax10.vpls.net (184.164.197.141)  2.336 ms  2.351 ms  8.832 ms
 9  67.229.29.200 (67.229.29.200)  0.879 ms  0.933 ms  0.893 ms

CentOS 7 源码安装 PHP 7.4 正式版教程

1、准备编译环境

yum -y install epel-release yum-utils
yum config-manager --set-enabled PowerTools
yum -y install gcc gcc-c++ make autoconf bzip2 bzip2-devel libpng libpng-devel freetype-devel gmp-devel readline-devel curl-devel libxml2-devel libjpeg-devel bison openssl-devel uw-imap-devel libc-client sqlite-devel libicu-devel libedit-devel libxslt-devel oniguruma oniguruma-devel

以及 libzip

2、下载并解压

wget https://www.php.net/distributions/php-7.4.0.tar.bz2
tar -jxf php-7.4.0.tar.bz2
cd php-7.4.0

3、配置并构建 PHP。在此步骤您可以使用很多选项自定义 PHP,例如启用某些扩展等。 运行 ./configure –help 命令来获得完整的可用选项清单。 在本示例中,我们仅进行包含 PHP-FPM 和 MySQL 支持的简单配置。

./configure --prefix=/usr \
   --sysconfdir=/etc/php \
   --with-config-file-path=/etc/php \
   --with-config-file-scan-dir=/etc/php/php.d \
   --bindir=/usr/bin \
   --docdir=/usr/share/doc \
   --sbindir=/usr/sbin \
   --libdir=/usr/lib64/php \
   --with-libdir=/usr/lib64/php \
   --libexecdir=/usr/libexec \
   --localstatedir=/var \
   --includedir=/usr/include \
   --localedir=/usr/local \
   --datarootdir=/usr/share \
   --datadir=/usr/share/php \
   --mandir=/usr/share/man \
   --infodir=/usr/share/info \
   --enable-fpm \
   --with-fpm-user=www-data \
   --with-fpm-group=www-data \
   --enable-mysqlnd \
   --enable-mysqlnd-compression-support \
   --enable-json \
   --with-openssl-dir \
   --with-zlib-dir \
   --with-freetype \
   --enable-gd-jis-conv \
   --enable-ftp \
   --enable-filter \
   --enable-fileinfo \
   --with-curl \
   --with-iconv \
   --with-bz2 \
   --with-zlib \
   --with-zip \
   --with-xsl \
   --with-jpeg \
   --with-webp \
   --with-xpm \
   --without-iconv \
   --with-kerberos \
   --with-imap-ssl \
   --with-openssl \
   --enable-dom \
   --with-gettext \
   --with-mysqli=mysqlnd \
   --enable-pdo \
   --with-pdo-mysql=mysqlnd \
   --enable-simplexml \
   --enable-session \
   --enable-sysvsem \
   --enable-sysvmsg \
   --enable-sockets \
   --with-pear \
   --with-xmlrpc \
   --with-mhash \
   --enable-bcmath \
   --with-cdb \
   --enable-exif \
   --with-gmp \
   --enable-mbstring \
   --enable-mbregex \
   --with-readline \
   --enable-shmop \
   --enable-soap \
   --enable-sockets \
   --enable-pcntl \
   --enable-intl \
   --enable-re2c-cgoto \
   --with-libedit
make
sudo make install

4、创建配置文件,并将其复制到正确的位置。

cp php.ini-production /etc/php/php.ini
cp sapi/fpm/php-fpm.conf /etc/php/php-fpm.conf
cp sapi/fpm/www.conf /etc/php/php-fpm.d/www.conf
cp sapi/fpm/php-fpm.service /etc/systemd/system/php-fpm.service

5、需要着重提醒的是,如果文件不存在,则阻止 Nginx 将请求发送到后端的 PHP-FPM 模块, 以避免遭受恶意脚本注入的攻击。
将 php.ini 文件中的配置项 cgi.fix_pathinfo 设置为 0 。
打开 php.ini:

vi /etc/php/php.ini

定位到 cgi.fix_pathinfo= 并将其修改为如下所示:

cgi.fix_pathinfo=0

6、配置 php-fpm 服务

sudo systemctl start php-fpm

检查是否启动成功

sudo systemctl status php-fpm

如果出现错误:ERROR: [pool www] cannot get uid for user 'www-data'
则新建www-data 用户组:

groupadd www-data
useradd -g www-data -s /sbin/nologin -M www-data

设置服务自启动

sudo systemctl enable php-fpm

本文档未涵盖对 php-fpm 进行进一步配置的信息,如果您需要更多信息,请查阅相关文档。

CentOS 源码安装 icu4c 65.1 最新版。解决报错问题:

checking for icu-uc >= 50.1 icu-io icu-i18n... no
configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:

Package 'icu-uc', required by 'virtual:world', not found
Package 'icu-io', required by 'virtual:world', not found
Package 'icu-i18n', required by 'virtual:world', not found

1、下载并解压

wget https://github.com/unicode-org/icu/releases/download/release-65-1/icu4c-65_1-src.tgz
tar -xf icu4c-65_1-src.tgz
cd icu/source

2、编译安装

./configure --prefix=/usr
make
make install

CentOS 源码安装 sqlite3 3.30.1 最新版。

1、下载并解压

wget https://www.sqlite.org/2019/sqlite-autoconf-3300100.tar.gz
tar -xf sqlite-autoconf-3300100.tar.gz
cd sqlite-autoconf-3300100

备用下载地址: https://down.24kplus.com/linux/sqlite/sqlite-autoconf-3300100.tar.gz

2、编译安装

./configure --prefix=/usr
make
sudo make install

3、查看已安装版本(可选)

sqlite3 --version

3.30.1 2019-10-10 20:19:45 18db032d058f1436ce3dea84081f4ee5a0f2259ad97301d43c426bc7f3df1b0b

PHP 7.4.0 发布了,此版本标志着 PHP 7 系列的第四次特性更新。

PHP 7.4.0 进行了许多改进,并带来了一些新特性,包括:

Typed Properties  类型属性

类属性现在支持类型声明,以下示例将强制 $User-> id 只能分配 int 值,而 $User-> name 只能分配 string 值。

<?php
class User {
    public int $id;
    public string $name;
}
?>

Arrow Functions  箭头函数

箭头函数提供了用于定义具有隐式按值作用域绑定的函数的简写语法。

<?php
$factor = 10;
$nums = array_map(fn($n) => $n * $factor, [1, 2, 3, 4]);
// $nums = array(10, 20, 30, 40);
?>

将闭包传递给 array_map 或 array_filter 等函数时,它可以发挥极大的作用。

// A collection of Post objects $posts = [/* … */];

$ids = array_map(fn($post) => $post->id, $posts);

Limited Return Type Covariance and Argument Type Contravariance  有限返回类型协变与参数类型逆变

仅当使用自动加载时,才提供完全协变/逆变支持。在单个文件中,只能使用非循环类型引用,因为所有类在被引用之前都必须可用。

<?php
class A {}
class B extends A {}

class Producer {
    public function method(): A {}
}
class ChildProducer extends Producer {
    public function method(): B {}
}
?>

Unpacking Inside Arrays  打包内部数组

<?php
$parts = ['apple', 'pear'];
$fruits = ['banana', 'orange', ...$parts, 'watermelon'];
// ['banana', 'orange', 'apple', 'pear', 'watermelon'];
?>

Numeric Literal Separator  数值文字分隔符

数字文字可以在数字之间包含下划线。

<?php
6.674_083e-11; // float
299_792_458;   // decimal
0xCAFE_F00D;   // hexadecimal
0b0101_1111;   // binary
?>

Weak References  弱引用

弱引用使程序员可以保留对对象的引用,不会阻止对象被销毁。

Allow Exceptions from __toString()  允许从 __toString() 抛出异常

现在允许从 __toString() 引发异常,以往这会导致致命错误,字符串转换中现有的可恢复致命错误已转换为 Error 异常。

Opcache Preloading  Opcache 预加载

新增 Opcache 预加载支持。

此外还有一些弃用,以及从核心中删除一些扩展,详情查看: