いろいろやってみるにっき

てきとーに生きている奴の日記

https化に伴い、表示できなくなっているリンクについて修復中。
2018年から遡って修正し、2015年分まで修正完了。


【小ネタ】Windows Server 2022にscoopを入れる

wingetをWindows Server 2022にインストールしようとしたが、うまくいかない。

 

shigeo-t.hatenablog.com

参照したこちらのWindows Terminalもやってみた。

dev.classmethod.jp

やはりエラーになる。何かが違うのかもしれない。

 

そこでひとまずwingetは置いといてscoopを使ってみることに。

qiita.com

 

PS C:\Users\Administrator> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
PS C:\Users\Administrator> iwr -useb get.scoop.sh | iex
 Initializing...   
Running the installer as administrator is disabled by default, see https://github.com/ScoopInstaller/Install#for-admin for details.

 

エラーになる。「https://github.com/ScoopInstaller/Install#for-admin for details.」と言っているので見てみる。

github.com

For Admin
Installation under the administrator console has been disabled by default for security considerations. If you know what you are doing and want to install Scoop as administrator. Please download the installer and manually execute it with the -RunAsAdmin parameter in an elevated console. Here is the example:

 

管理者PowerShellではコマンドが違うらしい。「iex "& {$(irm get.scoop.sh)} -RunAsAdmin"」にしてみる。

PS C:\Users\Administrator> iex "& {$(irm get.scoop.sh)} -RunAsAdmin"
Initializing...
Downloading...
Extracting...
詳細: 対象 "作成先: C:\Users\Administrator\scoop\apps\scoop\current\_tmp" に対して操作 "ディレクトリの作成"
を実行しています。
詳細: 対象 "作成先: C:\Users\Administrator\scoop\buckets\main\_tmp" に対して操作 "ディレクトリの作成"
を実行しています。
Creating shim...
Adding ~\scoop\shims to your path.
Scoop was installed successfully!
Type 'scoop help' for instructions.

今度はうまくいった。

 

使ってみる。

PS C:\Users\Administrator> scoop
Usage: scoop <command> [<args>]

Some useful commands are:

alias       Manage scoop aliases
bucket      Manage Scoop buckets
cache       Show or clear the download cache
cat         Show content of specified manifest. If available, `bat` will be used to pretty-print the JSON.
checkup     Check for potential problems
cleanup     Cleanup apps by removing old versions
config      Get or set configuration values
create      Create a custom app manifest
depends     List dependencies for an app
download    Download apps in the cache folder and verify hashes
export      Exports (an importable) list of installed apps
help        Show help for a command
hold        Hold an app to disable updates
home        Opens the app homepage
info        Display information about an app
install     Install apps
list        List installed apps
prefix      Returns the path to the specified app
reset       Reset an app to resolve conflicts
search      Search available apps
shim        Manipulate Scoop shims
status      Show status and check for new app versions
unhold      Unhold an app to enable updates
uninstall   Uninstall an app
update      Update apps, or Scoop itself
virustotal  Look for app's hash on virustotal.com
which       Locate a shim/executable (similar to 'which' on Linux)


Type 'scoop help <command>' to get help for a specific command.

動いた。

 

gitを入れてみる。

PS C:\Users\Administrator> scoop install git
Installing '7zip' (21.07) [64bit]
7z2107-x64.msi (1.8 MB) [=====================================================================================] 100%
Checking hash of 7z2107-x64.msi ... ok.
Extracting 7z2107-x64.msi ... done.
Linking ~\scoop\apps\7zip\current => ~\scoop\apps\7zip\21.07
Creating shim for '7z'.
Creating shortcut for 7-Zip (7zFM.exe)
Persisting Codecs
Persisting Formats
Running post-install script...
'7zip' (21.07) was installed successfully!
Notes
-----
Add 7-Zip as a context menu option by running: "C:\Users\Administrator\scoop\apps\7zip\current\install-context.reg"
Installing 'git' (2.36.1.windows.1) [64bit]
PortableGit-2.36.1-64-bit.7z.exe (43.5 MB) [==================================================================] 100%
Checking hash of PortableGit-2.36.1-64-bit.7z.exe ... ok.
Extracting dl.7z ... done.
Linking ~\scoop\apps\git\current => ~\scoop\apps\git\2.36.1.windows.1
Creating shim for 'git'.
Creating shim for 'gitk'.
Creating shim for 'git-gui'.
Creating shim for 'tig'.
Creating shim for 'git-bash'.
Creating shortcut for Git Bash (git-bash.exe)
Creating shortcut for Git GUI (git-gui.exe)
'git' (2.36.1.windows.1) was installed successfully!
Notes
-----
Set Git Credential Manager Core by running: "git config --global credential.helper manager-core"

問題無さそう。

 

ということで次はWindows Terminalをscoopでインストールしてみる。