Install Ruby On Rails in Ubuntu 9.10 Karmic Koala: The Quick and Easy way
I've installed Ruby on Rails in Ubuntu multiple times, and below is the quickest and easiest way I know to get it up and running.
Installing Ruby and Rails
Run the following commands in terminal:
$ sudo apt-get install ruby-full build-essential $ sudo apt-get install rubygems $ sudo apt-get install railsThis should install Ruby and Rails in Ubuntu. We still need to setup the database, for which I will use MySQL. You can also choose to install the sqlite3 database.
Installing MySQL database
$ sudo apt-get install mysql-server mysql-client $ sudo apt-get install libmysql-ruby libmysqlclient-dev $ sudo gem install mysqlI usually leave the root password blank in MySQL to keep things simple. Of course, don't leave it blank on production databases.
Create the development database
Log into mysql to create the database:
$ mysql -u root
mysql> create database myrailsapp_development;Create other databases (test, production) if needed.
Test your Rails installation
To test your Rails installation, generate a new Rails project using the command below. This will also generate a folder named 'myrailsapp' which will contain all your project files.
$ rails myrailsappChange the database.yml file under the 'config' folder to match your mysql database settings:
development: adapter: mysql database: myrailsapp_development pool: 5 timeout: 5000 username: root socket: '/var/run/mysqld/mysqld.sock'Rails assumes that the MySQL socket file will be found in /tmp/mysqld.sock. In Ubuntu/Debian, this is not the case. Be sure to change database.yml to reflect the actual location of the socket file:
socket: '/var/run/mysqld/mysqld.sock'Go to the project directory called 'myrailsapp' and start the rails app using:
$ ruby script/serverYou will see the url on which you can access your application in the notifications. Your application should now be live on that url.
0 comments:
Post a Comment