无法在 AWS EC2 实例 Ubuntu 上安装来自亚马逊存储库的包
Unable to install packages from amazon repo on AWS EC2 instance Ubuntu
我在 AWS 上有一个 EC2 实例,包含平台 Ubuntu。
我无法从命令行工具安装任何东西sudo apt-get install <package>
屏幕上弹出的结果就像
> ubuntu@ip-XX-XX-XX-XX:~$ sudo apt install awscli
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libuv1
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
docutils-common liblcms2-2 libpaper-utils libpaper1 libwebp5 libwebpmux1 python3-botocore python3-colorama python3-dateutil python3-docutils python3-jmespath python3-pil python3-pygments python3-roman
python3-rsa python3-s3transfer
Suggested packages:
liblcms2-utils texlive-latex-recommended texlive-latex-base texlive-lang-french fonts-linuxlibertine | ttf-linux-libertine docutils-doc python-pil-doc python3-pil-dbg ttf-bitstream-vera
The following NEW packages will be installed:
awscli docutils-common liblcms2-2 libpaper-utils libpaper1 libwebp5 libwebpmux1 python3-botocore python3-colorama python3-dateutil python3-docutils python3-jmespath python3-pil python3-pygments
python3-roman python3-rsa python3-s3transfer
0 upgraded, 17 newly installed, 0 to remove and 42 not upgraded.
Need to get 3,260 kB of archives.
After this operation, 28.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
0% [Connecting to us-east-1.ec2.archive.ubuntu.com (54.165.17.230)]
0% [Connecting to us-east-1.ec2.archive.ubuntu.com (54.165.17.230)]
0% [Connecting to us-east-1.ec2.archive.ubuntu.com (54.165.17.230)]
0% [Connecting to us-east-1.ec2.archive.ubuntu.com (54.165.17.230)]
Err:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu xenial/main amd64 liblcms2-2 amd64 2.6-3ubuntu2
Could not connect to us-east-1.ec2.archive.ubuntu.com:80 (54.152.129.43), connection timed out [IP: 54.152.129.43 80]
Err:2 http://us-east-1.ec2.archive.ubuntu.com/ubuntu xenial/universe amd64 python3-dateutil all 2.4.2-1
Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: [IP: 54.152.129.43 80]
..........
Err:14 http://us-east-1.ec2.archive.ubuntu.com/ubuntu xenial/main amd64 libwebp5 amd64 0.4.4-1
Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: [IP: 54.152.129.43 80]
Err:15 http://us-east-1.ec2.archive.ubuntu.com/ubuntu xenial/main amd64 libwebpmux1 amd64 0.4.4-1
Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: [IP: 54.152.129.43 80]
Err:16 http://security.ubuntu.com/ubuntu xenial-security/main amd64 python3-pil amd64 3.1.2-0ubuntu1.1
Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: [IP: 54.152.129.43 80]
Err:17 http://us-east-1.ec2.archive.ubuntu.com/ubuntu xenial/main amd64 python3-pygments all 2.1+dfsg-1
Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: [IP: 54.152.129.43 80]
0% [Connecting to security.ubuntu.com (91.189.88.162)]packet_write_wait: Connection to 54.152.110.91 port 22: Broken pipe
根据我的理解,AWS Ubuntu 包存储库没有响应。但是当在浏览器中访问 repo 的地址时,它就在那里(但里面没有包)。
此外,我能够正确安装节点包 (npm install <module>
)。
在我尝试将负载均衡器添加到实例之前,它运行良好。
所有这些都在为我的服务器添加 ssl 证书的过程中。
任何人都可以解释清楚如何解决这两个问题。
谢谢,提前。
终于找到问题所在了,安全组,我已经禁用了所有Outbound http,只允许https。一旦我在出站中添加了所有这些,它就解决了。
谢谢。
EC2 实例默认允许出站流量,但 Terraform 等其他软件默认禁用此功能。如果您使用 Terraform,解决方案是将其添加到您的安全组:
resource "aws_security_group" "instance" {
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
此外,如果您尚未向您的实例或启动配置添加安全组:
security_groups = [aws_security_group.instance.id]
我在 AWS 上有一个 EC2 实例,包含平台 Ubuntu。
我无法从命令行工具安装任何东西sudo apt-get install <package>
屏幕上弹出的结果就像
> ubuntu@ip-XX-XX-XX-XX:~$ sudo apt install awscli
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libuv1
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
docutils-common liblcms2-2 libpaper-utils libpaper1 libwebp5 libwebpmux1 python3-botocore python3-colorama python3-dateutil python3-docutils python3-jmespath python3-pil python3-pygments python3-roman
python3-rsa python3-s3transfer
Suggested packages:
liblcms2-utils texlive-latex-recommended texlive-latex-base texlive-lang-french fonts-linuxlibertine | ttf-linux-libertine docutils-doc python-pil-doc python3-pil-dbg ttf-bitstream-vera
The following NEW packages will be installed:
awscli docutils-common liblcms2-2 libpaper-utils libpaper1 libwebp5 libwebpmux1 python3-botocore python3-colorama python3-dateutil python3-docutils python3-jmespath python3-pil python3-pygments
python3-roman python3-rsa python3-s3transfer
0 upgraded, 17 newly installed, 0 to remove and 42 not upgraded.
Need to get 3,260 kB of archives.
After this operation, 28.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
0% [Connecting to us-east-1.ec2.archive.ubuntu.com (54.165.17.230)]
0% [Connecting to us-east-1.ec2.archive.ubuntu.com (54.165.17.230)]
0% [Connecting to us-east-1.ec2.archive.ubuntu.com (54.165.17.230)]
0% [Connecting to us-east-1.ec2.archive.ubuntu.com (54.165.17.230)]
Err:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu xenial/main amd64 liblcms2-2 amd64 2.6-3ubuntu2
Could not connect to us-east-1.ec2.archive.ubuntu.com:80 (54.152.129.43), connection timed out [IP: 54.152.129.43 80]
Err:2 http://us-east-1.ec2.archive.ubuntu.com/ubuntu xenial/universe amd64 python3-dateutil all 2.4.2-1
Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: [IP: 54.152.129.43 80]
..........
Err:14 http://us-east-1.ec2.archive.ubuntu.com/ubuntu xenial/main amd64 libwebp5 amd64 0.4.4-1
Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: [IP: 54.152.129.43 80]
Err:15 http://us-east-1.ec2.archive.ubuntu.com/ubuntu xenial/main amd64 libwebpmux1 amd64 0.4.4-1
Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: [IP: 54.152.129.43 80]
Err:16 http://security.ubuntu.com/ubuntu xenial-security/main amd64 python3-pil amd64 3.1.2-0ubuntu1.1
Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: [IP: 54.152.129.43 80]
Err:17 http://us-east-1.ec2.archive.ubuntu.com/ubuntu xenial/main amd64 python3-pygments all 2.1+dfsg-1
Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: [IP: 54.152.129.43 80]
0% [Connecting to security.ubuntu.com (91.189.88.162)]packet_write_wait: Connection to 54.152.110.91 port 22: Broken pipe
根据我的理解,AWS Ubuntu 包存储库没有响应。但是当在浏览器中访问 repo 的地址时,它就在那里(但里面没有包)。
此外,我能够正确安装节点包 (npm install <module>
)。
在我尝试将负载均衡器添加到实例之前,它运行良好。
所有这些都在为我的服务器添加 ssl 证书的过程中。
任何人都可以解释清楚如何解决这两个问题。
谢谢,提前。
终于找到问题所在了,安全组,我已经禁用了所有Outbound http,只允许https。一旦我在出站中添加了所有这些,它就解决了。
谢谢。
EC2 实例默认允许出站流量,但 Terraform 等其他软件默认禁用此功能。如果您使用 Terraform,解决方案是将其添加到您的安全组:
resource "aws_security_group" "instance" {
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
此外,如果您尚未向您的实例或启动配置添加安全组:
security_groups = [aws_security_group.instance.id]