Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ubuntu Ruby On Rails
- ruby 2.3.1 recomended
- sudo apt-get update
- 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
- cd
- wget http://ftp.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz
- tar -xzvf ruby-2.3.1.tar.gz
- cd ruby-2.3.1/
- ./configure
- make
- sudo make install
- ruby -v
- Last step install Bundler
- gem install bundler
- ========================sniff instalasi rails=====================================================
- 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.
- To install NodeJS, we're going to add it using the official repository:
- curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
- sudo apt-get install -y nodejs
- And now, without further adieu:
- gem install rails -v 4.2.6
- Now that you've installed Rails, you can run the rails -v command to make sure you have everything installed correctly:
- rails -v
- # Rails 4.2.6
- If you get a different result for some reason, it means your environment may not be setup properly.
- ===============sniff seting mysql ===========================================================================
- Setting Up MySQL
- 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.
- 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.
- 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.
- sudo apt-get install mysql-server mysql-client libmysqlclient-dev
- 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.
- ===============sniff FINAL STEP ===================================================================================
- Final Steps
- And now for the moment of truth. Let's create your first Rails application:
- #### If you want to use SQLite (not recommended)
- rails new myapp
- #### If you want to use MySQL
- rails new myapp -d mysql
- #### If you want to use Postgres
- # Note that this will expect a postgres user with the same username
- # as your app, you may need to edit config/database.yml to match the
- # user you created earlier
- rails new myapp -d postgresql
- # Move into the application directory
- cd myapp
- # If you setup MySQL or Postgres with a username/password, modify the
- # config/database.yml file to contain the username/password that you specified
- # Create the database
- rake db:create
- rails server
- You can now visit http://localhost:3000 to view your new website!
- Now that you've got your machine setup, it's time to start building some Rails applications.
- 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