【AmazonLinux2】创建新的Rails应用程序直到运行rake db:create命令

首先

因为在AmazonLinux2上创建新的Rails应用程序时遇到了各种错误,所以我把它写下来作为启示录。

翻译:环境

操作系统:AmazonLinux2
Ruby版本:ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
Rails版本:Rails 5.0.0
数据库:Mariadb

操作步骤

假设本次开发预计在AWS(cloud9)上使用AmazonLinux2进行。同时,我们假设已经创建了AWS的环境。

检查Ruby、Rails的版本(由于在AWS上已设置了环境)。
$ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]

$ rails -v
Rails 5.0.0
安装Gem(bundler)来管理Ruby的Gem库。
$ gem install bundler
Fetching bundler-2.1.4.gem
Successfully installed bundler-2.1.4
Parsing documentation for bundler-2.1.4
Installing ri documentation for bundler-2.1.4
Done installing documentation for bundler after 3 seconds
1 gem installed
安装用于使用Marinadb的必要软件包。

安装DB服务器

$ sudo yum install mariadb-server
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core                                                                                                                                                               | 3.7 kB  00:00:00     
220 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package mariadb-server.x86_64 3:10.2.10-2.amzn2.0.3 will be installed
--> Processing Dependency: mariadb-tokudb-engine(x86-64) = 3:10.2.10-2.amzn2.0.3 for package: 3:mariadb-server-10.2.10-2.amzn2.0.3.x86_64
--> Processing Dependency: mariadb-server-utils(x86-64) = 3:10.2.10-2.amzn2.0.3 for package: 3:mariadb-server-10.2.10-2.amzn2.0.3.x86_64
--> Processing Dependency: mariadb-rocksdb-engine(x86-64) = 3:10.2.10-2.amzn2.0.3 for package: 3:mariadb-server-10.2.10-2.amzn2.0.3.x86_64
--> Processing Dependency: mariadb-gssapi-server(x86-64) = 3:10.2.10-2.amzn2.0.3 for package: 3:mariadb-server-10.2.10-2.amzn2.0.3.x86_64
--> Processing Dependency: mariadb-errmsg(x86-64) = 3:10.2.10-2.amzn2.0.3 for package: 3:mariadb-server-10.2.10-2.amzn2.0.3.x86_64
--> Processing Dependency: mariadb-cracklib-password-check(x86-64) = 3:10.2.10-2.amzn2.0.3 for package: 3:mariadb-server-10.2.10-2.amzn2.0.3.x86_64
--> Processing Dependency: mariadb-backup(x86-64) = 3:10.2.10-2.amzn2.0.3 for package: 3:mariadb-server-10.2.10-2.amzn2.0.3.x86_64
--> Running transaction check
---> Package mariadb-backup.x86_64 3:10.2.10-2.amzn2.0.3 will be installed
---> Package mariadb-cracklib-password-check.x86_64 3:10.2.10-2.amzn2.0.3 will be installed
---> Package mariadb-errmsg.x86_64 3:10.2.10-2.amzn2.0.3 will be installed
---> Package mariadb-gssapi-server.x86_64 3:10.2.10-2.amzn2.0.3 will be installed
---> Package mariadb-rocksdb-engine.x86_64 3:10.2.10-2.amzn2.0.3 will be installed
---> Package mariadb-server-utils.x86_64 3:10.2.10-2.amzn2.0.3 will be installed
--> Processing Dependency: perl(DBI) for package: 3:mariadb-server-utils-10.2.10-2.amzn2.0.3.x86_64
--> Processing Dependency: perl(DBI) for package: 3:mariadb-server-utils-10.2.10-2.amzn2.0.3.x86_64
--> Processing Dependency: perl(DBD::mysql) for package: 3:mariadb-server-utils-10.2.10-2.amzn2.0.3.x86_64
---> Package mariadb-tokudb-engine.x86_64 3:10.2.10-2.amzn2.0.3 will be installed
--> Processing Dependency: libjemalloc.so.1()(64bit) for package: 3:mariadb-tokudb-engine-10.2.10-2.amzn2.0.3.x86_64
--> Running transaction check
---> Package jemalloc.x86_64 0:3.6.0-1.amzn2.0.1 will be installed
---> Package perl-DBD-MySQL.x86_64 0:4.023-6.amzn2 will be installed
---> Package perl-DBI.x86_64 0:1.627-4.amzn2.0.2 will be installed
--> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.amzn2.0.2.x86_64
--> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.amzn2.0.2.x86_64
--> Running transaction check
---> Package perl-PlRPC.noarch 0:0.2020-14.amzn2 will be installed
--> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.amzn2.noarch
--> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.amzn2.noarch
--> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.amzn2.noarch
--> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.amzn2.noarch
--> Running transaction check
---> Package perl-IO-Compress.noarch 0:2.061-2.amzn2 will be installed
--> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.amzn2.noarch
--> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.amzn2.noarch
---> Package perl-Net-Daemon.noarch 0:0.48-5.amzn2 will be installed
--> Running transaction check
---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.amzn2.0.2 will be installed
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.amzn2.0.2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================================================
 Package                                               Arch                         Version                                      Repository                                                Size
