diff options
Diffstat (limited to 'installer/vagrant')
-rw-r--r-- | installer/vagrant/README.es.txt | 8 | ||||
-rw-r--r-- | installer/vagrant/Vagrantfile-1.1.0a-vbox | 170 | ||||
-rw-r--r-- | installer/vagrant/Vagrantfile-1.1.1-vbox (renamed from installer/vagrant/Vagrantfile-1.0.6b-vbox) | 64 | ||||
-rw-r--r-- | installer/vagrant/Vagrantfile-boottools-vbox | 3 | ||||
-rw-r--r-- | installer/vagrant/Vagrantfile-browser-vbox | 2 | ||||
-rw-r--r-- | installer/vagrant/Vagrantfile-devel-vbox | 2 | ||||
-rw-r--r-- | installer/vagrant/Vagrantfile-ogagent-vbox | 2 | ||||
l---------[-rw-r--r--] | installer/vagrant/Vagrantfile-prod-vbox | 170 |
8 files changed, 222 insertions, 199 deletions
diff --git a/installer/vagrant/README.es.txt b/installer/vagrant/README.es.txt index 6f300afe..bc5888fe 100644 --- a/installer/vagrant/README.es.txt +++ b/installer/vagrant/README.es.txt @@ -5,7 +5,7 @@ Preparar entorno virtual de desarrollo para OpenGnsys Ficheros de configuración disponibles: - - Vagrantfile-prod-vbox Vagrantfile para OpenGnsys estable con proveedor VirtualBox. + - Vagrantfile-prod-vbox Vagrantfile para OpenGnsys última versión estable con proveedor VirtualBox. - Vagrantfile-devel-vbox Vagrantfile para OpenGnsys en desarrollo con proveedor VirtualBox. - Vagrantfile-boottools-vbox Vagrantfile para preparar el entorno de generación del cliente ogLive (recomendado solo para desarrolladores experimentados). - Vagrantfile-browser-vbox Vagrantfile para preparar el entorno de desarrollo del Browser del cliente (recomendado solo para miembros del grupo de desarrollo). @@ -14,15 +14,15 @@ Ficheros de configuración disponibles: Requisitos previos. - - Instalar Oracle VM VirtualBox 5.x con su Extension Pack. - - Instalar la última versión oficial de Vagrant (no usar la incluida en Ubuntu 14.04). + - Instalar Oracle VM VirtualBox con su Extension Pack. + - Instalar la última versión oficial de Vagrant. El entorno de trabajo de OpenGnsys. - ogAdministrator: MV para servidor OpenGnsys basada en Ubuntu 16.04 y 2º disco para repositorio. - pc11: MV cliente mlodelo con Ubuntu 16.04 instalado. - - pc12 - ogclientN: MV clientes para restaurar con disco vacío. + - pc12 - pcX: MV clientes para restaurar con disco vacío. Ejecutar el entorno virtual (Vagrantfile-prod-vbox y Vagrantfile-devel-vbox). diff --git a/installer/vagrant/Vagrantfile-1.1.0a-vbox b/installer/vagrant/Vagrantfile-1.1.0a-vbox new file mode 100644 index 00000000..07d43556 --- /dev/null +++ b/installer/vagrant/Vagrantfile-1.1.0a-vbox @@ -0,0 +1,170 @@ +# Vagrantfile to install OpenGnsys virtual environment (production version) using VirtualBox provider. + +VAGRANTFILE_API_VERSION = "2" +# VM provider: Oracle VM VirtualBox. +ENV['VAGRANT_DEFAULT_PROVIDER'] = "virtualbox" +# Language (accepted values: es_ES, ca_ES, en_GB). +LANGUAGE = "es_ES" +ENV['LC_ALL'] = LANGUAGE + ".UTF-8" +# Number of OpenGnsys clients (accepted values: from 2 to 9). +NCLIENTS = 4 +# Repository virtual disk: file and size (GB). +REPODISK = "ogRepo.vdi" +REPOSIZE = 50 +# Amount of memory for server and clients (MB) +SERVERMEM = 1024 # Minimum: 512 +CLIENTMEM = 512 # Minimum: 256 +# Prefixes for MAC and IP addresses. +MACPREFIX = "08:00:27:0E:65" +NETPREFIX = "192.168.2" +# OpenGnsys Server IP address. +SERVERIP = "#{NETPREFIX}.10" +# Local port to access OpenGnsys Server. +LOCALWEBPORT = 8443 + +# OpenGnsys Server provisioning script: prepare repo disk, install OpenGnsys, change default interface, configure DHCP server. +OGSERVERSCRIPT = <<EOT +# Exit if OpenGnsys is installed. +[ -f /opt/opengnsys/doc/VERSION.json ] && echo "Cannot provision, OpenGnsys is already installed." && exit 1 +# Create repository disk using LVM, if necesary. +if [ -z "$(blkid /dev/mapper/og-images | grep ext4)" ]; then + pvcreate /dev/sdb + vgcreate og /dev/sdb + vgchange -ay + lvcreate -ay -n images -l 100%VG og + mkfs -t ext4 /dev/mapper/og-images + mkdir -p /opt/opengnsys/images + echo "/dev/mapper/og-images /opt/opengnsys/images ext4 defaults 0 0" >> /etc/fstab + mount -a +fi +# Install OpenGnsys and change server address. +if which curl &>/dev/null; then + DOWNLOAD="curl -s" +elif which wget &>/dev/null; then + DOWNLOAD="wget -q -O -" +fi +BRANCH="opengnsys-1.1.0a" +$DOWNLOAD https://raw.githubusercontent.com/opengnsys/OpenGnsys/$BRANCH/installer/opengnsys_installer.sh | bash || exit $? +mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log +echo y | /opt/opengnsys/bin/setserveraddr $(ip -o link show | tail -1 | cut -d: -f2) +# Insert DHCP data. +for ((i=#{NCLIENTS+10}; i>10; i--)); do + sed -i "/^}$/ i host pc${i} { hardware ethernet #{MACPREFIX}:${i}; fixed-address #{NETPREFIX}.${i}; }" /etc/dhcp/dhcpd.conf +done +service isc-dhcp-server restart +# Set language. +export LANG="#{LANGUAGE}.UTF-8" +echo "LANG=\\\"$LANG\\\"" > /etc/default/locale +echo "LANG=\\\"$LANG\\\"" >> /etc/environment +locale-gen --lang #{LANGUAGE} +sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\\\"${LANG%_*}\\\"/" /etc/default/keyboard +dpkg-reconfigure -fnoninteractive console-setup +# Comment out next lines for automatic data insertion. +#SQL="INSERT INTO aulas (nombreaula, idcentro, urlfoto, grupoid, ubicacion, puestos, modomul, ipmul, pormul, velmul, router, netmask, ntp, dns, proxy, modp2p, timep2p) VALUES ('Aula virtual', 1, 'aula.jpg', 0, 'Despliegue virtual con Vagrant.', 5, 2, '239.194.2.11', 9000, 70, '#{NETPREFIX}.1', '255.255.255.0', '', '', '', 'peer', 30); INSERT INTO ordenadores (nombreordenador, ip, mac, idaula, idrepositorio, idperfilhard, idmenu, idproautoexec, grupoid, router, mascara, arranque, netiface, netdriver, fotoord) VALUES" +#for ((i=11; i<=#{NCLIENTS+10}; i++)); do +# SQL="$SQL ('pc$i', '#{NETPREFIX}.$i', REPLACE('#{MACPREFIX}$i',':',''), 1, 1, 0, 0, 0, 0, '#{NETPREFIX}.1', '255.255.255.0', '00unknown', 'eth0', 'generic', 'fotoordenador.gif')," +#done +#mysql -u usuog -ppassusuog -D ogAdmBD -e "${SQL%,}" +#/opt/opengnsys/bin/setclientmode ogLiveAdmin pc11 PERM +#for ((i=12; i<=#{NCLIENTS+10}; i++)); do +# /opt/opengnsys/bin/setclientmode ogLive pc$i PERM +#done +echo "Notes:" +echo "- OpenGnsys Server URL: https://localhost:#{LOCALWEBPORT}/opengnsys/" +exit 0 +EOT + +# Client 1 OS provisioning script. +OGAGENTPKG = "ogagent_1.1.0_all.deb" +MODELSCRIPT = <<EOT +# Comment out next lines to install and configure OGAgent for Ubuntu. +#apt-get update -y +#apt-get install -y curl +#curl -ks https://#{SERVERIP}/opengnsys/descargas/#{OGAGENTPKG} -o /tmp/#{OGAGENTPKG} +#if [ -f /tmp/#{OGAGENTPKG} ]; then +# apt-get install -y /tmp/#{OGAGENTPKG} || exit $? +# sed -i "0,/remote=/ s,remote=.*,remote=https://#{SERVERIP}/opengnsys/rest/," /usr/share/OGAgent/cfg/ogagent.cfg +# rm -f /tmp/#{OGAGENTPKG} +#else +# echo "Warning: cannot install OGAgent package #{OGAGENTPKG}" +#fi +# Remove network configuration added by Vagrant. +sed -i "/enp0s3/ d" /etc/network/interfaces +echo "Notes:" +echo "- After now, use VirtualBox GUI to disable network interface 1 and restart this VM." +# Leave VM halted. +sleep 2 +poweroff & +EOT + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + + # OpenGnsys Server VM definition. + config.vm.define "ogAdministrator", primary: true do |og| + # Specific VirtualBox configuration. + og.vm.provider "virtualbox" do |vb| + # VM name, memory and CPUs. + vb.name = "ogAdministrator" + vb.memory = SERVERMEM + vb.cpus = 1 + # 2nd virtual disk path (current dir on Windows, VM dir on other OSes) + if Vagrant::Util::Platform.windows? then + second_disk = File.join(".", REPODISK) + else + line = `VBoxManage list systemproperties`.match("Default machine folder.*")[0] + vb_machine_folder = line.split(':')[1].strip() + second_disk = File.join(vb_machine_folder, vb.name, REPODISK) + end + # Create repo virtual disk, if needed. + unless File.exist?(second_disk) + vb.customize ['createhd', '--filename', second_disk, '--size', REPOSIZE * 1024] + end + # Attach repo virtual disk. + vb.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', second_disk] + end + # VM base and host name. + og.vm.box = "bento/ubuntu-16.04" + og.vm.hostname = "ogAdministrator" + # Network configuration: forward web port and attach new interface to VMs private network. + og.vm.network "forwarded_port", guest: 443, host: LOCALWEBPORT, host_ip: "127.0.0.1" + og.vm.network "private_network", mac: "#{MACPREFIX}10".tr(":",""), ip: "#{SERVERIP}", virtualbox__intnet: true + # Comment out to disable synced folder. + #og.vm.synced_folder ".", "/vagrant", disabled: true + # Launch provisioning script. + og.vm.provision "shell", inline: OGSERVERSCRIPT + end + + # Client 1 VM definition. + config.vm.define "pc11", autostart: false do |v1| + v1.vm.box = "bento/ubuntu-16.04" + v1.vm.hostname = "pc11" + v1.vm.network "private_network", mac: "#{MACPREFIX}11".tr(":",""), type: "dhcp", virtualbox__intnet: true + v1.vm.provider "virtualbox" do |vb| + vb.name = "pc11" + vb.memory = CLIENTMEM + vb.cpus = 1 + vb.customize ['modifyvm', :id, '--boot1', 'net', '--boot2', 'disk'] + end + v1.vm.synced_folder ".", "/vagrant", disabled: true + v1.vm.provision "shell", inline: MODELSCRIPT + end + + # Clonable clients definition. + (2..NCLIENTS).each do |i| + config.vm.define "pc#{i+10}", autostart: false do |cl| + cl.vm.box = "clink15/pxe" + cl.ssh.insert_key = false + cl.vm.boot_timeout = 5 + cl.vm.network "private_network", mac: "#{MACPREFIX}#{i+10}".tr(":",""), type: "dhcp", virtualbox__intnet: true + cl.vm.provider "virtualbox" do |vb| + vb.name = "pc#{i+10}" + vb.memory = CLIENTMEM + vb.cpus = 1 + vb.customize ['modifyvm', :id, '--boot1', 'net', '--boot2', 'disk'] + vb.customize ["modifyvm", :id, "--nic1", "none"] + end + end + end + +end + diff --git a/installer/vagrant/Vagrantfile-1.0.6b-vbox b/installer/vagrant/Vagrantfile-1.1.1-vbox index 4317c654..7d4fb45c 100644 --- a/installer/vagrant/Vagrantfile-1.0.6b-vbox +++ b/installer/vagrant/Vagrantfile-1.1.1-vbox @@ -1,8 +1,10 @@ -# Vagrantfile to install old OpenGnSys 1.0.6b virtual environment using VirtualBox provider. +# Vagrantfile to install OpenGnsys virtual environment (production version) using VirtualBox provider. VAGRANTFILE_API_VERSION = "2" # VM provider: Oracle VM VirtualBox. ENV['VAGRANT_DEFAULT_PROVIDER'] = "virtualbox" +# OpenGnsys version +OGVERSION="1.1.1" # Language (accepted values: es_ES, ca_ES, en_GB). LANGUAGE = "es_ES" ENV['LC_ALL'] = LANGUAGE + ".UTF-8" @@ -14,9 +16,11 @@ REPOSIZE = 50 # Amount of memory for server and clients (MB) SERVERMEM = 1024 # Minimum: 512 CLIENTMEM = 512 # Minimum: 256 -# Clients MAC address prefix. +# Prefixes for MAC and IP addresses. MACPREFIX = "08:00:27:0E:65" NETPREFIX = "192.168.2" +# OpenGnsys Server IP address. +SERVERIP = "#{NETPREFIX}.10" # Local port to access OpenGnsys Server. LOCALWEBPORT = 8443 @@ -26,10 +30,6 @@ OGSERVERSCRIPT = <<EOT [ -f /opt/opengnsys/doc/VERSION.txt ] && echo "Cannot provision, OpenGnsys is already installed." && exit 1 # Create repository disk using LVM, if necesary. if [ -z "$(blkid /dev/mapper/og-images | grep ext4)" ]; then - if ! which vgcreate &>/dev/null; then - apt-get update - apt-get install -y lvm2 - fi pvcreate /dev/sdb vgcreate og /dev/sdb vgchange -ay @@ -40,7 +40,13 @@ if [ -z "$(blkid /dev/mapper/og-images | grep ext4)" ]; then mount -a fi # Install OpenGnsys and change server address. -wget -q https://opengnsys.es/svn/tags/opengnsys-1.0.6b/installer/opengnsys_installer.sh -O - | bash || exit $? +if which curl &>/dev/null; then + DOWNLOAD="curl -s" +elif which wget &>/dev/null; then + DOWNLOAD="wget -q -O -" +fi +BRANCH="opengnsys-#{OGVERSION}" +$DOWNLOAD https://raw.githubusercontent.com/opengnsys/OpenGnsys/$BRANCH/installer/opengnsys_installer.sh | bash || exit $? mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log echo y | /opt/opengnsys/bin/setserveraddr $(ip -o link show | tail -1 | cut -d: -f2) # Insert DHCP data. @@ -50,30 +56,44 @@ done service isc-dhcp-server restart # Set language. export LANG="#{LANGUAGE}.UTF-8" -echo "LANG=\"$LANG\"" > /etc/default/locale -echo "LANG=\"$LANG\"" >> /etc/environment +echo "LANG=\\\"$LANG\\\"" > /etc/default/locale +echo "LANG=\\\"$LANG\\\"" >> /etc/environment locale-gen --lang #{LANGUAGE} -sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\"${LANG%_*}\"/" /etc/default/keyboard +sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\\\"${LANG%_*}\\\"/" /etc/default/keyboard dpkg-reconfigure -fnoninteractive console-setup # Comment out next lines for automatic data insertion. -#SQL="INSERT INTO aulas (nombreaula, idcentro, urlfoto, grupoid, ubicacion, puestos, modomul, ipmul, pormul, velmul, router, netmask, dns, proxy, modp2p, timep2p) VALUES ('Aula virtual', 1, 'aula.jpg', 0, 'Despliegue virtual con Vagrant.', 5, 2, '239.194.2.11', 9000, 70, '#{NETPREFIX}.1', '255.255.255.0', '', '', 'peer', 30); INSERT INTO ordenadores (nombreordenador, ip, mac, idaula, idrepositorio, idperfilhard, idmenu, idproautoexec, grupoid, router, mascara, arranque, netiface, netdriver, fotoord) VALUES" +#SQL="INSERT INTO aulas (nombreaula, idcentro, urlfoto, grupoid, ubicacion, puestos, modomul, ipmul, pormul, velmul, router, netmask, ntp, dns, proxy, modp2p, timep2p) VALUES ('Aula virtual', 1, 'aula.jpg', 0, 'Despliegue virtual con Vagrant.', 5, 2, '239.194.2.11', 9000, 70, '#{NETPREFIX}.1', '255.255.255.0', '', '', '', 'peer', 30); INSERT INTO ordenadores (nombreordenador, ip, mac, idaula, idrepositorio, idperfilhard, idmenu, idproautoexec, grupoid, router, mascara, arranque, netiface, netdriver, fotoord) VALUES" #for ((i=11; i<=#{NCLIENTS+10}; i++)); do # SQL="$SQL ('pc$i', '#{NETPREFIX}.$i', REPLACE('#{MACPREFIX}$i',':',''), 1, 1, 0, 0, 0, 0, '#{NETPREFIX}.1', '255.255.255.0', '00unknown', 'eth0', 'generic', 'fotoordenador.gif')," #done #mysql -u usuog -ppassusuog -D ogAdmBD -e "${SQL%,}" -#if ! grep -q "1\.0" /opt/opengnsys/doc/VERSION.txt; then AUX=1; fi -#/opt/opengnsys/bin/setclientmode ogAdmin pc11 $AUX +#/opt/opengnsys/bin/setclientmode ogLiveAdmin pc11 PERM #for ((i=12; i<=#{NCLIENTS+10}; i++)); do -# /opt/opengnsys/bin/setclientmode ogClient pc$i $AUX +# /opt/opengnsys/bin/setclientmode ogLive pc$i PERM #done -echo "New OpenGnsys local URL: https://localhost:#{LOCALWEBPORT}/opengnsys/" +echo "Notes:" +echo "- OpenGnsys Server URL: https://localhost:#{LOCALWEBPORT}/opengnsys/" +exit 0 EOT # Client 1 OS provisioning script. MODELSCRIPT = <<EOT +# Comment out next lines to install and configure OGAgent for Ubuntu. +#OGAGENTPKG="ogagent_#{OGVERSION}_all.deb" +#apt-get update -y +#apt-get install -y curl +#curl -ks https://#{SERVERIP}/opengnsys/descargas/$OGAGENTPKG -o /tmp/$OGAGENTPKG +#if [ -f /tmp/$OGAGENTPKG ]; then +# apt-get install -y /tmp/$OGAGENTPKG || exit $? +# sed -i "0,/remote=/ s,remote=.*,remote=https://#{SERVERIP}/opengnsys/rest/," /usr/share/OGAgent/cfg/ogagent.cfg +# rm -f /tmp/$OGAGENTPKG +#else +# echo "Warning: cannot install OGAgent package $OGAGENTPKG" +#fi # Remove network configuration added by Vagrant. -sed -i "/VAGRANT/,$ d" /etc/network/interfaces -echo "After now, use VirtualBox GUI to disable network interface 1 and work with this VM." +sed -i "/enp0s3/ d" /etc/network/interfaces +echo "Notes:" +echo "- After now, use VirtualBox GUI to disable network interface 1 and restart this VM." # Leave VM halted. sleep 2 poweroff & @@ -102,14 +122,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| vb.customize ['createhd', '--filename', second_disk, '--size', REPOSIZE * 1024] end # Attach repo virtual disk. - vb.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', second_disk] + vb.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', second_disk] end # VM base and host name. - og.vm.box = "ubuntu/trusty64" + og.vm.box = "bento/ubuntu-18.04" og.vm.hostname = "ogAdministrator" # Network configuration: forward web port and attach new interface to VMs private network. og.vm.network "forwarded_port", guest: 443, host: LOCALWEBPORT, host_ip: "127.0.0.1" - og.vm.network "private_network", mac: "#{MACPREFIX}10".tr(":",""), ip: "#{NETPREFIX}.10", virtualbox__intnet: true + og.vm.network "private_network", mac: "#{MACPREFIX}10".tr(":",""), ip: "#{SERVERIP}", virtualbox__intnet: true # Comment out to disable synced folder. #og.vm.synced_folder ".", "/vagrant", disabled: true # Launch provisioning script. @@ -118,7 +138,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Client 1 VM definition. config.vm.define "pc11", autostart: false do |v1| - v1.vm.box = "ubuntu/trusty64" + v1.vm.box = "bento/ubuntu-18.04" v1.vm.hostname = "pc11" v1.vm.network "private_network", mac: "#{MACPREFIX}11".tr(":",""), type: "dhcp", virtualbox__intnet: true v1.vm.provider "virtualbox" do |vb| @@ -137,7 +157,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| cl.vm.box = "clink15/pxe" cl.ssh.insert_key = false cl.vm.boot_timeout = 5 - cl.vm.network "private_network", mac: "#{MACPREFIX}${i+10}".tr(":",""), type: "dhcp", virtualbox__intnet: true + cl.vm.network "private_network", mac: "#{MACPREFIX}#{i+10}".tr(":",""), type: "dhcp", virtualbox__intnet: true cl.vm.provider "virtualbox" do |vb| vb.name = "pc#{i+10}" vb.memory = CLIENTMEM diff --git a/installer/vagrant/Vagrantfile-boottools-vbox b/installer/vagrant/Vagrantfile-boottools-vbox index 14306402..82cae850 100644 --- a/installer/vagrant/Vagrantfile-boottools-vbox +++ b/installer/vagrant/Vagrantfile-boottools-vbox @@ -24,7 +24,8 @@ apt-get install -y jq subversion syslinux syslinux-efi syslinux-utils groupadd opengnsys mkdir -p /opt/opengnsys/client /tmp/opengnsys_installer/opengnsys ln -fs /var/lib/tftpboot /opt/opengnsys -svn export https://github.com/opengnsys/OpenGnsys/branches/devel/client /tmp/opengnsys_installer/opengnsys/client +BRANCH="master" +svn export https://github.com/opengnsys/OpenGnsys/branches/$BRANCH/client /tmp/opengnsys_installer/opengnsys/client echo "Connect to this VM, launch boot-tools generation script and follow instructions:" echo " sudo /tmp/opengnsys_installer/opengnsys/client/boot-tools/boottoolsgenerator.sh" echo "Warning: this process may take a long time." diff --git a/installer/vagrant/Vagrantfile-browser-vbox b/installer/vagrant/Vagrantfile-browser-vbox index 8e3abebf..d723abbd 100644 --- a/installer/vagrant/Vagrantfile-browser-vbox +++ b/installer/vagrant/Vagrantfile-browser-vbox @@ -29,7 +29,7 @@ echo "yes" | ./configure -opensource -embedded x86 -webkit -openssl -qt-gfx-vnc make make install # Compile the Browser. -BRANCH="devel" +BRANCH="master" svn export "https://github.com/opengnsys/OpenGnsys/branches/$BRANCH/client/browser" ../browser cd ../browser qmake browser.pro diff --git a/installer/vagrant/Vagrantfile-devel-vbox b/installer/vagrant/Vagrantfile-devel-vbox index c558227a..70bad3ac 100644 --- a/installer/vagrant/Vagrantfile-devel-vbox +++ b/installer/vagrant/Vagrantfile-devel-vbox @@ -43,7 +43,7 @@ if which curl &>/dev/null; then elif which wget &>/dev/null; then DOWNLOAD="wget -q -O -" fi -BRANCH="devel" +BRANCH="master" $DOWNLOAD "https://raw.githubusercontent.com/opengnsys/OpenGnsys/$BRANCH/installer/opengnsys_installer.sh" | bash || exit $? mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log echo y | /opt/opengnsys/bin/setserveraddr $(ip -o link show | tail -1 | cut -d: -f2) diff --git a/installer/vagrant/Vagrantfile-ogagent-vbox b/installer/vagrant/Vagrantfile-ogagent-vbox index 1bf48faa..7b7753db 100644 --- a/installer/vagrant/Vagrantfile-ogagent-vbox +++ b/installer/vagrant/Vagrantfile-ogagent-vbox @@ -33,7 +33,7 @@ wget -q https://atom.io/download/rpm -O /tmp/atom.rpm && dnf install -y /tmp/ato # Comment out next line if you prefer to install Eclipse IDE for Python (it needs more disk space). #dnf install -y eclipse-pydev eclipse-nls-${LANG%_*} # Download OGAgent environment installer. -BRANCH="devel" +BRANCH="master" wget -qc --unlink https://raw.githubusercontent.com/opengnsys/OpenGnsys/$BRANCH/installer/ogagent-devel-installer.sh -O /home/vagrant/ogagent-devel-installer.sh chmod +x /home/vagrant/ogagent-devel-installer.sh # Instructions. diff --git a/installer/vagrant/Vagrantfile-prod-vbox b/installer/vagrant/Vagrantfile-prod-vbox index 5cfc94d5..f14479e7 100644..120000 --- a/installer/vagrant/Vagrantfile-prod-vbox +++ b/installer/vagrant/Vagrantfile-prod-vbox @@ -1,169 +1 @@ -# Vagrantfile to install OpenGnsys virtual environment (production version) using VirtualBox provider. - -VAGRANTFILE_API_VERSION = "2" -# VM provider: Oracle VM VirtualBox. -ENV['VAGRANT_DEFAULT_PROVIDER'] = "virtualbox" -# Language (accepted values: es_ES, ca_ES, en_GB). -LANGUAGE = "es_ES" -ENV['LC_ALL'] = LANGUAGE + ".UTF-8" -# Number of OpenGnsys clients (accepted values: from 2 to 9). -NCLIENTS = 4 -# Repository virtual disk: file and size (GB). -REPODISK = "ogRepo.vdi" -REPOSIZE = 50 -# Amount of memory for server and clients (MB) -SERVERMEM = 1024 # Minimum: 512 -CLIENTMEM = 512 # Minimum: 256 -# Prefixes for MAC and IP addresses. -MACPREFIX = "08:00:27:0E:65" -NETPREFIX = "192.168.2" -# OpenGnsys Server IP address. -SERVERIP = "#{NETPREFIX}.10" -# Local port to access OpenGnsys Server. -LOCALWEBPORT = 8443 - -# OpenGnsys Server provisioning script: prepare repo disk, install OpenGnsys, change default interface, configure DHCP server. -OGSERVERSCRIPT = <<EOT -# Exit if OpenGnsys is installed. -[ -f /opt/opengnsys/doc/VERSION.txt ] && echo "Cannot provision, OpenGnsys is already installed." && exit 1 -# Create repository disk using LVM, if necesary. -if [ -z "$(blkid /dev/mapper/og-images | grep ext4)" ]; then - pvcreate /dev/sdb - vgcreate og /dev/sdb - vgchange -ay - lvcreate -ay -n images -l 100%VG og - mkfs -t ext4 /dev/mapper/og-images - mkdir -p /opt/opengnsys/images - echo "/dev/mapper/og-images /opt/opengnsys/images ext4 defaults 0 0" >> /etc/fstab - mount -a -fi -# Install OpenGnsys and change server address. -if which curl &>/dev/null; then - DOWNLOAD="curl -s" -elif which wget &>/dev/null; then - DOWNLOAD="wget -q -O -" -fi -$DOWNLOAD -s https://raw.githubusercontent.com/opengnsys/OpenGnsys/master/installer/opengnsys_installer.sh | bash || exit $? -mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log -echo y | /opt/opengnsys/bin/setserveraddr $(ip -o link show | tail -1 | cut -d: -f2) -# Insert DHCP data. -for ((i=#{NCLIENTS+10}; i>10; i--)); do - sed -i "/^}$/ i host pc${i} { hardware ethernet #{MACPREFIX}:${i}; fixed-address #{NETPREFIX}.${i}; }" /etc/dhcp/dhcpd.conf -done -service isc-dhcp-server restart -# Set language. -export LANG="#{LANGUAGE}.UTF-8" -echo "LANG=\\\"$LANG\\\"" > /etc/default/locale -echo "LANG=\\\"$LANG\\\"" >> /etc/environment -locale-gen --lang #{LANGUAGE} -sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\\\"${LANG%_*}\\\"/" /etc/default/keyboard -dpkg-reconfigure -fnoninteractive console-setup -# Comment out next lines for automatic data insertion. -#SQL="INSERT INTO aulas (nombreaula, idcentro, urlfoto, grupoid, ubicacion, puestos, modomul, ipmul, pormul, velmul, router, netmask, ntp, dns, proxy, modp2p, timep2p) VALUES ('Aula virtual', 1, 'aula.jpg', 0, 'Despliegue virtual con Vagrant.', 5, 2, '239.194.2.11', 9000, 70, '#{NETPREFIX}.1', '255.255.255.0', '', '', '', 'peer', 30); INSERT INTO ordenadores (nombreordenador, ip, mac, idaula, idrepositorio, idperfilhard, idmenu, idproautoexec, grupoid, router, mascara, arranque, netiface, netdriver, fotoord) VALUES" -#for ((i=11; i<=#{NCLIENTS+10}; i++)); do -# SQL="$SQL ('pc$i', '#{NETPREFIX}.$i', REPLACE('#{MACPREFIX}$i',':',''), 1, 1, 0, 0, 0, 0, '#{NETPREFIX}.1', '255.255.255.0', '00unknown', 'eth0', 'generic', 'fotoordenador.gif')," -#done -#mysql -u usuog -ppassusuog -D ogAdmBD -e "${SQL%,}" -#/opt/opengnsys/bin/setclientmode ogLiveAdmin pc11 PERM -#for ((i=12; i<=#{NCLIENTS+10}; i++)); do -# /opt/opengnsys/bin/setclientmode ogLive pc$i PERM -#done -echo "Notes:" -echo "- OpenGnsys Server URL: https://localhost:#{LOCALWEBPORT}/opengnsys/" -exit 0 -EOT - -# Client 1 OS provisioning script. -OGAGENTPKG = "ogagent_1.1.0_all.deb" -MODELSCRIPT = <<EOT -# Comment out next lines to install and configure OGAgent for Ubuntu. -#apt-get update -y -#apt-get install -y curl -#curl -ks https://#{SERVERIP}/opengnsys/descargas/#{OGAGENTPKG} -o /tmp/#{OGAGENTPKG} -#if [ -f /tmp/#{OGAGENTPKG} ]; then -# apt-get install -y /tmp/#{OGAGENTPKG} || exit $? -# sed -i "0,/remote=/ s,remote=.*,remote=https://#{SERVERIP}/opengnsys/rest/," /usr/share/OGAgent/cfg/ogagent.cfg -# rm -f /tmp/#{OGAGENTPKG} -#else -# echo "Warning: cannot install OGAgent package #{OGAGENTPKG}" -#fi -# Remove network configuration added by Vagrant. -sed -i "/enp0s3/ d" /etc/network/interfaces -echo "Notes:" -echo "- After now, use VirtualBox GUI to disable network interface 1 and restart this VM." -# Leave VM halted. -sleep 2 -poweroff & -EOT - -Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - - # OpenGnsys Server VM definition. - config.vm.define "ogAdministrator", primary: true do |og| - # Specific VirtualBox configuration. - og.vm.provider "virtualbox" do |vb| - # VM name, memory and CPUs. - vb.name = "ogAdministrator" - vb.memory = SERVERMEM - vb.cpus = 1 - # 2nd virtual disk path (current dir on Windows, VM dir on other OSes) - if Vagrant::Util::Platform.windows? then - second_disk = File.join(".", REPODISK) - else - line = `VBoxManage list systemproperties`.match("Default machine folder.*")[0] - vb_machine_folder = line.split(':')[1].strip() - second_disk = File.join(vb_machine_folder, vb.name, REPODISK) - end - # Create repo virtual disk, if needed. - unless File.exist?(second_disk) - vb.customize ['createhd', '--filename', second_disk, '--size', REPOSIZE * 1024] - end - # Attach repo virtual disk. - vb.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', second_disk] - end - # VM base and host name. - og.vm.box = "bento/ubuntu-16.04" - og.vm.hostname = "ogAdministrator" - # Network configuration: forward web port and attach new interface to VMs private network. - og.vm.network "forwarded_port", guest: 443, host: LOCALWEBPORT, host_ip: "127.0.0.1" - og.vm.network "private_network", mac: "#{MACPREFIX}10".tr(":",""), ip: "#{SERVERIP}", virtualbox__intnet: true - # Comment out to disable synced folder. - #og.vm.synced_folder ".", "/vagrant", disabled: true - # Launch provisioning script. - og.vm.provision "shell", inline: OGSERVERSCRIPT - end - - # Client 1 VM definition. - config.vm.define "pc11", autostart: false do |v1| - v1.vm.box = "bento/ubuntu-16.04" - v1.vm.hostname = "pc11" - v1.vm.network "private_network", mac: "#{MACPREFIX}11".tr(":",""), type: "dhcp", virtualbox__intnet: true - v1.vm.provider "virtualbox" do |vb| - vb.name = "pc11" - vb.memory = CLIENTMEM - vb.cpus = 1 - vb.customize ['modifyvm', :id, '--boot1', 'net', '--boot2', 'disk'] - end - v1.vm.synced_folder ".", "/vagrant", disabled: true - v1.vm.provision "shell", inline: MODELSCRIPT - end - - # Clonable clients definition. - (2..NCLIENTS).each do |i| - config.vm.define "pc#{i+10}", autostart: false do |cl| - cl.vm.box = "clink15/pxe" - cl.ssh.insert_key = false - cl.vm.boot_timeout = 5 - cl.vm.network "private_network", mac: "#{MACPREFIX}#{i+10}".tr(":",""), type: "dhcp", virtualbox__intnet: true - cl.vm.provider "virtualbox" do |vb| - vb.name = "pc#{i+10}" - vb.memory = CLIENTMEM - vb.cpus = 1 - vb.customize ['modifyvm', :id, '--boot1', 'net', '--boot2', 'disk'] - vb.customize ["modifyvm", :id, "--nic1", "none"] - end - end - end - -end - +Vagrantfile-1.1.1-vbox
\ No newline at end of file |