As a newbie of Rails, we might need to try this web application on AWS server, especially AWS providing Free tier Server for us. I use t2.micro as a testing server in this scenario.
Step One—Install Ruby
1. sudo yum install ruby (in my server, ruby is already installed, you may check by using this command)
Install necessary packages and libraries
2. sudo yum install gcc g++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel
3. sudo yum install ruby-rdoc ruby-devel
Step Two—Install Ruby Gems
4. sudo yum install rubygems
Step Three—Install Rails
5. sudo gem update
6. sudo gem update –system
7. sudo gem install rails
Step 8 lacking repositories
8. gem install io-console
9. gem install json
10. sudo yum install nodejs npm –enablerepo=epel
Step 9 remember to open port 3000 from AWS security Group
Step 10 Try to create a blog web application
11. cd /home/ec2-user
12. rails new blog
13. cd blog
Step 11 Start the server!
14. rails server
Step 12 Open your browser and take a look
15 http://x.x.x.x:3000
15. cd /home/ec2-user/blog
16. vi Gemfile
17. add “gem ‘io-console’” at the top of the file, so that you can execute “rails generate controller welcome index”
發佈留言