AWS CDK安装到AWS EC2 Linux 2

文章目录

  • 小结
  • 问题及解决
    • 安装NPM
    • 安装aws-cdk-lib
    • 找不到Python3
  • 测试
  • 参考

小结

AWS CDK安装到AWS EC2 Linux 2,并记录过程。

问题及解决

安装NPM

[ec2-user@ip-100-92-28-119 aws]$ sudo yum install npm
Loaded plugins: priorities, update-motd, upgrade-helper
amzn2-core                                                                                                                                                                                         | 3.6 kB  00:00:00     
amzn2extra-ecs                                                                                                                                                                                     | 2.9 kB  00:00:00     
amzn2extra-epel                                                                                                                                                                                    | 3.0 kB  00:00:00     
amzn2extra-mate-desktop1.x                                                                                                                                                                         | 3.0 kB  00:00:00     
amzn2extra-python3.8                                                                                                                                                                               | 2.9 kB  00:00:00     
epel/x86_64/metalink                                                                                                                                                                               | 4.9 kB  00:00:00     
epel                                                                                                                                                                                               | 4.7 kB  00:00:00     
(1/2): epel/x86_64/updateinfo                                                                                                                                                                      | 1.0 MB  00:00:00     
(2/2): epel/x86_64/primary_db                                                                                                                                                                      | 7.0 MB  00:00:00     
311 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package npm.x86_64 1:8.19.4-1.16.20.2.1.el7 will be installed
--> Processing Dependency: nodejs = 1:16.20.2-1.el7 for package: 1:npm-8.19.4-1.16.20.2.1.el7.x86_64
--> Running transaction check
---> Package nodejs.x86_64 1:16.20.2-1.el7 will be installed
--> Processing Dependency: nodejs-libs(x86-64) = 1:16.20.2-1.el7 for package: 1:nodejs-16.20.2-1.el7.x86_64
--> Processing Dependency: libuv >= 1:1.43.0 for package: 1:nodejs-16.20.2-1.el7.x86_64
--> Processing Dependency: openssl11 >= 1:1.1.1 for package: 1:nodejs-16.20.2-1.el7.x86_64
--> Processing Dependency: libbrotlidec.so.1()(64bit) for package: 1:nodejs-16.20.2-1.el7.x86_64
--> Processing Dependency: libbrotlienc.so.1()(64bit) for package: 1:nodejs-16.20.2-1.el7.x86_64
--> Processing Dependency: libcrypto.so.1.1()(64bit) for package: 1:nodejs-16.20.2-1.el7.x86_64
--> Processing Dependency: libnode.so.93()(64bit) for package: 1:nodejs-16.20.2-1.el7.x86_64
--> Processing Dependency: libssl.so.1.1()(64bit) for package: 1:nodejs-16.20.2-1.el7.x86_64
--> Processing Dependency: libuv.so.1()(64bit) for package: 1:nodejs-16.20.2-1.el7.x86_64
--> Running transaction check
---> Package libbrotli.x86_64 0:1.0.9-10.el7 will be installed
---> Package libuv.x86_64 1:1.39.0-1.amzn2 will be installed
---> Package nodejs.x86_64 1:16.20.2-1.el7 will be installed
--> Processing Dependency: libuv >= 1:1.43.0 for package: 1:nodejs-16.20.2-1.el7.x86_64
---> Package nodejs-libs.x86_64 1:16.20.2-1.el7 will be installed
---> Package openssl11.x86_64 1:1.1.1g-12.amzn2.0.19 will be installed
---> Package openssl11-libs.x86_64 1:1.1.1g-12.amzn2.0.19 will be installed
--> Processing Dependency: openssl11-pkcs11 for package: 1:openssl11-libs-1.1.1g-12.amzn2.0.19.x86_64
--> Running transaction check
---> Package nodejs.x86_64 1:16.20.2-1.el7 will be installed
--> Processing Dependency: libuv >= 1:1.43.0 for package: 1:nodejs-16.20.2-1.el7.x86_64
---> Package openssl11-pkcs11.x86_64 0:0.4.10-6.amzn2.0.1 will be installed
--> Finished Dependency Resolution
Error: Package: 1:nodejs-16.20.2-1.el7.x86_64 (epel)Requires: libuv >= 1:1.43.0Available: 1:libuv-1.23.2-1.amzn2.0.2.i686 (amzn2-core)libuv = 1:1.23.2-1.amzn2.0.2Available: 1:libuv-1.39.0-1.amzn2.i686 (amzn2-core)libuv = 1:1.39.0-1.amzn2You could try using --skip-broken to work around the problemYou could try running: rpm -Va --nofiles --nodigest

