Installing Ruby
sudo apt-get update
sudo apt-get upgrade
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
# sudo apt-get install ruby
#sudo apt-get install ruby-dev
安装rubygems
如果ruby版本大于2.可以直接使用 :
sudo gem update --ststem
如果上面的不行:
https://rubygems.org/pages/download
这个是rubygems下载页面,可以在这个页面获取到最新rubygems的链接
# wget https://rubygems.org/rubygems/rubygems-2.6.8.tgz
tar -xzf rubygems-2.6.8.tgz
cd rubygems-2.6.8
sudo ruby setup.rb
The last step is to install Bundler
gem install bundler
gem install rails
Setting Up MySQL
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
Final Steps
And now for the moment of truth. Let's create your first Rails application:sudo apt-get install -y nodejs
#### 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!