-
-
Notifications
You must be signed in to change notification settings - Fork 61
/
setup.sh
42 lines (36 loc) · 1.4 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
if [ "$EUID" -ne 0 ] ; then echo "Please run as root" ; exit ; fi
if [ $AWS_ACCESS_KEY == "" ] ; then
read -p "Entrez votre AWS_ACCESS_KEY : " AWS_ACCESS_KEY
read -p "Entrez votre AWS_SECRET_KEY : " AWS_SECRET_KEY
fi
1_virtualization_installation () {
if [ -f /etc/debian_version ]; then
apt-get update && apt-get -y upgrade
apt-get -y install wget unzip
apt-get -y install qemu-kvm libvirt-dev virtinst virt-viewer libguestfs-tools virt-manager uuid-runtime curl linux-source libosinfo-bin
virsh net-start default
virsh net-autostart default
elif [ -f /etc/redhat-release ]; then
yum -y install wget unzip
yum -y install epel-release
yum -y upgrade
yum -y group install "Virtualization Host"
yum -y install virt-manager libvirt virt-install qemu-kvm xauth dejavu-lgc-sans-fonts virt-top libguestfs-tools virt-viewer virt-manager curl
ln -s /usr/libexec/qemu-kvm /usr/bin/qemu-system-x86_64
fi
}
2_packer_installation () {
currentd=$PWD
cd /tmp
latest=$(curl -L -s https://releases.hashicorp.com/packer | grep 'packer_' | sed 's/^.*<.*\">packer_\(.*\)<\/a>/\1/' | head -1)
wget https://releases.hashicorp.com/packer/${latest}/packer_${latest}_linux_amd64.zip
unzip packer*.zip
chmod +x packer
mv packer /usr/local/bin/
/usr/local/bin/packer plugins install github.com/hashicorp/qemu
/usr/local/bin/packer plugins install github.com/hashicorp/ansible
cd $currentd
}
1_virtualization_installation
2_packer_installation