Vagrant files for RHCE exam preparation.
Learn more about vagrant at: https://www.vagrantup.com/
Sahara vagrant plugin used for snapshots: https://github.com/jedi4ever/sahara
- Update repos:
sudo apt update && sudo apt upgrade
- Install vagrant and dependencies:
sudo apt -y install vagrant && sudo apt -y install zlib1g-dev
- Install virtualbox:
sudo apt -y install virtualbox
- Patch a file if vagrant version is 1.8.1 (If you manually installed latest vagrant, no need to patch) link: http://stackoverflow.com/questions/36811863/cant-install-vagrant-plugins-in-ubuntu-16-04/36991648
- Install required vagrant plugins:
vagrant plugin install vagrant-vbguest && vagrant plugin install sahara
- Download centos vagrant box:
vagrant box add centos/7
If asked for provider select virtualbox. - Clone this and run
vagrant up
inside lab/virtualbox
###CentOS 7.2/Fedora 24
- Update:
sudo yum update
- Install dependencies and vagrant:
sudo yum -y install vagrant redhat-rpm-config vagrant-libvirt vagrant-libvirt-doc libvirt-devel libxslt-devel libxml2-devel virt-manager
- Install required vagrant plugins:
vagrant plugin install vagrant-libvirt && vagrant plugin install fog && vagrant plugin install sahara
- Download centos 7 vagrant box:
vagrant box add centos/7
If asked for provider select libvirt. - Clone this and run
vagrant up
inside lab/libvirt
sed -i '7,13s/^/#/g' virtualbox/scripts/classroom/classroom.sh
sed -i '12,18s/^/#/g' virtualbox/scripts/server/server.sh
sed -i '12,18s/^/#/g' virtualbox/scripts/desktop/desktop.sh
sed -i '7,13s/^/#/g' libvirt/scripts/classroom/classroom.sh
sed -i '12,18s/^/#/g' libvirt/scripts/server/server.sh
sed -i '12,18s/^/#/g' libvirt/scripts/desktop/desktop.sh
If possible clone the official centos mirrors so that the packages are available locally. Find the nearest mirros from: https://www.centos.org/download/mirrors/ and change in scripts/repoupdate
- Run a cron job daily using the script, scripts/repoupdate
- Install apache webserver: `sudo apt -y install apache2 && sudo rm -f /var/www/html/index.html && sudo systemctl enable apache2 && sudo systemctl restart apache2'
- Modify the ip address in the virtualbox/scripts folder to the ip of your base machine:
find scripts/ -type f -name "*.sh" -exec sed -i 's/172.16.0.143/<your-ip>/g' {} \;
- Run a cron job daily using the script, scripts/repoupdate
- Install apache webserver:
sudo yum -y install httpd && sudo sed -i s/^/#/g /etc/httpd/conf.d/welcome.conf && sudo systemctl enable httpd && sudo systemctl restart httpd
- Modify the ip address in the libvirt/scripts folder to the ip of your base machine:
find scripts/ -type f -name "*.sh" -exec sed -i 's/172.16.0.143/<your-ip>/g' {} \;
domain: example.com
hosts: classroom.example.com, server1.example.com, desktop1.example.com
services: DNS, NTP, Kerberos, LDAP
To access run:
vagrant ssh classroom
vagrant ssh server
vagrant ssh desktop
hostname: classroom.example.com
ipv4: 192.168.33.254
ipv6: 2000::254/64
kdc server: classroom.example.com
REALM: EXAMPLE.COM
ldap server: classroom.example.com
DN: dc=example,dc=com
users:
- user: vagrant, password: vagrant
- user: root, password: centos
ldap users:
- ldapuser1
- ldapuser2
- ldapuser3
ldap user home directory: /home/guests
ldap authentication password for ldap users: password
kerberos authentication password for ldap users: kerberos
keytab files:
- server: http://classroom.example.com/keytab/server1.keytab
- desktop: http://classroom.example.com/keytab/desktop1.keytab
CA certificate: http://classroom.example.com/pki/example_ca.crt
For httpd:
server1 key file: http://classroom.example.com/pki/tls/private/server1.key
server1 crt file: http://classroom.example.com/pki/tls/certs/server1.crt
Sample WSGI script: http://classroom.example.com/scripts/epoch.py
hostname: server.example.com
ipv4: 192.168.33.11
ipv6: set one in 2000::/64 range
users:
- user: vagrant, password: vagrant
- user: root, password: centos
script for checking teaming: /usr/local/scripts/teambridge.sh
Make the script executable: chmod u+x /usr/local/scripts/teambridge.sh
and run ./usr/local/scripts/teambridge.sh
- eno1
- eno2
bridge ip: 10.10.0.254
set any ip in the 10.10.0.0/24 network for the teamed interface
secondary disk: /dev/sdb if using virtualbox, otherwise /dev/vdb
hostname: desktop1.example.com
ipv4: 192.168.33.10
ipv6: set one in 2000::/64 range
users:
- user: vagrant, password: vagrant
- user: root, password: centos
secondary disk: /dev/sdb if using virtualbox, otherwise /dev/vdb