================================================================================================================================================================================================
Installing:
 mariadb-server                                        x86_64                       3:10.2.10-2.amzn2.0.3                        amzn2extra-lamp-mariadb10.2-php7.2                        17 M
Installing for dependencies:
 jemalloc                                              x86_64                       3.6.0-1.amzn2.0.1                            amzn2extra-lamp-mariadb10.2-php7.2                       109 k
 mariadb-backup                                        x86_64                       3:10.2.10-2.amzn2.0.3                        amzn2extra-lamp-mariadb10.2-php7.2                       5.9 M
 mariadb-cracklib-password-check                       x86_64                       3:10.2.10-2.amzn2.0.3                        amzn2extra-lamp-mariadb10.2-php7.2                        36 k
 mariadb-errmsg                                        x86_64                       3:10.2.10-2.amzn2.0.3                        amzn2extra-lamp-mariadb10.2-php7.2                       221 k
 mariadb-gssapi-server                                 x86_64                       3:10.2.10-2.amzn2.0.3                        amzn2extra-lamp-mariadb10.2-php7.2                        39 k
 mariadb-rocksdb-engine                                x86_64                       3:10.2.10-2.amzn2.0.3                        amzn2extra-lamp-mariadb10.2-php7.2                       4.0 M
 mariadb-server-utils                                  x86_64                       3:10.2.10-2.amzn2.0.3                        amzn2extra-lamp-mariadb10.2-php7.2                       1.6 M
 mariadb-tokudb-engine                                 x86_64                       3:10.2.10-2.amzn2.0.3                        amzn2extra-lamp-mariadb10.2-php7.2                       818 k
 perl-Compress-Raw-Bzip2                               x86_64                       2.061-3.amzn2.0.2                            amzn2-core                                                32 k
 perl-Compress-Raw-Zlib                                x86_64                       1:2.061-4.amzn2.0.2                          amzn2-core                                                58 k
 perl-DBD-MySQL                                        x86_64                       4.023-6.amzn2                                amzn2-core                                               141 k
 perl-DBI                                              x86_64                       1.627-4.amzn2.0.2                            amzn2-core                                               804 k
 perl-IO-Compress                                      noarch                       2.061-2.amzn2                                amzn2-core                                               260 k
 perl-Net-Daemon                                       noarch                       0.48-5.amzn2                                 amzn2-core                                                51 k
 perl-PlRPC                                            noarch                       0.2020-14.amzn2                              amzn2-core                                                36 k

Transaction Summary
================================================================================================================================================================================================
Install  1 Package (+15 Dependent packages)

Total download size: 31 M
Installed size: 136 M
Is this ok [y/d/N]: y
Downloading packages:
(1/16): jemalloc-3.6.0-1.amzn2.0.1.x86_64.rpm                                                                                                                            | 109 kB  00:00:00     
(2/16): mariadb-cracklib-password-check-10.2.10-2.amzn2.0.3.x86_64.rpm                                                                                                   |  36 kB  00:00:00     
(3/16): mariadb-errmsg-10.2.10-2.amzn2.0.3.x86_64.rpm                                                                                                                    | 221 kB  00:00:00     
(4/16): mariadb-backup-10.2.10-2.amzn2.0.3.x86_64.rpm                                                                                                                    | 5.9 MB  00:00:00     
(5/16): mariadb-gssapi-server-10.2.10-2.amzn2.0.3.x86_64.rpm                                                                                                             |  39 kB  00:00:00     
(6/16): mariadb-rocksdb-engine-10.2.10-2.amzn2.0.3.x86_64.rpm                                                                                                            | 4.0 MB  00:00:00     
(7/16): mariadb-server-utils-10.2.10-2.amzn2.0.3.x86_64.rpm                                                                                                              | 1.6 MB  00:00:00     
(8/16): mariadb-tokudb-engine-10.2.10-2.amzn2.0.3.x86_64.rpm                                                                                                             | 818 kB  00:00:00     
(9/16): mariadb-server-10.2.10-2.amzn2.0.3.x86_64.rpm                                                                                                                    |  17 MB  00:00:00     
(10/16): perl-Compress-Raw-Bzip2-2.061-3.amzn2.0.2.x86_64.rpm                                                                                                            |  32 kB  00:00:00     
(11/16): perl-Compress-Raw-Zlib-2.061-4.amzn2.0.2.x86_64.rpm                                                                                                             |  58 kB  00:00:00     
(12/16): perl-DBD-MySQL-4.023-6.amzn2.x86_64.rpm                                                                                                                         | 141 kB  00:00:00     
(13/16): perl-IO-Compress-2.061-2.amzn2.noarch.rpm                                                                                                                       | 260 kB  00:00:00     
(14/16): perl-Net-Daemon-0.48-5.amzn2.noarch.rpm                                                                                                                         |  51 kB  00:00:00     
(15/16): perl-PlRPC-0.2020-14.amzn2.noarch.rpm                                                                                                                           |  36 kB  00:00:00     
(16/16): perl-DBI-1.627-4.amzn2.0.2.x86_64.rpm                                                                                                                           | 804 kB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                            32 MB/s |  31 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 3:mariadb-errmsg-10.2.10-2.amzn2.0.3.x86_64                                                                                                                                 1/16 
  Installing : jemalloc-3.6.0-1.amzn2.0.1.x86_64                                                                                                                                           2/16 
  Installing : perl-Compress-Raw-Bzip2-2.061-3.amzn2.0.2.x86_64                                                                                                                            3/16 
  Installing : perl-Net-Daemon-0.48-5.amzn2.noarch                                                                                                                                         4/16 
  Installing : 1:perl-Compress-Raw-Zlib-2.061-4.amzn2.0.2.x86_64                                                                                                                           5/16 
  Installing : perl-IO-Compress-2.061-2.amzn2.noarch                                                                                                                                       6/16 
  Installing : perl-PlRPC-0.2020-14.amzn2.noarch                                                                                                                                           7/16 
  Installing : perl-DBI-1.627-4.amzn2.0.2.x86_64                                                                                                                                           8/16 
  Installing : perl-DBD-MySQL-4.023-6.amzn2.x86_64                                                                                                                                         9/16 
  Installing : 3:mariadb-tokudb-engine-10.2.10-2.amzn2.0.3.x86_64                                                                                                                         10/16 
  Installing : 3:mariadb-rocksdb-engine-10.2.10-2.amzn2.0.3.x86_64                                                                                                                        11/16 
  Installing : 3:mariadb-backup-10.2.10-2.amzn2.0.3.x86_64                                                                                                                                12/16 
  Installing : 3:mariadb-cracklib-password-check-10.2.10-2.amzn2.0.3.x86_64                                                                                                               13/16 
  Installing : 3:mariadb-gssapi-server-10.2.10-2.amzn2.0.3.x86_64                                                                                                                         14/16 
  Installing : 3:mariadb-server-10.2.10-2.amzn2.0.3.x86_64                                                                                                                                15/16 
  Installing : 3:mariadb-server-utils-10.2.10-2.amzn2.0.3.x86_64                                                                                                                          16/16 
  Verifying  : 1:perl-Compress-Raw-Zlib-2.061-4.amzn2.0.2.x86_64                                                                                                                           1/16 
  Verifying  : 3:mariadb-tokudb-engine-10.2.10-2.amzn2.0.3.x86_64                                                                                                                          2/16 
  Verifying  : perl-Net-Daemon-0.48-5.amzn2.noarch                                                                                                                                         3/16 
  Verifying  : 3:mariadb-rocksdb-engine-10.2.10-2.amzn2.0.3.x86_64                                                                                                                         4/16 
  Verifying  : perl-DBD-MySQL-4.023-6.amzn2.x86_64                                                                                                                                         5/16 
  Verifying  : 3:mariadb-backup-10.2.10-2.amzn2.0.3.x86_64                                                                                                                                 6/16 
  Verifying  : 3:mariadb-server-utils-10.2.10-2.amzn2.0.3.x86_64                                                                                                                           7/16 
  Verifying  : 3:mariadb-cracklib-password-check-10.2.10-2.amzn2.0.3.x86_64                                                                                                                8/16 
  Verifying  : perl-IO-Compress-2.061-2.amzn2.noarch                                                                                                                                       9/16 
  Verifying  : 3:mariadb-gssapi-server-10.2.10-2.amzn2.0.3.x86_64                                                                                                                         10/16 
  Verifying  : perl-Compress-Raw-Bzip2-2.061-3.amzn2.0.2.x86_64                                                                                                                           11/16 
  Verifying  : jemalloc-3.6.0-1.amzn2.0.1.x86_64                                                                                                                                          12/16 
  Verifying  : perl-DBI-1.627-4.amzn2.0.2.x86_64                                                                                                                                          13/16 
  Verifying  : perl-PlRPC-0.2020-14.amzn2.noarch                                                                                                                                          14/16 
  Verifying  : 3:mariadb-errmsg-10.2.10-2.amzn2.0.3.x86_64                                                                                                                                15/16 
  Verifying  : 3:mariadb-server-10.2.10-2.amzn2.0.3.x86_64                                                                                                                                16/16 

