一键安装GitLab7在CR-VHEL6,安装使用全经过

By admin in 4858.com on 2019年3月26日

rails框架默许有四个格局development(开发),production(上线),test(测试)

有机会再试一试Rails了,只是原先接触的是2,现在尘埃落定成为了4,仿佛未来的设置比原来会快些。。

有时机再试一试Rails了,只是原先接触的是2,今后已然成为了4,就如今后的设置比原来会快些。。

参考原作:http://www.linuxidc.com/Linux/2014-08/105137.htm

Development

 config.cache_classes =
false 每一回请求都会重新加载,修改代码之后能够一贯运用。

 config.consider_all_requests_local =
true 在该地质度量试的时候能够呈现全体的谬误。

 config.action_controller.perform_caching =
false 

 config.action_mailer.raise_delivery_errors =
false 如若寄信战败,是还是不是要丢出分裂。提议足以改成 true。

 config.active_support.deprecation =
:log 随着 Rails
版本的升官,借使有方法会在后头的版本中移除,deprecation
会提醒您怎么着因应。那里的 :log 表示会记录到 log 档案中。

 

Rails 4 安装

Rails 4 安装

1 关于gitlab7

Production 模式

 config.cache_classes =
true 与支出环境区别,把数据保存在内部存款和储蓄器中,速度更快

 config.action_controller.perform_caching =
true 不一致于 development,借使在 production
环境出现分裂错误,不会显得程式 call stack 音信,而是回传 public/500.html
页面。

 config.serve_static_assets =
false “X-Sendfile”
是网页服务器提供的功效,能够让下载档案的动作完全国委员会派给网页服务器,Rails
送出 X-Sendfile 标头后就毋需再佔住财富。

 config.force_ssl =
true 是还是不是限制全站必须SSL才能应用。 

 config.logger =
ActiveSupport::TaggedLogging.new(SyslogLogger.new) 能够转换掉
Rails 内建的 Logger,例如换到使用 syslog
的 SyslogLogger。

 config.cache_store =
:mem_cache_store 设定分化的快取储存库,暗中同意是
:memory_store,也等于每一种 Rails process
各自用内部存款和储蓄器存放。产业界最常用的则是 memcached 内部存储器快取服务器

 config.action_controller.asset_host =
“” 私下认可的静态档案地方是当前主机的
public 目录,你能够经过修改 asset_host
变更地点。例如你的静态档案放在分裂台机器或 CDN(Content delivery network)
上。

 

本着于安装了卡宴VM

本着于安装了奥迪Q5VM