以上报·epel·提供的·libuv·版本过低,关闭·epel·的·YUM·源,

[ec2-user@ip-100-92-28-119 deployment_automation_script]$ ls /etc/yum.repos.d/
amzn2-core.repo  amzn2-extras.repo  epel.repo.bak  epel-testing.repo.bak

安装aws-cdk-lib

[ec2-user@ip-100-92-28-119 aws]$ python3.8 -m pip install aws-cdk-lib[ec2-user@ip-100-92-28-119 aws]$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100 15916  100 15916    0     0  48438      0 --:--:-- --:--:-- --:--:-- 48376
=> nvm is already installed in /home/ec2-user/.nvm, trying to update using git
=> => Compressing and cleaning up git repository=> nvm source string already in /home/ec2-user/.bashrc
=> bash_completion source string already in /home/ec2-user/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
[ec2-user@ip-100-92-28-119 aws]$ . ~/.nvm/nvm.sh
[ec2-user@ip-100-92-28-119 aws]$ nvm install --lts
Installing latest LTS version.
Downloading and installing node v20.10.0...
Local cache found: ${NVM_DIR}/.cache/bin/node-v20.10.0-linux-x64/node-v20.10.0-linux-x64.tar.xz
Checksums match! Using existing downloaded archive ${NVM_DIR}/.cache/bin/node-v20.10.0-linux-x64/node-v20.10.0-linux-x64.tar.xz
Now using node v20.10.0
[ec2-user@ip-100-92-28-119 aws]$ npm install -g aws-cdk
node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by node)

以上报没找到GLIBC库,卸载版本20.10.0,安装版本16.0.0:

[ec2-user@ip-100-92-28-119 aws]$ nvm uninstall 20.10.0
Uninstalled node v20.10.0
[ec2-user@ip-100-92-28-119 aws]$ nvm install 16.0.0
v16.0.0 is already installed.
Now using node v16.0.0 (npm v10.2.4)
[ec2-user@ip-100-92-28-119 aws]$ npm install -g aws-cdk
npm WARN cli npm v10.2.4 does not support Node.js v16.0.0. This version of npm supports the following node versions: `^18.17.0 || >=20.5.0`. You can find the latest version at https://nodejs.org/.changed 1 package in 2s
npm notice 
npm notice New patch version of npm available! 10.2.4 -> 10.2.5
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.2.5
npm notice Run npm install -g npm@10.2.5 to update!
npm notice 

找不到Python3

碰到了没有找到Python3的问题,

[ec2-user@ip-100-92-28-119 hello-ecs]$ cdk bootstrap
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!                                                                            !!
!!  Node 16 has reached end-of-life on 2023-09-11 and is not supported.       !!
!!  Please upgrade to a supported node version as soon as possible.           !!
!!                                                                            !!
!!  This software is currently running on node v16.0.0.                       !!
!!  As of the current release of this software, supported node releases are:  !!
!!  - ^20.0.0 (Planned end-of-life: 2026-04-30)                               !!
!!  - ^18.0.0 (Planned end-of-life: 2025-04-30)                               !!
!!                                                                            !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/bin/sh: python3: command not foundSubprocess exited with error 127

由于我使用的是Python3.8,需要创建一个软链接:


[ec2-user@ip-100-92-28-119 bin]$ ls python*
python  python2  python2.7  python2.7-config  python2-config  python3  python3.8  python3.8-config  python3.8-x86_64-config  python-config[ec2-user@ip-100-92-28-119 hello-ecs]$ ll /usr/bin/python*
lrwxrwxrwx 1 root root    7 Nov  1 20:24 /usr/bin/python -> python2
lrwxrwxrwx 1 root root    9 Nov  1 20:24 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 7048 Oct 19 21:17 /usr/bin/python2.7
-rwxr-xr-x 1 root root 1846 Oct 19 21:17 /usr/bin/python2.7-config
lrwxrwxrwx 1 root root   16 Nov  1 20:24 /usr/bin/python2-config -> python2.7-config
lrwxrwxrwx 1 root root    9 Dec 28 04:30 /usr/bin/python3 -> python3.8
-rwxr-xr-x 1 root root 7048 Aug 30 23:21 /usr/bin/python3.8
-rwxr-xr-x 1 root root  171 Aug 30 23:20 /usr/bin/python3.8-config
-rwxr-xr-x 1 root root 3397 Aug 30 23:13 /usr/bin/python3.8-x86_64-config
lrwxrwxrwx 1 root root   14 Nov  1 20:24 /usr/bin/python-config -> python2-config[ec2-user@ip-100-92-28-119 bin]$ sudo ln -s python3.8 /usr/bin/python3

测试

[ec2-user@ip-100-92-28-119 aws]$ mkdir hello-ecs
[ec2-user@ip-100-92-28-119 aws]$ cd hello-ecs/
[ec2-user@ip-100-92-28-119 hello-ecs]$ cdk init --language python
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!                                                                            !!
!!  Node 16 has reached end-of-life on 2023-09-11 and is not supported.       !!
!!  Please upgrade to a supported node version as soon as possible.           !!
!!                                                                            !!
!!  This software is currently running on node v16.0.0.                       !!
!!  As of the current release of this software, supported node releases are:  !!
!!  - ^20.0.0 (Planned end-of-life: 2026-04-30)                               !!
!!  - ^18.0.0 (Planned end-of-life: 2025-04-30)                               !!
!!                                                                            !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Applying project template app for python# Welcome to your CDK Python project!This is a blank project for CDK development with Python.The `cdk.json` file tells the CDK Toolkit how to execute your app.This project is set up like a standard Python project.  The initialization
process also creates a virtualenv within this project, stored under the `.venv`
directory.  To create the virtualenv it assumes that there is a `python3`
(or `python` for Windows) executable in your path with access to the `venv`
package. If for any reason the automatic creation of the virtualenv fails,
you can create the virtualenv manually.To manually create a virtualenv on MacOS and Linux:$ python3 -m venv .venvAfter the init process completes and the virtualenv is created, you can use the following
step to activate your virtualenv.$ source .venv/bin/activateIf you are a Windows platform, you would activate the virtualenv like this:% .venv\Scripts\activate.batOnce the virtualenv is activated, you can install the required dependencies.$ pip install -r requirements.txtAt this point you can now synthesize the CloudFormation template for this code.$ cdk synthTo add additional dependencies, for example other CDK libraries, just add
them to your `setup.py` file and rerun the `pip install -r requirements.txt`
command.## Useful commands* `cdk ls`          list all stacks in the app* `cdk synth`       emits the synthesized CloudFormation template* `cdk deploy`      deploy this stack to your default AWS account/region* `cdk diff`        compare deployed stack with current state* `cdk docs`        open CDK documentationEnjoy!Initializing a new git repository...
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>
Author identity unknown*** Please tell me who you are.Rungit config --global user.email "you@example.com"git config --global user.name "Your Name"to set your account's default identity.
Omit --global to set the identity only in this repository.fatal: unable to auto-detect email address (got 'ec2-user@ip-100-92-28-119.(none)')
Unable to initialize git repository for your project.
Please run 'python3 -m venv .venv'!
Executing Creating virtualenv...
/bin/sh: python3: command not found
Unable to create virtualenv automatically
Please run 'python3 -m venv .venv'!
✅ All done!

参考

aws-cdk-lib 2.116.0
AWS: Getting started with the AWS CDK
stackoverflow: creating an alias for python3
stackoverflow: nodejs-16 dependency issue with libuv
Installing NPM on AWS EC2

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/591120.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

云计算:OpenStack 分布式架构部署(单控制节点与多计算节点)

