mint20 终端安装 vscode

本文介绍了APT仓库的概念,包括APT源的文件配置、镜像站的使用,以及如何添加和配置Visual Studio Code的软件仓库。通过修改`/etc/apt/sources.list`文件,用户可以设置不同的Ubuntu发行版的软件源。此外,还详细说明了如何通过添加`vscode.list`文件和安装GPG密钥来安装Visual Studio Code。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

APT 相关

APT Repo

An APT repository is a network server or a local directory containing deb packages and metadata files that are readable by the APT tools.
一个存放 deb package 和 metadata 的地方。

APT sources

/etc/apt/sources.list file

#deb cdrom:[Linux Mint 20 _Ulyana_ - Release amd64 20200624]/ focal contrib main

# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

deb http://repo.tld/ubuntu distro component…

  1. The first entry in the line defines the type of the archive. The archive type can be either deb or deb-src. Deb implies that the repository contains .deb packages while deb-src implies source packages.
  2. The second entry is the repository URL.
  3. The third entry specifies the distribution code name, such as beaver, xenial and so on.
  4. The last entries are the repository components or categories. The default Ubuntu repositories are split into four components - main, restricted, universe and multiverse. Generally, third-party repositories have only one category.

/etc/apt/sources.list.d/ directory

  1. 添加 vscode.list ,必须以 .list 结尾
deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main

vscode 相关

加上Visual Studio代码存储库与密钥,下载并安装存储库和GPG密钥

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg

sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/

sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list

更新 apt 索引安装Visual Studio Code

sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get install code

References

  1. microsoft-apt-repo
  2. microsoft-apt-repo-vscode
  3. https://linuxize.com/post/how-to-add-apt-repository-in-ubuntu/
  4. https://www.cxybb.com/article/weixin_31725659/117012784
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值