不顾gitlab是个好东西,不过极难安装和安排。bitnami(

Test 模式

 config.action_dispatch.show_exceptions =
false 不一样于 development 或 production
碰着例外会捕捉例外后,给浏览器呈现出 call stack trace 或 public/500.html
画面,在 test 格局就不处理,让分歧间接报错。

 config.action_mailer.delivery_method =
:test 测试情势下不会真正去寄送email

 config.active_support.deprecation =
:stderr 让 deprecation 新闻会间接显示到视窗之中

 

复制代码 代码如下:

复制代码 代码如下:

4858.com ,率先,bitmami的某个本子有标题,无法成功在rhel6.4上成功安装。因而,我找到了3个较新的可以运用的版本7.8.1(响应式页面):

gem install rails

gem install rails

ftp://pepstack.com/pub/tarball/bitnami-gitlab-7.8.1-0-linux-x64-installer.run

不曾的话应该那样:

从未有过的话应该那样:

(笔者的ftp不会直接提供,请想要的尽快下载)

复制代码 代码如下:

复制代码 代码如下:

那就是说,最终安装好的功用就是(点击可访问,第一回访问大概会相比较慢,须要较新本子的firefox或chrome,IE未测试):

sudo gem install rails

sudo gem install rails

设置昂CoraVM能够用句

设置EnclaveVM能够用句

2 必要描述

复制代码 代码如下:

复制代码 代码如下:

好了,先把须求陈述一下,假使读者的需求与本身不相同,小编不能。倘使小编有一台web主机(作者那里是pepstack.com),笔者在主机后边创立虚拟机(vm-gitlab),在vm-gitlab上安装gitlab7,然后通过配备web主机上的ngnix,能够经过上边包车型客车url访问到自个儿的gitlab:

curl -L | bash -s stable

curl -L | bash -s stable

**查看rails版本

**查看rails版本

创立虚拟机vm-gitlab的进度不细说了,倘若您使用实体机也是千篇一律的。vm-gitlab安装的是rhel6.4版本。确定保障在vm内部能够访问外部主机和internet(如ping
www.baidu.com)。

**

**

3 安装gitlab

复制代码 代码如下:

复制代码 代码如下:

ssh 到vm-gitlab:

rails -v
Rails 4.0.3

rails -v
Rails 4.0.3

# ssh root@vm-gitlab

一键安装GitLab7在CR-VHEL6,安装使用全经过。有如那便是眼前的风靡版本

犹如这正是现阶段的新式版本

下载一键式安装包:

Ruby版本

Ruby版本

# wget
ftp://pepstack.com/pub/tarball/bitnami-gitlab-7.8.1-0-linux-x64-installer.run

复制代码 代码如下:

复制代码 代码如下:

安装:

We recommend Ruby 2.1.0 for use with Rails. We stopped supporting Ruby
1.8.x after Rails 3.2. Ruby 1.9.2+ will be supported until Rails 5.

We recommend Ruby 2.1.0 for use with Rails. We stopped supporting Ruby
1.8.x after Rails 3.2. Ruby 1.9.2+ will be supported until Rails 5.

# chmod a+x bitnami-gitlab-7.8.1-0-linux-x64-installer.run

官方推荐用2.1.0. 也便是风靡版本

官方推荐用2.1.0. 也正是时尚版本

# ./bitnami-gitlab-7.8.1-0-linux-x64-installer.run

安装SQLite

安装SQLite

设置进程中会提醒:

就像这就是诸如Django、Rails那类对于轻量级网站的数据库供给。

犹如那便是比如说Django、Rails那类对于轻量级网站的数据库供给。


如果是mac os

如果是mac os

Welcome to the Bitnami Gitlab Stack Setup Wizard.

复制代码 代码如下:

复制代码 代码如下:


brew install sqlite3

brew install sqlite3

Select the components you want to install; clear the components you do
not want
to install. Click Next when you are ready to continue.

别的能够看情形设置,如openSUSE

其它能够看状态设置,如openSUSE

GitLab : Y (Cannot be edited)

复制代码 代码如下:

复制代码 代码如下:

GitLab CI [Y/n] :Y

sudo zypper install sqlite3

sudo zypper install sqlite3

Is the selection above correct? [Y/n]: Y

Rails 4 Hello,World

Rails 4 Hello,World


能够平昔用rails生成

能够一直用rails生成

Installation folder

复制代码 代码如下:

复制代码 代码如下:

Please, choose a folder to install Bitnami Gitlab Stack

$rails new hello

$rails new hello

Select a folder [/opt/gitlab-7.8.1-0]:

于是乎就有了

于是就有了


复制代码 代码如下:

复制代码 代码如下:

Create Admin account

  create
  create  README.rdoc
  create  Rakefile
  create  config.ru
  create  .gitignore
  create  Gemfile
  create  app
  create  app/assets/javascripts/application.js
  create  app/assets/stylesheets/application.css
  create  app/controllers/application_controller.rb
  create  app/helpers/application_helper.rb
  create  app/views/layouts/application.html.erb
  create  app/assets/images/.keep
  create  app/mailers/.keep
  create  app/models/.keep
  create  app/controllers/concerns/.keep
  create  app/models/concerns/.keep
  create  bin
  create  bin/bundle
  create  bin/rails
  create  bin/rake
  create  config
  create  config/routes.rb
  create  config/application.rb
  create  config/environment.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/backtrace_silencers.rb
  create  config/initializers/filter_parameter_logging.rb
  create  config/initializers/inflections.rb
  create  config/initializers/mime_types.rb
  create  config/initializers/secret_token.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/favicon.ico
  create  public/robots.txt
  create  test/fixtures
  create  test/fixtures/.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/cache
  create  tmp/cache/assets
  create  vendor/assets/javascripts
  create  vendor/assets/javascripts/.keep
  create  vendor/assets/stylesheets
  create  vendor/assets/stylesheets/.keep
run  bundle install

  create
  create  README.rdoc
  create  Rakefile
  create  config.ru
  create  .gitignore
  create  Gemfile
  create  app
  create  app/assets/javascripts/application.js
  create  app/assets/stylesheets/application.css
  create  app/controllers/application_controller.rb
  create  app/helpers/application_helper.rb
  create  app/views/layouts/application.html.erb
  create  app/assets/images/.keep
  create  app/mailers/.keep
  create  app/models/.keep
  create  app/controllers/concerns/.keep
  create  app/models/concerns/.keep
  create  bin
  create  bin/bundle
  create  bin/rails
  create  bin/rake
  create  config
  create  config/routes.rb
  create  config/application.rb
  create  config/environment.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/backtrace_silencers.rb
  create  config/initializers/filter_parameter_logging.rb
  create  config/initializers/inflections.rb
  create  config/initializers/mime_types.rb
  create  config/initializers/secret_token.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/favicon.ico
  create  public/robots.txt
  create  test/fixtures
  create  test/fixtures/.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/cache
  create  tmp/cache/assets
  create  vendor/assets/javascripts
  create  vendor/assets/javascripts/.keep
  create  vendor/assets/stylesheets
  create  vendor/assets/stylesheets/.keep
run  bundle install

Bitnami Gitlab Stack admin user creation

随即会安装包看重

接着会安装包信赖

Email Address [user@example.com]: cheungmine@qq.com

复制代码 代码如下:

复制代码 代码如下:

Login [user]: master (此处是你登录gitlab用的用户名)

  Fetching gem metadata from ……….
  Fetching additional metadata from ..
  Resolving dependencies…
  Using rake (10.3.1)
  Using i18n (0.6.9)
  Using minitest (4.7.5)
  Using multi_json (1.9.2)
  Using thread_safe (0.3.3)
  Using tzinfo (0.3.39)
  Using activesupport (4.0.3)
  Using builder (3.1.4)
  Using erubis (2.7.0)
  Using rack (1.5.2)
  Using rack-test (0.6.2)
  Using actionpack (4.0.3)
  Using mime-types (1.25.1)
  Using polyglot (0.3.4)
  Using treetop (1.4.15)
  Using mail (2.5.4)
  Using actionmailer (4.0.3)
  Using activemodel (4.0.3)
  Using activerecord-deprecated_finders (1.0.3)
  Using arel (4.0.2)
  Using activerecord (4.0.3)
  Using bundler (1.5.3)
  Using coffee-script-source (1.7.0)
  Using execjs (2.0.2)
  Using coffee-script (2.2.0)
  Using thor (0.19.1)
  Using railties (4.0.3)
  Using coffee-rails (4.0.1)
  Using hike (1.2.3)
  Using jbuilder (1.5.3)
  Using jquery-rails (3.1.0)
  Using json (1.8.1)
  Using tilt (1.4.1)
  Using sprockets (2.11.0)
  Using sprockets-rails (2.0.1)
  Using rails (4.0.3)
  Using rdoc (4.1.1)
  Using sass (3.2.19)
  Using sass-rails (4.0.3)
  Using sdoc (0.4.0)
  Using sqlite3 (1.3.9)
  Using turbolinks (2.2.2)
  Using uglifier (2.5.0)
  Your bundle is complete!
  Use `bundle show [gemname]` to see where a bundled gem is
installed.

  Fetching gem metadata from ……….
  Fetching additional metadata from ..
  Resolving dependencies…
  Using rake (10.3.1)
  Using i18n (0.6.9)
  Using minitest (4.7.5)
  Using multi_json (1.9.2)
  Using thread_safe (0.3.3)
  Using tzinfo (0.3.39)
  Using activesupport (4.0.3)
  Using builder (3.1.4)
  Using erubis (2.7.0)
  Using rack (1.5.2)
  Using rack-test (0.6.2)
  Using actionpack (4.0.3)
  Using mime-types (1.25.1)
  Using polyglot (0.3.4)
  Using treetop (1.4.15)
  Using mail (2.5.4)
  Using actionmailer (4.0.3)
  Using activemodel (4.0.3)
  Using activerecord-deprecated_finders (1.0.3)
  Using arel (4.0.2)
  Using activerecord (4.0.3)
  Using bundler (1.5.3)
  Using coffee-script-source (1.7.0)
  Using execjs (2.0.2)
  Using coffee-script (2.2.0)
  Using thor (0.19.1)
  Using railties (4.0.3)
  Using coffee-rails (4.0.1)
  Using hike (1.2.3)
  Using jbuilder (1.5.3)
  Using jquery-rails (3.1.0)
  Using json (1.8.1)
  Using tilt (1.4.1)
  Using sprockets (2.11.0)
  Using sprockets-rails (2.0.1)
  Using rails (4.0.3)
  Using rdoc (4.1.1)
  Using sass (3.2.19)
  Using sass-rails (4.0.3)
  Using sdoc (0.4.0)
  Using sqlite3 (1.3.9)
  Using turbolinks (2.2.2)
  Using uglifier (2.5.0)
  Your bundle is complete!
  Use `bundle show [gemname]` to see where a bundled gem is
installed.

Password : (输入你登录gitlab时要用的密码)

运行Rails

运行Rails

Please confirm your password :  (输入你登录gitlab时要用的密码)

Hostname that will be used to create internal URLs. If this value is
incorrect,
you may be unable to access your Gitlab installation from other
computers. It is
advisable to use a Domain instead of an IP address for compatibility
with
different browsers.

Domain [127.0.0.1]:

Do you want to configure mail support? [y/N]: Y


Configure SMTP Settings

This is required so your application can send notifications via email.

Default email provider:

[1] GMail
[2] Custom
Please choose an option [1] : 2


Configure SMTP Settings

This data is stored in the application configuration files and may be
visible to
others. For this reason, it is recommended that you do not use your
personal
account credentials.

Username []: cheungmine@qq.com

Password : (输入你的QQ密码)
Re-enter : (输入你的QQ密码)
SMTP Host []: smtp.qq.com

SMTP Port []: 25

Secure connection

[1] None
[2] SSL
[3] TLS
Please choose an option [3] :


Setup is now ready to begin installing Bitnami Gitlab Stack on your
computer.

Do you want to continue? [Y/n]: Y


Please wait while Setup installs Bitnami Gitlab Stack on your computer.

 Installing
 0% ______________ 50% ______________ 100%
 #########################################


Setup has finished installing Bitnami Gitlab Stack on your computer.

Info: To access the Bitnami Gitlab Stack, go to
from your browser.
Press [Enter] to continue:

4 配置gitlab
安排更是要小心。上面多少个布局文件要用到:

/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/config/environments/production.rb
/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/config/initializers/smtp_settings.rb
/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/config/gitlab.yml
/opt/gitlab-7.8.1-0/apps/gitlab/conf/httpd-app.conf
/opt/gitlab-7.8.1-0/apps/gitlab/gitlab-shell/config.yml

上边逐一说明:

4.1 production.rb

……
  # config.action_mailer.delivery_method = :sendmail
  # Defaults to:
  # # config.action_mailer.sendmail_settings = {
  # #  location: ‘/usr/sbin/sendmail’,
  # #  arguments: ‘-i -t’
  # # }
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    :address => “smtp.qq.com”,
    :port => “25”,
    :domain => “qq.com”,
    :authentication => :plain,
    :user_name => “cheungmine@qq.com”,
    :password => “********”,
    :enable_starttls_auto => true
  }

  config.eager_load = true
  config.assets.js_compressor = :uglifier

  config.allow_concurrency = false
