Skip to content

Instantly share code, notes, and snippets.

@jingkaihe
Last active January 9, 2017 19:32
Show Gist options
  • Save jingkaihe/6d71198105ea18d8d65e2a078aa639db to your computer and use it in GitHub Desktop.
Save jingkaihe/6d71198105ea18d8d65e2a078aa639db to your computer and use it in GitHub Desktop.
# Create SmartOS build image
```json
{
"brand": "joyent",
"fs_allowed": "ufs,pcfs,tmpfs",
"image_uuid": "e69a0918-055d-11e5-8912-e3ceb6df4cf8",
"quota": 100,
"max_physical_memory": 24576,
"alias": "smartos-build",
"resolvers": ["8.8.8.8", "8.8.4.4"],
"nics": [
{
"nic_tag": "admin",
"interface": "net0",
"ip": "dhcp"
}
]
}
```
vmadm create -f smartos-build.json
ZONE_UUID=$(vmadm list -Ho uuid alias=smartos-build)
# Configure image
Login to the build zone
```
zlogin $ZONE_UUID
```
Setup the build env
```sh
useradd -m baker
usermod -P 'Primary Administrator' baker
passwd baker # to set a password for the user and then go to /etc/passwd to change the default shell to bash
su - baker
pfexec pkgin -y in scmgit
git clone https://github.com/joyent/smartos-live
cd smartos-live
cp sample.configure.smartos configure.smartos
./configure
```
# In hypervisor
Take snapshot of the build VM
```sh
export ZONE_UUID=$(vmadm list -Ho uuid alias=smartos-build)
zfs snapshot zones/$ZONE_UUID@post-configure
```
Build the image
```sh
make iso
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment