• 安装依赖和yasm
[root@ECS ~]# yum install autoconf automake bzip2 bzip2-devel cmake freetype-devel gcc gcc-c++ git libtool make pkgconfig zlib-devel openssl-devel
[root@ECS ~]# yum install yasm​
  • 下载并解压源码包
[root@ECS ~]# wget http://ffmpeg.org/releases/ffmpeg-4.4.1.tar.gz
[root@ECS ~]# tar -xvf ffmpeg-4.4.1.tar.gz
  • 编译安装
[root@ECS ~]# cd ffmpeg-4.4.1
[root@ECS ffmpeg-4.4.1]# ./configure --enable-shared --enable-openssl --enable-protocols --enable-protocol=https --prefix=/usr/local/ffmpeg​
[root@ECS ffmpeg-4.4.1]# make && make install
  • 配置动态库路径
[root@ECS ~]# vi /etc/ld.so.conf
# 末尾加入/usr/local/ffmpeg/lib
[root@ECS ~]# ldconfig
  • 配置环境变量
[root@ECS ~] vi /etc/profile
# 文件末尾加入
PATH=$PATH:/usr/local/ffmpeg/bin
export PATH
[root@ECS ~] source /etc/profile
  • 查看FFMPEG版本
[root@ECS ~] ffmpeg -version
ffmpeg version 4.4.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44)
configuration: --enable-shared --enable-openssl --enable-protocols --enable-protocol=https --prefix=/usr/local/ffmpeg
libavutil      56. 70.100 / 56. 70.100
libavcodec     58.134.100 / 58.134.100
libavformat    58. 76.100 / 58. 76.100
libavdevice    58. 13.100 / 58. 13.100
libavfilter     7.110.100 /  7.110.100
libswscale      5.  9.100 /  5.  9.100
libswresample   3.  9.100 /  3.  9.100

阅读全文 »

  • 下载并解压源码包
[root@ECS ~]# wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
[root@ECS ~]# tar -xvf yasm-1.3.0.tar.gz
  • 编译安装
[root@ECS ~]# yum install gcc -y
[root@ECS ~]# cd yasm-1.3.0
[root@ECS yasm-1.3.0]# ./configure --prefix=/usr/local/yasm
[root@ECS yasm-1.3.0]# make && make install
  • 创建软连接
[root@ECS yasm-1.3.0]# ln -s /usr/local/yasm/bin/yasm /usr/bin/yasm
  • 验证
[root@ECS yasm-1.3.0]# yasm --version
yasm 1.3.0
Compiled on Apr 13 2022.
Copyright (c) 2001-2014 Peter Johnson and other Yasm developers.
Run yasm --license for licensing overview and summary.

在云服务器上装nvm发现安装脚本报错,提示Failed to connect to ::: No route to host无法访问raw.githubusercontent.com

[root@ecs-09077087-007 ~]# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to ::: No route to host

ping raw.githubusercontent.com发现被重定向到了127.0.0.1

[root@ecs-09077087-007 ~]# ping raw.githubusercontent.com
PING raw.githubusercontent.com (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.014 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.037 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.037 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.038 ms
64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.020 ms
64 bytes from localhost (127.0.0.1): icmp_seq=6 ttl=64 time=0.026 ms
64 bytes from localhost (127.0.0.1): icmp_seq=7 ttl=64 time=0.025 ms
64 bytes from localhost (127.0.0.1): icmp_seq=8 ttl=64 time=0.026 ms
^C
--- raw.githubusercontent.com ping statistics ---
8 packets transmitted, 8 received, 0% packet loss, time 7009ms
rtt min/avg/max/mdev = 0.014/0.027/0.038/0.010 ms

raw.githubusercontent.com.jpg
可以看到受墙影响国内抽风的还是比较厉害的,根据ipaddress.com查询raw.githubusercontent.com地址

Q:What IP addresses does raw.githubusercontent.com resolve to?
A:raw.githubusercontent.com resolves to 4 IPv4 addresses and 4 IPv6 addresses:
185.199.108.133
185.199.109.133
185.199.110.133
185.199.111.133
2606:50c0:8000::154
2606:50c0:8001::154
2606:50c0:8002::154
2606:50c0:8003::154

在云服务器上选择延迟较低的地址写入hosts文件

[root@ecs-09077087-007 ~]# vi /etc/hosts
185.199.108.133 raw.githubusercontent.com

再ping raw.githubusercontent.com可以看到已经ping通了

[root@ecs-09077087-007 ~]# ping raw.githubusercontent.com
PING raw.githubusercontent.com (185.199.108.133) 56(84) bytes of data.
64 bytes from raw.githubusercontent.com (185.199.108.133): icmp_seq=1 ttl=43 time=83.5 ms
64 bytes from raw.githubusercontent.com (185.199.108.133): icmp_seq=2 ttl=43 time=80.9 ms
64 bytes from raw.githubusercontent.com (185.199.108.133): icmp_seq=3 ttl=43 time=89.1 ms
64 bytes from raw.githubusercontent.com (185.199.108.133): icmp_seq=4 ttl=43 time=78.0 ms
^C
--- raw.githubusercontent.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3010ms
rtt min/avg/max/mdev = 78.028/82.919/89.175/4.115 ms

BTW国内访问github不稳定,推荐个利器dev-sidecar

前言

Google BBR 是一款免费开源的TCP拥塞控制传输控制协议, 可以使Linux服务器显著提高吞吐量和减少TCP连接的延迟。

升级内核

  • 查看内核版本
[root@ecs-09077087-003 ~]# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
[root@ecs-09077087-003 ~]# uname -a
Linux ecs-09077087-003 3.10.0-1160.25.1.el7.x86_64 #1 SMP Wed Apr 28 21:49:45 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • 查看当前已安装所有内核
[root@ecs-09077087-003 ~]# rpm -qa | grep kernel
kernel-headers-3.10.0-1160.59.1.el7.x86_64
kernel-tools-libs-3.10.0-1160.59.1.el7.x86_64
kernel-3.10.0-1160.59.1.el7.x86_64
kernel-3.10.0-1160.25.1.el7.x86_64
kernel-tools-3.10.0-1160.59.1.el7.x86_64
  • 启用elrepo仓库

阅读全文 »

今天在Centos7上按以前的方法通过yum安装MySQL时候碰到一个诡异的问题,报错如下

[root@ecs ~]# yum -y install mysql-community-server
Loaded plugins: fastestmirror, versionlock
Determining fastest mirrors
 * base: mirrors.cn99.com
 * extras: mirrors.163.com
 * updates: mirrors.ustc.edu.cn
base                                                                                                                                                               | 3.6 kB  00:00:00     
extras                                                                                                                                                             | 2.9 kB  00:00:00     
mysql-connectors-community                                                                                                                                         | 2.6 kB  00:00:00     
mysql-tools-community                                                                                                                                              | 2.6 kB  00:00:00     
mysql57-community                                                                                                                                                  | 2.6 kB  00:00:00     
updates                                                                                                                                                            | 2.9 kB  00:00:00     
(1/7): base/7/x86_64/group_gz                                                                                                                                      | 153 kB  00:00:00     
(2/7): extras/7/x86_64/primary_db                                                                                                                                  | 246 kB  00:00:00     
(3/7): mysql-connectors-community/x86_64/primary_db                                                                                                                |  90 kB  00:00:00     
(4/7): base/7/x86_64/primary_db                                                                                                                                    | 6.1 MB  00:00:00     
(5/7): mysql57-community/x86_64/primary_db                                                                                                                         | 298 kB  00:00:00     
(6/7): updates/7/x86_64/primary_db                                                                                                                                 |  14 MB  00:00:01     
(7/7): mysql-tools-community/x86_64/primary_db                                                                                                                     |  94 kB  00:00:05     
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.37-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.37-1.el7 for package: mysql-community-server-5.7.37-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.37-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.37-1.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.37-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.7.37-1.el7 will be installed
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be obsoleted
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64
---> Package mysql-community-libs.x86_64 0:5.7.37-1.el7 will be obsoleting
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:5.7.37-1.el7 will be obsoleting
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================================================================
 Package                                                 Arch                               Version                                   Repository                                     Size
==========================================================================================================================================================================================
Installing:
 mysql-community-libs                                    x86_64                             5.7.37-1.el7                              mysql57-community                             2.4 M
     replacing  mariadb-libs.x86_64 1:5.5.68-1.el7
 mysql-community-libs-compat                             x86_64                             5.7.37-1.el7                              mysql57-community                             1.2 M
     replacing  mariadb-libs.x86_64 1:5.5.68-1.el7
 mysql-community-server                                  x86_64                             5.7.37-1.el7                              mysql57-community                             174 M
Installing for dependencies:
 mysql-community-client                                  x86_64                             5.7.37-1.el7                              mysql57-community                              25 M
 mysql-community-common                                  x86_64                             5.7.37-1.el7                              mysql57-community                             311 k

Transaction Summary
==========================================================================================================================================================================================
Install  3 Packages (+2 Dependent packages)

Total download size: 203 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.37-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY | 760 kB  00:21:11 ETA 
Public key for mysql-community-common-5.7.37-1.el7.x86_64.rpm is not installed
(1/5): mysql-community-common-5.7.37-1.el7.x86_64.rpm                                                                                                              | 311 kB  00:00:02     
(2/5): mysql-community-libs-5.7.37-1.el7.x86_64.rpm                                                                                                                | 2.4 MB  00:00:08     
(3/5): mysql-community-client-5.7.37-1.el7.x86_64.rpm                                                                                                              |  25 MB  00:00:17     
(4/5): mysql-community-libs-compat-5.7.37-1.el7.x86_64.rpm                                                                                                         | 1.2 MB  00:00:06     
(5/5): mysql-community-server-5.7.37-1.el7.x86_64.rpm                                                                                                              | 174 MB  00:01:15     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                     2.2 MB/s | 203 MB  00:01:32     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid     : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
 Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 Package    : mysql57-community-release-el7-11.noarch (@/mysql57-community-release-el7-11.noarch)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql


Public key for mysql-community-libs-compat-5.7.37-1.el7.x86_64.rpm is not installed


 Failing package is: mysql-community-libs-compat-5.7.37-1.el7.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

不论是MySQL5.7还是8.0的版本均出现这个问题,百度找了一圈依旧没有解决办法。最后还是Google解决了我的问题。
解决办法:rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
参考:MySQL GPG keys expired, preventing installation/upgrade of MySQL packages from the official repository.