……

4.2 smtp_settings.rb
# cp smtp_settings.rb.sample smtp_settings.rb

# To enable smtp email delivery for your GitLab instance do the
following:
# 1. Rename smtp_settings.rb.sample to smtp_settings.rb
# 2. Edit settings inside this file
# 3. Restart GitLab instance
#
if Rails.env.production?
  Gitlab::Application.config.action_mailer.delivery_method = :smtp

  ActionMailer::Base.smtp_settings = {
    address: “smtp.qq.com”,
    port: 25,
    user_name: “cheungmine@qq.com”,
    password: “********”,
    domain: “qq.com”,
    authentication: :login,
    enable_starttls_auto: true,
    openssl_verify_mode: ‘none’
  }
end

4.3 gitlab.yml

# # # # # # # # # # # # # # # # # #
# GitLab application config file  #
# # # # # # # # # # # # # # # # # #
#
# How to use:
# 1. Copy file as gitlab.yml
# 2. Update gitlab -> host with your fully qualified domain name
# 3. Update gitlab -> email_from
# 4. If you installed Git from source, change git -> bin_path to
/usr/local/bin/git
# 5. Review this configuration file for other settings you may want to
adjust

production: &base
  #
  # 1. GitLab app settings
  # ==========================

  ## GitLab settings
  gitlab:
    ## Web server settings (note: host is the FQDN, do not include
