Adventure with Laravel Homestead, part 1

I thought it would be interesting to set up a Laravel instance to try it out. I did have a new project I wanted to develop, so I thought “How hard can it be to set up Laravel”? Well …

I have started using Vagrant to run some VMs (instead of VirtualBox by itself). I found the homestead box in the Vagrant Cloud, so I set that up to download and install.

> mkdir ~/Vagrant/laravel

> cd !!:$

> vagrant box add laravel/homestead

I wait a long while to download, but it finally arrives. I start it and look around, but I don’t see any of the programs I’m told will be associated with Homestead (mysql, nginx, etc). That’s odd.

The Laravel homestead documents also suggest cloning a repository. That did not make any sense, since I had a running Vagrant box. Since nothing was happening, I thought “Why not?”. The clone is downloaded into the same folder as the Laravel Vagrantfile. I follow the instructions to set up a Homestead.yaml file and look inside the Homestead folder to see if it’s there. It is, along with lots of others stuff, including … another Vagrantfile … That’s weird.

I make some simple changes to homestead.yaml and reload the original Vagrant box.

> vagrant reload –provision

I don’t see my changes. After some time, I wonder … What if I went inside the cloned folder and ran that Vagrantfile? It turns out that second Vagrantfile is the one that runs the homestead install. It seems weird to have a homestead box available in the Vagrant cloud and NOT have it be the one to use, but that’s what happened.

I make some changes in the homestead.yaml to set up a simple test site using the classic php test file.

<?php phpinfo(); ?>

Nothing displays. My first error message says “No input file specified”. I fixed that by pointing the map section inside homestead.yaml to the correct folder. Next error: “403 prohibited”. I thought it might be an nginx error, but I did not want to mess around too much with that just yet. However, I did check /var/log/nginx/homestead.test-error.log and I noticed something interesting:

“Unable to open primary script: /home/vagrant/code/test01/public/index.php (No such file or directory)”

OK. I guess I must wrap the simple php test page inside a Laravel template to make it display. Not a big deal, but one more thing I need to figure out. That will be for next time.

Advertisements

That would have been nice to know!

I run VirtualBox on my machine to test Ansible playbooks and to run (my legal copy of) Windows 7. I’ve received noticed from VirtualBox that there was a new version of VirtualBox available. (I run 5.1.28. The notice says 5.1.30.) After several weeks of delay, I decide to check it out.

I go to the VirtualBox website and discover that VB is now up to version 5.2.2. This is interesting. I wonder what they fixed? I like that it’s on minor version x.x.2, so they’ve tracked down the errors. I like it. I’ll download it and test it.

It looks good. It starts up as usual. The Windows 7 VM starts as expected. OK, let’s check out ansible. (Record scratch!!!) It won’t run any more. Vagrant 1.9.7 insists that it needs a copy of VirtualBox to run. I have VB installed. This can’t be right. I’ll force it and try again. Still not go with vagrant.

Let me run a Google search. It turns out that vagrant 2 won’t run VirtualBox 5.2 until the next minor update. What’s the newest version of vagrant available? 2.0.1. That’s it. I download it and attach the machine to a good internet pipe to handle the playbook.yml file. It starts up finally. A wasted afternoon on a machine that was not fixed until 9 pm.

Windows 7 updates, resolved

I’ve had some trouble with Windows 7 before. (tl;dr: I installed W7 on a VirtualBox VM. After several different mistakes, it finally installed, but no updates are downloading.) After some review and investigation, it looks like Windows update is working finally. I learned quite a bit.

For starters, it turns out that I had Windows 7 Service Pack 1 installed right from the DVD. That saved some problems, but I feel foolish for not knowing that.

I kept trying google searches to figure out what was going on with the Windows update problems. Eventually, after several months, I stumbled across a pinned reddit post that explains what to do. It makes sense and I compare it to other search results. Those other pages independently confirm what I need to do: download and install a series of software update rollup files and install them piece by piece. If I do it correctly, it will work.

I quickly have trouble with an ActiveX control. For some reason, I’m asked to install an add-on named “Microsoft Update Catalog”, even though I already have it. It’s already enabled, but not appearing in the list of running add-ons in IE 11. Fine, I switch to Chrome and continue downloading what I need.

Downloading the msu files takes time. I even set up a snapshot at one point to make sure I could roll back when one update’s notes described several errors with fixes requiring updates to registry files. I worked my way through April 2015, March / July / August / September / October and November 2016 updates and I’m ready to let Windows check by itself. It works! 29 additional updates had to be downloaded and installed. I did not have to find them. Finally!

Next steps:

  • Clone the Windows VM
  • Authenticate the Windows installation in the cloned VM (I’ve had to do this once already on a VM that I eventually kicked out the airlock.)
  • Install SQL Server 2014 available from Visual Studio Dev Essentials
    • Can I say how impressed I am with the Microsoft developer tools? I’ve always been an Apple guy, but I have not been excited about Xcode and Swift 3. The Microsoft stuff is new to me, so it looks exciting.
  • Study and practice for the MCSA exams in SQL Server 2012/2014

Adventures with Windows, part 2

As I mentioned earlier, I had trouble loading the free update to Windows 10. I now have a 5 GB file in my Windows 7 instance, but it never finished installing. It was stuck on 99% complete install for hours. I grew frustrated and decided to punt on the install.

Some websites mentioned that the Windows 10 update needed a fully patched and updates Windows 7 system in order to finish installing. It’s possible that may be true. It’s definitely true that I needed to patch Windows 7 as soon as possible. After installing an antivirus program (Avira) along with FireFox and Chrome, I decided to run the Windows update.