Installed:
  mariadb-server.x86_64 3:10.2.10-2.amzn2.0.3                                                                                                                                                   

Dependency Installed:
  jemalloc.x86_64 0:3.6.0-1.amzn2.0.1                        mariadb-backup.x86_64 3:10.2.10-2.amzn2.0.3                 mariadb-cracklib-password-check.x86_64 3:10.2.10-2.amzn2.0.3         
  mariadb-errmsg.x86_64 3:10.2.10-2.amzn2.0.3                mariadb-gssapi-server.x86_64 3:10.2.10-2.amzn2.0.3          mariadb-rocksdb-engine.x86_64 3:10.2.10-2.amzn2.0.3                  
  mariadb-server-utils.x86_64 3:10.2.10-2.amzn2.0.3          mariadb-tokudb-engine.x86_64 3:10.2.10-2.amzn2.0.3          perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.amzn2.0.2                   
  perl-Compress-Raw-Zlib.x86_64 1:2.061-4.amzn2.0.2          perl-DBD-MySQL.x86_64 0:4.023-6.amzn2                       perl-DBI.x86_64 0:1.627-4.amzn2.0.2                                  
  perl-IO-Compress.noarch 0:2.061-2.amzn2                    perl-Net-Daemon.noarch 0:0.48-5.amzn2                       perl-PlRPC.noarch 0:0.2020-14.amzn2                                  

Complete!

安装DB客户端

$ sudo yum install mariadb-devel
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
220 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package mariadb-devel.x86_64 3:10.2.10-2.amzn2.0.3 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================================================
 Package                                 Arch                             Version                                            Repository                                                    Size
================================================================================================================================================================================================
Installing:
 mariadb-devel                           x86_64                           3:10.2.10-2.amzn2.0.3                              amzn2extra-lamp-mariadb10.2-php7.2                           1.0 M

Transaction Summary
================================================================================================================================================================================================
Install  1 Package

Total download size: 1.0 M
Installed size: 4.5 M
Is this ok [y/d/N]: y
Downloading packages:
mariadb-devel-10.2.10-2.amzn2.0.3.x86_64.rpm                                                                                                                             | 1.0 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 3:mariadb-devel-10.2.10-2.amzn2.0.3.x86_64                                                                                                                                   1/1 
  Verifying  : 3:mariadb-devel-10.2.10-2.amzn2.0.3.x86_64                                                                                                                                   1/1 

Installed:
  mariadb-devel.x86_64 3:10.2.10-2.amzn2.0.3                                                                                                                                                    

Complete!
启动数据库服务器
$ sudo systemctl start mariadb
确认服务器的启动状态
$ sudo systemctl status mariadb
● mariadb.service - MariaDB 10.2 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-12-03 15:35:26 UTC; 8s ago
  Process: 860 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
  Process: 638 ExecStartPre=/usr/libexec/mysql-prepare-db-dir %n (code=exited, status=0/SUCCESS)
  Process: 582 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
 Main PID: 778 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 45
   Memory: 169.8M
   CGroup: /system.slice/mariadb.service
           └─778 /usr/libexec/mysqld --basedir=/usr

