目的
Vagrantで使用するCentOSのboxをWindows7でVeeweeを使って作成 - 迷い家の白猫 技術部 で作成したboxを使って環境構築
環境
Windows 7 Professional 64bit SP1
VirtualBox 4.3.6
Vagrant 1.4.3
開発環境構築
仮想マシン起動までの設定
Vagrant プラグインのインストール
コマンドプロンプトを起動させ、以下のコマンドを実行。
> vagrant plugin install sahara > vagrant plugin install vagrant-vbguest
プラグインがインストールできていることを確認
> vagrant plugin list sahara (0.0.16) vagrant-vbguest (0.10.0)
box ファイルを Vagrant に追加
任意の作業用フォルダを作成しそこで以下のコマンドをコマンドプロンプトを起動させ実行。
> vagrant box add 'CentOS-6.3-x86_64_dev' [絶対パスor相対パス]/CentOS-6.3-x86_64.box
作業フォルダ内で Shiftキー+右クリックで表示されるメニューの「コマンド ウィンドウをここで開く(W)」ですぐに開けます。(因みに、Vistaからの機能)
Vagrantfile を作成。
> vagrant init 'CentOS-6.3-x86_64_dev'
仮想マシン起動後の設定
yum update
$ sudo su - # echo exclude=kernel* centos* >> /etc/yum.conf # yum update -y # exit
Vim インストール
$ sudo yum install -y vim-enhanced
rvm、rubyインストール
$ \curl -sSL https://get.rvm.io | bash -s stable --autolibs=enabled --ruby $ source ~/.profile $ source /home/vagrant/.rvm/scripts/rvm
Git インストール
$ sudo yum install -y git $ git --version git version 1.7.1
tig インストール
tigとは、CUIなGitブラウザ
- RPMforgeリポジトリ導入
$ sudo rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
- tigをインストール
$ sudo yum install -y tig $ tig --version tig version 1.2
GIt簡易初期設定
$ git config --global user.email "you@example.com" $ git config --global user.name "Your Name" $ git config --global push.default current $ git config --global color.ui true
iptablesの停止
$ sudo /sbin/service iptables stop $ sudo /sbin/chkconfig iptables off
開発環境のため停止。80,443ポートは初期状態は閉じています。
必要な場合、別途設定する。
MySQLをインストール
$ sudo yum install -y mysql-server mysql-devel $ sudo /etc/init.d/mysqld start $ sudo /sbin/chkconfig mysqld on
$ mysql_secure_installation Enter current password for root (enter for none): [ENTER] ... Set root password? [Y/n] [ENTER] New password: [任意のパスワード] Re-enter new password: [任意のパスワード] ... Remove anonymous users? [Y/n] Y ... Disallow root login remotely? [Y/n] Y ... Remove test database and access to it? [Y/n] Y ... Reload privilege tables now? [Y/n] Y ... Thanks for using MySQL!