This guide shows the step to setup VirtualBox with CentOS 6 for your testing of deployment scripts on Rails.
- You are using Mac
- VirtualBox is a virtual machine that will run your CentOS and acts as a separate machine
- Follow the guide from http://opensourcedbms.com/dbms/installing-cent-os-6-3-linux-in-oracle-virtual-box-ssh-access/ to install and setup your CentOS with the following exceptions:
- Skip the steps on editing
/etc/sysconfig/network-scripts/ifcfg-eth0and setting up of SSH - Use CentOS 6.4 (64-bits) instead of 6.3
- Make sure you disable SELinux (
vi /etc/sysconfig/selinuxand change the string from SELINUX=enforcing to SELINUX=disabled.). Note: You need to restart server for this change.
- Skip the steps on editing
- Make sure the Virtual machine is off
- Go to Settings > Network > Adapter 1
- Make sure "Attached to" is set to "Nat"
- Click on Port Forwarding and set it to Protocal: TCP, Host Port: 2222, Guest Port: 22
- Add another Protocal: TCP, Host Port: 8888, Guest Port: 80
- Save it. This sets up the SSH and webserver port forwarding.
- Go to Settings > Network > Adapter 2
- Make sure "Attached to" is set to "Bridged Adapter" and set your Name to the wireless or wired connection of your computer
- Turn on the virtual machine.
- You can now SSH to the VM via:
ssh localhost -p 2222 -l root - VM can access Internet.
- Stop iptables (Linux firewall) for easier access to your computer
service iptables stop - You would need to setup 2 ports for SSH due to Capistrano issue:
vi /etc/ssh/sshd_config
# Uncomment Port 22
# Add Port 2222 in the second line
service sshd restart
chkconfig sshd on # Make sshd start on boot- In running machine (CentOS Instance), go to Machine > Take Snapshot...
- A snapshot of the current setup is created.
- You can now mess with the instance :)
- To return to the this snapshot, you simply go to VirtualBox Manager, click on the Snapshot (tab on the top right) and right-click on the snapshot to restore it.
- To shutdown CentOS,
shutdown -b now - You have selected the annoying mouse capture, you can disable it with
VBoxManage modifyvm "your-host-name" --mouse usbmultitouch