日記帳

プログラミングのことをつぶやく日記です。

WSLのUbuntu LTSの初期設定一覧

私は、最近WSLの初期設定を2台分行いました。それときに実行したコマンドを下記に記載します。

zsh

普段使用しているシェルはzshなので、導入します。

sudo apt install zsh
sudo chsh -s /usr/bin/zsh

oh-my-zsh

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

zsh-syntax-highlighting

cd ~/.oh-my-zsh/custom/plugins
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git

rbenv

aptで入れられるrbenvのバージョンが古いためか、新しいrubyバージョンが入れられません。したがってbuildを行います。

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
~/.rbenv/bin/rbenv init
mkdir -p "$(rbenv root)"/plugins
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build

peco

pecoの新しめのバージョンを動かすと、私が利用しているスクリプトが動かなくなってしまいました。そのため古めのpecoを入れています。

# ホームディレクトリ
cd ~/
# tarファイルをダウンロード
sudo wget "https://github.com/peco/peco/releases/download/v0.5.1/peco_linux_386.tar.gz"
# 解凍
sudo tar xzvf peco_linux_386.tar.gz
cd peco_linux_386
# 実行権限変更
sudo chmod +x peco
# PATHの通っている所にpecoを配置
sudo cp peco /usr/local/bin
# バージョン確認
peco --version

starship

curl -sS https://starship.rs/install.sh | sh

anyframe

mkdir ~/.zsh
cd ~/.zsh
git clone https://github.com/mollifier/anyframe

ghq

sudo add-apt-repository -y ppa:longsleep/golang-backports
sudo apt update -y 
sudo apt install -y golang-go
go install github.com/x-motemen/ghq@latest
# ghqはシェルを改めて立ち上げた

dockerがtmuxで動かない

dokcerがtmuxで動きませんでした。したがって、dcokerディレクトリの実行権限を付与してあげる必要があります。

# https://stackoverflow.com/questions/51766179/inside-tmux-docker-commands-wont-work-without-sudo
$ sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
$ sudo chmod g+rwx "/home/$USER/.docker" -R

ネットワークドライブ(Z:)をwslから見えるようにする

ネットワークドライブ(Z:)をwslから見えるようにするため、mountします。

# /mnt/nasというディレクトリはあらかじめ作成しておく。
# またWIndows側でzドライブにnasを割り当てている。
sudo mount -t drvfs 'z:' /mnt/nas/