目录 一、实验 1.环境 2. 计算服务安装(计算节点2) 3. 网络服务安装(计算节点2) 一、实验 1.环境 (1) 主机 表1 主机 主机架构IP备注controller控制节点192.168.204.210已部署compute01计算节点1192.168.204.211 已部署compute02计算节点2192.168.204.212 &#xff08;…

产品经理学习-从0-1搭建策略产品

从0-1搭建策略产品 目录&#xff1a; 回顾策略产品 如何从0-1搭建策略产品 回顾策略产品 之前也了解过从产品实施的角度来看&#xff0c;策略就是针对问题的解决方案&#xff0c;在互联网时代更集中体现在2个维度&#xff1a;业务场景和数据应用 如何从0-1搭建策略产品 我们…

positon emb(位置编码存在PAD)部分

Unk替换细节修改&#xff1a;若shuffle ratio1.0 &#xff08;1&#xff09;编码后的input_id: tensor([[ 101, 1996, 2006, 1996, 7195, 1997, 5409, 1011, 1011, 102], [ 101, 7842, 14194, 1997, 2100, 102, 0, 0, 0, 0], &#xff08;2&#xff09;对应的unk_mask: ten…

牛客周赛 Round 26 解题报告 | 珂学家 | 0-1 BFS + 状态机DP

前言 整体评价 T3是一道0-1 BFS题, 这样时间复杂度可以控制在O(n*m), 也可以用优先队列。 T4这类题型&#xff0c;在牛客Round周赛系列出现好多次了&#xff0c;要么状态机DP&#xff0c;要么容斥&#xff0c;如果n很大&#xff0c;就用矩阵幂优化。 欢迎关注 珂朵莉 牛客周…

MATLAB中xcorr函数用法

目录 语法 说明 示例 两个向量的互相关 向量的自相关 归一化的互相关 xcorr函数的功能是返回互相关关系。 语法 r xcorr(x,y) r xcorr(x) r xcorr(___,maxlag) r xcorr(___,scaleopt) [r,lags] xcorr(___) 说明 r xcorr(x,y) 返回两个离散时间序列的互相关。互相…

V8引擎-隐藏类

1、动态语言和静态语言 静态语言的效率更高 javaScript是一种动态语言&#xff0c;对象的属性在运行时可以被修改。因此&#xff0c;当V8使用一个对象时&#xff0c;比如使用start.x来访问对象start的属性x时&#xff0c;V8并不知道对象中是否存在x属性&#xff0c;也不知道x属…

【C Primer Plus第六版 学习笔记】 第十六章 C预处理器和C库

有基础&#xff0c;进阶用&#xff0c;个人查漏补缺 第十五章的内容之前学过&#xff0c;跳过 预处理之前&#xff0c;编译器必须对该程序进行一些翻译处理 首先把源代码中出现的字符映射到原字符集 其次编译器定位每个反斜杠后面跟着换行符的实例&#xff0c;并删除它们&…

在 Linux 系统中,常用的音频命令alsamixer、amixer、aplay、arecord

在 Linux 系统中&#xff0c;常用的音频命令主要包括以下几个&#xff1a; 1. alsamixer alsamixer 是一个交互式的音频混音控制台程序&#xff0c;它提供了对音量、通道、增益等设置的直观界面。 2. amixer amixer 命令用于管理音频设置&#xff0c;可以显示和调整音量、切换…

各种编程语言的特点及应用领域

1、C语言 特点&#xff1a;C语言是一种高效、快速、可移植、结构化的编程语言&#xff0c;具有广泛的应用领域。C语言不提供诸如面向对象编程&#xff08;OOP&#xff09;等高级语言所支持的抽象层次&#xff0c;但可以方便地访问底层硬件&#xff0c;因此常被用于系统编程和嵌…

一种安防场景下融合注意力机制和时空图卷积神经网络的人体动作识别方法与流程

本发明涉及模式识别与计算机视觉领域&#xff0c;尤其涉及一种安防场景下融合注意力机制和时空图卷积神经网络的人体动作识别方法。 背景技术&#xff1a; 视觉一直是人类获取外界信息的最重要、最直观的途径&#xff0c;据有关统计&#xff0c;人类获取信息的80&#xff05;都…

nginx 多端口部署多站点

目录 1.进行nginx.conf 2.复制粘贴 3.修改端口及站点根目录 4. 网站上传 1.进行nginx.conf 在 nginx 主要配置文件 nginx.conf 中&#xff0c;server 是负责一个网站配置的&#xff0c;我们想要多个端口访问的话&#xff0c;可以复制多个 server 先进入到 nginx.conf 中 …

「微服务」Saga 模式 如何使用微服务实现业务事务-第二部分

在上一篇文章中&#xff0c;我们看到了实现分布式事务的一些挑战&#xff0c;以及如何使用Event / Choreography方法实现Saga的模式。在本文中&#xff0c;我们将讨论如何通过使用另一种类型的Saga实现&#xff08;称为Command或Orchestration&#xff09;来解决一些问题&#…

vue3+echarts可视化——记录我的2023编程之旅

文章目录 ⭐前言⭐2023我在csdn的旅途痕迹&#x1f496;node系列文章&#x1f496;vue3系列文章&#x1f496;python系列文章&#x1f496;react系列文章&#x1f496;js拖拽相关文章&#x1f496;小程序系列文章&#x1f496;uniapp系列文章 ⭐可视化布局&#x1f496; git 数…

【VRTK】【VR开发】【Unity】18-VRTK与Unity UI控制的融合使用

课程配套学习项目源码资源下载 https://download.csdn.net/download/weixin_41697242/88485426?spm=1001.2014.3001.5503 【背景】 VRTK和Unity自身的UI控制包可以配合使用发挥效果。本篇就讨论这方面的实战内容。 之前可以互动的立体UI并不是传统的2D UI对象,在实际使用中…

MockServer简单使用记录

下载源码 下载git源码&#xff1a;git clone https://github.com/mock-server/mockserver.git 通过执行文件编译成jar包 ./mvnw clean package 可能会报错。 启动命令 java -jar ./mockserver-netty-jar-with-dependencies.jar -serverPort 1080 -proxyRemotePort 80 -pro…

(self-supervised learning)Event Camera Data Pre-training

Publisher: ICCV 2023 MOTIVATION OF READING: 自监督学习、稀疏事件 NILM link: https://arxiv.org/pdf/2301.01928.pdf Code: GitHub - Yan98/Event-Camera-Data-Pre-training 1. Overview Contributions are summarized as follows: 1. A self-supervised framework f…

如何下载LANDSAT数据

LANDSAT&#xff08;Land Remote Sensing Satellite&#xff09;是美国国家航空航天局&#xff08;NASA&#xff09;与美国地质调查局&#xff08;USGS&#xff09;合作推出的一系列卫星&#xff0c;旨在提供地球表面的高分辨率遥感数据。LANDSAT卫星系列始于1972年&#xff0c…

24届Java开发岗秋招春招面试题目合集【持续更新ing】

声明&#xff1a; 背景&#xff1a;本人为24届双非硕校招生&#xff0c;已经完整经历了一次秋招&#xff0c;拿到了三个offer。在这里分享一下我部分面试的题目&#xff0c;若有问题&#xff0c;可以评论私信与我沟通。我会在这里持续分享&#xff0c;有需要的可以收藏一波。 文…

win10连上了wifi热点但是无法上网

我的情况是能正常连接wifi热点&#xff08;手机连接这个热点能上网&#xff0c;说明这个wifi热点是正常的&#xff09; 但是没法上网 打开cmd窗口发现能ping通百度&#xff0c;掘金&#xff0c;csdn这些网址。这就更奇怪了&#xff01;于是根据上面的提示&#xff0c;检查了代…

【数据结构和算法】 相等行列对

其他系列文章导航 Java基础合集数据结构与算法合集 设计模式合集 多线程合集 分布式合集 ES合集 文章目录 其他系列文章导航 文章目录 前言 一、题目描述 二、题解 2.1 三层循环 2.2 哈希 二层循环 三、代码 3.1 三层循环 3.2 哈希 二层循环 四、复杂度分析 4.1 …