參考:
How to Install Ruby on Rails on Raspberry Pi
Installing the Essentials
Step 1
You should begin by installing the prerequisites, to prepare for the installation of Rails. Type the following command into the Terminal window, once you've connected via SSH.
1 | sudo apt-get install -y git curl zlib1g-dev subversion |
Step 2
If you come across a 404 Error, you'll likely need to update the package index, and this can be done using the following command.
1 | sudo apt-get update |
Step 3
Whilst you're already getting the required packages, you'll need to retrieve the SSL package, SQL database package, and more.
1 2 3 4 | sudo apt-get install -y openssl libreadline6-dev git-core zlib1g libssl-dev sudo apt-get install -y libyaml-dev libsqlite3-dev sqlite3 sudo apt-get install -y libxml2-dev libxslt-dev sudo apt-get install -y autoconf automake libtool bison |
Step 4
Open up the RVM, straight from its repository on GitHub.
1 | curl -L get.rvm.io | bash -s stable --rails |
Step 5
Once you've successfully installed the required packages, and have opened up the RVM, it's recommended that you run a script, just so that you can enable Ruby.
1 | source ~/.rvm/scripts/rvm |
Testing the Installations
Step 1
You should now have successfully installed Ruby, and Rails. You can test for Ruby by typing the following command.
1 | ruby -v |
If installed correctly, you'll see a message confirming which version of Ruby is installed, when it was produced, and what it's using in order to work correctly.
Step 2
You can also test for Rails by typing in the following command.
1 | rails -v |
快速架站參考
:
gem install serve
~$ cd my-project
~/my-project$ serve
經典參考學習 :Rails 101