{"id":329,"date":"2015-02-02T18:12:20","date_gmt":"2015-02-02T23:12:20","guid":{"rendered":"http:\/\/www.lektrikpuke.com\/blog\/?p=329"},"modified":"2015-02-02T21:36:55","modified_gmt":"2015-02-03T02:36:55","slug":"install-a-linux-web-server-on-your-windows-7-pc-with-vagrant","status":"publish","type":"post","link":"https:\/\/lektrikpuke.com\/blog\/2015\/02\/02\/install-a-linux-web-server-on-your-windows-7-pc-with-vagrant\/","title":{"rendered":"Install A Linux Web Server On Your Windows 7 PC With Vagrant"},"content":{"rendered":"<p>First, I&#8217;d like to reference an excellent video tutorial that I used for my initial foray into the Vagrant world.  <a href=\"https:\/\/www.youtube.com\/watch?v=d3KG18SoUZI\" target=\"_blank\">Click here to see that tutorial<\/a>.<\/p>\n<p><span style=\"font-size:small;\"><strong>Disclaimer<\/strong>:  This blog entry does not necessarily follow safe computer\/networking procedures.  Use this only as a reference.<\/p>\n<p>General outline:<\/p>\n<ol>\n<li>Install Oracle Virtualbox &#8211; you&#8217;re going to love this!<\/li>\n<li>Install Vagrant &#8211; gonna love this, too!<\/li>\n<li>Update and config Vagrant &#8211; PHP, MySQL, Apache.<\/li>\n<li>Connect and play!<\/li>\n<\/ol>\n<p>Okay, I won&#8217;t go into any specifics but hopefully you can follow along.  <a href=\"http:\/\/www.oracle.com\/technetwork\/server-storage\/virtualbox\/downloads\/index.html\" target=\"_blank\">Download and install VirtualBox<\/a>.  This was the correct link on February 2, 2015.  The installer you want is the Windows (32-bit\/64-bit).  You might have to answer some questions and do a reboot during the install (I don&#8217;t remember), but it should be fairly straight forward.<\/p>\n<p>Install Vagrant as shown in the video referenced above.  It really is an excellent tutorial.<\/p>\n<p><strong>Vagrantfile mods:<\/strong><\/p>\n<p>config.vm.network &#8220;private_network&#8221;, ip: &#8220;192.168.33.10&#8221; \/\/ uncomment this line so you can reach webserver at this address<br \/>\nconfig.vm.synced_folder &#8220;data&#8221;, &#8220;\/var\/www\/html&#8221; \/\/ mod like this<\/p>\n<p>Create data folder in ubuntu folder<br \/>\nadd html files there and they will automatically show up on the server<\/p>\n<p>Open a command prompt and change directory to vagrant install:<\/p>\n<p>ex:  cd C:\\Users\\robert\\VirtualBox VMs\\Vagrant\\ubuntu<\/p>\n<p>vagrant up<\/p>\n<p><a href=\"http:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/download.html\" target=\"_blank\">Download and install PuTTY<\/a> &#8211; I used &#8216;A .ZIP file containing all the binaries (except PuTTYtel), and also the help files&#8217;<\/p>\n<p>Using PuTTY ssh into box:<br \/>\n\thost name: vagrant@127.0.0.1<br \/>\n\tport:  2222<br \/>\n\topen, then enter password of vagrant<\/p>\n<p>Installing apache, mysql, and php:<br \/>\nsudo apt-get update \/\/ update packages<br \/>\nsudo apt-get install apache2<br \/>\nsudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql<br \/>\nsudo \/usr\/bin\/mysql_secure_installation \/\/ secures installation<br \/>\nsudo apt-get install php5 libapache2-mod-php5 php5-mcrypt<br \/>\nsudo apt-get upgrade \/\/ upgrades packages<\/p>\n<p>sudo apt-get install vim \/\/ I like vim for editor<\/p>\n<p>cd \/etc\/apache2\/<br \/>\nsudo vim apache2.conf<\/p>\n<p>mod apache2.conf as below:<\/p>\n<p>&lt;directory&gt;<br \/>\n    Options FollowSymLinks<br \/>\n    AllowOverride None<br \/>\n    Require all denied<br \/>\n&lt;\/directory&gt;<\/p>\n<p>&lt;directory \/usr\/share&gt;<br \/>\n    AllowOverride None<br \/>\n    Require all granted<br \/>\n&lt;\/directory&gt;<\/p>\n<p>&lt;directory \/var\/www&gt;<br \/>\n    Options Indexes FollowSymLinks<br \/>\n    AllowOverride All<br \/>\n    Require all granted<br \/>\n&lt;\/directory&gt;<\/p>\n<p>sudo a2enmod rewrite \/\/ enables rewrite<br \/>\nsudo service apache2 restart<\/p>\n<p><strong>Setup for HeidiSQL:<\/strong><br \/>\nGo to C:\\Program Files (x86)\\PuTTY\\puttygen.exe in Windows explorer<br \/>\nload:  C:\\Users\\robert\\.vagrant.d\\insecure_private_key<br \/>\nSave private key:  vagrantPrivateKey.ppk<\/p>\n<p>Notes: winscp &#8211; doesn&#8217;t allow for commands that require input\/feedback, so I went with PuTTY<\/p>\n<p>putty<br \/>\n\/\/ vagrant@127.0.0.1, 2222, ssh &#8211; password once at command prompt<br \/>\n192.168.33.10<\/p>\n<p>Tip:  You can use virtual box to start vagrant&#8217;s install of linux and ssh from there.<\/p>\n<p>Connect to MySQL:<\/p>\n<p><strong>HeidSQL Settings<\/strong><\/p>\n<p><a href=\"http:\/\/www.lektrikpuke.com\/blog\/wp-content\/uploads\/2015\/02\/VagrantHeidiSQLsettings.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.lektrikpuke.com\/blog\/wp-content\/uploads\/2015\/02\/VagrantHeidiSQLsettings.png\" alt=\"VagrantHeidiSQLsettings\" width=\"572\" height=\"422\" class=\"alignleft size-full wp-image-333\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.lektrikpuke.com\/blog\/wp-content\/uploads\/2015\/02\/VagrantHeidiSQLsshTunnel.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.lektrikpuke.com\/blog\/wp-content\/uploads\/2015\/02\/VagrantHeidiSQLsshTunnel.png\" alt=\"VagrantHeidiSQLsshTunnel\" width=\"582\" height=\"440\" class=\"alignleft size-full wp-image-334\" \/><\/a><br \/>\n<br style=\"clear:both;\" \/><br \/>\nYou will need to tell HeidiSQL where plink.exe is located (click folder icon)<\/p>\n<p><strong>MySQL Workbench Settings<\/strong><\/p>\n<p>Initially, do not put in usernames and passwords &#8211; wait till you&#8217;re trying to connect and it asks for them (you can have them saved at that time).<\/p>\n<p><a href=\"http:\/\/www.lektrikpuke.com\/blog\/wp-content\/uploads\/2015\/02\/VagrantMySQLWorkbench.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.lektrikpuke.com\/blog\/wp-content\/uploads\/2015\/02\/VagrantMySQLWorkbench.png\" alt=\"VagrantMySQLWorkbench\" width=\"907\" height=\"604\" class=\"alignleft size-full wp-image-335\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.lektrikpuke.com\/blog\/wp-content\/uploads\/2015\/02\/VagrantMySQLWorkbenchRemote.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.lektrikpuke.com\/blog\/wp-content\/uploads\/2015\/02\/VagrantMySQLWorkbenchRemote.png\" alt=\"VagrantMySQLWorkbenchRemote\" width=\"921\" height=\"619\" class=\"alignleft size-full wp-image-331\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.lektrikpuke.com\/blog\/wp-content\/uploads\/2015\/02\/VagrantMySQLWorkbenchSystem.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.lektrikpuke.com\/blog\/wp-content\/uploads\/2015\/02\/VagrantMySQLWorkbenchSystem.png\" alt=\"VagrantMySQLWorkbenchSystem\" width=\"911\" height=\"620\" class=\"alignleft size-full wp-image-332\" \/><\/a><\/p>\n<p>Note:  I had a lot of trouble getting Workbench to work at first.  I would suggest trying HeidiSQL first.<\/p>\n<p><strong>Start and Stop<\/strong><\/p>\n<p>To make life easier I made 2 batch files to start and stop Vagrant.  When opening a command prompt my computer naturally goes to C:\\Users\\robert\\, so I placed the files there, and then created shortcut links on the desktop.  You could also put a link to vagrantup.bat in your Startup (menu item):<\/p>\n<p>vagrantup.bat<br \/>\n@echo off<br \/>\ncls<br \/>\ncd &#8220;C:\\Users\\robert\\VirtualBox VMs\\Vagrant\\ubuntu&#8221;<br \/>\nvagrant up<\/p>\n<p>vagranthalt.bat<br \/>\n@echo off<br \/>\ncls<br \/>\ncd &#8220;C:\\Users\\robert\\VirtualBox VMs\\Vagrant\\ubuntu&#8221;<br \/>\nvagrant halt<\/p>\n<p><strong>Play<\/strong><\/p>\n<p>Additional fun things you can try.  Once you have installing the system down, it takes less than 1\/2 hour to completely redo, so experiment and have fun (I did):<\/p>\n<p>sudo apt-get install ubuntu-desktop<br \/>\nstartx or \/etc\/init.d\/gdm start for gnome desktop and \/etc\/init.d\/kdm start for the kde desktop or gnome<br \/>\nCtl+Alt+T to bring up the Terminal.<br \/>\nsudo shutdown -h now or sudo halt<br \/>\nctrl + alt + t => command prompt from desktop<br \/>\nctrl + alt + F1 => command prompt from login screen<br \/>\nsudo adduser newuser<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>First, I&#8217;d like to reference an excellent video tutorial that I used for my initial foray into the Vagrant world. Click here to see that tutorial. Disclaimer: This blog entry does not necessarily follow safe computer\/networking procedures. Use this only &hellip; <a href=\"https:\/\/lektrikpuke.com\/blog\/2015\/02\/02\/install-a-linux-web-server-on-your-windows-7-pc-with-vagrant\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[72,148,149],"tags":[8,5,136,6,89,174,107],"class_list":["post-329","post","type-post","status-publish","format-standard","hentry","category-computer-stuff","category-mysql-computer-stuff","category-php-computer-stuff","tag-installation","tag-mysql","tag-pc","tag-php","tag-script","tag-vagrant","tag-windows-7"],"_links":{"self":[{"href":"https:\/\/lektrikpuke.com\/blog\/wp-json\/wp\/v2\/posts\/329","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lektrikpuke.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lektrikpuke.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lektrikpuke.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lektrikpuke.com\/blog\/wp-json\/wp\/v2\/comments?post=329"}],"version-history":[{"count":4,"href":"https:\/\/lektrikpuke.com\/blog\/wp-json\/wp\/v2\/posts\/329\/revisions"}],"predecessor-version":[{"id":338,"href":"https:\/\/lektrikpuke.com\/blog\/wp-json\/wp\/v2\/posts\/329\/revisions\/338"}],"wp:attachment":[{"href":"https:\/\/lektrikpuke.com\/blog\/wp-json\/wp\/v2\/media?parent=329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lektrikpuke.com\/blog\/wp-json\/wp\/v2\/categories?post=329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lektrikpuke.com\/blog\/wp-json\/wp\/v2\/tags?post=329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}