糖尿病康复,内容丰富有趣,生活中的好帮手!
糖尿病康复 > apt apt-get_Windows用户准备好进行apt-get吗?

apt apt-get_Windows用户准备好进行apt-get吗?

时间:2022-12-18 22:11:39

相关推荐

apt apt-get_Windows用户准备好进行apt-get吗?

apt apt-get

它能做什么(What it does)

Chocolatey lets you install Windows applications quickly from the command line via a central catalog of installation scripts. You could install Git, 7Zip or even Microsoft Office (given a key.) The idea is seamless and quiet installations using a well-known key.

Chocolatey可让您通过安装脚本的中央目录从命令行快速安装Windows应用程序。 您可以安装Git,7Zip或什至Microsoft Office(提供密钥)。该想法是使用众所周知的密钥进行无缝,安静的安装。

For example, once installed you can do this from and command line:

例如,安装后,您可以从和命令行执行此操作:

cinst git cinst git cinst 7zip cinst 7zip cinst ruby 宝石Ruby cinst vlccinst vlc

That's basically it.

基本上就是这样。

The catalog has grown so complete, in fact, that I recently wanted to install DosBox so I could play Zork. I took and chance and just "cinst dosbox" and it worked. THAT is a the promise that Chocolatey makes.

实际上,目录已经非常完整,以至于我最近想安装DosBox,以便玩Zork。 我碰碰运气,只是“ cinst dosbox”而已。 这是Chocolatey的承诺。

Chocolatey入门 (Getting Started with Chocolatey)

You can get started by first installing the Chocolatey package manager. Copy paste this line to your command line and run it. (More on the fearfulness of this first step in a moment).

您可以先安装Chocolatey软件包管理器来开始使用。 复制此行并将其粘贴到您的命令行并运行它。 (更多有关此第一步的恐惧)。

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin

Presumably you like to know what command line stuff is going to do to your computer before you do it, so parse this line out. It's going to launch PowerShell to do the hard work. Nearly every Windows machine has PowerShell these days, and it's PowerShell that makes Chocolatey work.

大概您想在执行此操作之前先知道将对计算机执行哪些命令行操作,因此请解析此行。 将启动PowerShell进行艰苦的工作。 如今,几乎每台Windows机器都具有PowerShell,而PowerShell可以使Chocolatey正常工作。

Some folks have custom profiles so the -NoProfile switch suppresses custom profiles to prevent conflicts during installation. It launches a chunk of PowerShell script that it downloads from /install.ps1/ then executes. Note that it's setting execution policy to unrestricted to do this. To be clear, it's executing code downloaded over the web, so there is a non-zero risk there. It then adds Chocolatey to your path (for this one prompt) so you can use it immediately. It'll be added to future instances of prompts automatically.

某些人具有自定义配置文件,因此-NoProfile开关禁止显示自定义配置文件,以防止安装期间发生冲突。 它启动了一部分PowerShell脚本,该脚本从/install.ps1/下载。 请注意,它将执行策略设置为不受限制地执行此操作。 需要明确的是,它正在执行通过网络下载的代码,因此存在非零风险。 然后它将Chocolatey添加到您的路径中(针对此提示),以便您可以立即使用它。 它将自动添加到以后的提示实例中。

Look at /install.ps1 now. It's a very clean and easy to read script. It downloads the Chocolatey installation zip file (which is actually a NuGet package), unzips it and continues the installation by running a scripts in the tools section of the package.

现在查看/install.ps1 。 这是一个非常干净且易于阅读的脚本。 它会下载Chocolatey安装zip文件(实际上是一个NuGet软件包),将其解压缩并通过在该软件包的工具部分中运行脚本来继续安装。

怎么运行的 (How it works )

Chocolatey is a bootstrapper that uses PowerShell scripts and the NuGet packaging format to install apps for you. NuGet is the package management system that Windows Developers use to bring libraries down at theproject level. Chocolatey (get it? Chocolatey Nu-Get?) extends that concept to bring applications down at thesystem level.

Chocolatey是一个引导程序,使用PowerShell脚本和NuGet打包格式为您安装应用程序。 NuGet是Windows开发人员用来在项目级别关闭库的程序包管理系统。 Chocolatey(了解它吗?Chocolatey Nu-Get?)扩展了该概念,使应用程序在系统级别下降。

Today if you want to get 7Zip, you usually google for it, find the site, figure out the latest version or right version for your system, download it, run it, next next next finish and maybe add it to your path. Chocolatey does that for you.

今天,如果您想获得7Zip,通常可以在google上找到它,找到站点,找出适合您系统的最新版本或正确版本,下载并运行,下一步再完成,然后将其添加到您的路径中。 Chocolatey为您做到这一点。

Again, NuGet is libraries installed locally for projects, Chocolatey is applications installed globally for your whole system.

同样,NuGet是为项目本地安装的库,Chocolatey是为整个系统全局安装的应用程序。

Chocolatey uses PowerShell scripts (that you never have to think about) that package developers use to chain installations and build dependency trees. Take the internals of a Git installation script for example:

Chocolatey使用PowerShell脚本(您永远不必考虑),软件包开发人员使用它们来链接安装和构建依赖关系树。 以Git安装脚本的内部为例:

try {

Install-ChocolateyPackage 'git.install' 'exe' '/VERYSILENT' '/files/Git-1.8.1.2-preview0201.exe'

#------- ADDITIONAL SETUP -------#

$is64bit = (Get-WmiObject Win32_Processor).AddressWidth -eq 64

$programFiles = $env:programfiles

if ($is64bit) {$programFiles = ${env:ProgramFiles(x86)}}

$gitPath = Join-Path $programFiles 'Git\cmd'

Install-ChocolateyPath $gitPath 'user'

@"

Making GIT core.autocrlf false

"@ | Write-Host

#make GIT core.autocrlf false

& "$env:comspec" '/c git config --global core.autocrlf false'

Write-ChocolateySuccess 'git.install'

} catch {

Write-ChocolateyFailure 'git.install' $($_.Exception.Message)

throw

}

The most important part for you to take away here is the first line. Note that this Chocolatey script is downloading Gitfrom the mSysGit Site.Chocolatey is not changing installers, making installers or hosting installers. It's automating the boring parts of getting software, but it's still getting that software from the same location as always.

对于您来说,最重要的部分是第一行。 请注意,此Chocolatey脚本正在从mSysGit站点下载GitChocolatey不会更改安装程序,而不会更改安装程序或托管安装程序。 它可以自动完成无聊的软件获取过程,但仍然可以像往常一样从同一位置获取该软件。

高级的东西 (Advanced Stuff)

Once you learn the basics - and they're pretty basic - there's more depth to Chocolatey to explore. Beyond the cinst and cuninst there's other commands to make installing stuff on Windows easier. Remember, they're all in your PATH so you can call these commands anytime.

一旦您学习了基础知识(并且它们是非常基础的),就可以进一步探索Chocolatey。 除了cinst和cuninst之外,还有其他命令可以使在Windows上安装东西更加容易。 请记住,它们都在您的PATH中,因此您可以随时调用这些命令。

Each of these major sources can be called with cinst using the -source parameter like "cinst IISExpress - source WebPI" or using their own aliases for simplicity as shown below.

可以使用-source参数(如“ cinst IISExpress-源WebPI”)使用cinst调用这些主要源中的每一个,或为了简化起见使用它们自己的别名,如下所示。

cwindowsfeatures- If you've ever opened Add/Remove programs then click Install Windows Features in order to setup IIS or Hyper-V then this command is for you. Some examples:

cwindowsfeatures-如果您曾经打开过“添加/删除程序”,则单击“安装Windows功能”以设置IIS或Hyper-V,那么此命令适合您。 一些例子:

cwindowsfeatures IIS-WebServerRole cwindowsfeatures IIS-WebServerRole cwindowsfeatures Microsoft-Hyper-V-All cwindowsfeatures Microsoft-Hyper-V-All

