This page is just a collection of small useful (to me anyway) snippets of code/commands that I’ve had to use to get things working. Hopefully others may find some of this stuff useful too. If anything needs explaining then may warrant a short blog post in the future.
Installing .net Framework 3.5 Windows 10
Dism /online /enable-feature /featurename:NetFX3 /All /Source:E:\sources\sxs /LimitAccess
Command Snippets
Centos firewall-cmd --zone=public --add-port=80/tcp --permanent firewall-cmd --reload hostnamectl set-hostname
Get IP from ifconfig
Centos ip=$(ifconfig ens33 | grep 'inet ' | awk '{ print substr($2,0) }' | cut -f2 -d:) Ubuntu ip=$(ifconfig eth1 | grep 'inet addr' | awk '{ print substr($2,6) }')
Vagrant (loop)
(1..3).each do |i| config.vm.define "server#{i}" do |svr| svr.vm.hostname = "server#{i}" svr.network "private_network", ip: "10.10.10.2#{i}" end end
Line 1 contains a range (1..3), for each iteration the variable “i” will contain the value of the range.
Line 2 defines the vm to be created in virtualbox, using string interpolation to inject i into the name.
Line 3 defines name be used for the actual vm’s os hostname. Again appending the value of “i”.
Line 4 set a private network for the vm being created and specifies the IP Address and “i” within the last octet.