Ubuntu + RVM: Ruby Install – There was an error(23)

After a new install of RVM on Ubuntu, you may run into the error “There was an error(23)” in conjunction with a file write or folder creation permission error. This is caused when, for some reason, RVM does not properly add your Ubuntu user to the RVM group after it was installed. To correct this error, you need to complete the following steps, and executing the following commands:

Execute in terminal:
rvm group add rvm "$USER"

Log out of Ubuntu and log back in. If it still fails, you may need to have RVM fix its system permissions with the command:

Execute in terminal:
rvm fix-permissions

Mint 14: Latest Gedit Version + Ruby Plugins

If you are trying to use new plugins for Gedit, the default text editor on Mint, you might run into a problem as a lot of the new plugins require Gedit >=3.0 and be default Mint comes with 2.30.

To fix this you need to first get rid of Gedit 2.30 completely by running the following commands in your terminal.

sudo apt-get purge gedit
sudo apt-get purge gedit-common

Once those commands have completed successfully you need to run these commands to get the 3.6.1 version.





sudo apt-get install gedit-common/quantal
sudo apt-get install gedit/quantal

Now that we have the correct Gedit version we can install the Ruby and Rails plugins for Gedit. That’s all there is to it!

$ sudo apt-add-repository ppa:ubuntu-on-rails/ppa
$ sudo apt-get update
$ sudo apt-get install gedit-gmate

$ sudo apt-get install gedit-plugins

Mint 14/PostgreSQL: Peer authentication failed for user "someuser"

After you have installed PostgreSQL 9.1 on your Linux Mint 12/13/14, created a user login, a database with that user as the owner and try to connect to that database using that user, you may run into the following error:
Password for user someuser:
psql
: FATAL:  Peer authentication failed for user “someuser”

If this is the case, you need to open up this file /etc/postgresql/9.1/main/pg_hba.conf in a text editor (with root privileges) and change this line:

local   all             all                                     peer

to this:

local   all             all                                     md5

After changing and saving the file, restart the PostgreSQL server:

sudo service postgresql restart
You should not have no issue connecting to your databases using the associated user.

Mint 13: Installing Oracle JDK 7

How to install Oracle JDK 7 instead of the OpenJDK on your Linux Mint 13 (or Ubuntu 12) system. I found that I needed the official JDK in order to properly run JetBrains’ RubyMine IDE as well as a few other applications which do not play well with OpenJDK.
To do this open a terminal and execute the following commands in order:
1
2
3
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
After the installation runs its course, check to make sure that Java is reporting the correct version of JDK 7. Execute the command:
1
java -version
It should return something like this:
1
2
3
java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)
If the version reported back is not the latest as installed by the above command you may need to force the system to update its references to Java and its executables. Run the following command and then check the version again to verify:
1
sudo update-java-alternatives -s java-7-oracle

CentOS: Installing Git

You might notice that many Virtual Private Servers (VPS) are running the CentOS linux distribution. In its standard source repositories it does not have Git which we Ruby developers tend to use as our source code repositories. Due to this when you run the command ‘yum install git’ you get a message back stating it does not exist.

If you have googled for a solution you will run into a ton of really complicated solutions which require in-depth linux package management knowledge. For those of us who really aren’t interested in becoming linux server administrators its way too complicated and takes too  long to figure out. That being said I like to take the easy route and I found this through all my searching and it worked on my CentOS VPS on Hostingrails.

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
yum install git

RVM, Ruby, Rails on Linux Mint

Step 1: First we need to install all the required libraries

$ sudo apt-get install curl git-core build-essential zlib1g-dev libssl-dev libreadline5-dev

Step 2: Install RVM

$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

Step 3: mint 10 does not have a .bashrc file so one needs to be added and then RVM specific lines added

$ sudo touch .bashrc
$ sudo gedit .bashrc
(Add line to .bashrc file)
if [[ -s "$HOME/.rvm/scripts/rvm" ]]  ; then source "$HOME/.rvm/scripts/rvm" ; fi

Step 4: close the current terminal and open a new one in order to load the new commands

Step 5: verify RVM has been installed by running you should get back a description of the application written by the author

$ rvm notes

Step 6: now you can install the ruby version of your choice, I am using 1.9.2 so it is compatible with Rails 3

$ rvm install 1.9.2

Step 7: once installed you will need to set the default ruby version to be used by RVM

$ rvm --default ruby-1.9.2

Step 8: verify that the version you selected is now accessible via the standard ruby command

$ ruby -v

Step 9: then use the gem command to install the rails version of your choice

$ gem install rails

Step 10: install MySQL

$ sudo apt-get install libmysql-ruby libmysqlclient-dev
$ gem install mysql2