Deploy your first Rails project

Install Ruby2.3.8

  • Since ubuntu22.04 uses openssl3, the ruby3.2.2 version was installed when ruby ​​was installed before. However, the ruby ​​used in the rotten-potatoes project requires version 2.3.8, so you need to install ruby ​​2.3.8 first.

Install openssl1

  • To install ruby2.3.8 version, you need to install openssl1 first and enter the following command in the terminal
rvm pkg install openssl

Install ruby2.3.8

  • Install ruby2.3.8 using the command line (you may need to enter your login password during installation)
rvm install ruby-2.3.8

Set the default to use ruby2.3.8

  • Use the command line configuration to use Ruby version 2.3.8 by default (if this is the first time you install Ruby, you need to open the terminal preferences, find unnamed > Command > check Run command as login shell, and log in to the system again)
rvm install ruby-2.3.8 --default

Clone project

  • Clone the rotten-potatoes project using the command line
git clone https://gitee.com/shinabc/rotten-potatoes.git

Install dependencies

  • Install the nodejs and database dependencies required for the project in the terminal
sudo apt install libpq-dev  (安装数据库依赖)
sudo apt install nodejs      (安装nodejs)

Compile project

  • Go to the project folder
  • Run the following code to install all dependencies of the project
bundle install --without production

Project initialization

  • Run the following code in the project folder to initialize the project
rake db:setup
rake db:migrate           (初始化数据库)
rake db:seed  

Run the project

  • Run the following code in the project folder to start the project
rails server                   (启动服务器)

  • Open the browser, visit http://localhost:3000/, and find that the project runs successfully!

Guess you like

Origin blog.csdn.net/Qudoudou2020/article/details/133975757