cwindowsfeatures TelnetClient

cwindowsfeatures TelnetClient

Plus, you can always clist -source windowsfeatures for the complete list.另外,您始终可以clist -source Windowsfeatures作为完整列表。

cwindowsfeatures- If you've ever opened Add/Remove programs then click Install Windows Features in order to setup IIS or Hyper-V then this command is for you. Some examples:

cwindowsfeatures-如果您曾经打开过“添加/删除程序”,则单击“安装Windows功能”以设置IIS或Hyper-V,那么此命令适合您。 一些例子:

cwebpi -The Web Platform Installer is a great GUI for downloading any development tools you might need for Web Development on Windows. It's a catalog, an installer, and a chainer. There's also a command-line version of WebPI that Chocolatey integrates with so you can:

cwebpi-Web平台安装程序是一个不错的GUI,可用于下载Windows上进行Web开发可能需要的任何开发工具。 它是一个目录,一个安装程序和一个链接器。 Chocolatey还集成了WebPI的命令行版本,因此您可以:

cwebpi IISExpress cwebpi IISExpress

cwebpi VWDOrVs11AzurePack_2_0

cwebpi VWDOrVs11AzurePack_2_0

And again, clist -source webpi gets you a list of what you can do. 再一次,clist -source webpi会为您提供您可以执行的操作的列表。

cwebpi -The Web Platform Installer is a great GUI for downloading any development tools you might need for Web Development on Windows. It's a catalog, an installer, and a chainer. There's also a command-line version of WebPI that Chocolatey integrates with so you can:

cwebpi-Web平台安装程序是一个不错的GUI,可用于下载Windows上进行Web开发可能需要的任何开发工具。 它是一个目录,一个安装程序和一个链接器。 Chocolatey还集成了WebPI的命令行版本,因此您可以:

There's a more complete list at the Chocolatey Commands Reference including how it integrates with Cygwin, Gems and Python.

Chocolatey命令参考中有更完整的列表,包括如何与Cygwin,Gems和Python集成。

安全问题 (Security Issues)

This is a prickly one. How do you make a system that lets you install anything directly from the Internet quickly, cleanly, and easily without, well, installing something evil directly from the Internet? You'll want the communication with the server to be secure and the packages trusted, but you'll also want to make sure the packages haven't been tampered with since they were uploaded. There's the inevitable threat of a man-in-the-middle attack. You'll want to watch for malicious packages and enable quick takedowns if one sneaks by.

这是一个多刺的人。 您如何制作一个系统,使您可以快速,干净,轻松地直接从Internet安装任何内容,而无需直接从Internet安装有害的东西? 您将希望与服务器的通信是安全的,并且软件包是受信任的,但是您还希望确保自从上载软件包以来,软件包未被篡改。 存在中间人攻击的不可避免的威胁。 您将需要监视恶意软件包,并在有恶意软件包的情况下快速删除。

Security concerns aren't unique to Chocolatey, of course. They are a part of package repositories since their inception. The node npm repository had a security breach in March of , and the folks at andyet explored the issues surrounding it, but also pointed out that personal responsibility has to have a role as well.

当然,安全性问题并不是Chocolatey独有的。 自创建以来,它们就是软件包存储库的一部分。 node npm存储库在3月发生安全漏洞,andyet的人们探索了它周围的问题,但同时指出,个人责任也必须发挥作用。

Linux's apt-get solves much of this with appropriate uses of cryptography and best practices that can (and should) be emulated. Packages in apt repos are signed with SecureApp, there are warnings if you're using a 3rd party repo or installing an unsigned package.

Linux的apt-get通过适当使用加密技术和可以(应该)模拟的最佳实践来解决许多问题。 apt仓库中的软件包已通过SecureApp签名,如果您使用第三方仓库或安装未签名的软件包,则会出现警告。