That did not go well either. I selected Windows Update from the Windows Control Panel and the “Other Programs” list on various occasions. I never got the impression that anything was happening. From other websites, I knew that the initial Windows update should take roughly 90-120 minutes. I would run Windows update 3 hours with  no indication that anything was happening.

I decided to try to install Windows updates directly from the browser. My browser was immediately updated to IE 11. Immediately is relative. It still took roughly 90 minutes to download and install 14 updates for IE 11 only. Once it was done, I went back to update.microsoft.com to see if that would list files to download. I was told to set the update back to Windows Update. I did not know any better, so now going to update.microsoft.com bounces me over to Windows Update again.

I may try downloading Windows 7 SP1 by itself. Maybe that will take care of some of the missing updates. It’s possible my home download speed is too slow to download any information quickly enough. It would be nice to go somewhere with a big pipe and not a lot of traffic. Where could that be?

Adventures with Windows 10: part 1

Microsoft announced that free upgrades to Windows 10 would end on July 29, 2016. I bought a full copy of Windows 7 to load onto a VirtualBox Virtual Machine several years ago, but never got around to installing it. I realized that this week would be a good time to get that project started and finished.

A while back, I created a ISO file of the Windows 7 installer DVD. I know that my current laptop does not have an optical drive, but the older one (the one with the failing trackpad) does. I suspect I bought the installer when I had the older laptop, but I also knew that I would need an ISO, if not for a new laptop, then for the desktop, which also does not come with an optical drive. (Weird.)

I created a new VirtualBox Virtual Machine to handle Windows 7. I remember I created a virtual optical drive in the virtual machine settings and attached the ISO to that virtual drive. Everything looks ready. Let’s start. Immediately, I get a message saying “Failed. No bootable medium found.”

I aborted and checked the settings again. There was a google search that suggested I hit the F12 key during boot up. That may have solved some issues, if I had tried it. I knew I needed an external optical drive any way, in case I sell or destroy the old laptop, so I drive down to the local Apple store and buy an overpriced optical drive.

I come back home and attach it to the new laptop. I can see the Windows 7 optical disk in the finder. I misunderstand how to load it in the Virtual Machine settings and end up starting the installer from the ISO. I know because if the installer were using the disk, I should have heard spinning sounds from the optical drive, which I did not.

It looks like Windows 7 is installing this time. I know it’s supposed to reboot to finish installation. What slips from my mind is that the second time, it’s supposed to reboot from the hard drive, not the ISO / optical drive. I keep interrupting the boot process by manually booting from the optical drive. It turns out that I installed several copies of Windows 7 into the virtual hard drive until I ran out of space.

I can see this is not working, so I start over with a fresh Virtual Machine. I decide not to add a virtual hard drive after realizing that the link to an optical drive already existed. When I start the blank windows machine this time, I was asked to pick a bootable drive. I was given the option of the drive with the Windows installer or the ISO (?). I pick the drive and go through the installation again, along with my extra second installation from the optical drive after reboot.

I read a bit online. (Google is your friend.) At this point, I realize that I need to let the reboot work without interference from me. I wipe out the Windows partitions created by the Windows installer and start over.

Finally, the Windows 7 installer works. I have a running Windows 7 instance running in VirtualBox. Next steps:

  • upgrade to Windows 10 for free – nope, 99% freeze. See next post.
  • load an anti-virus application – I’ve done research on free AV
  • load all other windows updates – nope
  • install Firefox and Chrome – eventually

All of that is for another time.

Friday link dump for later reading

While trying to find some info about CakePHP 3 and its integration with AJAX, I stumbled across Zen of Coding, which had several posts on this topic. I realized I needed to find part one of his six part series, so I went to his home page. In the content list, I saw another post titled “Making Sense of Vagrant for your CakePHP or Symfony 2 project.” There, it discusses a GUI for the Vagrantfile config, based off of something called PuPHPet, a “GUI configurator for Puppet and Vagrant“. Puppet is for system administration, which I don’t do much any more. Vagrant configures “virtual development environments”.

I like the idea of Vagrant, where I can set up the same Ubuntu instance (for example) and feel confident it will work with any other Ubuntu instance running the same version (more or less). I plan on installing it (VirtualBox, then Ubuntu and maybe Vagrant) one day, when I get around to installing all the other stuff I need to load onto my machine first. For now, I have this post to remind me of all the links I want to visit very, very soon.

Yes to Gparted, but still having trouble

It turns out the /home directories in my Ubuntu VM were too small to transfer over to a separate partition. I ran “Disk Usage Manager” (I think) and discovered that one of my main directories (/usr or /lib) was using almost all the free space available. It was a good idea to use VBoxManager to boost the space available for the hard drive in the VM. However, GParted does not allow modification of the partition it’s running on.

I realized I had to run a GParted Live CD on the VM. I found the .iso file and left it on the desktop. I had to modify the VM settings to read the .iso file first when booting. Once I figured that out, I was able to run the GParted Live CD. I was still having trouble reordering the partitions of the Ubuntu VMs.

It turns out that the extra space was added at the end of the Linux swap partition, as separate unallocated space. Eventually, a Google search helped me realize that I needed to move the Linux swap space to the far end of the unallocated partition, then extend the “boot” partition over to fill the remaining space. (It’s weird. Why not just one command instead of two separate actions?) I reshuffled the partition space, rebooted and Ubuntu started again with the full 16 GB partitions correctly.

Unfortunately, I’m still having trouble with Ubuntu updates. I can finally run them without running out of free space, but I have a configuration problem where a linux-generic update depends on another file that is not loaded and that file won’t load because it’s not needed. More on that later.