How to install Ruby On Rails on Ubuntu and quickly create a new Rails project

Installation: (Environment: ubuntu)
Various dependencies required for installation

sudo apt-get install apache2 curl git libmysqlclient-dev mysql-server nodejs

Install ruby

   sudo apt-get install ruby2.3 ruby2.3-dev

Install rails

sudo gem install rails --version=5.0.2 --no-ri --no-rdoc

================================================= =
Build:
1. Locate the specified location: rails new abcd (project name) -d mysql
create a project and specify the mysql database
2. After a while, you can execute rails s directly, but an error will be reported.
3. An error may be reported. Missing js file
Add
gem'execjs' gem'therubyracer' to the
Gemfile
and install the bundle.
This will still report an error.
4. An error will be reported that a database is missing or the database cannot be found.
Execute: rake db:create db:migrate
bin/rake db: create db:migrate


After the database is successfully created , start the server to start the server by
rails s

Simply record the follow-up meticulous processing

Guess you like

Origin blog.csdn.net/weixin_42656358/article/details/99650391