The Chocolatey team has been very quick to jump on security issues and they are very approachable. They've added SSL where appropriate and are aware of the work to come. If Chocolatey gets big (bandwidth and costs is a question in my mind) perhaps a non-profit organization would step in to help with not only costs, but also security audits and best practices.

Chocolatey团队在解决安全问题方面非常Swift,而且非常容易上手。 他们在适当的地方添加了SSL,并且知道接下来的工作。 如果Chocolatey规模变大(带宽和成本在我看来是个问题),也许非营利组织会介入,不仅提供成本方面的帮助,而且还提供安全审核和最佳实践的帮助。

Here's some points (edited for length by me) from a post from Chocolatey's lead, Rob in a post on their mailing list, also in march of :

以下是Chocolatey领导的文章Rob在他们的邮件列表中的一篇文章中(由我编辑的一些观点),同样在3月:

Security has a big future aspect of chocolatey. At the present I am the curator and I every day I get an email showing me all of the new packages that went in the day before. I look at all packages from new authors and I typically look at the first version of most new packages from authors I have good contacts with.

安全性在巧克力方面有很大的发展前景。 目前,我是策展人,每天我都会收到一封电子邮件,向我显示前一天发布的所有新软件包。 我查看了新作者的所有软件包,并且通常会查看与我有良好联系的作者的大多数新软件包的第一个版本。

I've talked at length with others about having a moderated feed in the aspect of every package, every new version would be approved prior to showing up on the main feed. I am paying attention to how debian does things with multiple feeds and there are thoughts to move in that direction as well.

我已经与其他人详细讨论了在每个程序包方面都有适度的Feed,每个新版本都需要先获得批准,然后才能显示在主Feed上。 我一直在关注debian如何使用多个feed进行操作,并且也有想法朝着这个方向发展。

Security? In the future we are looking at a small group of folks be an approving body for nupkgs. We also talked about showing the hash for the nupkg, and possibly letting folks specify a hash for the installers so chocolatey can verify the things it downloads prior to execution.

安全? 将来,我们希望看到一小部分人成为批准小人的机构。 我们还讨论了显示nupkg的哈希,并可能让人们为安装程序指定哈希,以便Chocolatey可以在执行之前验证它下载的内容。

Could I make a Chocolatey package called "FormatMyHardDrive?" Sure I could, just like I could ask you to open an admin prompt and format c: /q, but you won't, right? ;)

我可以制作一个名为“ FormatMyHardDrive”的Chocolatey包吗? 当然可以,就像我可以问您打开管理提示并格式化c:/ q一样,但是您不会,对吗? ;)

