The most appropriate installation method depends on your operating system and whether you will install more than one version of Ruby. Ruby installation can be done with package management systems, installers, managers, or building from source code. A list of available installation tools/methods can be found on the Ruby website.
The Linux Red Hat CentOs is the operating system on the Bluehost VPS. I decided to use Ruby Version Manager (RVM) to install and manage Ruby. It is compatible with Linux, assists with easy installation, and provides easy management of upgrades to newer version of Ruby in the future.
Hopefully you will see the following response (where "username" is you actual username):
If you do, you are in your user's home directory. If you don't, you can change to that directory using the cd command:
2. Once you confirm you are in your user's home directory, type the following and hit Return:
This will retrieve the public key for the install. You will see something similar to the following as the key is retrieved:
3. Once the public key is retrieved, you will see the command line prompt again. Now type the following and hit Return to install the latest stable version of RVM:
Installation status messages similar to the following will appear in the Terminal window as RVM is installed:
Note: These instructions can be found on the RVM website home page. This is the simple installation. If you want to install using a more secure installation, you can find instructions on the RVM site here. There are also other installation options, such as installing Ruby and/or Rails with RVM, that are outlined on the RVM site here.
4. Once the installation successfully completes, you need to reboot the server before you can use RVM. There are two ways to reboot the server.
The first way is to press the "Send CtrlAltDel" button at the top right part of the system console window:
The second way is to go to the "server management" page in your Bluehost account interface and click the "reboot" button:
5. After the server shuts down and restarts (this will probably take a couple of minutes), you will need to log in again. Close your Terminal window and open a new one. Connect to the VPS via ssh again, and then run the following command to see if RVM is now available to use at the command line:
The system console response should be
If it is, then you successfully installed RVM and made it available to use as a command line function!
When I installed RVM the first time, I installed it as the root user. That is not preferred, as written on the RVM site. It is better to install it as a single user in a user account's home directory as the steps above describe.
Because I initially installed it for multiple users as root, I ran into some problems and needed to uninstall and reinstall from scratch. To do this, I found the best method requires several steps (I found this explanation on this stackoverflow thread):
1. First run the following command (you might have to do this as the root user if you installed it as the root user):
2. After the uninstaller finishes running, there may be a couple of other files to find and delete manually. Check for mentions of rvm in the PATH variable and remove them if they are there. Also, look for rvm in the .bashrc, .profile, and .bash_profile files. Remove any mentions you find in those files. Lastly, look for files in the following locations and delete them if they exist:
/etc/rvmrc
~/.rvmrc
If I remember correctly, after going through these steps I was able to install RVM from scratch in the single user's home directory without any errors.
Previous post: Connecting to the VPS through Terminal and why I prefer this over the System Console
Next post: Installing Ruby
The Linux Red Hat CentOs is the operating system on the Bluehost VPS. I decided to use Ruby Version Manager (RVM) to install and manage Ruby. It is compatible with Linux, assists with easy installation, and provides easy management of upgrades to newer version of Ruby in the future.
Install RVM
1. First go to the Terminal window that is connected via ssh to the VPS (see previous post for help with this). Once you are connected, make sure you are in your user directory by running the following command (Don't type the # symbol - that just represents the end of the command line prompt):# pwd
Hopefully you will see the following response (where "username" is you actual username):
/home/username
If you do, you are in your user's home directory. If you don't, you can change to that directory using the cd command:
# cd /home/username
2. Once you confirm you are in your user's home directory, type the following and hit Return:
# gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3This will retrieve the public key for the install. You will see something similar to the following as the key is retrieved:
gpg: requesting key D39DC0E3 from hkp server keys.gnupg.net
gpg: key D39DC0E3: "Michal Papis (RVM signing) <mpapis@gmail.com>" not changed
gpg: Total number processed: 1
gpg: unchanged: 1
3. Once the public key is retrieved, you will see the command line prompt again. Now type the following and hit Return to install the latest stable version of RVM:
# \curl -sSL https://get.rvm.io | bash -s stable
Installation status messages similar to the following will appear in the Terminal window as RVM is installed:
Downloading https://github.com/rvm/rvm/archive/1.27.0.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.27.0/1.27.0.tar.gz.asc
gpg: Signature made Tue 29 Mar 2016 01:49:47 PM UTC using RSA key ID BF04FF17
gpg: Good signature from "Michal Papis (RVM signing) <mpapis@gmail.com>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 409B 6B17 96C2 7546 2A17 0311 3804 BB82 D39D C0E3
Subkey fingerprint: 62C9 E5F4 DA30 0D94 AC36 166B E206 C29F BF04 FF17
GPG verified '/home/username/.rvm/archives/rvm-1.27.0.tgz'
Installing RVM to /home/username/.rvm/
Adding rvm PATH line to /home/username/.profile /home/username/.mkshrc /home/username/.bashrc /home/username/.zshrc.
Adding rvm loading line to /home/username/.profile /home/username/.bash_profile /home/username/.zlogin.
Installation of RVM in /home/username/.rvm/ is almost complete:
* To start using RVM you need to run `source /home/username/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
# username,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.
In case of problems: https://rvm.io/help and https://twitter.com/rvm_io
* WARNING: You have '~/.profile' file, you might want to load it,
to do that add the following line to '/home/username/.bash_profile':
source ~/.profile
* WARNING: you have GEM_HOME="/usr/local/rvm/gems" this is conflicting with RVM, make sure to:
unset GEM_HOME
Note: These instructions can be found on the RVM website home page. This is the simple installation. If you want to install using a more secure installation, you can find instructions on the RVM site here. There are also other installation options, such as installing Ruby and/or Rails with RVM, that are outlined on the RVM site here.
4. Once the installation successfully completes, you need to reboot the server before you can use RVM. There are two ways to reboot the server.
The first way is to press the "Send CtrlAltDel" button at the top right part of the system console window:
The second way is to go to the "server management" page in your Bluehost account interface and click the "reboot" button:
5. After the server shuts down and restarts (this will probably take a couple of minutes), you will need to log in again. Close your Terminal window and open a new one. Connect to the VPS via ssh again, and then run the following command to see if RVM is now available to use at the command line:
# type rvm | head -n 1
The system console response should be
rvm is a function
If it is, then you successfully installed RVM and made it available to use as a command line function!
Troubleshooting
When I installed RVM the first time, I installed it as the root user. That is not preferred, as written on the RVM site. It is better to install it as a single user in a user account's home directory as the steps above describe.
Because I initially installed it for multiple users as root, I ran into some problems and needed to uninstall and reinstall from scratch. To do this, I found the best method requires several steps (I found this explanation on this stackoverflow thread):
1. First run the following command (you might have to do this as the root user if you installed it as the root user):
gem uninstall rvm
2. After the uninstaller finishes running, there may be a couple of other files to find and delete manually. Check for mentions of rvm in the PATH variable and remove them if they are there. Also, look for rvm in the .bashrc, .profile, and .bash_profile files. Remove any mentions you find in those files. Lastly, look for files in the following locations and delete them if they exist:
/etc/rvmrc
~/.rvmrc
If I remember correctly, after going through these steps I was able to install RVM from scratch in the single user's home directory without any errors.
Previous post: Connecting to the VPS through Terminal and why I prefer this over the System Console
Next post: Installing Ruby


No comments:
Post a Comment