2017-01-24 5 views
0

안녕하세요 저는 방랑과 포장업자가 처음인데 apache2가 사전 설치되어있는 방황 상자를 만들려고합니다. 매번 상자를 추가하면 아파치가 설치되지 않은 ssh가 추가됩니다. 내 대본은 다음과 같습니다 :apache2가 사전 설치되어있는 변경 상자 만들기

#!/bin/bash 
set -e 
set -v 


# http://superuser.com/questions/196848/how-do-i-create-an-administrator-user-on-ubuntu 
# http://unix.stackexchange.com/questions/1416/redirecting-stdout-to-a-file-you-dont-have-write-permission-on 
# This line assumes the user you created in the preseed directory is vagrant 
echo "vagrant ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/init-users 
sudo cat /etc/sudoers.d/init-users 


# Installing vagrant keys 
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' 
sudo mkdir -p /home/vagrant/.ssh 
sudo chown -R vagrant:vagrant /home/vagrant/.ssh 
cat ./vagrant.pub >> /home/vagrant/.ssh/authorized_keys 

apt-get install -y apache2 
# Change apache to run as vagrant:vagrant 
# https://github.com/ChiperSoft/Packer-Vagrant-Example/blob/master/packer/scripts/packages.sh 
sed -i s/www-data/vagrant/ /etc/apache2/envvars 


echo "All Done!" 

나는 이것을 올바르게합니까?

+0

위의 스크립트에서 잘못된 점은 없지만 패커와 방글라데시의 워크 플로/이해에 오류가 가장 많이 있습니다. 당신이 실행하는 명령을 제공하면 나는 틀린 것을 당신에게 도움을 줄 수 있습니다. –

+0

이것들은 제가 한 명령입니다 : –

+0

이것들은 제가 한 명령입니다 : pakcer는 ubuntu.json을 빌드 한 다음, 빌드의 디렉토리로 이동합니다. 그리고 나서 vagrantfile을 편집하여 config.vm.box = "우분투/xenial64 " config.vm.network : forwarded_port, guest : 80, host : 8080 ,, 방황벽 추가 상자 ubuntu.json - 이름 테스트, 컴퓨터에 SSH를 넣은 후 아파치가 없다. –

답변

0

패 커와 함께 변경 상자를 만들었 으면 vagrant box add <name> <packer-box-file>과 함께 추가해야합니다. vagrant init <name> && vagrant up을 수행 할 수 있습니다.