Noobie needs help with ssh, VMs on Linux

79 views
Skip to first unread message

signmeuptoo

unread,
Apr 1, 2019, 7:10:35 PM4/1/19
to Vagrant
Hi, I'm a vagrant noobie who is in self study for Linux Admin theory.

I run Linux Mint, not Windows, in case that is germane to my problems.

I performed a few installs of VBs of centos for personal study with vagrant, however, after trying several times, and not getting ssh to load the OSs by the names I used during installs, I gave up for a bit and searched all over and found out that vagrant ssh default (or not using default) allowed the VM to be accessable.

However, I want to be able to vagrant up multiple OSs on my system that already had VirtualBox installed, and have them ssh able with the names I give them, rather than default as a name. I've read documentation but I am a bit lost because my aptitude isn't up to speed with the explanations given on vagrant's site, I don't understand them yet.

In my .vagrant.d home directory (there is also a .vagrant directory) I find 5 VMs listed, with names such as centos1 and such. I tried changing names of the directories but that didn't do the trick.

Is there a change I need to make to my Vagrantfile and also how do I install additional versions of Centos, Debian, and SUSE? 

My apologies for being a greenhorn, I'm trying to learn as well as I can.

Brian Cain

unread,
Apr 2, 2019, 11:52:46 AM4/2/19
to vagra...@googlegroups.com
Hey there!

I recommend sharing what your Vagrantfile looks like first so we can understand what exactly you are working with.

Thanks!
 

My apologies for being a greenhorn, I'm trying to learn as well as I can.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/0cc56797-f19a-48d9-8722-bd7b0ade09e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Brian Cain

signmeuptoo

unread,
Apr 2, 2019, 1:18:08 PM4/2/19
to Vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
 config.vm.provision "shell", inline: "echo Hello"

 config.vm.define :OS1 do |os1|
   os1.vm.box = "mycentos"
 end

  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://vagrantcloud.com/search.


  # The url from where the 'config.vm.box' box will be fetched if it
  # doesn't already exist on the user's system.
  # config.vm.box_url = "https://github.com/tommy-muehle/puppet-vagrant-boxes/releases/download/1.1.0/centos-7.0-x86_64.box"
 
  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  # NOTE: This will enable public access to the opened port
  # config.vm.network "forwarded_port", guest: 80, host: 8080

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine and only allow access
  # via 127.0.0.1 to disable public access
  # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  # config.vm.network "private_network", ip: "192.168.33.10"

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  # config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
  #   vb.gui = true
  #
  #   # Customize the amount of memory on the VM:
  #   vb.memory = "1024"
  # end
  #
  # View the documentation for the provider you are using for more
  # information on available options.

  # Enable provisioning with a shell script. Additional provisioners such as
  # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
  # documentation for more information about their specific syntax and use.
  # config.vm.provision "shell", inline: <<-SHELL
  #   apt-get update
  #   apt-get install -y apache2
  # SHELL
end


On Tuesday, April 2, 2019 at 11:52:46 AM UTC-4, Brian Cain wrote:
Hey there!

On Mon, Apr 1, 2019 at 4:10 PM signmeuptoo <signm...@gmail.com> wrote:
Hi, I'm a vagrant noobie who is in self study for Linux Admin theory.

I run Linux Mint, not Windows, in case that is germane to my problems.

I performed a few installs of VBs of centos for personal study with vagrant, however, after trying several times, and not getting ssh to load the OSs by the names I used during installs, I gave up for a bit and searched all over and found out that vagrant ssh default (or not using default) allowed the VM to be accessable.

However, I want to be able to vagrant up multiple OSs on my system that already had VirtualBox installed, and have them ssh able with the names I give them, rather than default as a name. I've read documentation but I am a bit lost because my aptitude isn't up to speed with the explanations given on vagrant's site, I don't understand them yet.

In my .vagrant.d home directory (there is also a .vagrant directory) I find 5 VMs listed, with names such as centos1 and such. I tried changing names of the directories but that didn't do the trick.

Is there a change I need to make to my Vagrantfile and also how do I install additional versions of Centos, Debian, and SUSE? 

I recommend sharing what your Vagrantfile looks like first so we can understand what exactly you are working with.

Thanks!
 

My apologies for being a greenhorn, I'm trying to learn as well as I can.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagra...@googlegroups.com.


--
Brian Cain

Brian Cain

unread,
Apr 2, 2019, 1:20:47 PM4/2/19
to vagra...@googlegroups.com
Excellent, thanks!

What exactly are you trying to do, and what have you tried doing?
If I understand your previous email right, are you trying to bring up multiple Vagrant guests?

To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/a0384298-0089-478d-a4d6-7ddd78833c72%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Brian Cain

signmeuptoo

unread,
Apr 2, 2019, 1:23:54 PM4/2/19
to Vagrant

May I give some background: I tried installing centos via vangrant init <my_filename> <the_file_on_the_vagrant_site> Several times. This I messed with over a few days. I'm a greenhorn as they say doing self study.

