Created
July 14, 2012 22:24
-
-
Save sax/3113693 to your computer and use it in GitHub Desktop.
set up basic zone in SmartOS within VirtualBox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Set up SmartOS in VirtualBox | |
# http://www.perkin.org.uk/posts/automated-virtualbox-smartos-installs.html | |
# set up global zone with Joyent datasets | |
if [[ ! -e /var/db/imgadm/sources.list || `grep -v "https://datasets.joyent.com/datasets" /var/db/imgadm/sources.list` ]]; then | |
echo "https://datasets.joyent.com/datasets" >> /var/db/imgadm/sources.list | |
fi | |
imgadm update | |
# download sdc:sdc:base64:1.7.1 dataset | |
imgadm import 8da4bc54-d77f-11e1-8f6f-cfe8e7177a23 | |
# find gateway based on global zone gateway | |
export GATEWAY=$(netstat -r | grep default | awk '{ print $2 }') | |
# create a 'manage' zone | |
if [[ ! `vmadm list -H alias=manage` ]]; then | |
echo "{ | |
\"brand\": \"joyent\", | |
\"dataset_uuid\": \"8da4bc54-d77f-11e1-8f6f-cfe8e7177a23\", | |
\"quota\": 1, | |
\"max_physical_memory\": 64, | |
\"alias\": \"manage\", | |
\"nics\": [ | |
{ | |
\"nic_tag\": \"admin\", | |
\"ip\": \"dhcp\", | |
\"netmask\": \"dhcp\", | |
\"gateway\": \"${GATEWAY}\" | |
} | |
] | |
}" | vmadm create | |
fi | |
export MANAGE_ZONE="$(vmadm list -H alias=manage | awk '{ print $1 }')" | |
cd /zones/${MANAGE_ZONE} | |
mkdir -p local/bin | |
mkdir -p local/data/zones | |
echo "{ | |
\"brand\": \"joyent\", | |
\"dataset_uuid\": \"8da4bc54-d77f-11e1-8f6f-cfe8e7177a23\", | |
\"quota\": 10, | |
\"max_physical_memory\": 1024, | |
\"alias\": \"sample\", | |
\"nics\": [ | |
{ | |
\"nic_tag\": \"admin\", | |
\"ip\": \"dhcp\", | |
\"netmask\": \"dhcp\", | |
\"gateway\": \"${GATEWAY}\" | |
} | |
] | |
}" > local/data/zones/sample.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment