Advertisement
rama_astadipati

ROR ubuntu

Oct 23rd, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.56 KB | None | 0 0
  1. Ubuntu Ruby On Rails
  2. ruby 2.3.1 recomended
  3.  
  4. sudo apt-get update
  5.  
  6. sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
  7.  
  8. cd
  9. wget http://ftp.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz
  10. tar -xzvf ruby-2.3.1.tar.gz
  11. cd ruby-2.3.1/
  12. ./configure
  13. make
  14. sudo make install
  15. ruby -v
  16.  
  17. Last step install Bundler
  18.  
  19. gem install bundler
  20.  
  21. ========================sniff instalasi rails=====================================================
  22.  
  23. Since Rails ships with so many dependencies these days, we're going to need to install a Javascript runtime like NodeJS. This lets you use Coffeescript and the Asset Pipeline in Rails which combines and minifies your javascript to provide a faster production environment.
  24.  
  25. To install NodeJS, we're going to add it using the official repository:
  26.  
  27. curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
  28. sudo apt-get install -y nodejs
  29.  
  30. And now, without further adieu:
  31.  
  32. gem install rails -v 4.2.6
  33.  
  34. Now that you've installed Rails, you can run the rails -v command to make sure you have everything installed correctly:
  35.  
  36. rails -v
  37. # Rails 4.2.6
  38.  
  39. If you get a different result for some reason, it means your environment may not be setup properly.
  40.  
  41. ===============sniff seting mysql ===========================================================================
  42.  
  43. Setting Up MySQL
  44.  
  45. Rails ships with sqlite3 as the default database. Chances are you won't want to use it because it's stored as a simple file on disk. You'll probably want something more robust like MySQL or PostgreSQL.
  46.  
  47. There is a lot of documentation on both, so you can just pick one that seems like you'll be more comfortable with. If you're coming from PHP, you may already be familiar with MySQL. If you're new to databases, I'd suggest skipping to setting up PostgreSQL.
  48.  
  49. You can install MySQL server and client from the packages in the Ubuntu repository. As part of the installation process, you'll set the password for the root user. This information will go into your Rails app's database.yml file in the future.
  50.  
  51. sudo apt-get install mysql-server mysql-client libmysqlclient-dev
  52.  
  53. Installing the libmysqlclient-dev gives you the necessary files to compile the mysql2 gem which is what Rails will use to connect to MySQL when you setup your Rails app.
  54.  
  55. ===============sniff FINAL STEP ===================================================================================
  56.  
  57.  
  58. Final Steps
  59.  
  60. And now for the moment of truth. Let's create your first Rails application:
  61.  
  62. #### If you want to use SQLite (not recommended)
  63. rails new myapp
  64.  
  65. #### If you want to use MySQL
  66. rails new myapp -d mysql
  67.  
  68. #### If you want to use Postgres
  69. # Note that this will expect a postgres user with the same username
  70. # as your app, you may need to edit config/database.yml to match the
  71. # user you created earlier
  72. rails new myapp -d postgresql
  73.  
  74. # Move into the application directory
  75. cd myapp
  76.  
  77. # If you setup MySQL or Postgres with a username/password, modify the
  78. # config/database.yml file to contain the username/password that you specified
  79.  
  80. # Create the database
  81. rake db:create
  82.  
  83. rails server
  84.  
  85. You can now visit http://localhost:3000 to view your new website!
  86.  
  87. Now that you've got your machine setup, it's time to start building some Rails applications.
  88.  
  89. If you received an error that said Access denied for user 'root'@'localhost' (using password: NO) then you need to update your config/database.yml file to match the database username and password.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement