Size: 10404
Comment:
|
Size: 10416
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 120: | Line 120: |
vagrant -v |
Vagrant
vagrantfile
sample file for ubuntu xenial
1 Vagrant.configure("2") do |config|
2 config.vm.box = "ubuntu/xenial64"
3 config.vm.network "forwarded_port", guest: 8080, host: 18080, host_ip: "127.0.0.1"
4 config.vm.network "forwarded_port", guest: 9990, host: 19990, host_ip: "127.0.0.1"
5 config.vm.network "forwarded_port", guest: 9000, host: 19000, host_ip: "127.0.0.1"
6 config.vm.network "forwarded_port", guest: 9001, host: 19001, host_ip: "127.0.0.1"
7 config.vm.network "forwarded_port", guest: 9002, host: 19002, host_ip: "127.0.0.1"
8 config.vm.network "forwarded_port", guest: 9003, host: 19003, host_ip: "127.0.0.1"
9 config.vm.network "forwarded_port", guest: 4200, host: 14200, host_ip: "127.0.0.1"
10 config.vm.network "forwarded_port", guest: 5672, host: 15672, host_ip: "127.0.0.1"
11 config.vm.network "forwarded_port", guest: 15672, host: 25672, host_ip: "127.0.0.1"
12 config.vm.network "forwarded_port", guest: 8000, host: 18000, host_ip: "127.0.0.1"
13 config.vm.network "forwarded_port", guest: 5000, host: 15000, host_ip: "127.0.0.1"
14 config.vm.network "forwarded_port", guest: 1433, host: 11433, host_ip: "127.0.0.1"
15 config.vm.network "forwarded_port", guest: 9042, host: 19042, host_ip: "127.0.0.1"
16 config.vm.network "forwarded_port", guest: 27017, host: 37017, host_ip: "127.0.0.1"
17
18 config.vm.provider "virtualbox" do |vb|
19 vb.gui = false
20 vb.memory = "2048"
21 vb.name = "UbuntuVM"
22 file_to_disk = "dockerdata.vmdk"
23 unless File.exist?(file_to_disk)
24 vb.customize [ "createmedium", "disk", "--filename", file_to_disk, "--format", "vmdk", "--size", 1024 * 10 ]
25 end
26 vb.customize [ "storageattach", "UbuntuVM" , "--storagectl", "SCSI", "--port", "2", "--device", "0", "--type", "hdd", "--medium", file_to_disk]
27 end
28
29 config.vm.provision "shell", inline: <<-SHELL
30 apt-get update
31 apt-get install apt-transport-https ca-certificates curl software-properties-common
32 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
33 add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
34 apt-get update
35 apt-get install openjdk-8-jdk maven nodejs npm docker-ce -y
36 usermod -a vagrant -G docker
37 dd if=/dev/zero of=/swapfile1 bs=1024 count=2097152
38 chown root:root /swapfile1
39 chmod 0600 /swapfile1
40 mkswap /swapfile1
41 swapon /swapfile1
42 echo "/swapfile1 none swap sw 0 0" >> /etc/fstab
43 # nodejs stuff
44 apt-get purge nodejs npm
45 curl -sL https://deb.nodesource.com/setup_9.x | bash -
46 apt-get install -y nodejs
47 # prepare new disk for docker data ...
48 echo -e "n\np\n1\n\n\nw" | fdisk /dev/sdc
49 mkfs.ext4 /dev/sdc1
50 mkdir -p /mnt/dockerdata
51 mount /dev/sdc1 /mnt/dockerdata/
52 echo "/dev/sdc1 /mnt/dockerdata ext4 defaults 0 0 " >> /etc/fstab
53 echo -e "{\n \"data-root\": \"/mnt/dockerdata\"\n}" > /etc/docker/daemon.json
54 SHELL
55 end
vagrant init
vagrant init [name [url]] This initializes the current directory to be a Vagrant environment by creating an initial Vagrantfile if one does not already exist. If a first argument is given, it will prepopulate the config.vm.box setting in the created Vagrantfile. If a second argument is given, it will prepopulate the config.vm.box_url setting in the created Vagrantfile. Create a base Vagrantfile: $ vagrant init hashicorp/precise64 Create a minimal Vagrantfile (no comments or helpers): $ vagrant init -m hashicorp/precise64 Create a Vagrantfile with the specific box, from the specific box URL: $ vagrant init my-company-box https://boxes.company.com/my-company.box
vagrant up
vagrant up [name|id] This command creates and configures guest machines according to your Vagrantfile.
centos 7
# https://app.vagrantup.com/centos/boxes/7 vagrant init centos/7 # customize the Vagrantfile vagrant up
Slackbuild install vagrant
Install for Slackware64 15.0
Vagrant file ubuntu maven docker java8
- cat Vagrantfile | grep -v "^.*#"
Vagrant.configure("2") do |config| config.vm.box = "ubuntu/xenial64" config.vm.network "forwarded_port", guest: 8080, host: 18080, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 9990, host: 19990, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 9000, host: 19000, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 9001, host: 19001, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 9002, host: 19002, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 9003, host: 19003, host_ip: "127.0.0.1" config.vm.provider "virtualbox" do |vb| vb.gui = false vb.memory = "2048" end config.vm.provision "shell", inline: <<-SHELL apt-get update apt-get install docker-ce apt-get install openjdk-8-jdk apt-get install maven dd if=/dev/zero of=/swapfile1 bs=1024 count=2097152 chown root:root /swapfile1 chmod 0600 /swapfile1 mkswap /swapfile1 swapon /swapfile1 echo "/swapfile1 none swap sw 0 0" >> /etc/fstab SHELL end
SandboxVM nodejs jdk8 docker ubuntu
Vagrant.configure("2") do |config| config.vm.box = "ubuntu/xenial64" config.vm.network "forwarded_port", guest: 8080, host: 18080, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 9990, host: 19990, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 9000, host: 19000, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 9001, host: 19001, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 9002, host: 19002, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 9003, host: 19003, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 4200, host: 14200, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 5672, host: 15672, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 15672, host: 25672, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 8000, host: 18000, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 5000, host: 15000, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 1433, host: 11433, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 9042, host: 19042, host_ip: "127.0.0.1" config.vm.network "forwarded_port", guest: 27017, host: 37017, host_ip: "127.0.0.1" config.vm.provider "virtualbox" do |vb| vb.gui = false vb.memory = "2048" vb.name = "SandboxVM" file_to_disk = "dockerdata.vmdk" unless File.exist?(file_to_disk) vb.customize [ "createmedium", "disk", "--filename", file_to_disk, "--format", "vmdk", "--size", 1024 * 10 ] end vb.customize [ "storageattach", "SandboxVM" , "--storagectl", "SCSI", "--port", "2",, "--device", "0", "--type", "hdd", "--medium", file_to_disk] end config.vm.provision "shell", inline: <<-SHELL apt-get update apt-get install apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" apt-get update apt-get install openjdk-8-jdk maven -y apt-get install nodejs npm -y apt-get install docker-ce -y usermod -a vagrant -G docker dd if=/dev/zero of=/swapfile1 bs=1024 count=2097152 chown root:root /swapfile1 chmod 0600 /swapfile1 mkswap /swapfile1 swapon /swapfile1 echo "/swapfile1 none swap sw 0 0" >> /etc/fstab apt-get purge nodejs npm curl -sL https://deb.nodesource.com/setup_9.x | bash - apt-get install -y nodejs echo -e "n\np\n1\n\n\nw" | fdisk /dev/sdc mkfs.ext4 /dev/sdc1 mkdir -p /mnt/dockerdata mount /dev/sdc1 /mnt/dockerdata/ echo "/dev/sdc1 /mnt/dockerdata ext4 defaults 0 0 " >> /etc/fstab echo -e "{\n \"data-root\": \"/mnt/dockerdata\"\n}" > /etc/docker/daemon.json SHELL end
Install vagrant and VirtualBox on debian bullseye - yoga 300
1 sudo apt update
2 sudo apt upgrade
3 cd Downloads/
4 wget https://download.virtualbox.org/virtualbox/6.1.34/virtualbox-6.1_6.1.34-150636.1~Debian~bullseye_amd64.deb
5 wget https://releases.hashicorp.com/vagrant/2.2.19/vagrant_2.2.19_x86_64.deb
6 # install dependencies
7 sudo apt install -y libqt5opengl5 linux-headers-amd64 linux-source
8 sudo apt install dkms build-essential linux-image-5.10.0-13-amd64
9 sudo apt autoremove
10 # remove non used linux kernel images
11 sudo apt remove linux-image-4.19.0-6-amd64
12 sudo apt remove linux-image-5.17.0-1-amd64
13 # install packages
14 sudo dpkg -i virtualbox-6.1_6.1.34-150636.1~Debian~bullseye_amd64.deb
15 sudo dpkg -i vagrant_2.2.19_x86_64.deb
16 virtualbox &
17 vagrant --version
Vagrantfile
- vagrant up
- vagrant ssh
1 # -*- mode: ruby -*-
2 # vi: set ft=ruby :
3
4 Vagrant.configure("2") do |config|
5 config.vm.box = "debian/bullseye64"
6 config.vm.provider "virtualbox" do |vb|
7 vb.customize ["setextradata", :id, "CustomVideoMode1", "1366x768x32"]
8 end
9
10 config.vm.provision "shell", inline: <<-SHELL
11 apt update
12 apt upgrade
13 apt install -y docker.io openjdk-17-jdk maven gradle
14 apt install -y xorg lxterminal wmaker lightdm ibus
15 usermod -a vagrant -G docker
16 service lightdm start
17 SHELL
18 end