http://)
    host: pepstack.com
    port: 80                # Set to 443 if using HTTPS, see
installation.md#using-https for additional HTTPS configuration
details
    https: false            # Set to true if using HTTPS, see
installation.md#using-https for additional HTTPS configuration details

    # Uncommment this line below if your ssh host is different from
HTTP/HTTPS one
    # (you’d obviously need to replace ssh.host_example.com with your
own host).
    # Otherwise, ssh host will be set to the `host:` value above
    # ssh_host: ssh.host_example.com

    # WARNING: See config/application.rb under “Relative url support”
for the list of
    # other files that need to be changed for relative url support
    relative_url_root: /gitlab

    # Uncomment and customize if you can’t use the default user to run
GitLab (default: ‘git’)
    # user: git

    ## Date & Time settings
    # Uncomment and customize if you want to change the default time
zone of GitLab application.
    # To see all available zones, run `bundle exec rake time:zones:all
RAILS_ENV=production`
    # time_zone: ‘UTC’

    ## Email settings
    # Uncomment and set to false if you need to disable email sending
from GitLab (default: true)
    # email_enabled: true
    # Email address used in the “From” field in mails sent by GitLab
    email_from: cheungmine@qq.com
    support_email: cheungmine@qq.com

    # Email server smtp settings are in
config/initializers/smtp_settings.rb.sample

    # default_can_create_group: false  # default: true
    # username_changing_enabled: false # default: true – User can
change her username/namespace
    ## Default theme
    ##  BASIC  = 1
    ##  MARS  = 2
    ##  MODERN = 3
    ##  GRAY  = 4
    ##  COLOR  = 5
    # default_theme: 2 # default: 2
……

上边文件改动之处在于:

host: pepstack.com
relative_url_root: /gitlab
email_from: cheungmine@qq.com
support_email: cheungmine@qq.com

上面包车型客车布局是因为要把gitlab置于nginx前面使用:

4.4 httpd-app.conf

<Directory “/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/public”>
    Options -MultiViews
    AllowOverride All
    <IfVersion < 2.3 >
        Order allow,deny
        Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
        Require all granted
    </IfVersion>

    SetEnv RAILS_RELATIVE_URL_ROOT “/gitlab”

    PassengerEnabled on
    PassengerAppRoot “/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/”
    <IfModule pagespeed_module>
        ModPagespeedDisallow “*”
    </IfModule>
    PassengerUser git
    PassengerGroup git
    SetEnv MAGIC
“/opt/gitlab-7.8.1-0/ruby/lib/ruby/gems/2.0.0/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/src/file-5.08/magic/magic.mgc”
    SetEnv PATH “/opt/gitlab-7.8.1-0/python/bin:${PATH}”

</Directory>
PassengerPreStart

分化之处在于:

SetEnv RAILS_RELATIVE_URL_ROOT “/gitlab”
PassengerPreStart

4.5 config.yml


gitlab_url:

那般大家访问gitlab就是遵照上边包车型地铁地址:

5 主机nginx配置

地点的配备都是在vm-gitlab上进行的,注意打开80:http端口。上面要给主机nginx增加安排,配置文件:

/etc/nginx/conf.d/redmine.conf

剧情如下(笔者还要还提供了redmine服务):

# 指向内网redmine的web服务(192.168.122.21:80)
#
upstream redmine {
    server 192.168.122.21:80;
}

upstream gitlab {
    server 192.168.122.20:80;
}

server {
    server_name pepstack.com;

    # /var/log/nginx 本地目录必须存在
    access_log  /var/log/nginx/redmine_access.log;
    error_log  /var/log/nginx/redmine_error.log;

    location /redmine {
        try_files $uri @red;      # @red 名字是随机的
    }

    location /gitlab {
        try_files $uri @git;
    }

    location @red {
        proxy_set_header  Host            $host;
        proxy_set_header  X-Real_IP        $remote_addr;
        proxy_set_header  X-Forwarded-For 
$proxy_add_x_forwarded_for;

        proxy_read_timeout    300;
        proxy_connect_timeout  300;
        proxy_redirect        off;

        proxy_pass ;  # 指向 upstream redmine
    }

    location @git {
        proxy_set_header  Host            $host;
        proxy_set_header  X-Real_IP        $remote_addr;
        proxy_set_header  X-Forwarded-For 
$proxy_add_x_forwarded_for;

        proxy_read_timeout    300;
        proxy_connect_timeout  300;
        proxy_redirect        off;

        proxy_pass ;  # 指向 upstream gitlab
    }
}

即注释掉:include /etc/nginx/sites-enabled/*;

6 运营服务

功勋卓著告成,在主机运维nginx:

$ sudo nginx -s reload

在vm-gitlab启动gitlab:

# cd /opt/gitlab-7.8.1-0/

# ./ctlscript.sh restart

4858.com 1

CentOS源码安装GitLab汉化版 
http://www.linuxidc.com/Linux/2015-10/124648.htm

在 Ubuntu 12.04 上安装
GitLab
http://www.linuxidc.com/Linux/2012-12/75249.htm

GitLab 5.3 升级注意事项
http://www.linuxidc.com/Linux/2013-06/86473.htm

在 CentOS 上配置 GitLab (自托管的Git项目仓库)
http://www.linuxidc.com/Linux/2013-06/85754.htm

在RHEL6/CentOS6/ScientificLinux6上安装GitLab 6.0.2
http://www.linuxidc.com/Linux/2014-03/97831.htm

CentOS 6.5安装GitLab教程及有关问题消除
http://www.linuxidc.com/Linux/2014-05/101526.htm

GitLab
的详尽介绍
:请点那里
GitLab
的下载地址
:请点那里

本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-11/124919.htm

4858.com 2

复制代码 代码如下:

复制代码 代码如下:

$rails server

$rails server

那样的话打开 就足以看看,Rails的欢迎界面Welcome
aboard,有点类似于Django-CMS的中国首富马化腾~~

那样的话打开 就能够看到,Rails的欢迎界面Welcome
aboard,有点类似于Django-CMS的马化腾(英文名:Pony)~~

4858.com 3

4858.com 4

创建controller

创建controller

如官方指南所说

如官方指南所说

执行命令:

执行命令:

复制代码 代码如下:

复制代码 代码如下:

$rails generate controller welcome index

$rails generate controller welcome index

就会创立上面这几个文件:

就会创立上面那一个文件:

复制代码 代码如下:

复制代码 代码如下:

  create  app/controllers/welcome_controller.rb
   route  get “welcome/index”
  invoke  erb
  create    app/views/welcome
  create    app/views/welcome/index.html.erb
  invoke  test_unit
  create    test/controllers/welcome_controller_test.rb
  invoke  helper
  create    app/helpers/welcome_helper.rb
  invoke    test_unit
  create      test/helpers/welcome_helper_test.rb
  invoke  assets
  invoke    coffee
  create      app/assets/javascripts/welcome.js.coffee
  invoke    scss
  create      app/assets/stylesheets/welcome.css.scss

  create  app/controllers/welcome_controller.rb
   route  get “welcome/index”
  invoke  erb
  create    app/views/welcome
  create    app/views/welcome/index.html.erb
  invoke  test_unit
  create    test/controllers/welcome_controller_test.rb
  invoke  helper
  create    app/helpers/welcome_helper.rb
  invoke    test_unit
  create      test/helpers/welcome_helper_test.rb
  invoke  assets
  invoke    coffee
  create      app/assets/javascripts/welcome.js.coffee
  invoke    scss
  create      app/assets/stylesheets/welcome.css.scss

在config/routes.rb添加默许页面

在config/routes.rb添加默许页面

复制代码 代码如下:

复制代码 代码如下:

root ‘welcome#index’

root ‘welcome#index’

再运行

再运行

复制代码 代码如下:

复制代码 代码如下:

rails server

rails server

就会并发

就汇合世

复制代码 代码如下:

复制代码 代码如下:

Welcome#index

Welcome#index

Find me in app/views/welcome/index.html.erb

Find me in app/views/welcome/index.html.erb

全体来得很快,很突兀。

全部来得十分的快,很突然。

你恐怕感兴趣的篇章:

  • 敏捷安装Ruby on
    Rails的醒目指南
  • win7安装ruby on
    rails开发条件
  • 在 Ubuntu 12.04 Server 上设置配备 Ruby on Rails
    应用
  • Windows下Ruby on
    Rails开发环境设置配备图像和文字教程
  • CentOS7下搭建ruby on
    rails开发条件
  • Ruby on
    Rails下的图像处理入门教程
  • 多少个加速Ruby on
    Rails的编制程序技巧
  • Ruby on rails安装后去掉DL is deprecated,please use
    Fiddle警告音讯的情势【测试可用】

Rails 4 安装 针对于安装了SportageVM 复制代码…

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图
Copyright @ 2010-2019 美高梅手机版4858 版权所有