I ended up, it now seems with a vagrant and a vagrant2 directory, a .vagrant and a .vangrant.d directory.

It seems that that is part of the problem.

Something seems to have gone wrong with the init process of the install.

I tried chosing these names: centos, centos1, centos2, CentOS, and OS1.

It only would start up with vagrant up, then ssh vagrant default (rather than any of the names I tried), and that is before I recently tried to change the Vagrantfile as per someone's guidance. I'm still in a quandry whether to start from the beginnning and if so, how to do so.

signmeuptoo

unread,
Apr 2, 2019, 1:30:46 PM4/2/19
to Vagrant

I just attempted to copy and past that Vagrantfile, since none existed in my vagrant2 folder where I tried setting up, with several iterrations, centos under different names, one of which WAS centos and then nanoingthe Vagrantfile with the name centos rather than mycentos, and I get this:

vagrant ssh centos
The machine with the name 'centos' was not found configured for
this Vagrant environment.

On Monday, April 1, 2019 at 7:10:35 PM UTC-4, signmeuptoo wrote:

Brian Cain

unread,
Apr 2, 2019, 1:34:56 PM4/2/19
to vagra...@googlegroups.com
Is the problem that you are using a box named "mycentos"? This name should correspond to the box you wish to use, rather than
a name you want it to be called. These names typically correspond to boxes on Vagrant Cloud: https://app.vagrantup.com/boxes/search?utf8=%E2%9C%93&sort=downloads&provider=&q=centos

So if you wanted to use say, bento/centos-7.2, your Vagrantfile would look like

Vagrant.configure("2") do |config|
 config.vm.provision "shell", inline: "echo Hello"

 config.vm.define "centos" do |c|
   c.vm.box = "bento/centos-7.2"
 end
end

I also changed the guest to be called "centos".

One way to check what name you should type when you run `vagrant up` is the command `vagrant status`. It will show you what names are defined.

Since I called this guest "centos", that means you can run `vagrant up centos` and `vagrant ssh centos`, as well as any other vagrant commands for that guest.

But more generally, you give your Vagrant guests names through that config option that is `config.vm.define`. The string after this is the name.

Have you started with the introduction/getting started guide on the website? https://www.vagrantup.com/intro/getting-started/index.html

I recommend following along and reading through all of that. It should give you a good understanding of how to use Vagrant and what steps you might be missing.

Thanks!

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Brian Cain

signmeuptoo

unread,
Apr 2, 2019, 1:54:19 PM4/2/19
to Vagrant
thank you, I will work on that information in a bit, I appreciate it. Someone else is also helping via email.

One question:

with this part:

c.vm.box = "bento/centos-7.2"

My install via the init box install the box centos term is not centos-7.2, but a longer term in the copied and pasted init box. Does it know that simpler OS name (centos-7.2)?
To unsubscribe from this group and stop receiving emails from it, send an email to vagra...@googlegroups.com.


--
Brian Cain

Brian Cain

unread,
Apr 2, 2019, 1:57:15 PM4/2/19
to vagra...@googlegroups.com
On Tue, Apr 2, 2019 at 10:54 AM signmeuptoo <signm...@gmail.com> wrote:
thank you, I will work on that information in a bit, I appreciate it. Someone else is also helping via email.

One question:

with this part:

c.vm.box = "bento/centos-7.2"

My install via the init box install the box centos term is not centos-7.2, but a longer term in the copied and pasted init box. Does it know that simpler OS name (centos-7.2)?

Nope, it does not! If you want the bento box specifically, you need the full name. You can also add and build your own boxes (which means you can give it any name you want),
but I would consider that an advanced feature that I wouldn't worry about until learning more and understanding how Vagrant works.
 
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/94e2d3f4-5c30-4a9d-93d2-43d3c1703a48%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Brian Cain

signmeuptoo

unread,
Apr 2, 2019, 5:39:43 PM4/2/19
to vagra...@googlegroups.com
Thank you all, I got it now, greatly appreciated!

signmeuptoo

unread,
Apr 2, 2019, 5:49:47 PM4/2/19
to Vagrant

Now as I add OSs, I just add lines the same way, those two lines, or is there any additional stuff?


--
Brian Cain

Brian Cain

unread,
Apr 2, 2019, 6:46:34 PM4/2/19
to vagra...@googlegroups.com
On Tue, Apr 2, 2019 at 2:49 PM signmeuptoo <signm...@gmail.com> wrote:

Now as I add OSs, I just add lines the same way, those two lines, or is there any additional stuff?

Yes, if you want to add more guests you can do so like:

Vagrant.configure("2") do |config|
 config.vm.provision "shell", inline: "echo Hello"

 config.vm.define "centos" do |g|
   g.vm.box = "bento/centos-7.2"
 end
 config.vm.define "ubuntu" do |g|
   g.vm.box = "bento/ubuntu-18.04"
 end
# Keep going....
end

And so on... 

To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/c3a68d05-c5d3-497f-89db-46c05922d71b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Brian Cain

