Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vagrant error:Vagrantfile already exists in this directory

When I input $ vagrant box list,
Terminal outputs: centos64 (virtualbox)

Now I input $ vagrant init centos64,
Terminal outputs an error message:

"Vagrantfile" already exists in this directory. Remove it before running "vagrant init".

How do I remove it?

like image 778
kusumoto_teruya Avatar asked Apr 27 '14 15:04

kusumoto_teruya


People also ask

How do I remove Vagrantfile from a folder?

You can remove the Vagrantfile by typing rm Vagrantfile at the command line, but it is not clear what you are trying to achieve. The vagrant init command will initialise a new virtual box by creating a default Vagrantfile. Since you already have one, it looks like you may already have run the vagrant init command.

What is vagrant Vagrantfile?

A Basic Vagrantfile A Vagrantfile is a Ruby file that instructs Vagrant to create, depending on how it is executed, new Vagrant machines or boxes. You can see a box as a compiled Vagrantfile. It describes a type of Vagrant machines. From a box, we can create new Vagrant machines.

Where is the Vagrantfile located?

Explore the synced folder Tip: When you vagrant ssh into your machine, you're in /home/vagrant , which is a different directory from the synced /vagrant directory. Believe it or not, the Vagrantfile that you see inside the virtual machine is actually the same Vagrantfile that is on your actual host machine.


2 Answers

You can remove the Vagrantfile by typing rm Vagrantfile at the command line, but it is not clear what you are trying to achieve.

The vagrant init command will initialise a new virtual box by creating a default Vagrantfile. Since you already have one, it looks like you may already have run the vagrant init command.

If you are trying to start the VM then you need to use the command vagrant up centos64

like image 99
susieQ Avatar answered Oct 18 '22 02:10

susieQ


From website : https://www.vagrantup.com/docs/cli/init.html

To overwrite any existing Vagrantfile use :

vagrant init {BOX_NAME} --force

If specified, this command will overwite any existing Vagrantfile.

and then

vagrant up

like image 5
Tzvi Gregory Kaidanov Avatar answered Oct 18 '22 01:10

Tzvi Gregory Kaidanov