下一步是什么? (What's next?)

Chocolatey is clearly not meant to be used by your "Gender Non-Specific Non-Technical Parent" and it does have some "competition" in the form of the Ninite GUI installation utility. While still not for the average Joe/Jane and having only a limited catalog, Ninite does fill a gap for the super-user to quickly get the common apps and utilities they want.

Chocolatey显然不打算由您的“性别非特定非技术父母”使用,并且它确实具有Ninite GUI安装实用程序形式的“竞争”。 尽管仍然不是普通的Joe / Jane,并且目录有限,但Ninite确实填补了超级用户的空白,使他们可以快速获得所需的通用应用程序和实用程序。

Additionally, is Chocolatey really apt-get? It's not installing libraries system-wide, although there's no reason it couldn't. Other open source projects like CoApp would like to be the Windows app-get although CoApp is more of a "system-wide libraries, C++ support, and Unix-like utilities" and Chocolatey is more of a "developer and poweruser utilities and their dependencies."

此外,巧克力味真的很贴切吗? 它没有在系统范围内安装库,尽管没有理由不能这样做。 尽管CoApp更像是“系统范围的库,C ++支持和类似Unix的实用程序”,而Chocolatey更像是“开发人员和poweruser实用程序及其依赖项”,但其他开源项目(如CoApp)都希望成为Windows应用程序。 。”

Chocolatey does install dependencies and you can see that happen yourself by trying out "cinst gitextensions" which itself has a dependency on git. Chocolatey will walk the graph and install what it needs before finally installing gitextensions.

Chocolatey确实安装了依赖项,您可以通过尝试本身与git有依赖关系的“ cinst gitextensions”来看到这种情况。 Chocolatey将在最终安装gitextensions之前遍历图表并安装所需的内容。

Where Chocolatey, and ultimately Windows itself, falls down is with odd PATHing and install locations. Because Windows doesn't have formal install locations for things and because Chocolatey puts itself first in the PATH, it's possible to get one's self into odd situations where apps that were installed outside of Chocolatey don't line up with apps installed inside. For example, I installed Git with Chocolatey some months ago, then forgot about that version and installed a newer version of Git on my own. However, I kept hitting an old git bug because the Chocolatey version of Git was "first." I believe issues like this have changed with recent builds of Chocolatey, but the point remains: it's hard on Windows today to who installed what low-level utility, when, and where it ended up.

Chocolatey以及最终Windows本身崩溃的地方是奇怪的PATHing和安装位置。 由于Windows没有正式的安装位置,并且因为Chocolatey将自己放在PATH的首位,因此有可能使自己陷入奇怪的情况,即在Chocolatey之外安装的应用程序与内部安装的应用程序不符。 例如,几个月前,我在Chocolatey上安装了Git,然后忘记了该版本,而是自己安装了新版本的Git。 但是,我一直遇到一个旧的git bug,因为Git的Chocolatey版本是“第一个”。 我相信,随着最新版Chocolatey的出现,此类问题已经发生了变化,但要点仍然是:今天的Windows上,很难确定谁安装了什么低级实用程序,何时安装,在哪里安装。

品牌推广 (Branding)

Now, by no means to I want to take away from the hard work done by Rob and the team, but (and I've said this to Rob before) I really have trouble getting past the name Chocolatey. Sure, there are two ways to spell "Chocolaty," which make it hard at least for me to type "Chocolatey" reliably. The -ey is a theoretically a valid variant spelling, but you can tell that that to the red squiggled underline in Word. But it's less the spelling and more the name itself. It lacks the nerdiness of an "npm," the gravitas of an "apt-get," or the poetic terseness of a "gem." I realize that we are living in a world with companies called Hulu, Yahoo, Microsoft (seriously, MICRO SOFT, what is that?) and Google, but it's worth pointing out that a good name can really take a project to the next level. I'm not sure Chocolatey is the right name for this project, but that's 100% my opinion.

现在,我绝对不想摆脱Rob和团队所做的辛苦工作,但是(而且我之前已经对Rob说过这一点)我真的很难摆脱Chocolatey这个名字。 当然,有两种方法可以拼写“ Chocolaty ”,这至少使我很难可靠地键入“ Chocolatey”。 -ey从理论上讲是有效的变体拼写,但是您可以将其告诉Word中的红色扭曲下划线。 但是它的拼写更少,而名称本身更多。 它缺乏“ npm”的书呆子,“ apt-get”的引人入胜之处或“ gem”的诗意简洁。 我意识到我们与Hulu,Yahoo,Microsoft(严重的是MICRO SOFT,那是什么?)和Google共同生活在一个世界中,但值得指出的是,一个好名字确实可以将一个项目提升到一个新的水平。 我不确定Chocolatey是该项目的正确名称,但是我认为这是100%。

I encourage you, technical reader, to check out Chocolatey for yourself! It's a powerful tool, an engaged and growing community and an interesting piece of tech in its own right.

我鼓励您,技术读者,亲自检查Chocolatey ! 它本身就是一个功能强大的工具,一个参与不断发展的社区以及一项有趣的技术。

Is Chocolatey the apt-get Windows users have been waiting for? Sound off in the comments.

巧克力般的Windows用户一直在等待吗? 在评论中听起来不错。

翻译自: /blog/is-the-windows-user-ready-for-aptget

apt apt-get

如果觉得《apt apt-get_Windows用户准备好进行apt-get吗?》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。