常见问题收录

问题1

1
2
3
4
root@VirtualBox:/skynet_fly/test# sh ../binshell/make_server.sh ../
: not found/make_server.sh: 3:
: not found/make_server.sh: 5:
../binshell/make_server.sh: 24: Syntax error: end of file unexpected (expecting "then")

文件换行符格式问题
window 是 CRLF
linux 是 LF

make_server.sh改成对应平台格式即可

更换 yum 源

备份/etc/yum.repos.d/CentOS-Base.repo

1
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

然后编辑

1
vi /etc/yum.repos.d/CentOS-Base.repo

复制以下内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

执行更新

1
yum makecache && yum -y update

安装

1
yum install centos-release-scl -y

修改 CentOS-SCLo-scl.repo baseurl

1
vi /etc/yum.repos.d/CentOS-SCLo-scl.repo
1
2
3
4
5
6
7
[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/
# mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-sclo
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

修改 CentOS-SCLo-scl-rh.repo 的 baseurl

1
2
vi /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo

1
2
3
4
5
6
7
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
# mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-rh
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

刷新缓存

1
yum repolist && yum clean all && yum makecache

centos 升级gcc问题

这个错误提示是说你正在尝试安装的 devtoolset-9-binutils-2.32-16.el7.x86_64.rpm 软件包的公钥尚未安装。我们需要导入用于签署这些软件包的公钥。
由于 CentOS 7 的软件包通常是由 CentOS 项目或相关的 SCL (Software Collections) 项目团队签署的,你可能需要导入用于签署这些软件包的额外公钥。
导入 GPG 公钥
执行以下命令导入必要的 GPG 公钥:
sudo rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
sudo rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

如果你还没有导入 Aliyun 提供的密钥,也可以执行以下命令:
sudo rpm –import https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

再次更新 YUM 缓存
在导入公钥之后,我们需要刷新 YUM 的缓存来确保已经安装的公钥被识别:
sudo yum clean all
sudo yum makecache

重新尝试安装软件包
现在重新尝试安装你需要的软件包:
sudo yum install devtoolset-9-gcc-c++

疑难解答步骤

检查并导入所有必要的公钥:
有时,需要导入多个公钥来覆盖所有可能的软件包源。

CentOS 7 Main Key

sudo rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

SCLo SIG Key

sudo rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

Aliyun provided key

sudo rpm –import https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

检查并更新 YUM 配置文件:
确保你的 /etc/yum.repos.d/CentOS-SCLo-scl.repo 和 /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo 文件中的 gpgkey 字段正确指向刚才导入的 GPG 公钥。

调试信息:
如果问题依然存在,启用更多的调试信息以帮助识别问题:
sudo yum install -y devtoolset-9-gcc-c++ –setopt=debuglevel=10

临时禁用 GPG 检查:
虽然不推荐,但如果以上步骤无法解决问题,可以暂时禁用 GPG 检查仅用于调试:
sudo yum install –nogpgcheck devtoolset-9-gcc-c++

希望这些步骤能帮助你解决当前的问题。如果仍然遇到问题,可以考虑参阅 CentOS或阿里云的官方文档 或社区论坛寻求更多的帮助。


常见问题收录
https://huahua132.github.io/2024/08/17/skynet_fly_word/word_1/N_question/
作者
huahua132
发布于
2024年8月17日
许可协议