新型MacBook Proが出そうですね。
そんな最中僕も2017年のMacBook Pro 15inchの現行最高スペックモデルを買いましたわ。
早速仮想環境を立てて、Railsのプロジェクトを動かしてみた。
パッケージ管理ツール
Homebrew
まず一番最初に入れとけってやつ。
ワイはChromeの次だけど。
qiita.com
Last login: Sun Jul 1 09:48:19 on console
TakunoMacBook-puro:~ a3ae10511$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following new directories will be created:
/usr/local/Cellar
/usr/local/Homebrew
/usr/local/Frameworks
/usr/local/bin
/usr/local/etc
/usr/local/include
/usr/local/lib
/usr/local/opt
/usr/local/sbin
/usr/local/share
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var
==> The Xcode Command Line Tools will be installed.
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir -p /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
Password:
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown a3ae10511 /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /bin/mkdir -p /Users/a3ae10511/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/a3ae10511/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown a3ae10511 /Users/a3ae10511/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/mkdir -p /Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown a3ae10511 /Library/Caches/Homebrew
==> Searching online for the Command Line Tools
==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
==> Installing Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.4
==> /usr/bin/sudo /usr/sbin/softwareupdate -i Command\ Line\ Tools\ (macOS\ High\ Sierra\ version\ 10.13)\ for\ Xcode-9.4
Software Update Tool
Downloading Command Line Tools (macOS High Sierra version 10.13) for Xcode
Downloaded Command Line Tools (macOS High Sierra version 10.13) for Xcode
Installing Command Line Tools (macOS High Sierra version 10.13) for Xcode
Done with Command Line Tools (macOS High Sierra version 10.13) for Xcode
Done.
==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
==> /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
==> Downloading and installing Homebrew...
remote: Counting objects: 103939, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 103939 (delta 0), reused 1 (delta 0), pack-reused 103937
Receiving objects: 100% (103939/103939), 23.65 MiB | 88.00 KiB/s, done.
Resolving deltas: 100% (75837/75837), done.
From https://github.com/Homebrew/brew
* [new branch] master -> origin/master
* [new tag] 0.1 -> 0.1
* [new tag] 0.2 -> 0.2
* [new tag] 0.3 -> 0.3
* [new tag] 0.4 -> 0.4
* [new tag] 0.5 -> 0.5
* [new tag] 0.6 -> 0.6
* [new tag] 0.7 -> 0.7
* [new tag] 0.7.1 -> 0.7.1
* [new tag] 0.8 -> 0.8
* [new tag] 0.8.1 -> 0.8.1
* [new tag] 0.9 -> 0.9
* [new tag] 0.9.1 -> 0.9.1
* [new tag] 0.9.2 -> 0.9.2
* [new tag] 0.9.3 -> 0.9.3
* [new tag] 0.9.4 -> 0.9.4
* [new tag] 0.9.5 -> 0.9.5
* [new tag] 0.9.8 -> 0.9.8
* [new tag] 0.9.9 -> 0.9.9
* [new tag] 1.0.0 -> 1.0.0
* [new tag] 1.0.1 -> 1.0.1
* [new tag] 1.0.2 -> 1.0.2
* [new tag] 1.0.3 -> 1.0.3
* [new tag] 1.0.4 -> 1.0.4
* [new tag] 1.0.5 -> 1.0.5
* [new tag] 1.0.6 -> 1.0.6
* [new tag] 1.0.7 -> 1.0.7
* [new tag] 1.0.8 -> 1.0.8
* [new tag] 1.0.9 -> 1.0.9
* [new tag] 1.1.0 -> 1.1.0
* [new tag] 1.1.1 -> 1.1.1
* [new tag] 1.1.10 -> 1.1.10
* [new tag] 1.1.11 -> 1.1.11
* [new tag] 1.1.12 -> 1.1.12
* [new tag] 1.1.13 -> 1.1.13
* [new tag] 1.1.2 -> 1.1.2
* [new tag] 1.1.3 -> 1.1.3
* [new tag] 1.1.4 -> 1.1.4
* [new tag] 1.1.5 -> 1.1.5
* [new tag] 1.1.6 -> 1.1.6
* [new tag] 1.1.7 -> 1.1.7
* [new tag] 1.1.8 -> 1.1.8
* [new tag] 1.1.9 -> 1.1.9
* [new tag] 1.2.0 -> 1.2.0
* [new tag] 1.2.1 -> 1.2.1
* [new tag] 1.2.2 -> 1.2.2
* [new tag] 1.2.3 -> 1.2.3
* [new tag] 1.2.4 -> 1.2.4
* [new tag] 1.2.5 -> 1.2.5
* [new tag] 1.2.6 -> 1.2.6
* [new tag] 1.3.0 -> 1.3.0
* [new tag] 1.3.1 -> 1.3.1
* [new tag] 1.3.2 -> 1.3.2
* [new tag] 1.3.3 -> 1.3.3
* [new tag] 1.3.4 -> 1.3.4
* [new tag] 1.3.5 -> 1.3.5
* [new tag] 1.3.6 -> 1.3.6
* [new tag] 1.3.7 -> 1.3.7
* [new tag] 1.3.8 -> 1.3.8
* [new tag] 1.3.9 -> 1.3.9
* [new tag] 1.4.0 -> 1.4.0
* [new tag] 1.4.1 -> 1.4.1
* [new tag] 1.4.2 -> 1.4.2
* [new tag] 1.4.3 -> 1.4.3
* [new tag] 1.5.0 -> 1.5.0
* [new tag] 1.5.1 -> 1.5.1
* [new tag] 1.5.10 -> 1.5.10
* [new tag] 1.5.11 -> 1.5.11
* [new tag] 1.5.12 -> 1.5.12
* [new tag] 1.5.13 -> 1.5.13
* [new tag] 1.5.14 -> 1.5.14
* [new tag] 1.5.2 -> 1.5.2
* [new tag] 1.5.3 -> 1.5.3
* [new tag] 1.5.4 -> 1.5.4
* [new tag] 1.5.5 -> 1.5.5
* [new tag] 1.5.6 -> 1.5.6
* [new tag] 1.5.7 -> 1.5.7
* [new tag] 1.5.8 -> 1.5.8
* [new tag] 1.5.9 -> 1.5.9
* [new tag] 1.6.0 -> 1.6.0
* [new tag] 1.6.1 -> 1.6.1
* [new tag] 1.6.2 -> 1.6.2
* [new tag] 1.6.3 -> 1.6.3
* [new tag] 1.6.4 -> 1.6.4
* [new tag] 1.6.5 -> 1.6.5
* [new tag] 1.6.6 -> 1.6.6
* [new tag] 1.6.7 -> 1.6.7
* [new tag] 1.6.8 -> 1.6.8
* [new tag] 1.6.9 -> 1.6.9
HEAD is now at 4840b688e Merge pull request #4429 from MikeMcQuaid/linkage-optional-deps
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 4801, done.
remote: Compressing objects: 100% (4597/4597), done.
remote: Total 4801 (delta 55), reused 550 (delta 13), pack-reused 0
Receiving objects: 100% (4801/4801), 3.90 MiB | 212.00 KiB/s, done.
Resolving deltas: 100% (55/55), done.
Tapped 4586 formulae (4,842 files, 12.2MB)
==> Cleaning up /Library/Caches/Homebrew...
==> Migrating /Library/Caches/Homebrew to /Users/a3ae10511/Library/Caches/Homebrew...
==> Deleting /Library/Caches/Homebrew...
Already up-to-date.
==> Installation successful!
==> Homebrew has enabled anonymous aggregate user behaviour analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics.html
==> Next steps:
- Run `brew help` to get started
- Further documentation:
https://docs.brew.sh
TakunoMacBook-puro:~ a3ae10511$
ちなみにこの辺を入れようと思ってる。
けど、とりあえず新品Macの環境汚したくないので仮想環境に入れるだけ入れる(日和)。
brew install vim
brew install tig
brew install mysql
brew install tree
brew install git
brew cask install virtualbox
brew cask install docker
brew cask install vagrant
brew cask install iterm2
brew cask install sublime-text
brew cask install gyazo
brew cask install postman #APIのレスポンスをURLを貼り付けることで簡単に分かるツール
brew cask install funter #finderでは非表示になっているドットファイルが表示できる
brew cask install sourcetree #GUIでgitを操作できる
brew cask install mysqlworkbench #MySQLのER図作成出来たりと色々便利
brew cask install alfred
brew cask install slack
brew cask install 1password
TakunoMacBook-puro:~ a3ae10511$ brew cask install vagrant
==> Tapping homebrew/cask
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask'...
remote: Counting objects: 4087, done.
remote: Compressing objects: 100% (4069/4069), done.
remote: Total 4087 (delta 24), reused 688 (delta 14), pack-reused 0
Receiving objects: 100% (4087/4087), 1.28 MiB | 78.00 KiB/s, done.
Resolving deltas: 100% (24/24), done.
Tapped 0 formulae (4,096 files, 4MB)
==> Satisfying dependencies
==> Downloading https://releases.hashicorp.com/vagrant/2.1.2/vagrant_2.1.2_x86_64.dmg
######################################################################## 100.0%
==> Verifying checksum for Cask vagrant
==> Installing Cask vagrant
==> Creating Caskroom at /usr/local/Caskroom
==> We'll set permissions properly so we won't need sudo in the future.
Password:
==> Running installer for vagrant; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
installer: Package name is Vagrant
installer: Installing at base path /
installer: The install was successful.
🍺 vagrant was successfully installed!
問題なくインストール完了。
TakunoMacBook-puro:~ a3ae10511$ brew cask install virtualbox
==> Caveats
To install and/or use virtualbox you may need to enable their kernel extension in
System Preferences → Security & Privacy → General
For more information refer to vendor documentation or the Apple Technical Note:
https://developer.apple.com/library/content/technotes/tn2459/_index.html
==> Satisfying dependencies
==> Downloading https://download.virtualbox.org/virtualbox/5.2.14/VirtualBox-5.2.14-123301-OSX.dmg
######################################################################## 100.0%
==> Verifying checksum for Cask virtualbox
==> Installing Cask virtualbox
==> Running installer for virtualbox; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
installer: Package name is Oracle VM VirtualBox
installer: Installing at base path /
installer: The install failed (エラーによってインストールできませんでした。ソフトウェアの製造元に問い合わせてください。)
==> Purging files for version 5.2.14,123301 of Cask virtualbox
Error: Command failed to execute!
==> Failed command:
/usr/bin/sudo -E -- /usr/sbin/installer -pkg /usr/local/Caskroom/virtualbox/5.2.14,123301/VirtualBox.pkg -target /
==> Standard Output of failed command:
installer: Package name is Oracle VM VirtualBox
installer: Installing at base path /
installer: The install failed (エラーによってインストールできませんでした。ソフトウェアの製造元に問い合わせてください。)
==> Standard Error of failed command:
==> Exit status of failed command:
#<Process::Status: pid 5819 exit 1>
エラーっぽいけど、アプリには入っていたので放置。
なんか起きてから考える。
仮想環境用のディレクトリを切る。
TakunoMacBook-puro:~ a3ae10511$ ls -la
total 32
drwxr-xr-x+ 15 a3ae10511 staff 480 7 6 23:22 .
drwxr-xr-x 5 root admin 160 7 1 09:48 ..
-r-------- 1 a3ae10511 staff 7 7 1 09:48 .CFUserTextEncoding
-rw-r--r--@ 1 a3ae10511 staff 8196 7 6 06:35 .DS_Store
drwx------ 2 a3ae10511 staff 64 7 1 09:49 .Trash
drwx------ 3 a3ae10511 staff 96 7 6 23:22 .bash_sessions
drwx------@ 3 a3ae10511 staff 96 7 1 09:52 Applications
drwx------+ 3 a3ae10511 staff 96 7 1 09:48 Desktop
drwx------+ 3 a3ae10511 staff 96 7 1 09:48 Documents
drwx------+ 6 a3ae10511 staff 192 7 6 23:08 Downloads
drwx------@ 59 a3ae10511 staff 1888 7 6 23:37 Library
drwx------+ 3 a3ae10511 staff 96 7 1 09:48 Movies
drwx------+ 3 a3ae10511 staff 96 7 1 09:48 Music
drwx------+ 3 a3ae10511 staff 96 7 1 09:48 Pictures
drwxr-xr-x+ 4 a3ae10511 staff 128 7 1 09:48 Public
TakunoMacBook-puro:~ a3ae10511$ pwd
/Users/a3ae10511
TakunoMacBook-puro:~ a3ae10511$ mkdir ~/vagrant/ubuntu64
mkdir: /Users/a3ae10511/vagrant: No such file or directory
TakunoMacBook-puro:~ a3ae10511$ mkdir -r ~/vagrant/ubuntu64
mkdir: illegal option -- r
usage: mkdir [-pv] [-m mode] directory ...
TakunoMacBook-puro:~ a3ae10511$ mkdir -R ~/vagrant/ubuntu64
mkdir: illegal option -- R
usage: mkdir [-pv] [-m mode] directory ...
TakunoMacBook-puro:~ a3ae10511$ mkdir
usage: mkdir [-pv] [-m mode] directory ...
TakunoMacBook-puro:~ a3ae10511$ mkdir vagrant
TakunoMacBook-puro:~ a3ae10511$ ls -la
total 32
drwxr-xr-x+ 16 a3ae10511 staff 512 7 6 23:44 .
drwxr-xr-x 5 root admin 160 7 1 09:48 ..
-r-------- 1 a3ae10511 staff 7 7 1 09:48 .CFUserTextEncoding
-rw-r--r--@ 1 a3ae10511 staff 8196 7 6 06:35 .DS_Store
drwx------ 2 a3ae10511 staff 64 7 1 09:49 .Trash
drwx------ 3 a3ae10511 staff 96 7 6 23:22 .bash_sessions
drwx------@ 3 a3ae10511 staff 96 7 1 09:52 Applications
drwx------+ 3 a3ae10511 staff 96 7 1 09:48 Desktop
drwx------+ 3 a3ae10511 staff 96 7 1 09:48 Documents
drwx------+ 6 a3ae10511 staff 192 7 6 23:08 Downloads
drwx------@ 59 a3ae10511 staff 1888 7 6 23:37 Library
drwx------+ 3 a3ae10511 staff 96 7 1 09:48 Movies
drwx------+ 3 a3ae10511 staff 96 7 1 09:48 Music
drwx------+ 3 a3ae10511 staff 96 7 1 09:48 Pictures
drwxr-xr-x+ 4 a3ae10511 staff 128 7 1 09:48 Public
drwxr-xr-x 2 a3ae10511 staff 64 7 6 23:44 vagrant
TakunoMacBook-puro:~ a3ae10511$ cd vagrant/
TakunoMacBook-puro:vagrant a3ae10511$ mkdir ubuntu64
TakunoMacBook-puro:vagrant a3ae10511$ cd ubuntu64/
TakunoMacBook-puro:ubuntu64 a3ae10511$ ls -la
total 0
drwxr-xr-x 2 a3ae10511 staff 64 7 6 23:44 .
drwxr-xr-x 3 a3ae10511 staff 96 7 6 23:44 ..
TakunoMacBook-puro:ubuntu64 a3ae10511$ pwd
/Users/a3ae10511/vagrant/ubuntu64
途中バカ丸出しなことしてたw
仮想環境構築
先ほどのアプリがインストールできたら早速環境構築していく。
特にこだわりはなかったけど、現場でUbuntu14.04 + VirtualBox + Vagrantを利用しているのでその環境セットに近いものをググってそのまま使う。
あと意識したのは、なるべく記事作成した日が近いエントリ。
qiita.com
box: Progress: 18% (Rate: 33760/s, Estimated time remaining: 0:57:19)
↑こんな感じでクソネットワーク遅かったw
TakunoMacBook-puro:ubuntu64 a3ae10511$ vagrant box add ubuntu/xenial64 https://vagrantcloud.com/ubuntu/boxes/xenial64/versions/20170929.0.0/providers/virtualbox.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'ubuntu/xenial64' (v0) for provider:
box: Downloading: https://vagrantcloud.com/ubuntu/boxes/xenial64/versions/20170929.0.0/providers/virtualbox.box
box: Download redirected to host: cloud-images.ubuntu.com
==> box: Successfully added box 'ubuntu/xenial64' (v0) for 'virtualbox'!
TakunoMacBook-puro:ubuntu64 a3ae10511$ vagrant init ubuntu/xenia164
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
TakunoMacBook-puro:ubuntu64 a3ae10511$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/xenia164' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
The box 'ubuntu/xenia164' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Vagrant Cloud, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:
URL: ["https://vagrantcloud.com/ubuntu/xenia164"]
Error: The requested URL returned error: 404 Not Found
怒られた。
Vagrantfileの以下のコメントアウトを消す。
qiita.com
- config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
- config.vm.network "private_network", ip: "192.168.33.10"
これでもダメ。
ググった。これっぽい。
qiita.com
てか、、、
vagrant init ubuntu/xenia164のときの"xenia164"とvagrant box addのときの"ubuntu/xenial64"スペル違くね問題。
TakunoMacBook-puro:ubuntu64 a3ae10511$ rm Vagrantfile
TakunoMacBook-puro:ubuntu64 a3ae10511$ vagrant init ubuntu/xenial64
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
TakunoMacBook-puro:ubuntu64 a3ae10511$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/xenial64'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: ubuntu64_default_1530892758802_6591
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:
https://www.virtualbox.org/manual/ch04.html#sharedfolders
This option can be disabled globally with an environment variable:
VAGRANT_DISABLE_VBOXSYMLINKCREATE=1
or on a per folder basis within the Vagrantfile:
config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["startvm", "f00d859d-d8ce-47f9-824f-7169c58b7dc9", "--type", "headless"]
Stderr: VBoxManage: error: The virtual machine 'ubuntu64_default_1530892758802_6591' has terminated unexpectedly during startup with exit code 1 (0x1)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine
とりあえず進んだっぽいがまだエラー。
どうやらVirtualBoxのバージョンが古い問題。
というかやはりVirtualBoxのインストール時にエラー起こしてたからそれなんじゃ問題。
多分権限とかの問題だと思うんだが。
skkskynw.hateblo.jp
ググると以下の設定をする必要があるよう。
「システム環境設定」→「セキュリティとプライバシー」→「一般」でインストールの許可
でもう一度。
TakunoMacBook-puro:ubuntu64 a3ae10511$ brew cask install virtualbox
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
No changes to formulae.
==> Caveats
To install and/or use virtualbox you may need to enable their kernel extension in
System Preferences → Security & Privacy → General
For more information refer to vendor documentation or the Apple Technical Note:
https://developer.apple.com/library/content/technotes/tn2459/_index.html
==> Satisfying dependencies
==> Downloading https://download.virtualbox.org/virtualbox/5.2.14/VirtualBox-5.2.14-123301-OSX.dmg
Already downloaded: /Users/a3ae10511/Library/Caches/Homebrew/Cask/virtualbox--5.2.14,123301.dmg
==> Verifying checksum for Cask virtualbox
==> Installing Cask virtualbox
==> Running installer for virtualbox; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password:
installer: Package name is Oracle VM VirtualBox
installer: Installing at base path /
installer: The install was successful.
🍺 virtualbox was successfully installed!
やっとできた。
再度Vagrantfileを作成して、vagrant init。
TakunoMacBook-puro:ubuntu64 a3ae10511$ brew cask list
vagrant virtualbox
TakunoMacBook-puro:ubuntu64 a3ae10511$ brew list
TakunoMacBook-puro:ubuntu64 a3ae10511$ ls -la
total 8
drwxr-xr-x 4 a3ae10511 staff 128 7 7 00:59 .
drwxr-xr-x 3 a3ae10511 staff 96 7 6 23:44 ..
drwxr-xr-x 3 a3ae10511 staff 96 7 7 00:38 .vagrant
-rw-r--r-- 1 a3ae10511 staff 3022 7 7 00:59 Vagrantfile
TakunoMacBook-puro:ubuntu64 a3ae10511$ rm Vagrantfile
TakunoMacBook-puro:ubuntu64 a3ae10511$ vagrant init ubuntu/xenial64
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
TakunoMacBook-puro:ubuntu64 a3ae10511$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 5.1.34
default: VirtualBox Version: 5.2
==> default: Mounting shared folders...
default: /vagrant => /Users/a3ae10511/vagrant/ubuntu64
無事立ち上がったので、vagrant ssh。
TakunoMacBook-puro:ubuntu64 a3ae10511$ vagrant ssh
Welcome to Ubuntu 16.04.4 LTS (GNU/Linux 4.4.0-130-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
0 packages can be updated.
0 updates are security updates.
vagrant@ubuntu-xenial:~$
できた。
最後にVagrantfileの共有フォルダ設定をする。
vagrant@ubuntu-xenial:~$ mkdir tmp
vagrant@ubuntu-xenial:~$ pwd
/home/vagrant
vagrant@ubuntu-xenial:~$ exit
logout
Connection to 127.0.0.1 closed.
TakunoMacBook-puro:ubuntu64 a3ae10511$ vi
.vagrant/ Vagrantfile ubuntu-xenial-16.04-cloudimg-console.log
TakunoMacBook-puro:ubuntu64 a3ae10511$ vi Vagrantfile
いったんターミナルを再起動して、pingうって通るか確認する。
問題なく通れば、共有ファイル設定OK。
では仮想環境ができたので、Ubuntuにアプリを入れていく。
rbenv
まずはここから。
vagrant@ubuntu-xenial:~$ ruby -v
The program 'ruby' is currently not installed. To run 'ruby' please ask your administrator to install the package 'ruby'
vagrant@ubuntu-xenial:~$ sudo apt-get install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
git is already the newest version (1:2.7.4-0ubuntu1.4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
vagrant@ubuntu-xenial:~$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
Cloning into '/home/vagrant/.rbenv'...
remote: Counting objects: 2737, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 2737 (delta 11), reused 17 (delta 10), pack-reused 2714
Receiving objects: 100% (2737/2737), 518.23 KiB | 948.00 KiB/s, done.
Resolving deltas: 100% (1711/1711), done.
Checking connectivity... done.
vagrant@ubuntu-xenial:~$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
Rubyは当然入っていないのでrbenvをgit cloneしてくる。
vagrant@ubuntu-xenial:~$ vi ~/.bashrc
vagrant@ubuntu-xenial:~$ source ~/.bashrc
eval "$(rbenv init -)"
を記述する。
とりあえずよくわかってないけど、ruby-buildなるものを入れる。
vagrant@ubuntu-xenial:~$ mkdir -p "$(rbenv root)"/plugins
vagrant@ubuntu-xenial:~$ git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
Cloning into '/home/vagrant/.rbenv/plugins/ruby-build'...
remote: Counting objects: 8922, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 8922 (delta 0), reused 2 (delta 0), pack-reused 8918
Receiving objects: 100% (8922/8922), 1.86 MiB | 1008.00 KiB/s, done.
Resolving deltas: 100% (5738/5738), done.
Checking connectivity... done.
vagrant@ubuntu-xenial:~$ sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgdbm3 is already the newest version (1.8.3-13.1).
The following additional packages will be installed:
automake autotools-dev binutils cpp cpp-5 dpkg-dev fakeroot g++ g++-5 gcc gcc-5 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan2 libatomic1 libbison-dev libc-dev-bin libc6-dev libcc1-0 libcilkrts5
libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-5-dev libgomp1 libisl15 libitm1 liblsan0 libmpc3 libmpx0 libquadmath0 libssl-doc libstdc++-5-dev libtinfo-dev libtsan0 libubsan0 linux-libc-dev m4 make manpages-dev
Suggested packages:
autoconf-archive gnu-standards autoconf-doc libtool gettext binutils-doc bison-doc cpp-doc gcc-5-locales debian-keyring g++-multilib g++-5-multilib gcc-5-doc libstdc++6-5-dbg gcc-multilib flex gdb gcc-doc gcc-5-multilib libgcc1-dbg
libgomp1-dbg libitm1-dbg libatomic1-dbg libasan2-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx0-dbg libquadmath0-dbg glibc-doc ncurses-doc readline-doc libstdc++-5-doc libyaml-doc make-doc
The following NEW packages will be installed:
autoconf automake autotools-dev binutils bison build-essential cpp cpp-5 dpkg-dev fakeroot g++ g++-5 gcc gcc-5 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan2 libatomic1 libbison-dev libc-dev-bin
libc6-dev libcc1-0 libcilkrts5 libdpkg-perl libfakeroot libffi-dev libfile-fcntllock-perl libgcc-5-dev libgdbm-dev libgomp1 libisl15 libitm1 liblsan0 libmpc3 libmpx0 libncurses5-dev libquadmath0 libreadline6-dev libssl-dev libssl-doc
libstdc++-5-dev libtinfo-dev libtsan0 libubsan0 libyaml-dev linux-libc-dev m4 make manpages-dev zlib1g-dev
0 upgraded, 51 newly installed, 0 to remove and 0 not upgraded.
Need to get 43.1 MB of archives.
After this operation, 163 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 libmpc3 amd64 1.0.3-1 [39.7 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial/main amd64 m4 amd64 1.4.17-5 [195 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 autoconf all 2.69-9 [321 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial/main amd64 autotools-dev all 20150820.1 [39.8 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial/main amd64 automake all 1:1.15-4ubuntu1 [510 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 binutils amd64 2.26.1-1ubuntu1~16.04.6 [2,311 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial/main amd64 libbison-dev amd64 2:3.0.4.dfsg-1 [338 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/main amd64 bison amd64 2:3.0.4.dfsg-1 [259 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libc-dev-bin amd64 2.23-0ubuntu10 [68.7 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-libc-dev amd64 4.4.0-130.156 [866 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libc6-dev amd64 2.23-0ubuntu10 [2,079 kB]
Get:12 http://archive.ubuntu.com/ubuntu xenial/main amd64 libisl15 amd64 0.16.1-1 [524 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 cpp-5 amd64 5.4.0-6ubuntu1~16.04.10 [7,671 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial/main amd64 cpp amd64 4:5.3.1-1ubuntu1 [27.7 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libcc1-0 amd64 5.4.0-6ubuntu1~16.04.10 [38.8 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libgomp1 amd64 5.4.0-6ubuntu1~16.04.10 [55.1 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libitm1 amd64 5.4.0-6ubuntu1~16.04.10 [27.4 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libatomic1 amd64 5.4.0-6ubuntu1~16.04.10 [8,888 B]
Get:19 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libasan2 amd64 5.4.0-6ubuntu1~16.04.10 [264 kB]
Get:20 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 liblsan0 amd64 5.4.0-6ubuntu1~16.04.10 [105 kB]
Get:21 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libtsan0 amd64 5.4.0-6ubuntu1~16.04.10 [244 kB]
Get:22 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libubsan0 amd64 5.4.0-6ubuntu1~16.04.10 [95.3 kB]
Get:23 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libcilkrts5 amd64 5.4.0-6ubuntu1~16.04.10 [40.1 kB]
Get:24 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libmpx0 amd64 5.4.0-6ubuntu1~16.04.10 [9,764 B]
Get:25 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libquadmath0 amd64 5.4.0-6ubuntu1~16.04.10 [131 kB]
Get:26 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libgcc-5-dev amd64 5.4.0-6ubuntu1~16.04.10 [2,228 kB]
Get:27 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 gcc-5 amd64 5.4.0-6ubuntu1~16.04.10 [8,426 kB]
Get:28 http://archive.ubuntu.com/ubuntu xenial/main amd64 gcc amd64 4:5.3.1-1ubuntu1 [5,244 B]
Get:29 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libstdc++-5-dev amd64 5.4.0-6ubuntu1~16.04.10 [1,426 kB]
Get:30 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 g++-5 amd64 5.4.0-6ubuntu1~16.04.10 [8,319 kB]
Get:31 http://archive.ubuntu.com/ubuntu xenial/main amd64 g++ amd64 4:5.3.1-1ubuntu1 [1,504 B]
Get:32 http://archive.ubuntu.com/ubuntu xenial/main amd64 make amd64 4.1-6 [151 kB]
Get:33 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libdpkg-perl all 1.18.4ubuntu1.4 [195 kB]
Get:34 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 dpkg-dev all 1.18.4ubuntu1.4 [584 kB]
Get:35 http://archive.ubuntu.com/ubuntu xenial/main amd64 build-essential amd64 12.1ubuntu2 [4,758 B]
Get:36 http://archive.ubuntu.com/ubuntu xenial/main amd64 libfakeroot amd64 1.20.2-1ubuntu1 [25.5 kB]
Get:37 http://archive.ubuntu.com/ubuntu xenial/main amd64 fakeroot amd64 1.20.2-1ubuntu1 [61.8 kB]
Get:38 http://archive.ubuntu.com/ubuntu xenial/main amd64 libalgorithm-diff-perl all 1.19.03-1 [47.6 kB]
Get:39 http://archive.ubuntu.com/ubuntu xenial/main amd64 libalgorithm-diff-xs-perl amd64 0.04-4build1 [11.0 kB]
Get:40 http://archive.ubuntu.com/ubuntu xenial/main amd64 libalgorithm-merge-perl all 0.08-3 [12.0 kB]
Get:41 http://archive.ubuntu.com/ubuntu xenial/main amd64 libfile-fcntllock-perl amd64 0.22-3 [32.0 kB]
Get:42 http://archive.ubuntu.com/ubuntu xenial/main amd64 libgdbm-dev amd64 1.8.3-13.1 [35.9 kB]
Get:43 http://archive.ubuntu.com/ubuntu xenial/main amd64 libtinfo-dev amd64 6.0+20160213-1ubuntu1 [77.4 kB]
87% [Working] 28.2 kB/s 3min 2s^Get:44 http://archive.ubuntu.com/ubuntu xenial/main amd64 libncurses5-dev amd64 6.0+20160213-1ubuntu1 [175 kB]
87% [44 libncurses5-dev 0 B/175 kB 0%] 28.2 kB/s 3min 2s^Get:45 http://archive.ubuntu.com/ubuntu xenial/main amd64 libreadline6-dev amd64 6.3-8ubuntu2 [124 kB]
Get:46 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 zlib1g-dev amd64 1:1.2.8.dfsg-2ubuntu4.1 [168 kB]
Get:47 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libssl-dev amd64 1.0.2g-1ubuntu4.13 [1,342 kB]
90% [47 libssl-dev 565 kB/1,342 kB 42%] 70.0 kB/s 58s^91% [47 libssl-dev 854 kB/1,342 kB 64%] 70.0 kB/s 54s^Get:48 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libssl-doc all 1.0.2g-1ubuntu4.13 [1,079 kB]
Get:49 http://archive.ubuntu.com/ubuntu xenial/main amd64 manpages-dev all 4.04-2 [2,048 kB]
Get:50 http://archive.ubuntu.com/ubuntu xenial/main amd64 libffi-dev amd64 3.2.1-4 [161 kB]
Get:51 http://archive.ubuntu.com/ubuntu xenial/main amd64 libyaml-dev amd64 0.1.6-3 [55.2 kB]
Fetched 43.1 MB in 1min 34s (454 kB/s)
Extracting templates from packages: 100%
Selecting previously unselected package libmpc3:amd64.
(Reading database ... 54133 files and directories currently installed.)
Preparing to unpack .../libmpc3_1.0.3-1_amd64.deb ...
Unpacking libmpc3:amd64 (1.0.3-1) ...
Selecting previously unselected package m4.
Preparing to unpack .../archives/m4_1.4.17-5_amd64.deb ...
Unpacking m4 (1.4.17-5) ...
Selecting previously unselected package autoconf.
Preparing to unpack .../autoconf_2.69-9_all.deb ...
Unpacking autoconf (2.69-9) ...
Selecting previously unselected package autotools-dev.
Preparing to unpack .../autotools-dev_20150820.1_all.deb ...
Unpacking autotools-dev (20150820.1) ...
Selecting previously unselected package automake.
Preparing to unpack .../automake_1%3a1.15-4ubuntu1_all.deb ...
Unpacking automake (1:1.15-4ubuntu1) ...
Selecting previously unselected package binutils.
Preparing to unpack .../binutils_2.26.1-1ubuntu1~16.04.6_amd64.deb ...
Unpacking binutils (2.26.1-1ubuntu1~16.04.6) ...
Selecting previously unselected package libbison-dev:amd64.
Preparing to unpack .../libbison-dev_2%3a3.0.4.dfsg-1_amd64.deb ...
Unpacking libbison-dev:amd64 (2:3.0.4.dfsg-1) ...
Selecting previously unselected package bison.
Preparing to unpack .../bison_2%3a3.0.4.dfsg-1_amd64.deb ...
Unpacking bison (2:3.0.4.dfsg-1) ...
Selecting previously unselected package libc-dev-bin.
Preparing to unpack .../libc-dev-bin_2.23-0ubuntu10_amd64.deb ...
Unpacking libc-dev-bin (2.23-0ubuntu10) ...
Selecting previously unselected package linux-libc-dev:amd64.
Preparing to unpack .../linux-libc-dev_4.4.0-130.156_amd64.deb ...
Unpacking linux-libc-dev:amd64 (4.4.0-130.156) ...
Selecting previously unselected package libc6-dev:amd64.
Preparing to unpack .../libc6-dev_2.23-0ubuntu10_amd64.deb ...
Unpacking libc6-dev:amd64 (2.23-0ubuntu10) ...
Selecting previously unselected package libisl15:amd64.
Preparing to unpack .../libisl15_0.16.1-1_amd64.deb ...
Unpacking libisl15:amd64 (0.16.1-1) ...
Selecting previously unselected package cpp-5.
Preparing to unpack .../cpp-5_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking cpp-5 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package cpp.
Preparing to unpack .../cpp_4%3a5.3.1-1ubuntu1_amd64.deb ...
Unpacking cpp (4:5.3.1-1ubuntu1) ...
Selecting previously unselected package libcc1-0:amd64.
Preparing to unpack .../libcc1-0_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking libcc1-0:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package libgomp1:amd64.
Preparing to unpack .../libgomp1_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking libgomp1:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package libitm1:amd64.
Preparing to unpack .../libitm1_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking libitm1:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package libatomic1:amd64.
Preparing to unpack .../libatomic1_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking libatomic1:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package libasan2:amd64.
Preparing to unpack .../libasan2_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking libasan2:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package liblsan0:amd64.
Preparing to unpack .../liblsan0_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking liblsan0:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package libtsan0:amd64.
Preparing to unpack .../libtsan0_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking libtsan0:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package libubsan0:amd64.
Preparing to unpack .../libubsan0_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking libubsan0:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package libcilkrts5:amd64.
Preparing to unpack .../libcilkrts5_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking libcilkrts5:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package libmpx0:amd64.
Preparing to unpack .../libmpx0_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking libmpx0:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package libquadmath0:amd64.
Preparing to unpack .../libquadmath0_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking libquadmath0:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package libgcc-5-dev:amd64.
Preparing to unpack .../libgcc-5-dev_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking libgcc-5-dev:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package gcc-5.
Preparing to unpack .../gcc-5_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking gcc-5 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package gcc.
Preparing to unpack .../gcc_4%3a5.3.1-1ubuntu1_amd64.deb ...
Unpacking gcc (4:5.3.1-1ubuntu1) ...
Selecting previously unselected package libstdc++-5-dev:amd64.
Preparing to unpack .../libstdc++-5-dev_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking libstdc++-5-dev:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package g++-5.
Preparing to unpack .../g++-5_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking g++-5 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package g++.
Preparing to unpack .../g++_4%3a5.3.1-1ubuntu1_amd64.deb ...
Unpacking g++ (4:5.3.1-1ubuntu1) ...
Selecting previously unselected package make.
Preparing to unpack .../archives/make_4.1-6_amd64.deb ...
Unpacking make (4.1-6) ...
Selecting previously unselected package libdpkg-perl.
Preparing to unpack .../libdpkg-perl_1.18.4ubuntu1.4_all.deb ...
Unpacking libdpkg-perl (1.18.4ubuntu1.4) ...
Selecting previously unselected package dpkg-dev.
Preparing to unpack .../dpkg-dev_1.18.4ubuntu1.4_all.deb ...
Unpacking dpkg-dev (1.18.4ubuntu1.4) ...
Selecting previously unselected package build-essential.
Preparing to unpack .../build-essential_12.1ubuntu2_amd64.deb ...
Unpacking build-essential (12.1ubuntu2) ...
Selecting previously unselected package libfakeroot:amd64.
Preparing to unpack .../libfakeroot_1.20.2-1ubuntu1_amd64.deb ...
Unpacking libfakeroot:amd64 (1.20.2-1ubuntu1) ...
Selecting previously unselected package fakeroot.
Preparing to unpack .../fakeroot_1.20.2-1ubuntu1_amd64.deb ...
Unpacking fakeroot (1.20.2-1ubuntu1) ...
Selecting previously unselected package libalgorithm-diff-perl.
Preparing to unpack .../libalgorithm-diff-perl_1.19.03-1_all.deb ...
Unpacking libalgorithm-diff-perl (1.19.03-1) ...
Selecting previously unselected package libalgorithm-diff-xs-perl.
Preparing to unpack .../libalgorithm-diff-xs-perl_0.04-4build1_amd64.deb ...
Unpacking libalgorithm-diff-xs-perl (0.04-4build1) ...
Selecting previously unselected package libalgorithm-merge-perl.
Preparing to unpack .../libalgorithm-merge-perl_0.08-3_all.deb ...
Unpacking libalgorithm-merge-perl (0.08-3) ...
Selecting previously unselected package libfile-fcntllock-perl.
Preparing to unpack .../libfile-fcntllock-perl_0.22-3_amd64.deb ...
Unpacking libfile-fcntllock-perl (0.22-3) ...
Selecting previously unselected package libgdbm-dev.
Preparing to unpack .../libgdbm-dev_1.8.3-13.1_amd64.deb ...
Unpacking libgdbm-dev (1.8.3-13.1) ...
Selecting previously unselected package libtinfo-dev:amd64.
Preparing to unpack .../libtinfo-dev_6.0+20160213-1ubuntu1_amd64.deb ...
Unpacking libtinfo-dev:amd64 (6.0+20160213-1ubuntu1) ...
Selecting previously unselected package libncurses5-dev:amd64.
Preparing to unpack .../libncurses5-dev_6.0+20160213-1ubuntu1_amd64.deb ...
Unpacking libncurses5-dev:amd64 (6.0+20160213-1ubuntu1) ...
Selecting previously unselected package libreadline6-dev:amd64.
Preparing to unpack .../libreadline6-dev_6.3-8ubuntu2_amd64.deb ...
Unpacking libreadline6-dev:amd64 (6.3-8ubuntu2) ...
Selecting previously unselected package zlib1g-dev:amd64.
Preparing to unpack .../zlib1g-dev_1%3a1.2.8.dfsg-2ubuntu4.1_amd64.deb ...
Unpacking zlib1g-dev:amd64 (1:1.2.8.dfsg-2ubuntu4.1) ...
Selecting previously unselected package libssl-dev:amd64.
Preparing to unpack .../libssl-dev_1.0.2g-1ubuntu4.13_amd64.deb ...
Unpacking libssl-dev:amd64 (1.0.2g-1ubuntu4.13) ...
Selecting previously unselected package libssl-doc.
Preparing to unpack .../libssl-doc_1.0.2g-1ubuntu4.13_all.deb ...
Unpacking libssl-doc (1.0.2g-1ubuntu4.13) ...
Selecting previously unselected package manpages-dev.
Preparing to unpack .../manpages-dev_4.04-2_all.deb ...
Unpacking manpages-dev (4.04-2) ...
Selecting previously unselected package libffi-dev:amd64.
Preparing to unpack .../libffi-dev_3.2.1-4_amd64.deb ...
Unpacking libffi-dev:amd64 (3.2.1-4) ...
Selecting previously unselected package libyaml-dev:amd64.
Preparing to unpack .../libyaml-dev_0.1.6-3_amd64.deb ...
Unpacking libyaml-dev:amd64 (0.1.6-3) ...
Processing triggers for install-info (6.1.0.dfsg.1-5) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Setting up libmpc3:amd64 (1.0.3-1) ...
Setting up m4 (1.4.17-5) ...
Setting up autoconf (2.69-9) ...
Setting up autotools-dev (20150820.1) ...
Setting up automake (1:1.15-4ubuntu1) ...
update-alternatives: using /usr/bin/automake-1.15 to provide /usr/bin/automake (automake) in auto mode
Setting up binutils (2.26.1-1ubuntu1~16.04.6) ...
Setting up libbison-dev:amd64 (2:3.0.4.dfsg-1) ...
Setting up bison (2:3.0.4.dfsg-1) ...
update-alternatives: using /usr/bin/bison.yacc to provide /usr/bin/yacc (yacc) in auto mode
Setting up libc-dev-bin (2.23-0ubuntu10) ...
Setting up linux-libc-dev:amd64 (4.4.0-130.156) ...
Setting up libc6-dev:amd64 (2.23-0ubuntu10) ...
Setting up libisl15:amd64 (0.16.1-1) ...
Setting up cpp-5 (5.4.0-6ubuntu1~16.04.10) ...
Setting up cpp (4:5.3.1-1ubuntu1) ...
Setting up libcc1-0:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Setting up libgomp1:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Setting up libitm1:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Setting up libatomic1:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Setting up libasan2:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Setting up liblsan0:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Setting up libtsan0:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Setting up libubsan0:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Setting up libcilkrts5:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Setting up libmpx0:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Setting up libquadmath0:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Setting up libgcc-5-dev:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Setting up gcc-5 (5.4.0-6ubuntu1~16.04.10) ...
Setting up gcc (4:5.3.1-1ubuntu1) ...
Setting up libstdc++-5-dev:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Setting up g++-5 (5.4.0-6ubuntu1~16.04.10) ...
Setting up g++ (4:5.3.1-1ubuntu1) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
Setting up make (4.1-6) ...
Setting up libdpkg-perl (1.18.4ubuntu1.4) ...
Setting up dpkg-dev (1.18.4ubuntu1.4) ...
Setting up build-essential (12.1ubuntu2) ...
Setting up libfakeroot:amd64 (1.20.2-1ubuntu1) ...
Setting up fakeroot (1.20.2-1ubuntu1) ...
update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode
Setting up libalgorithm-diff-perl (1.19.03-1) ...
Setting up libalgorithm-diff-xs-perl (0.04-4build1) ...
Setting up libalgorithm-merge-perl (0.08-3) ...
Setting up libfile-fcntllock-perl (0.22-3) ...
Setting up libgdbm-dev (1.8.3-13.1) ...
Setting up libtinfo-dev:amd64 (6.0+20160213-1ubuntu1) ...
Setting up libncurses5-dev:amd64 (6.0+20160213-1ubuntu1) ...
Setting up libreadline6-dev:amd64 (6.3-8ubuntu2) ...
Setting up zlib1g-dev:amd64 (1:1.2.8.dfsg-2ubuntu4.1) ...
Setting up libssl-dev:amd64 (1.0.2g-1ubuntu4.13) ...
Setting up libssl-doc (1.0.2g-1ubuntu4.13) ...
Setting up manpages-dev (4.04-2) ...
Setting up libffi-dev:amd64 (3.2.1-4) ...
Setting up libyaml-dev:amd64 (0.1.6-3) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
qiita.com
今回は2.5.0を入れる。
qiita.com
vagrant@ubuntu-xenial:~$ rbenv install 2.5.0
Downloading ruby-2.5.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.0.tar.bz2
Installing ruby-2.5.0...
Installed ruby-2.5.0 to /home/vagrant/.rbenv/versions/2.5.0
vagrant@ubuntu-xenial:~$ rbenv global 2.5.0
$ cd
$ vi .gemrc
$ cat .gemrc
install: --no-ri --no-rdoc
update: --no-ri --no-rdoc
この辺はやらなくてもいいはず。
vagrant@ubuntu-xenial:~$ ruby -v
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
vagrant@ubuntu-xenial:~$ ls -la
total 44
drwxr-xr-x 6 vagrant vagrant 4096 Jul 6 16:59 .
drwxr-xr-x 4 root root 4096 Jul 6 16:32 ..
-rw------- 1 vagrant vagrant 46 Jul 6 16:39 .bash_history
-rw-r--r-- 1 vagrant vagrant 220 Jul 6 08:58 .bash_logout
-rw-r--r-- 1 vagrant vagrant 3833 Jul 6 16:59 .bashrc
drwx------ 2 vagrant vagrant 4096 Jul 6 16:32 .cache
-rw-r--r-- 1 vagrant vagrant 655 Jul 6 08:58 .profile
drwxrwxr-x 12 vagrant vagrant 4096 Jul 6 17:11 .rbenv
drwx------ 2 vagrant vagrant 4096 Jul 6 16:32 .ssh
drwxrwxr-x 2 vagrant vagrant 4096 Jul 6 16:38 tmp
-rw------- 1 vagrant vagrant 766 Jul 6 16:59 .viminfo
vagrant@ubuntu-xenial:~$ vi .gemrc
vagrant@ubuntu-xenial:~$ gem install rails --version="5.1.4"^C
vagrant@ubuntu-xenial:~$ gem install rails -v 5.1.4
Fetching: concurrent-ruby-1.0.5.gem (100%)
Successfully installed concurrent-ruby-1.0.5
Fetching: i18n-0.9.5.gem (100%)
Successfully installed i18n-0.9.5
Fetching: thread_safe-0.3.6.gem (100%)
Successfully installed thread_safe-0.3.6
Fetching: tzinfo-1.2.5.gem (100%)
Successfully installed tzinfo-1.2.5
Fetching: activesupport-5.1.4.gem (100%)
Successfully installed activesupport-5.1.4
Fetching: rack-2.0.5.gem (100%)
Successfully installed rack-2.0.5
Fetching: rack-test-1.0.0.gem (100%)
Successfully installed rack-test-1.0.0
Fetching: mini_portile2-2.3.0.gem (100%)
Successfully installed mini_portile2-2.3.0
Fetching: nokogiri-1.8.4.gem (100%)
Building native extensions. This could take a while...
Successfully installed nokogiri-1.8.4
Fetching: crass-1.0.4.gem (100%)
Successfully installed crass-1.0.4
Fetching: loofah-2.2.2.gem (100%)
Successfully installed loofah-2.2.2
Fetching: rails-html-sanitizer-1.0.4.gem (100%)
Successfully installed rails-html-sanitizer-1.0.4
Fetching: rails-dom-testing-2.0.3.gem (100%)
Successfully installed rails-dom-testing-2.0.3
Fetching: builder-3.2.3.gem (100%)
Successfully installed builder-3.2.3
Fetching: erubi-1.7.1.gem (100%)
Successfully installed erubi-1.7.1
Fetching: actionview-5.1.4.gem (100%)
Successfully installed actionview-5.1.4
Fetching: actionpack-5.1.4.gem (100%)
Successfully installed actionpack-5.1.4
Fetching: activemodel-5.1.4.gem (100%)
Successfully installed activemodel-5.1.4
Fetching: arel-8.0.0.gem (100%)
Successfully installed arel-8.0.0
Fetching: activerecord-5.1.4.gem (100%)
Successfully installed activerecord-5.1.4
Fetching: globalid-0.4.1.gem (100%)
Successfully installed globalid-0.4.1
Fetching: activejob-5.1.4.gem (100%)
Successfully installed activejob-5.1.4
Fetching: mini_mime-1.0.0.gem (100%)
Successfully installed mini_mime-1.0.0
Fetching: mail-2.7.0.gem (100%)
Successfully installed mail-2.7.0
Fetching: actionmailer-5.1.4.gem (100%)
Successfully installed actionmailer-5.1.4
Fetching: nio4r-2.3.1.gem (100%)
Building native extensions. This could take a while...
Successfully installed nio4r-2.3.1
Fetching: websocket-extensions-0.1.3.gem (100%)
Successfully installed websocket-extensions-0.1.3
Fetching: websocket-driver-0.6.5.gem (100%)
Building native extensions. This could take a while...
Successfully installed websocket-driver-0.6.5
Fetching: actioncable-5.1.4.gem (100%)
Successfully installed actioncable-5.1.4
Fetching: thor-0.20.0.gem (100%)
Successfully installed thor-0.20.0
Fetching: method_source-0.9.0.gem (100%)
Successfully installed method_source-0.9.0
Fetching: railties-5.1.4.gem (100%)
Successfully installed railties-5.1.4
Fetching: bundler-1.16.2.gem (100%)
Successfully installed bundler-1.16.2
Fetching: sprockets-3.7.2.gem (100%)
Successfully installed sprockets-3.7.2
Fetching: sprockets-rails-3.2.1.gem (100%)
Successfully installed sprockets-rails-3.2.1
Fetching: rails-5.1.4.gem (100%)
Successfully installed rails-5.1.4
36 gems installed
Gems
bundler
vagrant@ubuntu-xenial:~/tmp$ rails _5.1.4_ new sample_app
create
create README.md
create Rakefile
create config.ru
create .gitignore
create Gemfile
run git init from "."
Initialized empty Git repository in /home/vagrant/tmp/sample_app/.git/
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 bin/yarn
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_5_1.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 test/system
create test/system/.keep
create test/application_system_test_case.rb
create tmp
create tmp/.keep
create tmp/cache
create tmp/cache/assets
create vendor
create vendor/.keep
create package.json
remove config/initializers/cors.rb
remove config/initializers/new_framework_defaults_5_1.rb
run bundle install
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 12.3.1
Installing rake 12.3.1
Using concurrent-ruby 1.0.5
Fetching i18n 1.0.1
Installing i18n 1.0.1
Fetching minitest 5.11.3
Installing minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Fetching activesupport 5.1.6
Installing activesupport 5.1.6
Using builder 3.2.3
Using erubi 1.7.1
Using mini_portile2 2.3.0
Using nokogiri 1.8.4
Using rails-dom-testing 2.0.3
Using crass 1.0.4
Using loofah 2.2.2
Using rails-html-sanitizer 1.0.4
Fetching actionview 5.1.6
Installing actionview 5.1.6
Using rack 2.0.5
Using rack-test 1.0.0
Fetching actionpack 5.1.6
Installing actionpack 5.1.6
Using nio4r 2.3.1
Using websocket-extensions 0.1.3
Using websocket-driver 0.6.5
Fetching actioncable 5.1.6
Installing actioncable 5.1.6
Using globalid 0.4.1
Fetching activejob 5.1.6
Installing activejob 5.1.6
Using mini_mime 1.0.0
Using mail 2.7.0
Fetching actionmailer 5.1.6
Installing actionmailer 5.1.6
Fetching activemodel 5.1.6
Installing activemodel 5.1.6
Using arel 8.0.0
Fetching activerecord 5.1.6
Installing activerecord 5.1.6
Fetching public_suffix 3.0.2
Installing public_suffix 3.0.2
Fetching addressable 2.5.2
Installing addressable 2.5.2
Fetching bindex 0.5.0
Installing bindex 0.5.0 with native extensions
Using bundler 1.16.2
Fetching byebug 10.0.2
Installing byebug 10.0.2 with native extensions
Fetching xpath 3.1.0
Installing xpath 3.1.0
Fetching capybara 2.18.0
Installing capybara 2.18.0
Fetching ffi 1.9.25
Installing ffi 1.9.25 with native extensions
Fetching childprocess 0.9.0
Installing childprocess 0.9.0
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 0.9.0
Using thor 0.20.0
Fetching railties 5.1.6
Installing railties 5.1.6
Fetching coffee-rails 4.2.2
Installing coffee-rails 4.2.2
Fetching multi_json 1.13.1
Installing multi_json 1.13.1
Fetching jbuilder 2.7.0
Installing jbuilder 2.7.0
Fetching rb-fsevent 0.10.3
Installing rb-fsevent 0.10.3
Fetching rb-inotify 0.9.10
Installing rb-inotify 0.9.10
Fetching ruby_dep 1.5.0
Installing ruby_dep 1.5.0
Fetching listen 3.1.5
Installing listen 3.1.5
Fetching puma 3.11.4
Installing puma 3.11.4 with native extensions
Using sprockets 3.7.2
Using sprockets-rails 3.2.1
Fetching rails 5.1.6
Installing rails 5.1.6
Fetching rubyzip 1.2.1
Installing rubyzip 1.2.1
Fetching sass-listen 4.0.0
Installing sass-listen 4.0.0
Fetching sass 3.5.6
Installing sass 3.5.6
Fetching tilt 2.0.8
Installing tilt 2.0.8
Fetching sass-rails 5.0.7
Installing sass-rails 5.0.7
Fetching selenium-webdriver 3.13.0
Installing selenium-webdriver 3.13.0
Fetching spring 2.0.2
Installing spring 2.0.2
Fetching spring-watcher-listen 2.0.1
Installing spring-watcher-listen 2.0.1
Fetching sqlite3 1.3.13
Installing sqlite3 1.3.13 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/sqlite3-1.3.13/ext/sqlite3
/home/vagrant/.rbenv/versions/2.5.0/bin/ruby -r ./siteconf20180706-30590-1kba36g.rb extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'brew install sqlite3',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/vagrant/.rbenv/versions/2.5.0/bin/$(RUBY_BASE_NAME)
--with-sqlite3-config
--without-sqlite3-config
--with-pkg-config
--without-pkg-config
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0-static/sqlite3-1.3.13/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/sqlite3-1.3.13 for inspection.
Results logged to /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0-static/sqlite3-1.3.13/gem_make.out
An error occurred while installing sqlite3 (1.3.13), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.13' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
sqlite3
run bundle exec spring binstub --all
Could not find gem 'sqlite3' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
怒られた。
vagrant@ubuntu-xenial:~/tmp$ rails _5.1.4_ new sample_app --skip-bundle
exist
identical README.md
identical Rakefile
identical config.ru
identical .gitignore
identical Gemfile
run git init from "."
Reinitialized existing Git repository in /home/vagrant/tmp/sample_app/.git/
exist app
identical app/assets/config/manifest.js
identical app/assets/javascripts/application.js
identical app/assets/javascripts/cable.js
identical app/assets/stylesheets/application.css
identical app/channels/application_cable/channel.rb
identical app/channels/application_cable/connection.rb
identical app/controllers/application_controller.rb
identical app/helpers/application_helper.rb
identical app/jobs/application_job.rb
identical app/mailers/application_mailer.rb
identical app/models/application_record.rb
identical app/views/layouts/application.html.erb
identical app/views/layouts/mailer.html.erb
identical app/views/layouts/mailer.text.erb
identical app/assets/images/.keep
exist app/assets/javascripts/channels
identical app/assets/javascripts/channels/.keep
identical app/controllers/concerns/.keep
identical app/models/concerns/.keep
exist bin
identical bin/bundle
identical bin/rails
identical bin/rake
identical bin/setup
identical bin/update
identical bin/yarn
exist config
identical config/routes.rb
identical config/application.rb
identical config/environment.rb
conflict config/secrets.yml
Overwrite /home/vagrant/tmp/sample_app/config/secrets.yml? (enter "h" for help) [Ynaqdh] n
skip config/secrets.yml
identical config/cable.yml
identical config/puma.rb
identical config/spring.rb
exist config/environments
identical config/environments/development.rb
identical config/environments/production.rb
identical config/environments/test.rb
exist config/initializers
identical config/initializers/application_controller_renderer.rb
identical config/initializers/assets.rb
identical config/initializers/backtrace_silencers.rb
identical config/initializers/cookies_serializer.rb
create config/initializers/cors.rb
identical config/initializers/filter_parameter_logging.rb
identical config/initializers/inflections.rb
identical config/initializers/mime_types.rb
create config/initializers/new_framework_defaults_5_1.rb
identical config/initializers/wrap_parameters.rb
exist config/locales
identical config/locales/en.yml
identical config/boot.rb
identical config/database.yml
exist db
identical db/seeds.rb
exist lib
exist lib/tasks
identical lib/tasks/.keep
exist lib/assets
identical lib/assets/.keep
exist log
identical log/.keep
exist public
identical public/404.html
identical public/422.html
identical public/500.html
identical public/apple-touch-icon-precomposed.png
identical public/apple-touch-icon.png
identical public/favicon.ico
identical public/robots.txt
exist test/fixtures
identical test/fixtures/.keep
exist test/fixtures/files
identical test/fixtures/files/.keep
exist test/controllers
identical test/controllers/.keep
exist test/mailers
identical test/mailers/.keep
exist test/models
identical test/models/.keep
exist test/helpers
identical test/helpers/.keep
exist test/integration
identical test/integration/.keep
identical test/test_helper.rb
exist test/system
identical test/system/.keep
identical test/application_system_test_case.rb
exist tmp
identical tmp/.keep
exist tmp/cache
exist tmp/cache/assets
exist vendor
identical vendor/.keep
identical package.json
remove config/initializers/cors.rb
remove config/initializers/new_framework_defaults_5_1.rb
とりあえずbundle installしなければ、Railsプロジェクト作成できる。
Gemfileを設定して、bundle install --without-production
これでもsqlite3でエラーがでるので、ググった結果を実施する。
shuzo-kino.hateblo.jp
vagrant@ubuntu-xenial:~/tmp/sample_app$ sudo apt-get install sqlite3 libsqlite3-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
sqlite3-doc
The following NEW packages will be installed:
libsqlite3-dev sqlite3
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,023 kB of archives.
After this operation, 3,637 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 libsqlite3-dev amd64 3.11.0-1ubuntu1 [508 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial/main amd64 sqlite3 amd64 3.11.0-1ubuntu1 [515 kB]
Fetched 1,023 kB in 3s (324 kB/s)
Selecting previously unselected package libsqlite3-dev:amd64.
(Reading database ... 61527 files and directories currently installed.)
Preparing to unpack .../libsqlite3-dev_3.11.0-1ubuntu1_amd64.deb ...
Unpacking libsqlite3-dev:amd64 (3.11.0-1ubuntu1) ...
Selecting previously unselected package sqlite3.
Preparing to unpack .../sqlite3_3.11.0-1ubuntu1_amd64.deb ...
Unpacking sqlite3 (3.11.0-1ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libsqlite3-dev:amd64 (3.11.0-1ubuntu1) ...
Setting up sqlite3 (3.11.0-1ubuntu1) ...
vagrant@ubuntu-xenial:~/tmp/sample_app$ bundle install --without production
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
Using rake 12.3.1
Using concurrent-ruby 1.0.5
Using i18n 0.9.5
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.1.4
Using builder 3.2.3
Using erubi 1.7.1
Using mini_portile2 2.3.0
Using nokogiri 1.8.4
Using rails-dom-testing 2.0.3
Using crass 1.0.4
Using loofah 2.2.2
Using rails-html-sanitizer 1.0.4
Using actionview 5.1.4
Using rack 2.0.5
Using rack-test 1.0.0
Using actionpack 5.1.4
Using nio4r 2.3.1
Using websocket-extensions 0.1.3
Using websocket-driver 0.6.5
Using actioncable 5.1.4
Using globalid 0.4.1
Using activejob 5.1.4
Using mini_mime 1.0.0
Using mail 2.7.0
Using actionmailer 5.1.4
Using activemodel 5.1.4
Using arel 8.0.0
Using activerecord 5.1.4
Using ansi 1.5.0
Using bindex 0.5.0
Using bundler 1.16.2
Using byebug 9.0.6
Using coderay 1.1.2
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 0.9.0
Using thor 0.20.0
Using railties 5.1.4
Using coffee-rails 4.2.2
Using ffi 1.9.25
Using formatador 0.2.5
Using rb-fsevent 0.10.3
Using rb-inotify 0.9.10
Using ruby_dep 1.5.0
Using listen 3.1.5
Using lumberjack 1.0.13
Using nenv 0.3.0
Using shellany 0.0.1
Using notiffany 0.1.1
Using pry 0.11.3
Using guard 2.13.0
Using guard-compat 1.2.1
Using guard-minitest 2.4.4
Using multi_json 1.13.1
Using jbuilder 2.7.0
Using jquery-rails 4.3.1
Using ruby-progressbar 1.9.0
Using minitest-reporters 1.1.14
Using puma 3.9.1
Using sprockets 3.7.2
Using sprockets-rails 3.2.1
Using rails 5.1.4
Using rails-controller-testing 1.0.2
Using sass-listen 4.0.0
Using sass 3.5.6
Using tilt 2.0.8
Using sass-rails 5.0.6
Using spring 2.0.2
Using spring-watcher-listen 2.0.1
Fetching sqlite3 1.3.13
Installing sqlite3 1.3.13 with native extensions
Fetching turbolinks-source 5.1.0
Installing turbolinks-source 5.1.0
Fetching turbolinks 5.0.1
Installing turbolinks 5.0.1
Fetching uglifier 3.2.0
Installing uglifier 3.2.0
Fetching web-console 3.5.1
Installing web-console 3.5.1
Bundle complete! 19 Gemfile dependencies, 78 gems now installed.
Gems in the group production were not installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
やっと通った。
git pushが通らなかったのでssh鍵を登録した。
qiita.com
緊張の一瞬、、、
vagrant@ubuntu-xenial:~/tmp/sample_app$ rails server
Traceback (most recent call last):
19: from bin/rails:4:in `<main>'
18: from bin/rails:4:in `require'
17: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
16: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
15: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
14: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
13: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
12: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
11: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `perform'
10: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `tap'
9: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:133:in `block in perform'
8: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:133:in `require'
7: from /home/vagrant/tmp/sample_app/config/application.rb:7:in `<top (required)>'
6: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler.rb:114:in `require'
5: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:65:in `require'
4: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:65:in `each'
3: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:76:in `block in require'
2: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:76:in `each'
1: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:80:in `block (2 levels) in require'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:84:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
Backtrace for gem load error is:
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/uglifier-3.2.0/lib/uglifier.rb:5:in `require'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/uglifier-3.2.0/lib/uglifier.rb:5:in `<top (required)>'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:81:in `require'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:76:in `each'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:76:in `block in require'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:65:in `each'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:65:in `require'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler.rb:114:in `require'
/home/vagrant/tmp/sample_app/config/application.rb:7:in `<top (required)>'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:133:in `require'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:133:in `block in perform'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `tap'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `perform'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Bundler Error Backtrace:
vagrant@ubuntu-xenial:~/tmp/sample_app$ bundle exec rails s -b 0.0.0.0
Traceback (most recent call last):
19: from bin/rails:4:in `<main>'
18: from bin/rails:4:in `require'
17: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
16: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
15: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
14: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
13: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
12: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
11: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `perform'
10: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `tap'
9: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:133:in `block in perform'
8: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:133:in `require'
7: from /home/vagrant/tmp/sample_app/config/application.rb:7:in `<top (required)>'
6: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler.rb:114:in `require'
5: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:65:in `require'
4: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:65:in `each'
3: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:76:in `block in require'
2: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:76:in `each'
1: from /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:80:in `block (2 levels) in require'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:84:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
Backtrace for gem load error is:
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/uglifier-3.2.0/lib/uglifier.rb:5:in `require'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/uglifier-3.2.0/lib/uglifier.rb:5:in `<top (required)>'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:81:in `require'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:76:in `each'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:76:in `block in require'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:65:in `each'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:65:in `require'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/lib/bundler.rb:114:in `require'
/home/vagrant/tmp/sample_app/config/application.rb:7:in `<top (required)>'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:133:in `require'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:133:in `block in perform'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `tap'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `perform'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Bundler Error Backtrace:
結果は失敗。
gem 'therubyracer', platforms: :rubyをbundle installする。
rails server で There was an error while trying to load the gem 'uglifier'.と言われる解決方法。qiita.com
vagrant@ubuntu-xenial:~/tmp/sample_app$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 12.3.1
Using concurrent-ruby 1.0.5
Using i18n 0.9.5
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.1.4
Using builder 3.2.3
Using erubi 1.7.1
Using mini_portile2 2.3.0
Using nokogiri 1.8.4
Using rails-dom-testing 2.0.3
Using crass 1.0.4
Using loofah 2.2.2
Using rails-html-sanitizer 1.0.4
Using actionview 5.1.4
Using rack 2.0.5
Using rack-test 1.0.0
Using actionpack 5.1.4
Using nio4r 2.3.1
Using websocket-extensions 0.1.3
Using websocket-driver 0.6.5
Using actioncable 5.1.4
Using globalid 0.4.1
Using activejob 5.1.4
Using mini_mime 1.0.0
Using mail 2.7.0
Using actionmailer 5.1.4
Using activemodel 5.1.4
Using arel 8.0.0
Using activerecord 5.1.4
Using ansi 1.5.0
Using bindex 0.5.0
Using bundler 1.16.2
Using byebug 9.0.6
Using coderay 1.1.2
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 0.9.0
Using thor 0.20.0
Using railties 5.1.4
Using coffee-rails 4.2.2
Using ffi 1.9.25
Using formatador 0.2.5
Using rb-fsevent 0.10.3
Using rb-inotify 0.9.10
Using ruby_dep 1.5.0
Using listen 3.1.5
Using lumberjack 1.0.13
Using nenv 0.3.0
Using shellany 0.0.1
Using notiffany 0.1.1
Using pry 0.11.3
Using guard 2.13.0
Using guard-compat 1.2.1
Using guard-minitest 2.4.4
Using multi_json 1.13.1
Using jbuilder 2.7.0
Using jquery-rails 4.3.1
Fetching libv8 3.16.14.19 (x86_64-linux)
Installing libv8 3.16.14.19 (x86_64-linux)
Using ruby-progressbar 1.9.0
Using minitest-reporters 1.1.14
Using puma 3.9.1
Using sprockets 3.7.2
Using sprockets-rails 3.2.1
Using rails 5.1.4
Using rails-controller-testing 1.0.2
Fetching ref 2.0.0
Installing ref 2.0.0
Using sass-listen 4.0.0
Using sass 3.5.6
Using tilt 2.0.8
Using sass-rails 5.0.6
Using spring 2.0.2
Using spring-watcher-listen 2.0.1
Using sqlite3 1.3.13
Fetching therubyracer 0.12.3
Installing therubyracer 0.12.3 with native extensions
Using turbolinks-source 5.1.0
Using turbolinks 5.0.1
Using uglifier 3.2.0
Using web-console 3.5.1
Bundle complete! 20 Gemfile dependencies, 81 gems now installed.
Gems in the group production were not installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
vagrantの場合、-b 0.0.0.0をつけてserverを起動するらしい。(素人かw)
vagrant@ubuntu-xenial:~/tmp/sample_app$ bundle exec rails s -b 0.0.0.0
=> Booting Puma
=> Rails 5.1.4 application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.9.1 (ruby 2.5.0-p0), codename: Private Caller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
Started GET "/" for 192.168.33.1 at 2018-07-06 19:35:32 +0000
Cannot render console from 192.168.33.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Processing by Rails::WelcomeController#index as HTML
Rendering /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/templates/rails/welcome/index.html.erb
Rendered /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/templates/rails/welcome/index.html.erb (7.3ms)
Completed 200 OK in 437ms (Views: 23.9ms)
ついにキマシタワ。
つまづいたところ
最初springサーバ関連かなと思って、「rails ソース 即時反映されない」でググってみたら以下にvagrant環境だとそうなるって買いてあった。
www.tcmobile.jp
理由は以下のようだ。
ファイルの変更を検知しているのはapp/config/environments/development.rbのfile_watcherの部分。
その設定ファイル内でconfig.file_watcher = ActiveSupport::EventedFileUpdateCheckerによって検知している
ただ、その検知方法がファイルの変更イベントを受けて検知しているがdocker-machineの共有ファイルに関してはその変更イベントが発生しない。 (これはdocker-machineの問題でなく、共有ファイルとしてホスト側をマウントする方式では仕様としてどうしようもないそうです。)
ということで、なんとかファイルの変更をトリガーに変更を検知するのではなく、ポーリング形式でファイルの変更を監視する方法が必要なようでした。
で、いろいろ調べてみると、昔はその方式だったようでその方式でファイルの変更を検知すると自動でリロードされました。。
qiita.com
config/environments/development.rb
#config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.file_watcher = ActiveSupport::FileUpdateChecker
↑ではコメントアウトしてないけど、config.file_watcherの設定を全てコメントアウトしても即時反映されたのでそうした。
と思ったら、そのあとの
@import "bootstrap-sprockets";
@import "bootstrap";
でシンタックスエラーが出てしまったので、やっぱり必要らしい。
OSS・GitHubリポジトリのまとめがあったのでRubyの勉強に役に立ちそうなやつの環境を作ってみた。
employment.en-japan.com
その中でもRubyのプロジェクトであろうawesome-rubyをクローンすることに決めた。