How to Install Ruby on Rails 3.2 with Mysql on Debian/Ubuntu 19 This Is the Way I Managed to Install Ruby on Rails 3.2 with Mysql on Debian/Ubuntu

How to Install Ruby on Rails 3.2 with Mysql on Debian/Ubuntu 19 This Is the Way I Managed to Install Ruby on Rails 3.2 with Mysql on Debian/Ubuntu

Cicolink Blog Web technologies, rich internet application… search AUG APR HowHow toto installinstall RubyRuby onon RailsRails 43.2 with with SQLite3 MySQL on on Debian/Ubuntu Debian/Ubuntu 18 This is the way I managed to install Ruby on Rails 4 with SQLite3 on Debian Wheezy / Ubuntu 12.04 19 This is the way I managed to install Ruby on rails 3.2 with MySQL on Debian/Ubuntu. (but it is valid also for previous versions of Ubuntu 11.04, 10.10, 10,04 etc) . I've chosen to install all the packages manually in a way that you can exactly know what you're installing and where, without Other articles you may be interested in: using rbenv or RVM. ROR with SQLite3 for Ubuntu 11 .10 (the easiest way to install and use ror) ROR with SQLite3 for Fedora 15 Pay attention: if you had already installed Ruby on rails with SQLite3 and you just want to add mysql Other articles you may be interested in: database you can skip some steps, but make sure to install the required libraries. ROR with MySQL for Ubuntu 1. INSTALL THE NEEDED LIBRARIES Type the following command in the console: 1. INSTALL SOME LIBRARIES sudo apt-get install zlib1g zlib1g-dev build-essential openssl libssl-dev libmysqlclient18 Open the console and run the following comand as super user (su -): libmysqlclient-dev libyaml-dev apt-get install zlib1g zlib1g-dev build-essential sqlite3 libsqlite3-dev openssl libssl-dev libyaml- 2. DOWNLOAD AND INSTALL RUBY 1.9.3 dev libreadline-dev libxml2-dev libxslt1-dev Send feedback open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com Send feedback 2. DOWNLOAD AND INSTALL RUBY 1.9.3 Download the last version Ruby 2.0.0 in the "Compiling Ruby" section of the web page Unzip the archive Install running: $ ./configure $ make $ sudo make install Check the successful installation running ruby -v: it should answer with "ruby 2.0.0pxxx..." And gem -v should answer "2.0.3" or next... 3. INSTALL RAILS Install Rails running on the console as super user: $ gem install rails (it takes a while, don't worry) Check if everything's ok using the commands "rails -v" (you should get "Rails 4.0.0") or "gem list" 4. CREATE A NEW RAILS PROJECT $ rails new yourappname Hold on after the message run bundle install 5. CREATE THE BLANK DATABASE open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com Put the console in myapp folder (cd yourappname) and run: $ rake db:create in order to create the databases test.sqlite3 and development.sqlite3: (you can see them in db folder). !!! If you receive some error jump to the session : 9. !! COMMON ISSUES THAT MIGHT OCCUR !!! 6. RUN YOUR RAILS APP Put the console in myapp folder and run $ rails server Open the browser http://localhost:3000 and you should see the Ruby on Rails: welcome page;-) open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com I suggest you to continue the ROR learning on the official documentation, in particular on the getting started page. 9. !! COMMON ISSUES THAT MIGHT OCCUR !! Running rails server you could get the following error: /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError) Solution (thanks to: http://stackoverflow.com/questions/17643897/cannot-load-such-file-sqlite3-sqlite3- native-loaderror-on-ruby-on-rails ): find out the location of the file sqlite3-1.3.7.gemspec (locate sqlite3-1.3.7.gemspec), mine is " /usr/local/lib/ruby/gems/2.0.0/specifications/sqlite3-1.3.7.gemspec" modify that line s.require_paths = ["lib"] with s.require_paths = ["lib/sqlite3_native"] Running rake db:create or rake db:migrate you could get the error: uninitialized constant Rake::DSL. The solution is to put in the first line of your Rakefile: require 'rake/dsl_definition' In the browser at localhost:3000 you could get the error: "no such file to load -- openssl". The solution is to go through the installation directory of ruby: ruby-1.9.2-p180/ext/openssl and run: ruby extconf.rb make sudo make install open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com Running rake db:create the first time could generate this error: rake aborted! Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. The error should be fixed adding in the Gemfile (in the root folder of your app) the lines: gem 'execjs' gem 'therubyracer' and run the comand bundle install (as super user) Put again the console in myapp folder and run: $ rake db:create I hope that everything went the right way, check the comments below, feel free to post comments or issues, please provide me a feedback ;-) AND DON'T FORGET TO +1 ! Posted 4 weeks ago by Manuele Dones Labels: Ruby on rails, debian, Sqlite3, Ubuntu APR How to install Ruby on Rails 3.2 with MySQL on Debian/Ubuntu 19 This is the way I managed to install Ruby on rails 3.2 with MySQL on Debian/Ubuntu. open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com Other articles you may be interested in: ROR with SQLite3 for Ubuntu 11 .10 (the easiest way to install and use ror) ROR with SQLite3 for Fedora 15 Pay attention: if you had already installed Ruby on rails with SQLite3 and you just want to add mysql database you can skip some steps, but make sure to install the required libraries. 1. INSTALL THE NEEDED LIBRARIES Type the following command in the console: sudo apt-get install zlib1g zlib1g-dev build-essential openssl libssl-dev libmysqlclient18 libmysqlclient-dev libyaml-dev 2. DOWNLOAD AND INSTALL RUBY 1.9.3 Download the last version Ruby 1.9.3 in the "Compiling Ruby" section of the web page Unzip the archive Install running: $ ./configure $ make take a coffee $ sudo make install Check the successful installation running ruby -v: it should answer with "ruby 1.9.3p..." open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com 3. DOWNLOAD RUBY GEM: THE STANDARD RUBY PACKAGE MANAGER Download ruby gem version 1.8.25 (rubygems-1.8.25.tgz) Unzip the archive somewhere Put the console in the unzipped folder Install running: $ sudo ruby setup.rb Check the successful installation running gem -v: it should reply "1.8.25" 4. INSTALL RAILS Install Rails running on the console: $ sudo gem install rails (it takes a while, don't worry) Check if everything is ok using the commands "rails -v" (you should get "rails 3.2.XX") or "gem list" 5. INSTALL MYSQL Install running on the console: $ sudo apt-get install mysql-client-5.5 mysql-server-5.5 During the installer it asks for a mysql root-user password (type for ex. admin) Try to start and stop the mysql server using the commands: $ sudo service mysql stop $ sudo service mysql start 6. INSTALL MYSQL GEM In order to install the mysql gem you could use: $ sudo gem install mysql2 open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com $ sudo gem install therubyracer 7. CREATE A NEW RAILS PROJECT $ rails new yourappname -d=mysql When you see run bundle install wait some seconds. Put the console in myapp folder It could be useful also to run: $ sudo bundle install because maybe the project requires other gems (in my case it installed a new version of rake gem) 8. DATABASE SETTINGS ON THE NEW RAILS APPLICATION Open the file myapp/config/database.yml and put your mysql root-user password for the test and development database You must leave a blank character after the 'password' keybord. So you should get something like this: adapter: mysql2 encoding: utf8 reconnect: false database: myapp_development pool: 5 username: root password: your-password open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com socket: /var/run/mysqld/mysqld.sock 9. CREATE THE BLANK DATABASE Start the mysql database using: sudo service mysql start Put the console in myapp folder and run: $ rake db:create Check the step 12 if you get an error here. in order to create the databases myapp_test and myapp_development. If creates the db is correctly creates, it replies with anything... It could be useful to check if the db is created or not: do like this: $ mysql -u root -p // open mysql console $ Enter password: type-your-password mysql> show databases; and you should find the myapp_test and myapp_development db. mysql> \q // close mysql console 10. RUN YOUR RAILS APP Put the console in myapp folder and run $ rails server Open the browser http://localhost:3000 and you should see the Ruby on Rails: welcome page;-) open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com I suggest you to continue the ROR learning on the official documentation, in particular on the getting started page. 11. SOME USEFUL MYSQL COMMANDS $ mysql -u root -p // open mysql console mysql> show databases; //show all the databases open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com mysql> use database-name; //select a database mysql> show tables; //show the tables of the selected db mysql> describe table-name; //show the attributes of the selected table If you need to change the mysql root password type this command: $ mysqladmin -u root -p password enter-your-new-password Enter password: enter-your-old-password 12.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    51 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us