Problem while Installing The Homestead Vagrant Box - laravel

I'm using ubuntu 14.04, and I'm trying to setup larave/Homestead. But while installing Homestead Vagrant Box I lost internet connection in middle, later on I tried to reinstall it using '$ vagrant box add laravel/homestead'
command line, but it prompts following errors while reinstalling.
1) virtualbox
2) vmware_desktop
Enter your choice: 1
==> box: Adding box 'laravel/homestead' (v0.3.3) for provider: virtualbox
box: Downloading: https://atlas.hashicorp.com/laravel/boxes/homestead/versions/0.3.3/providers/virtualbox.box
==> box: Box download is resuming from prior download progress
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
HTTP server doesn't seem to support byte ranges. Cannot resume.
I tried reinstalling vagrant but this didn't work.

You need to clear the temporary files generated by Vagrant.
This can be achieved in three ways:
Force Clean Install
Add a parameter --clean as such $ vagrant box add laravel/homestead --clean
Manual Deletion
Navigate manually to vagrants temporary folder, by hitting cmd+space and typing ~/.vagrant.d/tmp/, and remove files located there.
Terminal
Open the terminal and remove the temporary files generated by
vagrant:
rm ~/.vagrant.d/tmp/*

Thanks #Nicklas for your quick response. But I solved it adding '-c' flag at end.
$ vagrant box add laravel/homestead -c
This removed files associated with it allocated in .vagrant.d/tmp/

The easiest option is to force the installer to clean the old files, so you just need to use this command
$ vagrant box add laravel/homestead --clean
source

Related

Vagrant: "The box you're attempting to add already exists"

I am pretty new to Vagrant and already I seem to have hit a snag with it. I am basically following their get started guide.
When I type the command:
$ vagrant box add hashicorp/precise64
I get this error:
The box you're attempting to add already exists. Remove it before
adding it again or add it with the --force flag.
Name: hashicorp/precise64
Provider: virtualbox
Version: 1.1.0
Here is what I have tried.
I destroyed it first using:
$ vagrant destroy
I then backed out into documents using:
$ cd -
I then removed the director with:
$ rm -rf vagrant_getting_started
Then I created a new directory with:
$ mkdir vagrant_getting_started
I then went into that directory with:
$ cd vagrant_getting_started
Then I typed:
$ vagrant box add hashicorp/precise64
Which gave me:
==> box: Loading metadata for box 'hashicorp/precise64'
box: URL: https://vagrantcloud.com/hashicorp/precise64
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.
1) hyperv
2) virtualbox
3) vmware_fusion
Enter your choice:
Finally I chose option 2 and then this is where the error is.
Can anyone see anything that I am doing wrong?
vagrant box remove -f laravel/homestead will remove the "laravel/homestead" from your machine and you can reinstall the same by vagrant box add laravel/homestead.
Unless the Vagrant box image has become corrupted, you don't need to download it again to re-use it.
Vagrant only downloads the boxes it doesn't have. Once a box image is saved locally on your system, Vagrant will use the local image to work from.
When setting up a new Vagrant based project, the following will happen:
You create or navigate to your project directory
Run vagrant init hashicorp/precise64. This will initialise Vagrant inside the directory, and create a new Vagrantfile if one doesn't exist. It also tells Vagrant which box image to use. If the box image is already stored locally - it won't download it.
Alternatively, if you already have a Vagrantfile in your project directory, simply run vagrant up. Vagrant will take care of everything for you - including downloading the box image (if applicable).

error in setting up vagrant as local development environment

I have vagrant (Vagrant 2.0.4) and Oracle VM Virtual Box (Version 5.2.10 r122406 (Qt5.6.2)) installed on my machine.
As soon as I enter vagrant box add laravel/homestead or vagrant box add laravel/homestead http://atlas.hashicorp.com/laravel/boxes/homestead on Git Bash, I get the following error:
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again. OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
Problem Statement:
I am wondering, what command I need to enter on my Git Bash so that I am successfully able to laravel/homestead for virtualbox.
I followed this answer, but it didn't solve my problem.
try emptying the temp first by running this command:
rm -rf ~/.vagrant.d/tmp/
then running the following command:
vagrant box add --insecure laravel/homestead
if this doesn't work ,then empty your temp by :
pressing win +r
typing %temp% then hitting enter
then delete everything in there and if asked to continue or skip, choose skip
then connect to a VPN and try running the following command :
vagrant box add laravel/homestead
hope this helps.

Terminal Doesn't Say Whether Vagrant Box Installed Successfully or Not

I'm having some issues installing Laravel/Homestead. When I ran the $ vagrant box add laravel/homesteadcommand everything went fine but I didn't see this line, ==> box: successfully added box 'laravel/homestead' (v0.4.2) for 'virtualbox'!" However, when I run the $ vagrant box add laravel/homesteadcommand again it shows the following below, which means that Laravel/Homestead was successfully installed, right? Or no? If not how would I delete all the vagrant files that I installed? Would I per the usual, go to the control panel and select uninstall program, or would that not be enough? Thanks for you help!
==> box: Loading metadata for box 'laravel/homestead'
box: URL: https://vagrantcloud.com/laravel/homestead
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.
1) parallels
2) virtualbox
3) vmware_desktop
Enter your choice: 2
==> box: Adding box 'laravel/homestead' (v4.0.0) for provider: virtualbox
The box you're attempting to add already exists. Remove it before
adding it again or add it with the `--force` flag.
Name: laravel/homestead
Provider: virtualbox
Version: 4.0.0
Your first attempt did work, as the Vagrant is telling you that instance already exists... Use GitBash (assuming you are on windows) and once in terminal mode
cd ~/Homestead (or try cd ~/.Homestead)
vagrant up
If its all working - you will see the messages OK and if not, you'll get an error
Then you just go into your code folder where your projects will be created
cd ~/Code (code being the folder I want to create my Laravel projetcs)
composer create-project --prefer-dist laravel/laravel nameofproject
Not sure if above helps. in my example, the homestead files are in the /users/myuser/Homestead folder - but best of luck

Vagrant, can't download box

not sure why I'm having this issue but I can't add vagrant boxes.
Using windows 10, tried on powershell and simple command prompt. same issue. It's a relatively fresh install of windows. Maybe I'm missing some required package?
first i tried this command:
vagrant box add hashicorp/precise32
and got the error:
The box 'hashicorp/precise32' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:
URL: ["https://atlas.hashicorp.com/hashicorp/precise32"]
Error:
So I downloaded the box manually and tried this:
vagrant box add base64 file:///D:/downloads/vagrant_boxes/precise64.box
And got this error again:
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'base64' (v0) for provider:
box: Unpacking necessary files from: file:///D:/downloads/vagrant_boxes/precise64.box
box:
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
The libraries on current version (as of this date) OSX don't support the version of curl bundled with Vagrant 1.8.7. I installed 1.8.6 and everything worked like a champ. To test this theory:
cd /opt/vagrant/embedded/bin
./curl --help
If you get a 'normal' reply than you should be fine or there's something else wrong.
I was using vagrant v1.8.0 when this happened. Later that day vagrant v1.8.1 was released. I didn't try that, instead I shifted back to v1.7.4 and the issue was gone.
I've been resolving this issue since I installed vagrant 1.8.1, I tried to installed lower version but i came up with the same problem. Hopefully, I solve it here:
first make sure you installed Microsoft Visual C++ 2010 SP1 Redistributable.
here is for 64bit https://www.microsoft.com/en-us/download/details.aspx?id=13523
next, download ssl version of curl in my case 64bit also. here:
https://curl.haxx.se/latest.cgi?curl=win64-ssl-sspi
now extract the curl.exe to C:\Vagrant\embedded\bin. please see your installation directory.
and then done. if your not using ssl try the no-ssl version of curl. hope helps
Check the C: \ HashiCorp \ Vagrant \ embedded \ bin \ curl.exe
case give an error, there is your problem.
To solve, just download gitbash, console2, cmder, etc ... you have curl installed, or try http://www.confusedbycode.com/curl/.
however strongly recommend gitbash or cmder
https://atlas.hashicorp.com/hashicorp/boxes/precise32
base on the offical URL.. there is only virutal box provider.
try below command:
vagrant init hashicorp/precise32; vagrant up --provider virtualbox
For MacOS users whom reinstalling new version of vagrant doesn't help:
sudo mv /opt/vagrant/embedded/lib/libiconv.2.dylib /opt/vagrant/embedded/lib/libiconv.2.dylib_
brew install libiconv
brew link --force libiconv
credits to: https://github.com/mitchellh/vagrant/issues/5782
You don`t need to add the box. Init instead of this:
vagrant init hashicorp/precise32
vagrant up
vagrant ssh
Hope it will be added in boxes list automatically.
If you want to set up local box - add it getting few steps:
D:
cd downloads/vagrant_boxes
vagrant box add base64 precise64.box
vagrant up
vagrant ssh

Download vagrant box file locally from atlas and configuring it

I want to download a vagrant box file from Atlas for using it later locally with my vagrant file. How can I do this, and how can I configure it?
To download a file you have to add version and provider in the URL. For example for downloading trusty64 First you need its URL which is
https://app.vagrantup.com/ubuntu/boxes/trusty64/
then you have to add version and provider afterwards, for our example the download URL would be.
https://app.vagrantup.com/ubuntu/boxes/trusty64/versions/20180206.0.0/providers/virtualbox.box
Then you have to add it locally from your vagrant file.
To add it locally to vagrant file use the following command
vagrant box add foo-box /path/to/vagrant-box.box
vagrant init foo-box
vagrant up
This will create the vagrantfile and you can configure the vagrant file.
However, this will add the box as version 0.
○ → vagrant box add ubuntu/trusty64 ~/Downloads/trusty-server-cloudimg-amd64-vagrant-disk1.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'ubuntu/trusty64' (v0) for provider:
box: Unpacking necessary files from: file:///Users/ram/Downloads/trusty-server-cloudimg-amd64-vagrant-disk1.box
==> box: Successfully added box 'ubuntu/trusty64' (v0) for 'virtualbox'!
vagrant does not allow to specify a version number of the manually added box
○ → vagrant box add ubuntu/trusty64 ~/Downloads/trusty-server-cloudimg-amd64-vagrant-disk1.box --box-version 20151021.0.0
==> box: Box file was not detected as metadata. Adding it directly...
You specified a box version constraint with a direct box file
path. Box version constraints only work with boxes from Vagrant
Cloud or a custom box host. Please remove the version constraint
and try again.
To update the version number of the box, change the folder name '0' in ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-trusty64/0 to the version number you downloaded. For example '20160120.0.0'
|2.2.3| MacBook-Pro in ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-trusty64
○ → mv 0 20160120.0.0
now you are all set to update the version next time with vagrant command too
○ → vagrant box list
ubuntu/trusty64 (virtualbox, 20160120.0.0)
I faced the same issue not being able to download from script. So manually downloaded the box and added to vagrant as below,
you can get versions you want from here - https://atlas.hashicorp.com/ubuntu/boxes/precise64
wget https://atlas.hashicorp.com/ubuntu/boxes/precise64/versions/20160818.0.0/providers/virtualbox.box
cd my_vagrant_project
vagrant box add precise64 ~/Downloads/precise-server-cloudimg-amd64-vagrant-disk1.box
vagrant init precise64
vagrant up
Download virtualbox.box:
https://app.vagrantup.com/laravel/boxes/homestead/versions/6.4.0/providers/virtualbox.box
You can change the version(6.4.0) of homestead box with the Current Version.
Current version: 6.4.0.
Check for the latest version here: https://app.vagrantup.com/laravel/boxes/homestead
After downloading the box, rename it to virtualbox.box
Don't forget to include the .box extension.
Add the downloaded homestead box to vagrant:
vagrant box add laravel/homestead file:///f:/virtualbox.box
Change the Drive( c: or d: or e:) or Path(c:/folder1/folder2/virtualbox.box) to the location where you have stored your downloaded homestead box.
You will get success massage like image below:
Update homestead box
Navigate to vagrant directory:
c:/users/YourUserName/.vagrant.d/boxes/laravel-VAGRANTSLASH-homestead
After that, Create a file called metadata_url
NOTE: There is no extension for metadata_url
Then add the link below and save the file
https://app.vagrantup.com/laravel/homestead
Do not add a newline after link in above file.
Rename folder 0 to 6.4.0
6.4.0 is your homestead box version.
And it's Done. Hope it help.
First: check latest version from this link Here
Update:you can try by go to the mentioned link above ,to get the number of latest version,then try to change the version in bellow URL
for now the latest version is:7.2.1
for virtualbox:
https://vagrantcloud.com/laravel/boxes/homestead/versions/7.2.1/providers/virtualbox.box
for hyperv:
https://vagrantcloud.com/laravel/boxes/homestead/versions/7.2.1/providers/hyperv.box
for vmware:
https://vagrantcloud.com/laravel/boxes/homestead/versions/7.2.1/providers/vmware_desktop.box
for parallels:
https://vagrantcloud.com/laravel/boxes/homestead/versions/7.2.1/providers/parallels.box
Maybe in the future the link changed so try to get download vagrant box by using command on your terminal/CMD by command
vagrant box add laravel/homestead
choose your virtualization method
then you will see the download link *ended with .box, after that you can cancel it CTRL+C and copy the download link and download it locally by using IDM/aria2c -x16 etc.
Second: Use this command
vagrant box add laravel/homestead {Path of file from your local computer}
Third:add metadata by go to
1- you create a file called metadata_url
NOTE: There is no extension for metadata_url
2- Then add this link and save the file
https://atlas.hashicorp.com/laravel/homestead
3- Copy metadata_url file to:
for windows go to
%userprofile%.vagrant.d\boxes\laravel-VAGRANTSLASH-homestead
4- Then rename the folder named 0 to the version of the current homestead version = 7.2.1
I hope this help
for more information
Laravel
metadata
If you have the ubuntu-VAGRANTSLASH-trusty64 folder from someone else machine you can simply copy paste the folder to
~/.vagrant.d/boxes
and use the vagrant up to start the servers. This way you do not need to add the trusty64 box manually.
Instructions for OSX/Fusion:
wget https://vagrantcloud.com/hashicorp/boxes/precise64/versions/1.1.0/providers/vmware_fusion.box
# For some reason, the downloaded filename was set to an uuid
# mv <uuid> vmware_fusion.box
vagrant box add hashicorp/precise64 vmware_fusion.box
cd vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64
mv 0 1.1.0
echo -n "https://app.vagrantup.com/hashicorp/boxes/precise64" > metadata_url
vagrant box list
I try to use vagrant up and I got URL to download box file:
https://vagrantcloud.com/centos/boxes/7/versions/1801.02/providers/virtualbox.box

Resources