signmeuptoo

unread,
Apr 2, 2019, 8:58:23 PM4/2/19
to Vagrant
It appears that non of the base boxes on the site for debian will retrieve and install? Are the Debian versions down?

On Monday, April 1, 2019 at 7:10:35 PM UTC-4, signmeuptoo wrote:

signmeuptoo

unread,
Apr 3, 2019, 8:38:21 AM4/3/19
to Vagrant
It throws up errors, I used vagrant add "debian/jessie64"

And it added it, but my Vagrantfile throws up an error about special characters when using the term "debian/jessie65" it seems to not like the /


--
Brian Cain

signmeuptoo

unread,
Apr 3, 2019, 8:41:39 AM4/3/19
to Vagrant
vagrant up
Bringing machine 'debian/jessie64' up with 'virtualbox' provider...
Bringing machine 'centos' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The sub-VM name 'debian/jessie64' is invalid. Please don't use special characters.


--
Brian Cain

signmeuptoo

unread,
Apr 3, 2019, 8:47:23 AM4/3/19
to Vagrant
  GNU nano 2.9.3                     Vagrantfile                               

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
 config.vm.provision "shell", inline: "echo Hello"

# config.vm.box = "debian/jessie64"
# config.vm.box_version = "8.11.0"

 config.vm.define "debian/jessie64" do |g|
   g.vm.box = "debian/jessie64"
#   config.vm.box_version ="8.11.0"
 end

 config.vm.define "centos" do |c|

^G Get Help  ^O Write Out ^W Where Is  ^K Cut Text  ^J Justify   ^C Cur Pos
^X Exit      ^R Read File ^\ Replace   ^U Uncut Text^T To Spell  ^_ Go To Line


--
Brian Cain

Brian Cain

unread,
Apr 3, 2019, 12:46:25 PM4/3/19
to vagra...@googlegroups.com
On Wed, Apr 3, 2019 at 5:47 AM signmeuptoo <signm...@gmail.com> wrote:
  GNU nano 2.9.3                     Vagrantfile                               

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
 config.vm.provision "shell", inline: "echo Hello"

# config.vm.box = "debian/jessie64"
# config.vm.box_version = "8.11.0"

 config.vm.define "debian/jessie64" do |g|

I think Vagrant doesn't allow for "/" in your guest name. This is the name of the guest, where as the box value below is
what is used to define what kind of VM it will be. This should probably just be "debian"
 
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/4abcc8d5-05ff-4201-94e5-9163a3167762%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Brian Cain

Alvaro Miranda Aguilera

unread,
Apr 3, 2019, 1:34:48 PM4/3/19
to vagra...@googlegroups.com
Hello

Say you want to start a vm, centos/7


When you do vagrant box add centos/7 it will download a base box (like a template)

then you can create a vm like this

mkdir centos7
cd centos7
vagrant init -m centos/7

if you do vagrant status it will show a default box using centos/7


don't change the files in ~/.vagrant.d use the created vagrantfile.

if you want to change the name of the box, use

config.vm.define "centos7" 

that will rename default into centos7

if you want to change the hostame inside the vm, you can use

config.vm.hostname = "centos7"

alvaro

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Alvaro

signmeuptoo

unread,
Apr 3, 2019, 3:29:40 PM4/3/19
to Vagrant
Thanks, do I mkdir in .vagrant.d directory?


On Monday, April 1, 2019 at 7:10:35 PM UTC-4, signmeuptoo wrote:

signmeuptoo

unread,
Apr 4, 2019, 12:13:26 AM4/4/19
to vagra...@googlegroups.com
I see what you are saying, no luck though.

I was trying to not have multiple Vagrantfiles in multiple directories, and just want more than one OS VM to run when doing vagrant up. I already have centos running but can't get debian added on, and I've tried what everyone says. My host computer is Mint.

signmeuptoo

unread,
Apr 4, 2019, 1:07:11 AM4/4/19
to vagra...@googlegroups.com
I may have gotten it!

First I made directories for debian etcetera in the .vagrant directory and installed the boxes in there.

then I rewrote my Vagrantfile inside the ~/vangrant directory as follows:

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
 config.vm.provision "shell", inline: "echo Hello"

# config.vm.box = "debian/jessie64"
# config.vm.box_version = "8.11.0"

# config.vm.define "debian/jessie64" do |g|
#   g.vm.box = "debian/jessie64"
#   config.vm.box_version ="8.11.0"
# end

 config.vm.define "centos" do |c|
   c.vm.box = "centos-7.0-x86_64"
 end




 config.vm.box = "debian8"
# config.vm.box_version = "8.11.0"

  config.vm.define "debian8" do |c|
    c.vm.box = "debian8"

signmeuptoo

unread,
Apr 4, 2019, 1:09:36 AM4/4/19
to vagra...@googlegroups.com
Note that I left some entries in the Vagrantfile for future reference as comments.
Reply all
Reply to author
Forward
0 new messages