CentOS上安装配置Ruby on Rails

后端开发   发布日期:2025年07月10日   浏览次数:112
  1. 0.install sublime editor(optional)
  2. ref:http://www.tecmint.com/install-sublime-text-editor-in-linux/
  3. 1.install git
  4. $sudo yum install git
  5. $git --verison
  6. 2.install rbenv
  7. $ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
  8. $ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
  9. $ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
  10. $ exec $SHELL -l
  11. $ rbenv --version
  12. $ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
  13. $ rbenv install -l //show avaliable ruby
  14. 3.install package
  15. $sudo yum install openssl-devel
  16. 4.install ruby
  17. $rbenv install 2.2.2
  18. $rbenv versions
  19. $rbenv global 2.2.2
  20. $ruby -v
  21. 5.install rails
  22. $gem install rails
  23. $rails -v
  24. 6.install sqlite and mysql
  25. $echo "options single-request-reopen" >> /etc/resolv.conf
  26. $ sudo yum install sqlite
  27. $ sudo yum install sqlite-devel
  28. $sudo yum install epel-release //get from epel repo as nodejs is not published for centos
  29. $sudo yum install nodejs
  30. $node -v
  31. //http://nomnel.net/blog/install-mysql/ //cannot start mysql server
  32. //$sudo yum install mysql-server
  33. //$sudo yum install mysql-devel
  34. //So I did below
  35. //reference link:http://weblabo.oscasierra.net/installing-mysql-rhel6-with-yum/
  36. $yum -y install http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
  37. $yum info mysql-community-server
  38. $yum -y install mysql-community-server
  39. $mysqld --version
  40. $mysql --version
  41. $sudo chkconfig mysqld on //set mysqld start automaticlly
  42. $service mysqld start
  43. 7. clone remote sourcefiles and start
  44. $git clone https://....git //need to replace
  45. this line with your url.
  46. $cd splunkportal
  47. $vi config/config.yml
  48. $vi config/database.yml
  49. $vi Gemfile //need to change the version of rails as you installed
  50. $vi .ruby-version (change ruby version to 2.2.2,not 2.2.2p95)
  51. $bundle install
  52. $sudo gem install rake
  53. $rake db:create
  54. $rake db:migrate
  55. $rails server //if it shows "Listening on tcp://localhost:3000" success!
  56. 8. setup git
  57. $git config --global user.name "Your Name"
  58. $git config --global user.email you@example.com
  59. $git config --global core.editor "subl -w" //set sublimetext as editor (sublimetext must be
  60. installed)
  61. $cd splunkportal //make sure directory is app directory
  62. $git remote -v //List your existing remotes in order to get the name of the remote you want to
  63. change.
  64. $git remote set-url origin https://....git
  65. $git remote -v //can see both fetch and push are changed to the url you set
  66. 9.Development
  67. $git checkout -b NewBranch //create a branch namely "NewBranch"
  68. $git branch //confirm branch
  69. ... //change source code
  70. $git status //confirm status
  71. $git add .
  72. $git commit -m "My First Commit"
  73. $git log
  74. $git push -u origin NewBranch //push to remote NewBranch
  75. $git checkout master //Switch local branch to branch 'master'
  76. $git merge NewBranch //update local master(merge with NewBranch), remote master have not changed
  77. $git push -u origin master //push local master to remote master, now github master branched updated.


以上就是CentOS上安装配置Ruby on Rails的详细内容,更多关于CentOS上安装配置Ruby on Rails的资料请关注九品源码其它相关文章!