Я создал новый базовый блок из chef/centos-6.6
. При создании коробки все работало как положено. IP был правильным, и я смог без проблем использовать vagrant ssh
. Затем я упаковал свою коробку с помощью vagrant package --base vm_name --ouput devCentos-6.6.box
и загрузил ее на свой NAS.
Я добавил поле, используя: vagrant box add devCentos-6.6 http://10.1.1.120/boxes/devCentos-6.6.box
Затем запустил: vagrant init devCentos-6.6
и сгенерировал правильный vagrantFile.
Когда я запускаю: vagrant up
, я получаю этот вывод:
vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: bridged
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
Хозяин – Ubuntu 14.04.2 LTS
, а гость – Centos6.6
.
Использование: VirtualBox 4.3.26 r98988
и Vagrant 1.7.2
У меня есть vb.gui = true
, так как я слышал, что это решает проблему, но здесь это не так. Когда я использую vagrant ssh
, я получаю запрос пароля вместо того, чтобы позволить мне войти.
Когда я нахожусь в виртуальной машине, я запустил ifconfig
и заметил, что IP-адрес и сетевая маска неверны. IP-адрес: 10.0.2.15
, а сетевая маска: 255.255.255.0
.
service sshd status
показывает: openssh-daemon (pid 1082) is running...
ss -tlnp
показывает:
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 :::22 :::* users:(("sshd",1082,4))
LISTEN 0 128 *:22 *:* users:(("sshd",1082,3))
LISTEN 0 100 ::1:25 :::* users:(("master",1314,13))
LISTEN 0 100 127.0.0.1:25 *:* users:(("master",1314,12))
LISTEN 0 128 *:46201 *:* users:(("rpc.statd",945,8))
LISTEN 0 128 :::443 :::* users:(("httpd",1327,6),("httpd",1334,6),("httpd",1335,6),("httpd",1336,6),("httpd",1337,6),("httpd",1338,6),("httpd",1339,6),("httpd",1340,6),("httpd",1341,6))
LISTEN 0 128 :::43427 :::* users:(("rpc.statd",945,10))
LISTEN 0 50 *:3306 *:* users:(("mysqld",1219,10))
LISTEN 0 128 :::111 :::* users:(("rpcbind",925,11))
LISTEN 0 128 *:111 *:* users:(("rpcbind",925,8))
LISTEN 0 128 :::80 :::* users:(("httpd",1327,4),("httpd",1334,4),("httpd",1335,4),("httpd",1336,4),("httpd",1337,4),("httpd",1338,4),("httpd",1339,4),("httpd",1340,4),("httpd",1341,4))
ip addr show
показывает:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:6b:1c:dd brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
inet6 fe80::a00:27ff:fe6b:1cdd/64 scope link
valid_lft forever preferred_lft forever
3: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 08:00:27:d5:43:2a brd ff:ff:ff:ff:ff:ff
Я также пробовал это исправление, которое я нашел, но не повезло:
sed -i 's|NM_CONTROLLED=yes|NM_CONTROLLED=no|g' /etc/sysconfig/network-scripts/ifcfg-eth0
service network restart
Кроме того, когда мне удалось решить проблему с ключом и сетью, у меня возникла проблема с монтированием:
jpsimkins@jpUbuntu:~/Vagrant/centos-6.6$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'olympusatDev-Centos-6.6'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: centos-66_default_1429641033222_17210
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: bridged
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if its present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => /home/jpsimkins/Vagrant/centos-6.6
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:
mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant
The error output from the last command was:
/sbin/mount.vboxsf: mounting failed with the error: No such device
Гостевые инструменты установлены. Они пришли из оригинальной коробки (шеф-повар)
Я новичок в бродяге, поэтому я сделал все возможное, чтобы изолировать эту проблему. Со всем, что я нашел до сих пор в Интернете, я еще не нашел решения. Надеюсь, кто-то здесь может помочь мне изолировать это.
Дайте мне знать, если вам нужна дополнительная информация.
Спасибо
Моя конфигурация бродяги:
# -*- 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|
# 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://atlas.hashicorp.com/search.
#config.vm.box = "chef/centos-6.6"
# Custom Box
config.vm.box = "devCentos-6.6"
config.vm.box_url = "http://10.1.1.120/boxes/devCentos-6.6.box"
config.vm.hostname = "jpCentos"
# 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.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# 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", ip: "10.1.1.69", :netmask => "255.255.254.0", bridge: 'eth0'
# 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 "/home/jpsimkins/Sites", "/var/www/vhosts"
# 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:vagrant
vb.memory = "1024"
end
end