201411-07 Vagrant入门——Vagrant虚拟机概述 如果你在开发应用和发布应用的时候采用了不同的环境,那么在正式使用时,应用可能出现许多奇怪的BUG。如果你是在开发团队里工作,那么保证各位的开发环境和所有的库文件都是最新的并且处在同一版本,会是件更麻烦的事。如果你在Windows平台开发并准备部署到Linux(或其他非Windows的平台)上,或者你是在开发团队里工作,那你应该考虑用个虚拟机。这虽然听起来挺麻烦,但是Vagrant这个程序可以辅助你用几步就创建一个简单的虚拟... 继续阅读 >
201411-07 Vagrant入门——安装、升级、卸载 1.安装InstallingVagrantisextremelyeasy.Headovertothedownloadspageandgettheappropriateinstallerorpackageforyourplatform.Theninstallitusingstandardproceduresforyouroperatingsystem.Theinstallerwillautomaticallyaddvagranttoyoursystempathsothatitisavailableinterminals.Ifitisnotfound,pleasetryloggingoutandloggingbackintoyoursystem(thisis... 继续阅读 >
201411-07 Vagrant入门——项目设置(Project Setup) ThefirststepforanyprojecttouseVagrantistoconfigureVagrantusingaVagrantfile.ThepurposeoftheVagrantfileistwofold:Marktherootdirectoryofyourproject.AlotoftheconfigurationofVagrantisrelativetothisrootdirectory.Describethekindofmachineandresourcesyouneedtorunyourproject,aswellaswhatsoftwaretoinstallandhowyouwanttoaccessit.Vagran... 继续阅读 >
201411-07 Vagrant入门——启动盒子(Boxes) Insteadofbuildingavirtualmachinefromscratch,whichwouldbeaslowandtediousprocess,Vagrantusesabaseimagetoquicklycloneavirtualmachine.ThesebaseimagesareknownasboxesinVagrant,andspecifyingtheboxtouseforyourVagrantenvironmentisalwaysthefirststepaftercreatinganewVagrantfile.1.安装Ifyouranthecommandsonthegettingstartedoverviewpage,theny... 继续阅读 >
201411-07 Vagrant入门——启动并建立SSH连接(up and ssh) Itistimetobootyourfirstguestmachine.Runthefollowing:$vagrantupInlessthanaminute,thiscommandwillfinishandyou'llhaveavirtualmachinerunningUbuntu.Youwon'tactuallyseeanythingthough,sinceVagrantrunsthevirtualmachinewithoutaUI.Toprovethatitisrunning,youcanSSHintothemachine:$vagrantsshThiscommandwilldropyouintoafull-fledgedSSHsession.... 继续阅读 >
201411-07 Vagrant入门——同步文件及文件夹(Synced Folders) Whileitiscooltohaveavirtualmachinesoeasily,notmanypeoplewanttoeditfilesusingjustplainterminal-basededitorsoverSSH.LuckilywithVagrantyoudon'thaveto.Byusingsyncedfolders,Vagrantwillautomaticallysyncyourfilestoandfromtheguestmachine.Bydefault,Vagrantsharesyourprojectdirectory(remember,thatistheonewiththeVagrantfile)tothe/vagrantdirecto... 继续阅读 >
201411-07 Vagrant入门——简单配置及使用(Provisioning) Alright,sowehaveavirtualmachinerunningabasiccopyofUbuntuandwecaneditfilesfromourmachineandhavethemsyncedintothevirtualmachine.Let'snowservethosefilesusingawebserver.WecouldjustSSHinandinstallawebserverandbeonourway,buttheneverypersonwhousedVagrantwouldhavetodothesamething.Instead,Vagranthasbuilt-insupportforautomatedprovisioni... 继续阅读 >
201411-07 Vagrant入门——网络配置(Networking) Atthispointwehaveawebserverupandrunningwiththeabilitytomodifyfilesfromourhostandhavethemautomaticallysyncedtotheguest.However,accessingthewebpagessimplyfromtheterminalfrominsidethemachineisnotverysatisfying.Inthisstep,we'lluseVagrant'snetworkingfeaturestogiveusadditionaloptionsforaccessingthemachinefromourhostmachine.1.接口设置One... 继续阅读 >
201411-07 Vagrant入门——关机(Teardown) Wenowhaveafullyfunctionalvirtualmachinewecanuseforbasicwebdevelopment.Butnowlet'ssayitistimetoswitchgears,maybeworkonanotherproject,maybegoouttolunch,ormaybejusttimetogohome.Howdowecleanupourdevelopmentenvironment?WithVagrant,yoususpend,halt,ordestroytheguestmachine.Eachoftheseoptionshaveprosandcons.Choosethemethodthatworksbe... 继续阅读 >
201411-07 Vagrant入门——重构(Rebuild) Whenyou'rereadytocomebacktoyourproject,whetheritistomorrow,aweekfromnow,orayearfromnow,gettingitupandrunningiseasy:$vagrantupThat'sit!SincetheVagrantenvironmentisalreadyallconfiguredviatheVagrantfile,youoranyofyourcoworkerssimplyhavetorunavagrantupatanytimeandVagrantwillrecreateyourworkenvironment. 继续阅读 >
201411-07 Vagrant入门——其他虚拟机(Providers) Inthisgettingstartedguide,yourprojectwasalwaysbackedwithVirtualBox.ButVagrantcanworkwithawidevarietyofbackendproviders,suchasVMwareFusion,AWS,andmore.Readthepageofeachproviderformoreinformationonhowtosetthemup.Onceyouhaveaproviderinstalled,youdon'tneedtomakeanymodificationstoyourVagrantfile,justvagrantupwiththeproperproviderandVag... 继续阅读 >