Ubuntuで最初にやること

バージョン

$ 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にする

$ 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にする

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

aptのアップグレード

$ sudo apt update
$ sudo apt upgrade -y

必要なパッケージのインストール

$ sudo apt install -y \
build-essential \
direnv \
git \
jq \
tmux \
zip \
zsh \
;

SHELLをzshにする

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

自分用dotfilesの展開

% mkdir -p GitHub/bocci-farm
% cd !$
% git clone https://github.com/bocci-farm/dotfiles
% cd dotfiles
% ./deploy.sh

tfenv

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

nodenv

执行nodenv-installer

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

.zshrcにPATHを追加

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

PATHを再読み込み

% exec -l $SHELL

確認

% 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

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

谷歌云

参考: https://cloud.google.com/sdk/docs/quickstart-debian-ubuntu?hl=ja

请使用以下链接参考:https://cloud.google.com/sdk/docs/quickstart-debian-ubuntu?hl=ja

# 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。

gcloud init
广告
将在 10 秒后关闭
bannerAds