{"id":154,"date":"2017-09-23T15:11:09","date_gmt":"2017-09-23T15:11:09","guid":{"rendered":"https:\/\/codingfix.com\/?p=154"},"modified":"2024-09-02T17:31:28","modified_gmt":"2024-09-02T17:31:28","slug":"laravel-setup-homstead","status":"publish","type":"post","link":"https:\/\/codingfix.com\/laravel-setup-homstead\/","title":{"rendered":"Laravel: how to setup Homstead in Windows and Linux"},"content":{"rendered":"\n<h1 class=\"wp-block-heading western\" id=\"introduction\">Introduction<\/h1>\n\n\n\n<p>When I started to learn Laravel, I have choosen to use Homestead, the \u201cpre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine.\u201d<\/p>\n\n\n\n<p>Actually, I already had Php installed on my machine, as well Apache server and MySql, but I thought it would have been a good opportunity to learn something new.<\/p>\n\n\n\n<p>Though the <a href=\"https:\/\/laravel.com\/docs\/5.5\/homestead\" target=\"_blank\" rel=\"noopener\">official documentation<\/a> is quite complete, I needed some more help: I didn\u2019t know anything about Vagrant, I didn\u2019t use Composer, nor Git (I use Mercurial).<\/p>\n\n\n\n<p>So I have googled a bit and I have found some great tutorial. Well, I don\u2019t know if this happens only to me, but I can guarantee you that to me it often happens indeed: I follow some \u201cUltimate tutorial\u201d or some \u201cDefinitive guide to&#8230;\u201d and what is was promised to work fails with errors that seem to be unknown to everyone else! It\u2019s really frustrating, isn\u2019t it?<\/p>\n\n\n\n<p>For this reason, I\u2019m going to tell you how I have installed, setup and finally got working a Laravel Homestead environment, mentioning the different issues I\u2019ve got into and illustrating the solution I have found.<\/p>\n\n\n\n<p><em><strong>Notice: <\/strong>for some parts of the process (as the installation of some software) I\u2019ll give you the links to the official documentation or to some useful article I have found without duplicating here that content. But in general, you should be able to get everything setup and running just reading this article. Or so I hope \ud83d\ude42<\/em><\/p>\n\n\n\n<p>Let\u2019s start with Laravel Homestead.<\/p>\n\n\n\n<h2 class=\"wp-block-heading western\" id=\"required-software\">Required software<\/h2>\n\n\n\n<p>To use Laravel Homestead you need to first install some software:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>VirtualBox<\/strong> (<a href=\"https:\/\/www.virtualbox.org\/wiki\/Downloads\" target=\"_blank\" rel=\"noopener\">https:\/\/www.virtualbox.org\/wiki\/Downloads<\/a>)*: VirtualBox will run Homestead virtual machine with everything we need: an operating system (as I\u2019m writing is Ubuntu 16.04), Php, several database engines and more (for the full list refer to the official documentation: <a href=\"https:\/\/laravel.com\/docs\/5.5\/homestead\" target=\"_blank\" rel=\"noopener\">https:\/\/laravel.com\/docs\/5.5\/homestead<\/a>)<\/li>\n\n\n\n<li><strong>Composer<\/strong> (<a href=\"https:\/\/getcomposer.org\/doc\/00-intro.md\" target=\"_blank\" rel=\"noopener\">https:\/\/getcomposer.org\/doc\/00-intro.md<\/a>): used to create laravel projects and manage all their dependencies; the easiest way to get Composer up and running in Ubuntu is just <span class=\"theme:dark-terminal lang:default decode:true crayon-inline \">sudo apt-get install composer<\/span><\/li>\n\n\n\n<li><strong>Vagrant<\/strong> (<a href=\"https:\/\/www.vagrantup.com\/downloads.html\" target=\"_blank\" rel=\"noopener\">https:\/\/www.vagrantup.com\/downloads.html<\/a>): used to run the Homestead virtual machine on the fly and access its contents directly from your host (you\u2019ll can use your web application directly from your browser without the need to use a browser installed in the VM, for instance)<\/li>\n\n\n\n<li><strong>Git<\/strong> (<a href=\"https:\/\/git-scm.com\/downloads\" target=\"_blank\" rel=\"noopener\">https:\/\/git-scm.com\/downloads<\/a>): used to generate the SSH key used by Vagrant to authenticate the server connection (in Ubuntu just <span class=\"theme:dark-terminal lang:default decode:true crayon-inline \">sudo apt-get install git<\/span> )<\/li>\n<\/ul>\n\n\n\n<p>*<i>it\u2019s not mandatory to use VirtualBox: you can also use Hyper-V, VMWare or Parallels if you feel more comfortable.<\/i><\/p>\n\n\n\n<p>Installing these software is quite easy and painless. Just be sure to get the latest versions of them. Especially for VirtualBox, Laravel requires it be version 5.1 or greater. So, if you have VirtualBox already installed, be sure to check its version: just start VirtualBox and the software itself will notify you if a more recent version is available for your system.<\/p>\n\n\n\n<p>If instead you have to install VirtualBox from scratch you can follow this tutorial: <a href=\"https:\/\/www.pcsteps.com\/184-install-virtualbox-linux-mint-ubuntu\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.pcsteps.com\/184-install-virtualbox-linux-mint-ubuntu\/<\/a>: skip everything talks about distro software managers and jump to the section where the author teachs you how the get the latest VirtualBox version for your distro (Windows users have just to download and run the installer from the <a href=\"https:\/\/www.virtualbox.org\/wiki\/Downloads\" target=\"_blank\" rel=\"noopener\">official site<\/a>).<\/p>\n\n\n\n<p>For the rest you can just refer to links above.<\/p>\n\n\n\n<p>As I said, I didn\u2019t find any problem installing any of these softwares so I won\u2019t spend other time on this.<\/p>\n\n\n\n<h2 class=\"wp-block-heading western\" id=\"starting-with-laravel\">Starting with Laravel<\/h2>\n\n\n\n<p>When you have all softwares installed, just open the command prompt on Windows or a terminal window in Linux (from now on I\u2019ll just call it CLI) and type:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"vagrant box add laravel\/homestead\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">vagrant box add laravel\/homestead<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>You&#8217;ll be asked if you want to use Hyper-V, Parallels, VirtualBox or VMWare: select your virtual environment of choice and press Enter. This will download the Homestead virtual box and it will probably take sometime to finish, so feel free to take a break.<\/p>\n\n\n\n<p>The next step is to download the command line interface for Homestead. Open your CLI and navigate to the folder where you want to store your Laravel projects in (for this article I&#8217;ll assume it will be C:\\Users\\&lt;USER_NAME&gt;\\ in Windows and just your home ~\/ in Linux) and type:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"git clone https:\/\/github.com\/laravel\/homestead.git Homestead\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">git clone https:\/\/github.com\/laravel\/homestead.git Homestead<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>This will create a folder called Homestead. Let\u2019s enter it from CLI and initilize Homestead:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"cd Homestead\nbash init.sh\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">cd<\/span><span style=\"color: #D4D4D4\"> Homestead<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">bash init.sh<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>The response will be an enthusiastic \u201cHomestead initialized!\u201d. Sounds good, isn\u2019t it? But what does it mean? Simple: it means that in your Homestead folder has been created the <em>Homestead.yaml<\/em> file, isn\u2019t it fantastic? In fact, <em>Homestead.yaml<\/em> file will allow you to setup your sites and your shared folder. Okay, it can sound obscure this, I admit, but be patient: I promise it is quite simple and I\u2019ll explain soon.<\/p>\n\n\n\n<h2 class=\"wp-block-heading western\" id=\"a-ssh-key-please\">A SSH key, please.<\/h2>\n\n\n\n<p>Now we have first to create a SSH key to allow us to be authenticated in our server in Vagrant box.<\/p>\n\n\n\n<p>Linux users can just use their standard CLI, Windows users can use Git Bash (just right click on your Desktop and click Git Bash to open it; it is like a command prompt but with something magic). Are your ready? Ok, type in this:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"ssh-keygen -t rsa -C &quot;yourname@homestead&quot;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">ssh-keygen<\/span><span style=\"color: #D4D4D4\"> -t rsa -C <\/span><span style=\"color: #CE9178\">&quot;yourname@homestead&quot;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Do really I have to tell you? I\u2019m sure I don\u2019t but, well, just to be clear about this: replace \u201cyourname\u201d with\u2026 your (user) name.<\/p>\n\n\n\n<p>This will create a hidden folder called \u201c.ssh\u201d in your Home directory for Linux users (~\/), in your personal folder for Windows users (C:\\Users\\&lt;USER_NAME&gt;) and it will put your SSH key in this folder. We\u2019ll have to refer to this when we\u2019ll be setting up our <em>Homestead.yaml<\/em> file. That is, right now!<\/p>\n\n\n\n<h2 class=\"wp-block-heading western\" id=\"homestead-yaml-file-section-1\">Homestead.yaml file: section 1<\/h2>\n\n\n\n<p>Actually, <em>Homestead.yaml<\/em> file borns almost perfect. Let\u2019s analyze the important things.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"---\n\nip: &quot;192.168.10.10&quot;\n\nmemory: 2048\n\ncpus: 1\n\nprovider: virtualbox\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">---<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">ip<\/span><span style=\"color: #D4D4D4\">: <\/span><span style=\"color: #CE9178\">&quot;192.168.10.10&quot;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">memory<\/span><span style=\"color: #D4D4D4\">: <\/span><span style=\"color: #B5CEA8\">2048<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">cpus<\/span><span style=\"color: #D4D4D4\">: <\/span><span style=\"color: #B5CEA8\">1<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">provider<\/span><span style=\"color: #D4D4D4\">: <\/span><span style=\"color: #CE9178\">virtualbox<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>At the top of the file you see an IP address: this will be used to access your sites\/web applications. You can change it, if you have a good reason to do it, but as it is it works fine. We\u2019ll use this IP address later to set up our <i>hosts<\/i> file.<\/p>\n\n\n\n<p>The other important setting is the provider: it is already set to \u201cvirtualbox\u201d so we can be happy an go ahead \ud83d\ude42<\/p>\n\n\n\n<h2 class=\"wp-block-heading western\" id=\"homestead-yaml-file-section-2\">Homestead.yaml file: section 2<\/h2>\n\n\n\n<p>Then we have to set the path to our SSH key and the key file itself:<\/p>\n\n\n\n<p><b>Linux<\/b><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"authorize: ~\/.ssh\/id_rsa.pub\n\nkeys:\n\n- ~\/.ssh\/id_rsa\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">authorize<\/span><span style=\"color: #D4D4D4\">: <\/span><span style=\"color: #CE9178\">~\/.ssh\/id_rsa.pub<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">keys<\/span><span style=\"color: #D4D4D4\">:<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">- <\/span><span style=\"color: #CE9178\">~\/.ssh\/id_rsa<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><b>Windows<\/b><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"authorize: c:\/Users\/marco\/.ssh\/id_rsa.pub\n\nkeys:\n\n- c:\/Users\/marco\/.ssh\/id_rsa\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">authorize<\/span><span style=\"color: #D4D4D4\">: <\/span><span style=\"color: #CE9178\">c:\/Users\/marco\/.ssh\/id_rsa.pub<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">keys<\/span><span style=\"color: #D4D4D4\">:<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">- <\/span><span style=\"color: #CE9178\">c:\/Users\/marco\/.ssh\/id_rsa<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading western\" id=\"homestead-yaml-file-section-3\">Homestead.yaml file: section 3<\/h2>\n\n\n\n<p>Then we find the folder section. Here we set the shared folder: basically, we tell our virtual machine where the code of our website\/application resides so it can execute it.<\/p>\n\n\n\n<p><b>Linux<\/b><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"- map: ~\/Homestead\/Code\n\nto: \/home\/vagrant\/Code\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">- <\/span><span style=\"color: #569CD6\">map<\/span><span style=\"color: #D4D4D4\">: <\/span><span style=\"color: #CE9178\">~\/Homestead\/Code<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">to<\/span><span style=\"color: #D4D4D4\">: <\/span><span style=\"color: #CE9178\">\/home\/vagrant\/Code<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><b>Windows<\/b><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"- map: C:\/Users\/&lt;USER_NAME&gt;\/Homestead\/Code\nto: \/home\/vagrant\/Code\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">- <\/span><span style=\"color: #569CD6\">map<\/span><span style=\"color: #D4D4D4\">: <\/span><span style=\"color: #CE9178\">C:\/Users\/&lt;USER_NAME&gt;\/Homestead\/Code<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">to<\/span><span style=\"color: #D4D4D4\">: <\/span><span style=\"color: #CE9178\">\/home\/vagrant\/Code<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading western\" id=\"homestead-yaml-file-section-4\">Homestead.yaml file: section 4<\/h2>\n\n\n\n<p>Finally, we have to set up our sites, decide what our domains will be and tell the virtual machine where the relative code can be found (we can ignore the rest of Homestead.yaml file and leave it as it is). Let\u2019s imagine we want our first domain for our first Laravel site\/application be firstlaravel.app (this will be identical for both Linux and Windows users):<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"sites:\n\n- map: firstlaravel.app\n\nto: \/home\/vagrant\/Code\/firstlaravel\/public\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6\">sites<\/span><span style=\"color: #D4D4D4\">:<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">- <\/span><span style=\"color: #569CD6\">map<\/span><span style=\"color: #D4D4D4\">: <\/span><span style=\"color: #CE9178\">firstlaravel.app<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">to<\/span><span style=\"color: #D4D4D4\">: <\/span><span style=\"color: #CE9178\">\/home\/vagrant\/Code\/firstlaravel\/public<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Wait a moment: what&#8217;s that &#8220;Code&#8221; folder? It&#8217;s the folder where we keep all our projects but we have to create it. Go to your file manager, open your Homestead folder and create a folder giving it the name \u201cCode\u201d.<\/p>\n\n\n\n<p>Now, open your CLI in \u201cHomestead\/Code\u201d folder and type:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"composer create-project laravel\/laravel firstlaravel --prefer-dist\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">composer create-project laravel\/laravel firstlaravel --prefer-dist<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>This will create a new Laravel project with the following path<\/p>\n\n\n\n<p><b>Linux<\/b>: ~\/Homestead\/Code\/firstlaravel<\/p>\n\n\n\n<p><b>Windows<\/b>: C:\\Users\\&lt;USER_NAME&gt;\\Homestead\\Code\\firstlaravel<\/p>\n\n\n\n<h2 class=\"wp-block-heading western\" id=\"3-laps-to-go\">3 laps to go!<\/h2>\n\n\n\n<p>Just 3 little steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>we have to modify our <em>hosts<\/em> file adding the IP we have in our Homestead.yaml file. Linux users will find <em>hosts <\/em> file in \/etc\/ directory,\u00a0 Windows user will find it in C:\\Windows\\System32\\drivers\\etc; here we have to add the following line:<br><pre class=\"theme:github toolbar:2 show-lang:2 striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false show-plain:3 lang:default decode:true\">192.168.10.10  firstlaravel.app<\/pre><br><p>This way we&#8217;ll be able to use our domain to load the application in our browser.<\/p><br><\/li>\n\n\n\n<li>In our CLI we have now to initialize Vagrant; navigate to your Homestead folder and type:<br><pre class=\"theme:dark-terminal toolbar:2 striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false show-plain:3 lang:default decode:true\">vagrant init<\/pre><br><p>This will initialize \u201ccurrent directory to be a <em>Vagrant<\/em> environment\u201d (<a href=\"https:\/\/www.vagrantup.com\/docs\/cli\/init.html\" target=\"_blank\" rel=\"noopener\">https:\/\/www.vagrantup.com\/docs\/cli\/init.html<\/a>)<\/p><br><\/li>\n\n\n\n<li>Start our virtual machine: stay on your CLI and type<br><pre class=\"theme:dark-terminal toolbar:2 striped:false show-plain:3 lang:default decode:true\">vagrant up<\/pre><br><p>and wait your CLI return to the command prompt. Now your Homestead virtual machine is up and running.<\/p><br><\/li>\n<\/ol>\n\n\n\n<p>Now you can finally launch your browser and just type <span class=\"theme:github lang:default decode:true crayon-inline \">firstlaravel.app<\/span> in the address bar and, if everything is good, you should see the standar welcome page of Laravel:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><a href=\"https:\/\/codingfix.com\/wp-content\/uploads\/2017\/09\/firstlaravel.app_.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"448\" src=\"https:\/\/codingfix.com\/wp-content\/uploads\/2017\/09\/firstlaravel.app_.jpg\" alt=\"firstlaravel.app\" class=\"wp-image-328\" srcset=\"https:\/\/codingfix.com\/wp-content\/uploads\/2017\/09\/firstlaravel.app_.jpg 800w, https:\/\/codingfix.com\/wp-content\/uploads\/2017\/09\/firstlaravel.app_-600x336.jpg 600w, https:\/\/codingfix.com\/wp-content\/uploads\/2017\/09\/firstlaravel.app_-300x168.jpg 300w, https:\/\/codingfix.com\/wp-content\/uploads\/2017\/09\/firstlaravel.app_-768x430.jpg 768w, https:\/\/codingfix.com\/wp-content\/uploads\/2017\/09\/firstlaravel.app_-750x420.jpg 750w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"something-more\">Something more<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"adding-other-projects\">Adding other projects<\/h3>\n\n\n\n<p>As natural, we can expect we&#8217;ll create other Laravel projects, not just one. In this case, after having create the new project with the command<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"composer create-project laravel\/laravel firstlaravel --prefer-dist\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">composer create-project laravel\/laravel firstlaravel --prefer-dist<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>from you Homestead\/Code folder you have to do these simple steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open <em>Homestead.yaml<\/em> file, go to the site section and add your new project there; supposing the new project be called <em>secondlaravel.com<\/em> the new section should looks like this:<br><pre class=\"theme:github toolbar:2 show-lang:2 striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false plain:false show-plain:3 plain-toggle:false copy:false popup:false expand-toggle:false decode-attributes:false trim-whitespace:false trim-code-tag:false mixed:false lang:default decode:true show_mixed:false\">sites:<br><br>- map: firstlaravel.app<br><br>to: \/home\/vagrant\/Code\/firstlaravel\/public<br><br>- map: secondlaravel.com<br><br>to: \/home\/vagrant\/Code\/secondlaravel\/public<\/pre><br><\/li>\n\n\n\n<li>Open <em>hosts<\/em> file and add the following line:<br><pre class=\"theme:github toolbar:2 show-lang:2 striped:false marking:false ranges:false nums:false nums-toggle:false wrap-toggle:false show-plain:3 lang:default decode:true\">192.168.10.10  firstlaravel.app<br>192.168.10.10  secondlaravel.com<\/pre><br><\/li>\n\n\n\n<li>Open your CLI in your Homestead folder and type <span class=\"theme:dark-terminal lang:default decode:true crayon-inline \">vagrant provision<\/span>\u00a0 or <span class=\"theme:dark-terminal lang:default decode:true crayon-inline\">vagrant reload<\/span>\u00a0 in order your changes take effect.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"issue-1\">Issue 1:<\/h3>\n\n\n\n<p>I have already mentioned this but I repeat it again here: if you run <span class=\"theme:dark-terminal lang:default decode:true crayon-inline\">vagrant up<\/span>&nbsp;and everything looks good but trying to navigate to your app with the browser raises a &#8220;Timed out&#8221; error check your VirtualBox version and in general be sure you have the latest versions installed for each piece of software you&#8217;re using.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"issue-2\">Issue 2:<\/h3>\n\n\n\n<p>Both in Linux and in WIndows my first attempt to access my application has been frustrated by the following warning:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><a href=\"https:\/\/codingfix.com\/wp-content\/uploads\/2017\/09\/Homestead-errors.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"478\" src=\"https:\/\/codingfix.com\/wp-content\/uploads\/2017\/09\/Homestead-errors-1024x478.png\" alt=\"Homestead errors\" class=\"wp-image-333\" srcset=\"https:\/\/codingfix.com\/wp-content\/uploads\/2017\/09\/Homestead-errors-1024x478.png 1024w, https:\/\/codingfix.com\/wp-content\/uploads\/2017\/09\/Homestead-errors-600x280.png 600w, https:\/\/codingfix.com\/wp-content\/uploads\/2017\/09\/Homestead-errors-300x140.png 300w, https:\/\/codingfix.com\/wp-content\/uploads\/2017\/09\/Homestead-errors-768x359.png 768w, https:\/\/codingfix.com\/wp-content\/uploads\/2017\/09\/Homestead-errors-750x350.png 750w, https:\/\/codingfix.com\/wp-content\/uploads\/2017\/09\/Homestead-errors.png 1304w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>If this happens even to you, just open your CLI in your app folder (<em>Homestead\/Code\/firstlaravel<\/em>) and type this command:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"composer update --no-scripts\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">composer update --no-scripts<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>This command could give you some errors: for instance I saw it to fail if phpunit is not installed or if mbstring extension is missing. Just install al missing libraries once at a time to make it run (in WIndows just use installers, in Ubuntu use <span class=\"theme:dark-terminal lang:default decode:true crayon-inline \">sudo apt-get install phpunit<\/span> and <span class=\"theme:dark-terminal lang:default decode:true crayon-inline \">sudo apt-get install php7.0-mbstring<\/span>&nbsp;). It will be annoying, I know, but this what I did to solve the issue in my Linux Mint and I don&#8217;t know any alternative more comfortable way \ud83d\ude42<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"issue-3\">Issue 3:<\/h3>\n\n\n\n<p>You could get a page similar to the one above mentioning some missing software. For instance, in my system I was missing PhpUnit and this prevented me to access my application. I have just installed PhpUnit with the following comands and the error has gone. So I have had to install PEAR and PhpUnit. If this happens to you, I suggest to read this useful document: <a href=\"https:\/\/phpunit.de\/manual\/current\/en\/installation.html\" target=\"_blank\" rel=\"noopener\">https:\/\/phpunit.de\/manual\/current\/en\/installation.html<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"issue-4\">Issue 4:<\/h3>\n\n\n\n<p>If something goes wrong, Laravel message is a bit cryptic:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Whoops, looks like something went wrong.<\/p>\n<\/blockquote>\n\n\n\n<p>If you want to get Laravel show full debug information in the browser, rename the file <em>.env.example<\/em> in your project folder (<em>firstlaravel\/<\/em> in our example) to <em>.env. <\/em>Then open it with a text editor and be sure the value of APP_ENV be local:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"APP_ENV=local\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">APP_ENV=local<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"issue-5\">Issue 5:<\/h3>\n\n\n\n<p>Once you have set Laravel to show debug infos, you could get into this message:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>RuntimeException No application encryption key has been specified.<\/p>\n<\/blockquote>\n\n\n\n<p>If this happens even to you, don&#8217;t panic: just open your CLI in your project directory (firstlaravel\/) and type this command:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"php artisan key:generate\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">php artisan key:generate<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><strong>Warning:<\/strong> Before you can use this command, you <strong>must<\/strong> rename the <em>.env.example<\/em> file to <em>.env<\/em> otherwise you&#8217;ll get this error<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"file_get_contents(\/home\/marco\/Homestead\/Code\/firstlaravel\/.env): failed to\nopen stream: No such file or directory\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">file_get_contents(\/home\/marco\/Homestead\/Code\/firstlaravel\/.env): failed to<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">open stream: No such file or directory<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"that-s-all-folks-really\">That&#8217;s all, folks&#8230; really?<\/h2>\n\n\n\n<p>This is how I have successfully setup a Homestead environment in Linux Mint 18.2 and WIndows 10 running in my dual boot machine.<\/p>\n\n\n\n<p>I sincerely hope you won&#8217;t get any other issue but if you do, feel free to post here a comment: we will can make this article better \ud83d\ude42 Thank you!<\/p>\n\n\n\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction When I started to learn Laravel, I have choosen to use Homestead, the \u201cpre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine.\u201d Actually, I already had Php installed on my machine, as well Apache server [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":346,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_gspb_post_css":"","footnotes":""},"categories":[34],"tags":[],"post_folder":[142],"class_list":["post-154","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-other-stuff"],"_links":{"self":[{"href":"https:\/\/codingfix.com\/wp-json\/wp\/v2\/posts\/154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codingfix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codingfix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codingfix.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/codingfix.com\/wp-json\/wp\/v2\/comments?post=154"}],"version-history":[{"count":0,"href":"https:\/\/codingfix.com\/wp-json\/wp\/v2\/posts\/154\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codingfix.com\/wp-json\/wp\/v2\/media\/346"}],"wp:attachment":[{"href":"https:\/\/codingfix.com\/wp-json\/wp\/v2\/media?parent=154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codingfix.com\/wp-json\/wp\/v2\/categories?post=154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codingfix.com\/wp-json\/wp\/v2\/tags?post=154"},{"taxonomy":"post_folder","embeddable":true,"href":"https:\/\/codingfix.com\/wp-json\/wp\/v2\/post_folder?post=154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}