本文记录了安装VS Code到AWS EC2 Linux 2。
安装VS Code到AWS EC2 Linux 2采取了以下步骤:
更新VS Code的YUM源:
[ec2-user@ip-100-92-28-119 ~]$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
[ec2-user@ip-100-92-28-119 ~]$ sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
[ec2-user@ip-100-92-28-119 ~]$ vim /etc/yum.repos.d/vscode.repo
[ec2-user@ip-100-92-28-119 ~]$ yum check-update
Loaded plugins: priorities, update-motd, upgrade-helper
amzn2-core | 3.6 kB 00:00:00
code | 1.5 kB 00:00:00
code/primary | 86 kB 00:00:00
code 420/420
ecs-service-connect-agent.x86_64 v1.27.2.0-1.amzn2 amzn2extra-ecs
gawk.x86_64 4.0.2-4.amzn2.1.3 amzn2-core
gmp.x86_64 1:6.0.0-15.amzn2.0.3 amzn2-core
kernel.x86_64 4.14.330-250.540.amzn2 amzn2-core
libseccomp.x86_64 2.5.2-1.amzn2 amzn2-core
nspr.x86_64 4.35.0-1.amzn2 amzn2-core
nss.x86_64 3.90.0-2.amzn2.0.1 amzn2-core
nss-softokn.x86_64 3.90.0-6.amzn2 amzn2-core
nss-softokn-freebl.x86_64 3.90.0-6.amzn2 amzn2-core
nss-sysinit.x86_64 3.90.0-2.amzn2.0.1 amzn2-core
nss-tools.x86_64 3.90.0-2.amzn2.0.1 amzn2-core
nss-util.x86_64 3.90.0-1.amzn2 amzn2-core
openssh.x86_64 7.4p1-22.amzn2.0.6 amzn2-core
openssh-clients.x86_64 7.4p1-22.amzn2.0.6 amzn2-core
openssh-server.x86_64 7.4p1-22.amzn2.0.6 amzn2-core
openssl.x86_64 1:1.0.2k-24.amzn2.0.11 amzn2-core
openssl-libs.x86_64 1:1.0.2k-24.amzn2.0.11 amzn2-core
vim-common.x86_64 2:9.0.2120-1.amzn2.0.1 amzn2-core
vim-data.noarch 2:9.0.2120-1.amzn2.0.1 amzn2-core
vim-enhanced.x86_64 2:9.0.2120-1.amzn2.0.1 amzn2-core
vim-filesystem.noarch 2:9.0.2120-1.amzn2.0.1 amzn2-core
vim-minimal.x86_64 2:9.0.2120-1.amzn2.0.1 amzn2-core
xxd.x86_64 2:9.0.2120-1.amzn2.0.1 amzn2-core
安装:
[ec2-user@ip-100-92-28-119 ~]$ sudo yum install code
Loaded plugins: priorities, update-motd, upgrade-helper
amzn2-core | 3.6 kB 00:00:00
code | 1.5 kB 00:00:00
code/primary | 86 kB 00:00:00
code 420/420
Resolving Dependencies
--> Running transaction check
---> Package code.x86_64 0:1.85.1-1702462241.el7 will be installed
--> Processing Dependency: xdg-utils for package: code-1.85.1-1702462241.el7.x86_64
--> Running transaction check
---> Package xdg-utils.noarch 0:1.1.0-0.17.20120809git.amzn2.0.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================================================================================================================================================
Package Arch Version Repository Size
==========================================================================================================================================================================================================================
Installing:
code x86_64 1.85.1-1702462241.el7 code 129 M
Installing for dependencies:
xdg-utils noarch 1.1.0-0.17.20120809git.amzn2.0.1 amzn2-core 70 k
Transaction Summary
==========================================================================================================================================================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 130 M
Installed size: 363 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): xdg-utils-1.1.0-0.17.20120809git.amzn2.0.1.noarch.rpm | 70 kB 00:00:00
(2/2): code-1.85.1-1702462241.el7.x86_64.rpm | 129 MB 00:00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 176 MB/s | 130 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : xdg-utils-1.1.0-0.17.20120809git.amzn2.0.1.noarch 1/2
Installing : code-1.85.1-1702462241.el7.x86_64 2/2
Verifying : xdg-utils-1.1.0-0.17.20120809git.amzn2.0.1.noarch 1/2
Verifying : code-1.85.1-1702462241.el7.x86_64 2/2
Installed:
code.x86_64 0:1.85.1-1702462241.el7
Dependency Installed:
xdg-utils.noarch 0:1.1.0-0.17.20120809git.amzn2.0.1
Complete!
打开VS Code软件:
[ec2-user@ip-100-92-28-119 ~]$ /usr/bin/code
结果如下: