ubuntu 16.04 i386 安装 ruby + bundler + rails ; 搭建简单的网站bitbar
阅读原文时间:2023年07月09日阅读:1

参考

http://gorails.com/setup/ubuntu/16.04

概述

Project 2 主要探究对web的攻击,本次试验共有6个部分。

Project 2中攻击的是一个提供电子货币服务网站--bitbar(使用ruby 2.4和rails 5.0.2实现)。

bitbar网站的搭建:

服务器环境搭建

安装Ruby2.4和rails 5.0.2

http://gorails.com/setup/ubuntu/16.04

按照上面网址的布置安装Ruby 2.4和rail 5.0.2(安装正确的版本非常重要)。可以跳过MySQL和PostgreSQL部分。

下载实验提供的project 2源码

重定位到/bitbar目录下,执行bundle install

开启服务器 (rails server)

以上的步骤执行完后,你可以在http://localhost:3000上访问bitbar。如果要关闭服务器,可以在终端上执行Ctrl+C。在攻击的过程中,你不允许对网站的源码进行修改

环境:

Ubuntu16.04 i386

Virtual box

后来安装rails 时报错:

ERROR:  Error installing rails:

sprockets requires Ruby version >= 2.5.0.

改为

Ruby 2.5.0

Rails 5.0.7.2

一 ruby 2.5.0 +rails 5.0.7.2

先ruby

遇到问题

sudo systemctl --force --force reboot

解决

sudo systemctl --force --force reboot

sudo apt install curl

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt-get update

sudo apt-get install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn

注意apt 换源:

https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

备份原来的源:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

更换源:

sudo vim /etc/apt/sources.list

sudo apt-get update

git clone
https://github.com/rbenv/rbenv.git ~/.rbenv

echo
'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc

echo
'eval "$(rbenv init -)"' >> ~/.bashrc

exec
$SHELL

git clone
https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build

echo
'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >>
~/.bashrc

exec
$SHELL

rbenv
install 2.5.0

rbenv
global 2.5.0

ruby -v

gem install bundler

rbenv rehash

1、gem install rails -v 5.0.7.2

2、如果您使用的是rbenv,则需要运行以下命令以使Rails可执行文件可用:

rbenv rehash

3、rails -v

# Rails 5.0.7.2

4、创建您的第一个Rails应用程序:

#### If you want to use SQLite (not
recommended)

rails new myapp

You can now visit http://localhost:3000 to view your new website!

二 搭建bitbar

  1. 压缩文件夹为  bitbar.zip
  2. Ubuntu   unzip bitbar.zip
  3. Cd bitbar .zip
  4. Bundle install

原因是本地bundler版本和项目不一致

参考

https://bundler.io/blog/2019/05/14/solutions-for-cant-find-gem-bundler-with-executable-bundle.html

https://stackoverflow.com/questions/54087856/bundler-cant-find-gem-bundler-0-a-with-executable-bundle-gemgemnotfoun

删除项目的gemfile.lock的bundler版本即可

三 启动服务器

在 /bitbar

Rails server

http://localhost:3000上访问bitbar

终端Ctrl+c关闭服务器

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器