Skip to content

Instantly share code, notes, and snippets.

@solos
Forked from akiatoji/vagrant.org
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save solos/480a2943d929f4d3398d to your computer and use it in GitHub Desktop.

Select an option

Save solos/480a2943d929f4d3398d to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
* Installing CentOS
** Download net install iso: CentOS-6.2-x86_64-netinstall.iso
** Create a new VirtualBox machine
- Name: vagrant-centos
- Operating System: Linux
- Version: Red Hat
- Base Memory Size: 360 MB
- Create new hard disk
- Dynamically expanding storage
- 40 GB
- Disable Audio
- Disable USB
- Make sure network is set to NAT
- Attach the net install ISO to the CDROM
- Run it
** Run through install procedure
- (mode: linux text)
- Installation Method: URL
- Disable IPv6, leave IPv4 enabled with DHCP
- URL Setup:
- http://mirrors.kernel.org/centos/6/os/x86_64/
- http://mirrors.163.com/centos/6/os/x86_64/
- Use text mode
- Re-initialize all drives
- Root password: vagrant
- Partitioning Type: Use entire drive
- Configure network: yes
- Set hostname to vagrant-centos
- Customize software installation:
- Unselect:
- Dial-up networking
- Editors
- Text-based internet
- Base
- Remove CDRom media
- Reboot
- Disable firewall
- Run Services:
- Disable cups
** Add stuff
# useful
yum install curl ftp rsync sudo time wget which openssh-clients
# for building Virtualbox Additions
yum install gcc bzip2 make kernel-devel-`uname -r`
# for compiling ruby
yum install gcc-c++ zlib-devel openssl-devel readline-devel sqlite3-devel
# For VBoxGuestAddition
yum install perl Xorg
** Disabled SELinux and firewall
- In /etc/selinux/config, set SELINUX=disabled
- chkconfig iptables off
** Remove stuff
# yum erase wireless-tools gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts
** VirtualBox Additions
- export KERN_DIR=/usr/src/kernels/2.6.32-220.17.1.el6.x86_64
- Devices -> Install Guest Additions...
- sudo mount -o ro -t iso9660 /dev/cdrom /mnt
- sudo sh /mnt/VBoxLinuxAdditions.run
- reboot
** vagrant user
groupadd admin
useradd -G admin vagrant
passwd vagrant
# choose "vagrant" as the password
# set up sudo permissions:
visudo
# Add the following lines at the bottom:
# # Vagrant user should be able to sudo
# %admin ALL=NOPASSWD: ALL
# Comment out the following line:
# Defaults requiretty
# (otherwise ssh <command> doesn't work)
# Add the variable "PATH" to the "Defaults env_keep" list.
# (otherwise sudo cleans the path, and loses ruby, which ohai needs)
# (See http://stackoverflow.com/questions/257616)
# Add the /usr/sbin and /sbin to the path:
echo 'export PATH=$PATH:/usr/sbin:/sbin' >> ~vagrant/.bashrc
** Install rvm then ruby
curl -L get.rvm.io | sudo bash -s stable
logout
login as root
rvm install 1.9.2
** Install Puppet by adding puppet repo
rpm -ivh http://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-1.noarch.rpm
yum install puppet
** Add Vagrant's "insecure" public key
mkdir .ssh
chmod 755 .ssh
curl http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub > .ssh/authorized_keys
chmod 644 .ssh/authorized_keys
** Fiddle with MAC addres
- sudo /sbin/ifconfig
- write down MAC address of eth0 (eg. 08:00:27:60:AE:41)
sudo yum clean headers packages dbcache expire-cache
- shut down vm
** Export and package
Back on host
- vagrant package --base vbox_vm_name
- vagrant box add centos62 package.box
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment