4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Chocolateyをプロキシ環境下でインストールする

Last updated at Posted at 2021-02-10

この記事について

公式のインストールシェル実行時に下記のエラーが出た時の対処法。

install.ps1
警告: An existing Chocolatey installation was detected. Installation will not continue.
For security reasons, this script will not overwrite existing installations.

Please use choco upgrade chocolatey to handle upgrades of Chocolatey itself.

推測と対応

  • 公式の案内後にWindows側が変わっている
  • シェルを見ると古いversionが残っている場合は念のため上記の警告を出してインストールを中断している雰囲気(実行時は新品PCだったが。。)
    • →シェルのこの判断を無効化したところ成功

インストール手順

  • 公式から ps1ファイル を取得
  • 新規ファイルmy_install.ps1を作成して、上記をコピペ
    • install.ps1を直接編集すると署名不一致で実行できなくなるため
  • 下記をコメントアウト
my_install.ps1
# if (Test-ChocolateyInstalled) {
#     $message = @(
#         "An existing Chocolatey installation was detected. Installation will not continue."
#         "For security reasons, this script will not overwrite existing installations."
#         ""
#         "Please use `choco upgrade chocolatey` to handle upgrades of Chocolatey itself."
#     ) -join [Environment]::NewLine
#     Write-Warning $message
#     return
# }

  • 環境変数を設定
    • chocolateyIgnoreProxy=false
    • chocolateyProxyLocation=http://x.x.x.x
    • chocolateyProxyUser=ユーザーネーム
    • chocolateyProxyPassword=パス
  • 管理者権限のpowershell起動
    • 権限修正>Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
    • 編集したスクリプトを実行 > my_install.ps1
    • コマンド> chocoでversinoが出れば成功
Chocolatey v0.10.15

参考URL

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?