在全新 CentOS 6.5 安装上使用 vagrant“systemctl:找不到命令”

问题描述 投票:0回答:1

我正在创建新的 vagrant box,它使用我安装的 CentOS 6.5 的 virtualbox 映像。里面一切看起来都很好,但从外面看我无法访问 80 端口

当我编辑 Vagrantfile 并添加固定 IP 时: config.vm.network“私有网络”,IP:“10.10.10.10” 我运行 vagrant up,得到“systemctl 命令未找到”。

我认为它尝试设置网络接口,但失败了,因为它使用了 systemctl,我认为该版本或发行版中不可用。 有没有办法添加它,或者手动配置IP/网络接口?以便vagrant连接到它?

==> default: Attempting graceful shutdown of VM...
==> 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: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (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: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

systemctl stop etcd
ifconfig 10.10.10.10 netmask 255.255.255.0
mv /tmp/etcd-cluster.service /media/state/units/
systemctl restart local-enable.service

# Restart default etcd
systemctl start etcd


Stdout from the command:



Stderr from the command:

bash: line 3: systemctl: command not found
SIOCSIFNETMASK: No such device
SIOCGIFADDR: No such device
SIOCSIFBROADCAST: No such device
mv: cannot move `/tmp/etcd-cluster.service' to `/media/state/units/': No such file or directory
bash: line 6: systemctl: command not found
bash: line 9: systemctl: command not found
centos vagrant vagrantfile
1个回答
0
投票

不确定这是否是原因,但罪魁祸首可能是SELinux。也许它阻止了连接或权限。后来就可以用了:

setenforce Permissive
nano /etc/sysconfig/selinux
#setting SELINUX=disabled
© www.soinside.com 2019 - 2024. All rights reserved.