-
Notifications
You must be signed in to change notification settings - Fork 0
/
vagrant_install_linux.sh
56 lines (41 loc) · 1.57 KB
/
vagrant_install_linux.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Function to install a package on Ubuntu/Debian
install_package() {
sudo apt-get install -y "$1"
}
# Function to install VirtualBox on Ubuntu/Debian
install_virtualbox() {
echo "Installing VirtualBox..."
sudo apt-get update
install_package virtualbox
}
# Define the VirtualBox URL
virtualbox_url="https://download.virtualbox.org/virtualbox/7.0.12/VirtualBox-7.0.12-159484-Win.exe"
# Extract version number from the URL
virtualbox_version=$(echo $virtualbox_url | grep -oP 'VirtualBox-(\d+\.\d+\.\d+)-' | cut -d'-' -f2)
# Define the path where the installer will be saved
virtualbox_installer="/tmp/VirtualBox-$virtualbox_version-Win.exe"
# Download VirtualBox
echo "Downloading VirtualBox..."
wget -O $virtualbox_installer $virtualbox_url
# Install VirtualBox
echo "Installing VirtualBox..."
sudo chmod +x $virtualbox_installer
sudo $virtualbox_installer
# Clean up the installer file
rm $virtualbox_installer
# Define the Vagrant URL
vagrant_url="https://releases.hashicorp.com/vagrant/2.4.0/vagrant_2.4.0_linux_amd64.zip"
# Extract version number from the URL
vagrant_version=$(echo $vagrant_url | grep -oP 'vagrant/(\d+\.\d+\.\d+)/' | cut -d'/' -f2)
# Define the directory where Vagrant will be installed
install_dir="/usr/local/bin"
# Define the path where the installer will be saved
vagrant_installer="/tmp/vagrant_installer_$vagrant_version.zip"
# Download Vagrant
echo "Downloading Vagrant..."
wget -O $vagrant_installer $vagrant_url
# Unzip the installer
unzip -q $vagrant_installer -d $install_dir
# Clean up the installer file
rm $vagrant_installer