Ubuntuで最初にやること

## バージョン
```console
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:        20.04
Codename:       focal
```

## alternativesのeditorをvimにする
```console
$ sudo update-alternatives --config editor
There are 4 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /bin/nano            40        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
  3            /usr/bin/vim.basic   30        manual mode
  4            /usr/bin/vim.tiny    15        manual mode

Press <enter> to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in manual mode
```

## sudoをNOPASSWDにする
```console
$ sudo visudo
:
<ユーザー名> ALL=(ALL) NOPASSWD:ALL  # 最後の行に追加 or /etc/sudoers.d/以下にファイルを置く
```

## aptのアップグレード
```console
$ sudo apt update
$ sudo apt upgrade -y
```

## 必要なパッケージのインストール
```console
$ sudo apt install -y \
build-essential \
direnv \
git \
jq \
tmux \
zip \
zsh \
;
```

## SHELLをzshにする
```console
$ sudo chsh -s /usr/bin/zsh <ユーザー名>  # 変更後にターミナルを再起ち上げ
```

## 自分用dotfilesの展開
```console
% mkdir -p GitHub/bocci-farm
% cd !$
% git clone https://github.com/bocci-farm/dotfiles
% cd dotfiles
% ./deploy.sh
```

## tfenv
```console
$ git clone https://github.com/tfutils/tfenv.git ~/.tfenv
$ echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.zshrc
$ exec -l $SHELL
```

## nodenv
nodenv-installerを実行

```console
% curl -fsSL https://raw.githubusercontent.com/nodenv/nodenv-installer/master/bin/nodenv-installer | bash
```

.zshrcにPATHを追加

```zsh:.zshrc
if [ -d "$HOME/.nodenv/bin" ]; then
  export PATH="$HOME/.nodenv/bin:${PATH}"
  eval "$(nodenv init -)"
fi
```

PATHを再読み込み

```console
% exec -l $SHELL
```

確認

```console
% nodenv
nodenv 1.4.0+3.631d0b6
Usage: nodenv <command> [<args>]

Some useful nodenv commands are:
   commands    List all available nodenv commands
   local       Set or show the local application-specific Node version
   global      Set or show the global Node version
   shell       Set or show the shell-specific Node version
   install     Install a Node version using node-build
   uninstall   Uninstall a specific Node version
   rehash      Rehash nodenv shims (run this after installing executables)
   version     Show the current Node version and its origin
   versions    List installed Node versions
   which       Display the full path to an executable
   whence      List all Node versions that contain the given executable

See `nodenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/nodenv/nodenv#readme
```

## yarn
```console
% npm install --global yarn
% exec -l $SHELL
% yarn --version
1.22.10
```

## gcloud
ref. https://cloud.google.com/sdk/docs/quickstart-debian-ubuntu?hl=ja

```console
# Add the Cloud SDK distribution URI as a package source
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list

# Import the Google Cloud public key
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -

# Update the package list and install the Cloud SDK
sudo apt-get update && sudo apt-get install google-cloud-sdk
```

インストールが終わったらgcloudを初期化

```console
gcloud init
```