Dec 03 15:35:25 ip-172-31-19-99.us-east-2.compute.internal mysql-prepare-db-dir[638]: MySQL manual for more instructions.
Dec 03 15:35:25 ip-172-31-19-99.us-east-2.compute.internal mysql-prepare-db-dir[638]: Please report any problems at http://mariadb.org/jira
Dec 03 15:35:25 ip-172-31-19-99.us-east-2.compute.internal mysql-prepare-db-dir[638]: The latest information about MariaDB is available at http://mariadb.org/.
Dec 03 15:35:25 ip-172-31-19-99.us-east-2.compute.internal mysql-prepare-db-dir[638]: You can find additional information about the MySQL part at:
Dec 03 15:35:25 ip-172-31-19-99.us-east-2.compute.internal mysql-prepare-db-dir[638]: http://dev.mysql.com
Dec 03 15:35:25 ip-172-31-19-99.us-east-2.compute.internal mysql-prepare-db-dir[638]: Consider joining MariaDB's strong and vibrant community:
Dec 03 15:35:25 ip-172-31-19-99.us-east-2.compute.internal mysql-prepare-db-dir[638]: https://mariadb.org/get-involved/
Dec 03 15:35:26 ip-172-31-19-99.us-east-2.compute.internal mysqld[778]: 2020-12-03 15:35:26 140397484732224 [Note] /usr/libexec/mysqld (mysqld 10.2.10-MariaDB) starting as process 778 ...
Dec 03 15:35:26 ip-172-31-19-99.us-east-2.compute.internal mysqld[778]: 2020-12-03 15:35:26 140397484732224 [Warning] Changed limits: max_open_files: 1024  max_connections: 151  ta...ache: 431
Dec 03 15:35:26 ip-172-31-19-99.us-east-2.compute.internal systemd[1]: Started MariaDB 10.2 database server.
Hint: Some lines were ellipsized, use -l to show in full.
设置在操作系统启动时自动启动
$ sudo systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
创建新应用

我們現在在這裡創建一個新的應用程序。這次我們會指定mysql作為數據庫,所以輸入下面的命令。以”shift-management”作為應用程序名稱為例。

$ rails new shift-management -d mysql
      create  
      create  README.md
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/config/manifest.js
      create  app/assets/javascripts/application.js
      create  app/assets/javascripts/cable.js
      create  app/assets/stylesheets/application.css
      create  app/channels/application_cable/channel.rb
      create  app/channels/application_cable/connection.rb
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/jobs/application_job.rb
      create  app/mailers/application_mailer.rb
      create  app/models/application_record.rb
      create  app/views/layouts/application.html.erb
      create  app/views/layouts/mailer.html.erb
      create  app/views/layouts/mailer.text.erb
      create  app/assets/images/.keep
      create  app/assets/javascripts/channels
      create  app/assets/javascripts/channels/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/bundle
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  bin/update
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/secrets.yml
      create  config/cable.yml
      create  config/puma.rb
      create  config/spring.rb
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/application_controller_renderer.rb
      create  config/initializers/assets.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/cookies_serializer.rb
      create  config/initializers/cors.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/new_framework_defaults.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/apple-touch-icon-precomposed.png
      create  public/apple-touch-icon.png
      create  public/favicon.ico
      create  public/robots.txt
      create  test/fixtures
      create  test/fixtures/.keep
      create  test/fixtures/files
      create  test/fixtures/files/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/test_helper.rb
      create  tmp
      create  tmp/.keep
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/javascripts
      create  vendor/assets/javascripts/.keep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.keep
      remove  config/initializers/cors.rb
         run  bundle install
