Now we can install MySQL and Ruby on Rails with subversion and postfix support.
Right, let's get on and install MySQL:
sudo apt-get install mysql-server mysql-client libmysqlclient15-dev libmysql-ruby -y
MySQL installs without a password for the root user (don't confuse this 'root' user with your Slice root user - it is simply the MySQL user that has administration rights to all the databases, not to your system).
Let's add a password straight away:
mysqladmin -u root password YOURMYSQLPASSWORD
If you are not going to use InnoDB with your MySQL databases, then it is a good idea to turn it off right at the start. It uses a lot of memory and, if not going to be used, this is wasted memory.
Open the main MySQL config file:
sudo nano /etc/mysql/my.cnf
Search my.cnf for the heading:
# * InnoDB
Then, to turn off InnoDB, simply uncomment (remove the #) on this line:
Ruby on Rails install
We'll begin by installing ruby from the apt repositories and then installing rubygems via source code:
sudo apt-get install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby -y
We need to create some symlinks from the install to locations every programme would look. Each line below is a separate command:
sudo ln -s /usr/bin/ruby1.8 /usr/local/bin/ruby sudo ln -s /usr/bin/ri1.8 /usr/local/bin/ri sudo ln -s /usr/bin/rdoc1.8 /usr/local/bin/rdoc sudo ln -s /usr/bin/irb1.8 /usr/local/bin/irb
This articles has been updated to use the latest (at the time of writing) version of rubygems which is v1.2.0.
This version of rubygems has finally fixed the memory issues seen on smaller Slices.
You can now install, update and administer all your rubygems from within a 256Slice with no issues.
Let's go ahead and download the source code into our sources directory. If you haven't got a sources directory, you can simply create one:
mkdir ~/sources cd ~/sources ... wget http://rubyforge.org/frs/download.php/38646/rubygems-1.2.0.tgz
Then unpack it and move into the newly created folder:
tar xzvf rubygems-1.2.0.tgz cd rubygems-1.2.0
Now we can go through the simple process of compiling it and creating a symlink:
sudo ruby setup.rb ... sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
Whenever you need to update the installation just enter the following:
sudo gem update sudo gem update --system
Now we can install rails with the command:
sudo gem install rails
The basic Ruby on Rails install is now completed! Let's continue the install with imagemagick and a quick ruby test as follows:
sudo apt-get install imagemagick librmagick-ruby1.8 librmagick-ruby-doc libfreetype6-dev xml-core -y
Now we can do a quick test to see if the install works (thanks to brainspl.at for this idea).
irb #irb(main):001:0> require 'RMagick' #=> true #irb(main):002:0> require 'mysql' #=> true #irb(main):003:0> exit
Obviously, if the output does not return 'true' for each 'require' command, then something has gone wrong. If the result is correct and returns 'true' then we have a working ruby install.
Postfix and subversion
Finally, we need to install postfix (if we don't do this now, other programmes will install exim and all sorts of unneeded email help). Once done we can install subversion so we can 'check-out' plugins and other goodies for our Rails applications:
sudo apt-get install postfix subversion -y
Answer the postfix questions as you see fit but the defaults usually suffice for our purposes as we are only using it to send emails and not for receiving mail.
You now have a MySQL, Ruby on Rails and subversion stack setup and ready to roll.
Now you are ready to install the server of your choice whether that be Litespeed, Nginx or Apache.