WSL
skonishi1125.icon
WSL環境作っとくメモ。
code:usernameとpw
skonishi /
pwは他の環境でよく使うやつ
参考
https://learn.microsoft.com/ja-jp/windows/wsl/setup/environment?source=recommendations
explorerで開きたい
$ explorer.exe .
git接続
code:txt
ssh -T git@github.com
ssh-keygen -t rsa
ssh-add ~/.ssh/github
Could not open a connection to your authentication agent.
ssh-agentエラー
https://qiita.com/sshojiro/items/60982f06c1a0ba88c160
code:txt
eval ssh-agent
chmod 600 ~/.ssh/github
ssh-add ~/.ssh/github
githubで.pubの鍵を登録し、ssh -Tで接続できた。
プロジェクトのgit cloneをする
code:txt
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
https://qiita.com/shiro01/items/e886aa1e4beb404f9038
HTTP経由でcloneすると設定が別途必要になる。
usernameとpasswordが尋ねられる
ssh-addしているのなら、ssh経由でcloneすればよい。
code:txt
git@github.com:リポジトリ
docker導入
Docker Desktop WSL 2 バックエンド
https://docs.docker.jp/desktop/windows/wsl.html
事前準備
https://learn.microsoft.com/ja-jp/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package
ubuntuを入れることだと思う 済み。
AWS CLI
https://zenn.dev/bluesdd/articles/5e45b45c2afd11
code:txt
# unzipなければ入れておく
sudo apt install unzip
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
aws --version
direnv
https://abillyz.com/mamezou/studies/198
code:txt
sudo apt install direnv
eval "$(direnv hook bash)"
source ~/.bashrc
作りたい場所で
direnv edit .
hostsの書き換え
https://www.netassist.ne.jp/techblog/13744/
ここが参考になる
書き換えるときはメモ帳を管理者実行してhostsを書き換える。vimだと無理。
よく初期化されるらしいのでこの設定をしておいた。
https://hymd3a.hatenablog.com/entry/2022/06/20/204354
windows環境で作業するときの手順メモ
WSL立ち上げ
ペンギンのやつ
ssh-agent起動
これをしないとgitに繋げない
code:wsl
eval ssh-agent
ssh-add ~/.ssh/github
# 必要ならほかのカギも
こっちで作業することは少ないのでgit fetchで動作確認しておくと良い
docker立ち上げ
コンテナが古いことも多いので、気になるならdocker compose build --no-cacheでビルドからやると良い。
code:txt
skonishi@plusmash:~/go2senkyo$ docker compose build --no-cache
request returned Internal Server Error for API route and version http://%2Fvar%2Frun%2Fdocker.sock/_ping, check if the server supports the requested API version
SQLインポート
DBeaverの操作いろいろ
起動時設定
code:.bashrc
# ssh-agentを起動し、鍵を登録する
if -z "$SSH_AUTH_SOCK" ; then
eval ssh-agent -s
ssh-add ~/.ssh/wsl_github
ssh-add ~/.ssh/sp_senkyo_com.pem
fi
$ source ~/.bashrc
code:.bashrc
# Gitブランチ名を取得
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^^*/d' -e 's/* \(.*\)/ (\1)/'
}
# ターミナルの表示形式(プロンプト)を設定
# \u: ユーザー名, \h: ホスト名, \w: カレントディレクトリ
export PS1="${debian_chroot:+($debian_chroot)}\[\03301;32m\\u@\h\[\03300m\:\[\03301;34m\\w\[\03300m\\[\03301;33m\\$(parse_git_branch)\[\03300m\\$ "
skonishi@plusmash:~/repository (master)$となる
docker compose build --no-cache エラー
code:txt
+ build 0/1
⠙ Image xxx Building 1.2s
Dockerfile:2
--------------------
2 | >>> FROM --platform=linux/amd64 centos:7 AS base
--------------------
failed to solve: error getting credentials - err: exit status 1, out:
https://qiita.com/ksh-fthr/items/08b56c0182e79355cd4f
~/.docker/config.jsonを編集して調整したら通った。