[DEPRECATED] `Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env` (called at /home/ec2-user/.rvm/gems/ruby-2.6.3/gems/railties-5.0.0/lib/rails/generators/app_base.rb:374)
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
Fetching rake 13.0.1
Installing rake 13.0.1
Using concurrent-ruby 1.1.7
Fetching i18n 1.8.5
Installing i18n 1.8.5
Fetching minitest 5.14.2
Installing minitest 5.14.2
Using thread_safe 0.3.6
Fetching tzinfo 1.2.8
Installing tzinfo 1.2.8
Fetching activesupport 5.0.7.2
Installing activesupport 5.0.7.2
Using builder 3.2.4
Using erubis 2.7.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.10
Using rails-dom-testing 2.0.3
Using crass 1.0.6
Fetching loofah 2.8.0
Installing loofah 2.8.0
Using rails-html-sanitizer 1.3.0
Fetching actionview 5.0.7.2
Installing actionview 5.0.7.2
Using rack 2.2.3
Using rack-test 0.6.3
Fetching actionpack 5.0.7.2
Installing actionpack 5.0.7.2
Fetching nio4r 2.5.4
Installing nio4r 2.5.4 with native extensions
Using websocket-extensions 0.1.5
Using websocket-driver 0.6.5
Fetching actioncable 5.0.7.2
Installing actioncable 5.0.7.2
Using globalid 0.4.2
Fetching activejob 5.0.7.2
Installing activejob 5.0.7.2
Using mini_mime 1.0.2
Using mail 2.7.1
Fetching actionmailer 5.0.7.2
Installing actionmailer 5.0.7.2
Fetching activemodel 5.0.7.2
Installing activemodel 5.0.7.2
Using arel 7.1.4
Fetching activerecord 5.0.7.2
Installing activerecord 5.0.7.2
Fetching bindex 0.8.1
Installing bindex 0.8.1 with native extensions
Using bundler 2.1.4
Fetching byebug 11.1.3
Installing byebug 11.1.3 with native extensions
Fetching coffee-script-source 1.12.2
Installing coffee-script-source 1.12.2
Fetching execjs 2.7.0
Installing execjs 2.7.0
Fetching coffee-script 2.4.1
Installing coffee-script 2.4.1
Using method_source 1.0.0
Using thor 1.0.1
Fetching railties 5.0.7.2
Installing railties 5.0.7.2
Fetching coffee-rails 4.2.2
Installing coffee-rails 4.2.2
Fetching ffi 1.13.1
Installing ffi 1.13.1 with native extensions
Fetching jbuilder 2.10.1
Installing jbuilder 2.10.1
Fetching jquery-rails 4.4.0
Installing jquery-rails 4.4.0
Fetching rb-fsevent 0.10.4
Installing rb-fsevent 0.10.4
Fetching rb-inotify 0.10.1
Installing rb-inotify 0.10.1
Fetching listen 3.0.8
Installing listen 3.0.8
Fetching mysql2 0.4.10
Installing mysql2 0.4.10 with native extensions
Fetching puma 3.12.6
Installing puma 3.12.6 with native extensions
Fetching sprockets 3.7.2
Installing sprockets 3.7.2
Using sprockets-rails 3.2.2
Fetching rails 5.0.7.2
Installing rails 5.0.7.2
Fetching sass-listen 4.0.0
Installing sass-listen 4.0.0
Fetching sass 3.7.4
Installing sass 3.7.4
Fetching tilt 2.0.10
Installing tilt 2.0.10
Fetching sass-rails 5.0.7
Installing sass-rails 5.0.7
Fetching spring 2.1.1
Installing spring 2.1.1
Fetching spring-watcher-listen 2.0.1
Installing spring-watcher-listen 2.0.1
Fetching turbolinks-source 5.2.0
Installing turbolinks-source 5.2.0
Fetching turbolinks 5.2.1
Installing turbolinks 5.2.1
Fetching uglifier 4.2.0
Installing uglifier 4.2.0
Fetching web-console 3.7.0
Installing web-console 3.7.0
Bundle complete! 15 Gemfile dependencies, 62 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Post-install message from i18n:

HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
But that may break your application.

If you are upgrading your Rails application from an older version of Rails:

Please check your Rails app for 'config.i18n.fallbacks = true'.
If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
'config.i18n.fallbacks = [I18n.default_locale]'.
If not, fallbacks will be broken in your app by I18n 1.1.x.

If you are starting a NEW Rails application, you can ignore this notice.

For more info see:
https://github.com/svenfuchs/i18n/releases/tag/v1.1.0

Post-install message from sass:

Ruby Sass has reached end-of-life and should no longer be used.

* If you use Sass as a command-line tool, we recommend using Dart Sass, the new
  primary implementation: https://sass-lang.com/install

* If you use Sass as a plug-in for a Ruby web framework, we recommend using the
  sassc gem: https://github.com/sass/sassc-ruby#readme

* For more details, please refer to the Sass blog:
  https://sass-lang.com/blog/posts/7828841

         run  bundle exec spring binstub --all
* bin/rake: Spring inserted
* bin/rails: Spring inserted
创建数据库
$ rake db:create
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Created database 'shift-management_development'
Created database 'shift-management_test'

这次就到这里吧。

常见错误

在使用Rails创建新应用程序时,如果在安装mysql2时遇到错误,可以采取以下解决办法。

广告
将在 10 秒后关闭
bannerAds