5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ubuntu20.04の新規VMへanyenvやnodenvやphpenvをセットアップした時のコマンド履歴

Last updated at Posted at 2020-10-13

備忘のための記録なので解説などは無し。
(※ 2021-06-21:phpenvのセットアップ部分で間抜けな記述をしていたことに気づいたのでちょっと修正した)

###################################
## https://cloud-images.ubuntu.com/minimal/releases/focal/release/
## のような minimal版のUbuntuを使う場合はgitとcurlを先にインストールしておく
###################################
sudo apt update
sudo apt upgrade
sudo apt install git curl


###################################
##  anyenv のセットアップ
###################################
git clone https://github.com/riywo/anyenv ~/.anyenv
echo 'export PATH="~/.anyenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(anyenv init -)"' >> ~/.bashrc
~/.anyenv/bin/anyenv install --init
exec $SHELL -l
~/.anyenv/bin/anyenv init
mkdir -p ~/.anyenv/plugins
git clone https://github.com/znz/anyenv-update.git ~/.anyenv/plugins/anyenv-update
git clone https://github.com/znz/anyenv-git.git ~/.anyenv/plugins/anyenv-git
anyenv update

###################################
##  nodenv, node, yarn のセットアップ
###################################
anyenv install nodenv
echo 'export PATH="$HOME/.nodenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(nodenv init -)"' >> ~/.bashrc
exec $SHELL -l
mkdir -p "$(nodenv root)"/plugins
## 次行を実行した結果、「already exists and is not an empty directory.」とか言われるかも。そしたら node-build は既にセットアップ済みなので実行不要。
## git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build
git clone https://github.com/nodenv/nodenv-update.git "$(nodenv root)"/plugins/nodenv-update
nodenv update
touch $(nodenv root)/default-packages
nodenv install 14.13.1
nodenv rehash
nodenv versions      ### 確認
nodenv global 14.13.1
node -v
npm -v
npm install -g yarn
nodenv rehash
yarn -v

###################################
##  phpenv, php7.4系 のセットアップ
###################################
anyenv install phpenv
exec $SHELL -l
echo 'export PATH="$(phpenv root)/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(phpenv init -)"' >> ~/.bashrc
exec $SHELL -l
phpenv --version
mkdir -p $(phpenv root)/plugins/php-build
git clone git://github.com/php-build/php-build.git $(phpenv root)/plugins/php-build
phpenv install --list
phpenv versions
sudo apt -y install build-essential
sudo apt -y install libxml2-dev libssl-dev libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng-dev libmcrypt-dev libreadline-dev libtidy-dev libxslt-dev autoconf pkg-config libsqlite3-dev libonig-dev libzip-dev
phpenv install -i development 7.4.16
phpenv global 7.4.16
php -v


5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?