[RUBY] Install pyenv and rbenv on CentOS system-wide

pyenv uses Python rbenv is used when you want to manage multiple versions of Ruby.

This time, I decided to install both pyenv and rbenv in / usr / local.

It seems that there are many other derivative repositories such as phpenv, plenv and anyenv. For the time being, I installed Python and Ruby this time. Should other things be done in the same way?

It is troublesome to use sudo -i to read and sudo the settings of the file written under /etc/profile.d/.

pyenv

Place it in / usr / local.

sudo git clone git://github.com/yyuu/pyenv.git /usr/local/pyenv
sudo git clone git://github.com/yyuu/pyenv-virtualenv.git /usr/local/pyenv/plugins/pyenv-virtualenv

Write a file that will be read at startup ...

/etc/profile.d/pyenv.sh


export PYENV_ROOT="/usr/local/pyenv"
export PATH="${PYENV_ROOT}/bin:${PATH}"
eval "$(pyenv init -)"

Reboot the shell

exec $SHELL -l

rbenv

This is also the same.

sudo git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
sudo git clone git://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build

Write a file that will be read at startup ...

/etc/profile.d/rbenv.sh


export RBENV_ROOT="/usr/local/rbenv"
export PATH="${RBENV_ROOT}/bin:${PATH}"
eval "$(rbenv init -)"

Reboot the shell

exec $SHELL -l

It is successful if the path newly set by which ruby or which python appears.

How to use

The basic usage is similar for both

#List the installable versions
pyenv install -l
#Install the given version(In this case 3.4.2)
sudo -i pyenv install 3.4.2
#Confirm that the specified version is installed
pyenv versions

#If you want to use it only under a specific folder
cd /home/jibun/python3/
pyenv local 3.4.2
sudo -i pyenv rehash

#When setting to the whole
pyenv global 3.4.2
sudo -i pyenv rehash
#List the installable versions
rbenv install -l
#Install the given version(In this case 2.1.3)
sudo -i rbenv install 2.1.3
#Confirm that the specified version is installed
rbenv versions


#If you want to use it only under a specific folder
cd /home/jibun/ruby2.1/
rbenv local 2.1.3
sudo -i rbenv rehash


#When setting to the whole
rbenv global 2.1.3
sudo -i rbenv rehash

The articles referred to this time are as follows. http://qiita.com/la_luna_azul/items/3f64016feaad1722805c http://qiita.com/youcune/items/a5cc93313641b69b62f8

Recommended Posts

Install pyenv and rbenv on CentOS system-wide
Install pyenv and rbenv on CentOS system-wide
Install Python on CentOS using Pyenv
Install Python on CentOS using pyenv
Install pyenv and Python 3.6.8 on Ubuntu 18.04 LTS
Install pyenv on mac
Install pyenv and pyenv-virtualenv
Install numba on CentOS 7.2
Install Python3.4 on CentOS 6.6
Install mecab-python on CentOS
Install Python 2.7.3 on CentOS 5.4
Install pyenv on OSX
Install awscli on centos7
Install Chainer on CentOS 6.7
[CentOS7] Install anaconda using pyenv
Install ImageMagick-6.2.x series on CentOS7.7
Install Python 3.8 on CentOS 7 (SCL)
How to install Git GUI and Gitk on CentOS
Notes on pyenv and Atom
Install Python 3.7 and Django 3.0 (CentOS)
Install Chrome on CentOS 7 series
Install pyenv on Raspberry Pi and version control Python
Catalina on Mac and pyenv
How to install Python2.7 python3.5 with pyenv (on RHEL5 CentOS5) (2016 Nov)
Install pyenv on MacBook Air and switch python to use
raspberry pi 4 centos7 install on docker
Install Mecab and mecab-python3 on Ubuntu 14.04
Install and run dropbox on Ubuntu 20.04
Install OpenCV and Chainer on Ubuntu
Install CUDA 8.0 and Chainer on Ubuntu 16.04
Build and install OpenCV on Windows
Steps to install VirtualBox on CentOS
Install pyenv on EC2 (Amazon Linux)
Install java (Oracle JDK14) on CentOS7
How to install PyPy on CentOS
How to install TensorFlow on CentOS 7
Install pip on CentOS7. Also iPython.
Install VirtualBox on CentOS 7 on VirtualBox (mac + vagrant)
Install and configure `pyenv` Ansible playbook
Study Note 9_Install Jenkins on CentOS7
Install python2.x on catalina with pyenv
Install easy_install and pip on windows
system-wide pyenv
Enable sar command on CentOS (install sysstat)
Install wsl2 and master linux on windows
A memo with Python2.7 and Python3 on CentOS
Install and launch k3s on Manjaro Linux
Notes on building Python and pyenv on Mac
Install Mecab on Linux (CentOS) with brew
How to install Apache (httpd) on CentOS7
Install Puppet Master and Client on Ubuntu 16.04
How to install Apache (httpd) on CentOS8
Install PostgreSQL from source code on CentOS
Until you install Apache and Tomcat on Linux (CentOS) and deploy Java apps
Install matplotlib and display graph on Jupyter Notebook
[Ansible] Install dnf on Centos7 with Python3 interpreter
Install Python 3.8.6 on macOS Big Sur using pyenv
Install OpenCV 4.0 and Python 3.7 on Windows 10 with Anaconda
CentOS8 --Install --Django
Run OpenVino on macOS and pyenv and pipenv environment
[Failure] Install Stack Overflow Clone Askbot on CentOS 6.4