LoginSignup
2
2

More than 5 years have passed since last update.

vagrant rails 設定

Last updated at Posted at 2015-12-05

はじめは
【Vitualbox + Vagrant】Railsの開発環境構築 part2 〜CentOS構築編〜 に設定して

mysqlが動かなかったので 

/etc/yum.repos.d/epel.repo
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch

を下記に変更

/etc/yum.repos.d/epel.repo
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch

たぶん使うと思うので

$yum install ImageMagick

$yum install ImageMagick-devel

$yum install rmagick

データベース作って


$mysql -u root

mysql > CREATE DATABASE hoge_development;

Query OK, 1 row affected (0.00 sec)

確認

mysql> SHOW DATABASES;

*.ymlを作成して

ridgepole走らせて

$ bundle exec ridgepole --apply --file Schemafile --config config/database.yml 

socketの場所確認して

config/database.yml
socket: /var/lib/mysql/mysql.sock

に変更

ポートフォワーディングの設定して

  config.vm.network :"forwarded_port", guest: 3000, host: 3000

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  config.vm.network "private_network", ip: "192.168.33.10"

を追加

ポートを確認

$netstat -anp

3000 があいてないなら

etc/sysconfig/iptablesに

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3000 -j ACCEPT

を追加

起動

rails s -b 0.0.0.0

参考

Vagrant + VirtualBox で構築した環境を他の PC へコピー・移設する方法

【Vitualbox + Vagrant】Railsの開発環境構築 part2 〜CentOS構築編〜
CentOS6でyumが繋がらなくなった

localhost:3000に接続できません[vagrant centos rails]

vagrantでlocalhost:3000にアクセスできない問題

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2