素早くクロスプラットフォーム開発環境放浪+ VirtualBoxの+ボックスを作成

工欲善其事必先利其器、開発環境と開発ツールは、当社の開発者の剣であ​​るので、我々は、高速で使いやすい剣を必要とします


このブログについて説明するためのビデオを持っている:ベイグラントは、クロスプラットフォームのモバイル開発環境を作成します


私たちは、コンピュータ上でゆっくりと背中に触れ、より多くの物事は、さまざまな環境、PHP、Java(登録商標)、パイソン、nodejsあるとしてだけで、開発環境がコンピュータ上に構成されている場合の開発に着手そのため、非常に面倒、と多くの場合、何らかの理由で環境が繰り返されなければならないように、ORZ、再インストールするコンピュータを置きます。だから、自分自身のいずれかを構築し、環境を移動することができ、非常に重要です。

浮浪者が仮想開発環境、サポート窓口、Linuxでは、マックを構築するためのツールである、あなたのための右のは常にあります。そして放浪構成された環境は、箱の中に包装することができ、非常に便利な、直接他の人と共有

放浪-のvirtualbox-のubuntu-ポストtitle.png

システム要件MAC :( Iシステム)

マシンは、仮想化をサポートし、時々BIOSのCPUの仮想化を開くために調整する必要があります。

ステップ1:VirtualBoxのをインストールします(私のVirtualBoxバージョン4.3.30)

               具体的なインストールパッケージは、公式サイトから直接ダウンロードしてください:https://www.virtualbox.org/wiki/Downloads

ステップ2:インストール浮浪者(私は放浪バージョン1.6.3ベイグラント)

$ vagrant -v
Vagrant 1.6.3
具体安装包请直接从官网下载:

第三段階:浮浪者の基本的なコマンド

公式サイトを文書化:https://www.vagrantup.com/docs/getting-started/index.html


vagrant init        初始化vagrantfile
vagrant add box     添加box,自动帮你生成vagrantfile
vagrant halt        关闭虚拟机
vagrant destroy     销毁虚拟机
vagrant ssh         连接虚拟机
vagrant reload      重新加载vagarntfile文件
vagrant suspend     暂时挂起虚拟机
vagrant status      查看虚拟机运行状态

ステップ4:サンプルは示してい

4.1ダウンロードボックス

ここではUbuntuのの2つの公式アドレスは:
Ubuntuの正確な32のVirtualBox  http://files.vagrantup.com/precise32.box
Ubuntuの正確な64-VirtualBoxの  http://files.vagrantup.com/precise64.box
あなたは、他のシステムイメージをしたい場合ここからダウンロードすることができます: http://www.vagrantbox.es/              
$ mkdir -p  ~/vagrant/boxes
$ cd ~/vagrant/boxes && wget  
$ vagrant box add ubuntu64 precise64.box //添加box

4.2 LNMP(Linuxの+ nginxの+のMySQL + PHP-FPM)仮想マシンの作成

$ cd ~/vagrant && mkdir lnmp
$ cd lnmp
$ vagrant init ubuntu64 //初始化
$ vagrant up //启动虚拟机lnmp
$ vagrant ssh //进入虚拟机lnmp

新しい良い上、この仮想マシンは、非常に高速ではありません!ソフトウェアをインストールし、ソースを変更することができるのLinuxに精通

$ sudo apt-get install  keychain nginx mysql-server mysql-client  php5-cli php5-fpm php5-gd php5-mysql

具体的なプロセスは、私のブログを参照することができます:ubuntu12.04インストールphp5.4 / php5.5


ステップ5:パーソナライズされた構成Vagrantfile

放浪のinitを行った後、私たちは、対応するディレクトリVagrantfile内のファイルを検索します

ショットではなく、説明するために一つ一つを指示

600


600


ステップ6:あなたの箱をエクスポート

$ cd ~/VirtualBox\ VMs/phponubuntu64
$ vagrant package  --output lamp5_5onubuntu64.box --base phponubuntu64


注意事項

)使用してApache / nginxのはまだケースですが、ページが原因発生する静的ファイルキャッシュに、古いファイルを更新したときに写真編集の問題などが発生した後。あなたは、Apache / nginxの設定ファイル内の仮想マシンに変更を加える必要があります。

#nginx配置
sendfileをオフ
#apache配置
EnableSendFileオフ 

質問2:複数の仮想マシンにエラーを起動し、「使用中の2222のポート」

解决办法:(参考文章:Vagrant SSH errors with multiple VMs: Port 2222 in use)

config.vm.network "forwarded_port", guest: 22, host: 2220 ,id: 'ssh'


问题三:如果遇到 php 代码也感觉被缓存起来了,请关闭apc,opcode(从php5.5及以后版本默认开启opcode)


问题四:config.vm.boot_timeout


Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

类似如上的错误日志,本人解决方案是,设置=>网络=>高级=>选中 cable connected


问题五:GUI模式waiting for network configuration

waiting for network configuration
waiting an additional 60 seconds for network configuration

这个是网络配置有问题,直接进去虚拟机 编辑 /etc/network/interfaces 删除不需要的,


问题六:Warning: Authentication failure. Retrying...

那么把 https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub   公钥放到authorized_keys 文件中,重新vagrant reload 

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key


我个人操作步骤是

  1. 删除authorized_keys 

  2. vagrant reload

  3. 在上述链接的内容 放到 虚拟机 authorized_keys 中

  4. vagrant reload


问题七:mount: unknown filesystem type 'vboxsf' centos ubuntu 处理方案

Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:

mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant

The error output from the command was:

mount: unknown filesystem type 'vboxsf'


可能大家在使用vagrant的时候经常遇到以上提示,这个时候只是共享目录无法使用,虚拟机已经在运行了


下面是我处理的方法,贴出来与大家分享;


ubuntu系统处理方案

sudo apt-get update
sudo apt-get install virtualbox-guest-utils

以上两条代码,ubuntu系统我就处理好了。重启虚拟机



オリジナル住所: すぐにクロスプラットフォーム開発環境放浪+ VirtualBoxの+ボックスの作成
タグ: VirtualBoxの    作成に    迅速に    仮想マシンの    インストール    ボックスを    sendfileの    OFF    2222    生産ボックス    ベイグラントの    タイムアウト    待機    ネットワーク    クロスプラットフォームを   

インテリジェント勧告

ます。https://my.oschina.net/54php/blog/600187で再現

おすすめ

転載: blog.csdn.net/weixin_33877885/article/details/91634701