BMS, Movie, Illustrations, Programming

Linuxマシンの環境構築の自分用メモ(Ubuntu 20.04.3 LTS)

Linuxマシンの環境構築の自分用メモ(Ubuntu 20.04.3 LTS)

環境

  • Ubuntu 20.04.3 LTS
    • 日本語Remixではない
  • VMware Workstation 16 Player

日本語入力

# https://novicengineering.com/ubuntu_mozc_install/
sudo apt install ibus-mozc
ibus restart
gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'jp'), ('ibus', 'mozc-jp')]"

日付と時刻の設定

忘れずにタイムゾーンを Japan, Tokyo にしておく
(忘れると後々面倒なため)

Google Chrome

.deb形式でインストール

curl

sudo apt install curl

bash

######## ~/.bashrc########
HISTSIZE=20000
HISTFILESIZE=20000
alias be='bundle exec'
source ~/.bashrc

vim

sudo apt install vim
######## ~/.vimrc ########
filetype plugin indent on
:set tabstop=2
:set shiftwidth=2
:set expandtab

git

sudo apt install git
sudo apt install tig
git config --global user.email "yuinore@hotmail.co.jp"
git config --global user.name "yuinore"
git config --global core.editor "$(which vim)"

ssh

mkdir ~/.ssh
vim ~/.ssh/config
######## ~/.ssh/config ########
Host http://github.com
HostName http://github.com
User git
IdentityFile "/home/YOUR_USERNAME/.ssh/id_rsa"

秘密鍵 ~/.ssh/id_rsa (と公開鍵 ~/.ssh/id_rsa.pub )を用意する。なければ新規作成。

chmod 700 ~/.ssh/id_rsa

rails

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="~/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
rbenv -v

git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
sudo apt install -y build-essential libssl-dev zlib1g-dev
rbenv install --list
rbenv install 3.1.0
rbenv global 3.1.0
ruby -v
gem update
gem install bundler
bundle -v

RMagick

sudo apt install libmagickcore-dev

mysql

sudo apt install -y libmysqlclient-dev
sudo apt install mysql-server
sudo mysql_secure_installation # ←ローカル開発環境では不要らしい?
sudo vim /etc/mysql/my.cnf
######## /etc/mysql/my.cnf ########
[mysqld]
skip-grant-tables
sudo systemctl restart mysql # ←あってるよね?
mysql -u root # 確認

※for ruby 2.6.6

sudo apt install -y libreadline-dev
rbenv install 2.6.6

(この後プロジェクトディレクトリで gem install bundler:2.1.2 もした(なにこれ???))
(別のプロジェクトでは be rails assets:precompile もした(なにこれ????))

node

git clone https://github.com/nodenv/nodenv.git ~/.nodenv
echo 'export PATH="$HOME/.nodenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(nodenv init -)"' >> ~/.bashrc
source ~/.bashrc
nodenv -v
git clone https://github.com/nodenv/node-build.git $(nodenv root)/plugins/node-build
git clone https://github.com/pine/nodenv-yarn-install.git "$(nodenv root)/plugins/nodenv-yarn-install"
nodenv install --list
nodenv install 16.14.0
nodenv global 16.14.0
curl -fsSL https://github.com/nodenv/nodenv-installer/raw/master/bin/nodenv-doctor | bash
nodenv versions
nodenv version
yarn -v
# ※アップデート??
yarn install --check-files (なにこれ?????)
yarn upgrade --latest (なにこれ?????)

java

sudo apt install openjdk-17-jdk
java --version

2022/5/7追記:

pyonpyon

cd ~/projects/
git clone https://github.com/sgymtic/sl.git pyonpyon
cd pyonpyon/
git checkout pyonpyon
make
./pyonpyon # 確認
sudo cp pyonpyon /usr/local/bin
echo 'alias sl="pyonpyon"' >> ~/.bashrc
source ~/.bashrc

Python3 (使わないけど一応)

python3 --version # デフォルトでインストールされているはずなので確認
sudo apt install python3-pip