2creatives / vagrant-centos Goto Github PK
View Code? Open in Web Editor NEWScripts to create a lean CentOS Vagrant box.
License: Other
Scripts to create a lean CentOS Vagrant box.
License: Other
vagrant-centos ============== Scripts to create a lean CentOS Vagrant box. Run: ./setup and at the boot prompt press tab to gain access to the boot options. Add the `ks=.*` string you get from the command prompt. The rest of the installation is automated. Finally, run the last command that `setup` spits out (it's of the form `./cleanup && ...`). Congratulations! You have just created a Vagrant box. Specification ------------- The box is constrained to 613 MiB of memory to vaguely resemble an Amazon AWS micro instance. You may want to consider adjusting this for your needs using options like: config.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--memory", 2048] vb.customize ["modifyvm", :id, "--ioapic", "on", "--cpus", 2] end in your `Vagrantfile`. This box has a heavy bias towards US English locales. If this affects you, please adjust the `ks.cfg` file accordingly. This was mainly done as a space saving measure. Additional Notes ---------------- A simple Ruby-based webserver has been provided in order to bootstrap the process. Alternatively, you could host the `ks.cfg` file on your own HTTP server. Please be aware that these scripts will *not* install any special provisioners beyond the shell. Patches will be considered if you wish to contribute support for Puppet, Chef, etc. The development tools group package is also included for convenience. This includes things like `gcc` and `make` as well as VCSs like `git`, `hg`, `bzr`, etc. You are encouraged to look at the file `vars.sh` to modify the configuration to best suit your needs. In particular, take note of the location of the ISOs (which aren't include in the git repository): INSTALLER="./isos/CentOS-6.5-x86_64-minimal.iso" GUESTADDITIONS="./isos/VBoxGuestAdditions_4.3.14.iso" Assumptions have been made about the location of the hard drive as well: HDD="${HOME}/VirtualBox VMs/${NAME}/${NAME}.vmdk" If you wished to be emailed with the various logs the build produces see the `ks.cfg` file and find the line: EMAIL=root and adjust accordingly.
Current approach of zeroing the swap partition is problematic:
https://github.com/2creatives/vagrant-centos/blob/master/ks.cfg#L221
The result is something like that:
$ sudo swapon -s
Filename Type Size Used Priority
The problem is that fstab contains the UUID of this partition (not device name or something else). And that UUID is destroyed by dd
and re-generated by mkswap
.
I can imagine two options to handle that:
a) Use seek
parameter of dd
to skip zeroing the header of the partition. And do not perform mkswap after that.
b) Save the original UUID before the maintenance and then re-use it in mkswap. (Or alternatively - change the UUID in fstab). I think UUID can be extracted with blkid
or listing /dev/disk/by-uuid
.
Another problem is that dd
is executed with default block size which is terribly slow. It should be changed to e.g. 1MB. E.g.:
dd if=/dev/zero of=/dev/sdb1 bs=1024k seek=1
Another remark: maybe would be easier to manage the zeroing of free space and other operations too if using separate disk for swap. Also /boot
partition is usually handy to have it in separate partition (in case of VM - easier to do that as separate disk).
Cannot combine these under Mac OS X. Not sure if this is a change. works as sh ./http.sh nc -l 8081
Anyone using vagrant to utilize mod_nss or, in my case, a Fedora Directory Server is going to get hit with this fun guy which causes SSL issues:
https://lists.fedoraproject.org/pipermail/389-users/2013-December/016547.html
[Tue May 13 16:13:10 2014] [error] NSS_Initialize failed. Certificate database: /etc/dirsrv/admin-serv.
[Tue May 13 16:13:10 2014] [error] SSL Library Error: -8038 SEC_ERROR_NOT_INITIALIZED
This appears to be a problem with the particular nss package that is shipped with this box. The previous box (2013-12-05) works fine with the older nss-3.15.1-15.el6.x86_64
package. I guess it's resolved in nss-3.15.3-6
or later.
When Anaconda requests the file from the host system, it sends its HTTP headers requesting the file. Unfortunately, nc
doesn't wait for the request to finish and often sends its payload before the end of the request leading to Anaconda waiting for input that's already been sent.
nc
might be more reliable when used with -i 2
or something similar although it does add a fair delay.
A workaround for now is to use the quick python web server with:
python -m SimpleHTTPServer 8080 # Python 2.x
python -m http.server 8080 # Python 3.x
which will serve the current directory and then can be referenced in the installer using the host's IP (usually 10.0.2.3) and the location of the file. Often that's http://10.0.2.3:8080/ks.cfg if you're in the same directory as the repo.
This is not ideal as it interrupts the whole automated nature of the process but it is more reliable for now.
after a fresh "vagrant up", I'm not able to ping "vagrant-centos65.vagrantup.com".
Add this DN to the hosts resolve this.
Do you think this must be set in a fresh install ?
Add failover clocksource to grub to prevent problems with VirtualBox.
/cc @tljohnsn
Hello, I recently switched my config from a CentOS 6.3 box to your CentOS 6.4 box and then to the latest CentOS 6.5 box. In both cases, I got an error when running vagrant up
.
Here are the relevant parts of my Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "centos65-x86_64-20131205"
config.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.1/centos65-x86_64-20131205.box"
config.vm.network :private_network, ip: "192.168.50.4"
config.vm.network :forwarded_port, guest: 3306, host: 13306 # mysql
$ vagrant --version
Vagrant 1.4.0
$ VBoxManage --version
4.3.4r91027
$ vagrant up
...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
/sbin/ifdown eth1 2> /dev/null
Stdout from the command:
Stderr from the command:
Possibly related: hashicorp/vagrant#1777
I'm facing problem because of the custom configuration exclude=kernel*
: it prevents vagrant-vbguest installing VirtualBox guest add-ons: because that attempts to install kernel-devel.
This is a work in progress. I will update this comment when new ideas arise.
% ./box -h
usage: ./box cleanup
create
destroy
initialize
interactive
package
Short summary:
cleanup -- prepare the VM for distribution (delete CD-ROMs, etc.)
create -- perform an initialize, cleanup and package
destroy -- remove the VM from VirtualBox
initialize -- setup a box from ks.cfg and shutdown
interactive -- perform a create step but prompt for options
package -- produce a box file for Vagrant consumption
Options:
-h --help
-N --name [VM Name]
I'm getting some locale-related errors (from vagrant OS account) like locale: Cannot set LC_ALL to default locale: No such file or directory
. Perhaps that's due to the manual cleanup during the setup.
e.g.:
[vagrant@vagrant-centos65 ~]$ locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME=en_DK.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
The ~8GB disk that the image uses is quite small. On top of that it's not even using LVM, so I cannot extend it easily with Vagrant by creating an extra disk.
Please increase the disk size to a reasonable size of at least 40+GB, with a sparse disk it shouldn't matter as long as it's big enough.
Also use LVM for the partitioning so people can extend it when necessary.
I was attempting to use Salt to provision a machine based on this box, but as you can see in this gist a basic salt state with nothing in it takes over 60 seconds to run.
If I spin up the same salt provision, but with this box:
config.vm.box = "puppet-labs-centos64"
config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box"
the salt highstate takes about 2 seconds
Hi there,
swap doesn't appear to work. I'm assuming that this is because the UUID changes after zeroing /dev/sda2.
Prateep
you can create a vm with virtualbox gui again with the parameters in "setup" script right ? then locally run ruby and other tasks to provision this vagrant vm guest.what is the use of doing this like unattended vagrant box creation?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.