[RUBY] A guide to batch installation of version control tools for major scripting languages

A guide for creating an execution environment for the development script language locally in the account, such as a development VM environment. Of course, there are many articles on each installation method in Qiita, but it is convenient for me personally if there is a procedure to install all at once, so make a note.

For UNIX & for those who use Bash for terminal. For Mac, you can consider introducing it with HomeBrew, but I think you can do the same while cloning from Git.

The script language to be installed is the following language.

Get a repository of version control tools for each language

For Node.js, I used Node Version Manager (nvm). Python used pyenv. Ruby used rbenv. In rbenv, ruby-build plugin is required to execute rbenv install, so install this as well. Perl used PerlBrew. Only PerlBrew uses ~ / perl5 instead of a hidden directory because it's old-fashioned. As for PHP, it is complicated to develop locally (such as setting the path of Apache modules and having to think about various dependencies), so I will omit it.

$ cd
$ git clone https://github.com/creationix/nvm.git ~/.nvm
$ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$ git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
$ curl -L https://install.perlbrew.pl | bash

.bash_profile settings

Edit

From around exporting $ PATH, enter the path and setting command of each version control tool as follows.

~/.bash_profile(Change before)


# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH

↓↓↓

~/.bash_profile(After change)


# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin

# for Node.js(nvm)
export NVM_DIR=$HOME/.nvm
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"

# for Python(pyenv)
export PYENV_ROOT="$HOME/.pyenv"
PATH="$PYENV_ROOT/bin:$PATH"

# for Ruby(rbenv)
PATH="$HOME/.rbenv/bin:$PATH"

# for Perl(PerlBrew)
source ~/perl5/perlbrew/etc/bashrc

eval "$(rbenv init -)"
eval "$(pyenv init -)"

export PATH

Application

Log off and log back in. Check the path.

$ cd
$ pwd
/home/precure  #Below, replace it with your own home and check.
$ echo $PATH
/home/precure/.pyenv/shims:/home/precure/.rbenv/shims:/home/precure/perl5/perlbrew/bin:/home/precure/.rbenv/bin:/home/precure/.pyenv/bin:/home/precure/.nvm/versions/node/v6.10.1/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/precure/bin

Verification

Checking the operation of each version control tool

$ nvm --version; pyenv --version; rbenv --version; perlbrew --version
0.33.1
pyenv 1.0.9-7-gfe1bd31
rbenv 1.1.0
/home/precure/perl5/perlbrew/bin/perlbrew  - App::perlbrew/0.78

Language installation

Install languages in sequence. With each management tool

  1. Confirmation of available (available) version
  2. Installation
  3. Installation confirmation
  4. Setting the version to use

I do.

Node.js

$ nvm ls-remote     # list available versions
...
        v6.10.1   (Latest LTS: Boron)
...

$ nvm install v6.10.1

$ nvm ls            # list installed versions

$ nvm use v6.10.1   # decide to use

$ node --version    # check
v6.10.1

Python

$ pyenv install --list   # list available versions
...
  3.6-dev
  3.6.1
  3.7-dev
...

$ pyenv install 3.6.1

$ pyenv versions        # list installed versions

$ pyenv global 3.6.1    # decide to use

$ python -V
Python 3.6.1

Ruby

$ rbenv install -l     # list available versions
...
  2.3.3
  2.4.0-dev
  2.4.0-preview1
...

$ rbenv install 2.3.3

$ rbenv versions      # list installed versions

$ rbenv global 2.3.3

$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]

Perl

If you go through PerlBrew, it will compile instead of binary, so it will take a long time ...

$ perlbrew available    # list available versions
  perl-5.25.11
  perl-5.24.1
...

$ perlbrew install 5.25.11

$ perlbrew list        # list installed versions
  perl-5.25.11

$ perlbrew switch 5.25.11

$ perl -v

This is perl 5, version 25, subversion 11 (v5.25.11) built for darwin-2level
...

in conclusion

Depending on the language, there may be other (modern?) Management tools or management tools that suit your purpose. It's not too much or too little for me, so it's in this set, but I'd like you to change or modify it as needed.

Recommended Posts

A guide to batch installation of version control tools for major scripting languages
[For beginners] A word summary of popular programming languages (2018 version)
Python Tools for Visual Studio Installation Guide
Create a dataset of images to use for learning
A simple version of government statistics (immigration control) that is easy to handle with jupyter
Installation of OpenMDAO (version 1.7.1)
Installation procedure for Python and Ansible with a specific version
[End of 2020] A memo to start using AWS CLI (Version 2)
Use a scripting language for a comfortable C ++ life-OpenCV-Port Python to C ++-