JAMF Software’s Casper Suite has the ability to use Configuration Profiles (Apple’s preferred method for managing OSX and iOS) since version 8.0, and introduced Apple Push Notification Service (APNS) support since Casper Suite 8.4. The combination of using Configurations Profiles with APNS allows administrators the ability to push management settings, which will be installed immediately and securely on their client machines. However, Apple has been slow to provide Configuration Profiles a 1:1 feature parity that Mac Administrators were used to be able to configure through MCX via Workgroup Manager (RIP). There is a need to extract legacy MCX Settings and convert them into a working Configuration Profiles to manage options in a meticulous fashion: thus mcxToProfile.

Tim Sutton (@tvsutton) created mcxToProfile to solve this problem, and this utility is not new. In fact, the initial commit to the GitHub repo was on June 20th 2012 and the latest update was October 11th 2013! However, I feel that too many Casper administrators believe if there is not a Configuration Profile checkbox available from the JSS then they should figure out an alternative method which doesn’t include a profile. This is not true, have options! For example…

VPN Settings (Advanced)

When you configure VPN Settings (VPN Server, Authentication type, parameters, etc) via the JSS, the configuration part is easy and, more importantly, it works! However, there are a few items that we could do that would really help the end user experience.

VPN Settings

  • Enable the VPN Menu Item at the top
  • Enable the “Show Time Connected” setting so people can see that their VPN session is established

These two items are not available by a single checkbox within the JSS, however, we can find the proper plist files that have these settings and use mcxToProfile to create a custom plist.

Find the plists

There are actually two different plist files that we need to review; one for the Menu Items and the second for the VPN Menu Item settings1. The first one for the VPN Menu item itself is found in ~/Library/Preferences/com.apple.systemuiserver.plist. In a freshly installed system the file is relatively blank except for two lines, but if we manually create a VPN connection in System Preferences => Network and enable the “Show VPN status in menu bar” we can see:

Locals-Mac:~ ladmin$ defaults read ~/Library/Preferences/com.apple.systemuiserver.plist
{
    "__NSEnableTSMDocumentWindowLevel" = 1;
    "last-messagetrace-stamp" = "446068721.278329";
    menuExtras =     (
        "/System/Library/CoreServices/Menu Extras/VPN.menu",
        "/System/Library/CoreServices/Menu Extras/Displays.menu",
        "/System/Library/CoreServices/Menu Extras/Clock.menu"
    );
}

There is some extra stuff with the file, but we’ll clean it out a little later.

Next lets take a look at ~/Preferences/com.apple.networkConnect.plist. Again, default in a freshly installed system this file does not exist. However, when we start toggling the VPN display options from the VPN Menu Item the file gets written with the needed key/pair attributes:

Locals-Mac:~ ladmin$ defaults read ~/Library/Preferences/com.apple.networkConnect.plist
{
    VPNShowStatus = 1;
    VPNShowTime = 1;
}

I Love it when a Plan Comes Together

First lets get the mcxToProfile python script downloaded onto our machine. We can do this by opening Terminal and doing a git clone command which pulls down the script plus the README.md file with examples.

Locals-Mac:Desktop ladmin$ git clone https://github.com/timsutton/mcxToProfile.git
Cloning into 'mcxToProfile'...
remote: Counting objects: 129, done.
remote: Total 129 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (129/129), 32.83 KiB | 0 bytes/s, done.
Resolving deltas: 100% (63/63), done.
Checking connectivity... done.

Locals-Mac:Desktop ladmin$ cd mcxToProfile/

Locals-Mac:mcxToProfile ladmin$ ls -al
total 72
drwxr-xr-x   7 ladmin  staff    238 Feb 20 07:29 .
drwx------+  5 ladmin  staff    170 Feb 20 07:29 ..
drwxr-xr-x  13 ladmin  staff    442 Feb 20 07:29 .git
-rw-r--r--   1 ladmin  staff     31 Feb 20 07:29 .gitignore
-rw-r--r--   1 ladmin  staff   1086 Feb 20 07:29 LICENSE.md
-rw-r--r--   1 ladmin  staff   5684 Feb 20 07:29 README.md
-rwxr-xr-x   1 ladmin  staff  17320 Feb 20 07:29 mcxToProfile.py

With mcxToProfile we can identify multiple plist files that can be merged into one file to be imported into the JSS. This is clearly demonstrated in one of mcxToProfile examples available at https://github.com/timsutton/mcxToProfile#example-usage. Since my desire to display the VPN Menu Item and show the connection status are my personal suggestions to end users, I’m also applying the --manage Once option so changes can be made by the user at a later time. To generate our one plist file that we will import into the JSS, perform the following command:

Locals-Mac:~ ladmin$ ./mcxToProfile.py --plist ~/Library/Preferences/com.apple.networkConnect.plist --plist ~/Library/Preferences/com.apple.systemuiserver.plist --identifier com.local.vpnSetup --manage Once

This results in a nicely contained com.local.vpnSetup.mobileconfig file that has imported all of our settings from our two source plist files. However, remember when reviewing the com.apple.systemuiserver.plist there was some extra stuff that we needed to remove; “Display.menu” and “Clock.menu” shouldn’t be a part of our VPN configuration. Open the com.local.vpnSetup.mobileconfig file in your favorite text editor and remove the lines for these two menu items. You may also want to change the “PayloadDisplayName” value from “MCXToProfile: com.apple.networkConnect” to something more meaningful for your end users in case they review what has been installed in System Preferences => Profiles.23 The resulting file should look like this:

Once you Create a new Configuration Profile in the JSS by uploading our new combined plist file, we can then deploy to our test environment as demonstrated in this short video:

Resources

Footnotes


  1. I found these plist files by doing a little Google searching. However, Casper Admins could also use Composer with the "New and Modified Snapshot" method to discover what files are changing when you "check a box".

  2. The keys "__NSEnableTSMDocumentWindowLevel" and "last-messagetrace-stamp" may be able to be removed along with the other menu items. I did not remove these keys during my testing and the VPN Menu item and it's settings worked as desired.

  3. This step is not required for JSS Admins as you will have the chance to rename it once you import the plist into your new Configuration Policy.

“Someone thinks they are special by using LVM”

In my previous article Resizing a VMware Fusion Ubuntu Server Virtual Hard Drive (via Easy Mode), I described what was needed to enlarge your Virtual Hard Drive (VHD) on a VMware Fusion VM that was setup by the “Easy Install” method. If you are confused by what the “Easy Install” method is, there is a prompt when creating a new VM that asks you to provide information for a new account:

  • Full Name
  • Username
  • Password
HardVHD 1
Red pill, or blue pill?

By deselecting the “Use Easy Install” checkbox, you will be required to walk through the OS install setup just like if you were loading a physical CD into a physical machine. One of the steps during the setup assistant for Ubuntu Server is partitioning your Hard Drive which has a default value of “Guided - use entire disk and set up LVM”.

HardVHD 1

LVM stands for Logicial Volume Management. I found the best quickest explanation for why you would want an LVM environment in the Ask Ubuntu forums:

You can think of LVM as “dynamic partitions”, meaning that you can create/resize/delete LVM “partitions” (they’re called “Logical Volumes” in LVM-speak) from the command line while your Linux system is running: no need to reboot the system to make the kernel aware of the newly-created or resized partitions.

The Benefits of LVM

So lets see what we are working with and how it differs from the “Easy Install”. We’ll launch our new Ubuntu Server VM and perform the same tasks as last time to get a sense of how much space is available.

sadmin@ubuntu:~$ sudo fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00057b2d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758    41940991    20719617    5  Extended
/dev/sda5          501760    41940991    20719616   8e  Linux LVM

Disk /dev/mapper/ubuntu--vg-root: 19.1 GB, 19050528768 bytes
255 heads, 63 sectors/track, 2316 cylinders, total 37208064 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/ubuntu--vg-root doesn't contain a valid partition table

Disk /dev/mapper/ubuntu--vg-swap_1: 2143 MB, 2143289344 bytes
255 heads, 63 sectors/track, 260 cylinders, total 4186112 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/ubuntu--vg-swap_1 doesn't contain a valid partition table

HELLO! That was a lot more information than last time! The biggest clue as that we are dealing with a LVM system (outside the amount of text that is returned from one command) is the “Linux LVM” description for /dev/sda5.

Lets see what are the results from our command after we increase our VM size from 20GB to 30 GB (like we did last time).

sadmin@ubuntu:~$ sudo fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00057b2d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758    41940991    20719617    5  Extended
/dev/sda5          501760    41940991    20719616   8e  Linux LVM

Disk /dev/mapper/ubuntu--vg-root: 19.1 GB, 19050528768 bytes
255 heads, 63 sectors/track, 2316 cylinders, total 37208064 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/ubuntu--vg-root doesn't contain a valid partition table

Disk /dev/mapper/ubuntu--vg-swap_1: 2143 MB, 2143289344 bytes
255 heads, 63 sectors/track, 260 cylinders, total 4186112 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/ubuntu--vg-swap_1 doesn't contain a valid partition table

DRAT! We’re still in the same situation as last time that our environment knows we should have 30GB of space (e.g. “Disk /dev/sda: 32.2 GB”), but the number of blocks for /dev/sda5 is not showing any change nor did “Disk /dev/mapper/ubuntu–vg-root” increase in size (e.g. “19.1 GB, 19050528768 bytes”).

To see additional information about our LVM environment we can use the lvscan and lvs commands to find the size of our LVMs, the name of the Logical Volume, and Volume Group (in this case, “ubuntu-vg”). Full LVM details are available via lvdisplay command (think of this as diskutil cs list for OSX admins).

sadmin@ubuntu:~$ sudo lvscan
  ACTIVE            '/dev/ubuntu-vg/root' [17.74 GiB] inherit
  ACTIVE            '/dev/ubuntu-vg/swap_1' [2.00 GiB] inherit

sadmin@ubuntu:~$ sudo lvs
  LV     VG        Attr      LSize  Pool Origin Data%  Move Log Copy%  Convert
  root   ubuntu-vg -wi-ao--- 17.74g                                           
  swap_1 ubuntu-vg -wi-ao---  2.00g                                           

sadmin@ubuntu:~$ sudo lvdisplay
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/root
  LV Name                root
  VG Name                ubuntu-vg
  LV UUID                X3avCO-5H0o-PO6l-K6eg-IpQC-rXxw-7dfe0t
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2015-02-03 20:59:13 -0500
  LV Status              available
  # open                 1
  LV Size                17.74 GiB
  Current LE             4542
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0
   
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/swap_1
  LV Name                swap_1
  VG Name                ubuntu-vg
  LV UUID                sZ2BFu-TtbB-xxr0-w7jB-ZgOT-b0rK-e73G8B
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2015-02-03 20:59:13 -0500
  LV Status              available
  # open                 2
  LV Size                2.00 GiB
  Current LE             511
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1

Steps to Increase your VMware Fusion LVM

First thing we need configure to increase the disk space of our VM is by using the sudo cfdisk command to create a new Primary partition using the 8e/lvm format from our “Free Space”. The steps (with screen shots below) are:

  • Find your “Free Space” and create a new partition
  • Select to create a Primary partition
  • Use the entire partition by using the Enter key
  • Change the partition Type
  • Use “8E” (case sensitive) for “Linux LVM”
  • Write the new partition map
  • Type “yes” to verify partition map
  • Quit
HardVHD 2 HardVHD 3
HardVHD 2 HardVHD 3
HardVHD 2 HardVHD 3
HardVHD 2 HardVHD 3

You may noticed immediately after we write the partition map there was a error message at the bottom of the screen that states “Wrote partition table, but re-read table failed. Run partprobe(8), kpartx(8) or reboot to update table”… please reboot. Once restarted, we’ll run sudo fdisk -l again to grab the location of our new partition (truncated for brevity).

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758    41940991    20719617    5  Extended
/dev/sda3        41940992    62914559    10486784   8e  Linux LVM
/dev/sda5          501760    41940991    20719616   8e  Linux LVM

Next we need to do the following steps all via command line

# Make the new partition an lvm physical volume
sadmin@ubuntu:~$ sudo pvcreate /dev/sda3
  Physical volume "/dev/sda3" successfully created

# Add the new physical volume to the volume group found in the output of "sudo lvs"
sadmin@ubuntu:~$ sudo vgextend ubuntu-vg /dev/sda3
  Volume group "ubuntu-vg" successfully extended

# Increase the logical volume size
sadmin@ubuntu:~$ sudo lvextend -L+10G /dev/ubuntu-vg/root
  Extending logical volume root to 27.74 GiB
  Logical volume root successfully resized

# Increase the file system size
sadmin@ubuntu:~$ sudo resize2fs /dev/ubuntu-vg/root
resize2fs 1.42.9 (4-Feb-2014)
Filesystem at /dev/ubuntu-vg/root is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 2
The filesystem on /dev/ubuntu-vg/root is now 7272448 blocks long.

We’re done! Lets verify by quickly rerunning our LVM commands [ lvscan | lvs ] and/or doing a df -H | grep mappter

sadmin@ubuntu:~$ sudo lvscan
  ACTIVE            '/dev/ubuntu-vg/root' [27.74 GiB] inherit
  ACTIVE            '/dev/ubuntu-vg/swap_1' [2.00 GiB] inherit

sadmin@ubuntu:~$ sudo lvs
  LV     VG        Attr      LSize  Pool Origin Data%  Move Log Copy%  Convert
  root   ubuntu-vg -wi-ao--- 27.74g                                           
  swap_1 ubuntu-vg -wi-ao---  2.00g                                           

sadmin@ubuntu:~$ df -H | grep mapper
/dev/mapper/ubuntu--vg-root   30G  1.2G   27G   5% /

Source

Resizing a VMware Fusion Ubuntu Server Virtual Hard Drive (via Easy Install Mode)

“Well, here’s another fine mess you’ve gotten me into”

Let us pretend that you have an Ubuntu Server which has been running for several years and it has been doing it’s assigned task(s) nicely, until one day you make a change to your methodology/assumptions/workflow/tasks therefore the allocated Virtual Hard Drive (VHD) size is no longer sufficient. There are many reasons for this, but I ran into this issue twice in one weekended because I enabled a JDS as a Distribution Point (thus MySQL was eating needing a lot of space) and wanting to test multiple NetBoot NBI sources (because 10.10.2 seems to be causing imaging troubles). I need to increase the size of two different VHDs, however if you setup your Ubuntu Server via “Easy Install Mode” enlarging the VHD is not that strait forward.

Doing a quick search to see what VMware has to say about this issue returns less than helpful information for Ubuntu Servers by stating man fdisk. Google searching throws a lot of ideas, therefore I’m providing what I’ve learned from a couple of hours of research.

Increase size? I don’t think that word means what you think it means

First lets get a baseline of a default “Easy Install” of Ubuntu Server. We can see that we have a 20GB VHD by several ways:

  • Looking at our VMware Fusion Setup
  • Running sudo fdisk -l
  • Running df -H

Here is my test VM as it stands right now. You can see the VHD settings are for 20GB (really 21.5, guessing there is a rounding error somewhere), and that our primary partition is /dev/sda1 with 19GB drive.

sadmin@ubuntu:~$ sudo fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0001bae9

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    37750783    18874368   83  Linux
/dev/sda2        37752830    41940991     2094081    5  Extended
/dev/sda5        37752832    41940991     2094080   82  Linux swap / Solaris

sadmin@ubuntu:~$ df -H | grep sda
/dev/sda1        19G  1.4G   17G   8% /

Now it would be really nice if VMware Fusion’s tools to increase the VHD worked as expected. If we could just simply move our slider (or type in a new value) for our desired HD space that would actually increase our storage space, that would be perfect!

EasyVHD 1
Result VMware Fusion VHD setting after adjusting from 20GB to 30GB.

We start our Ubuntu Server to verify that our new drive is now 30GB of storage, however what we see is the Virtual Environment believes we have 30GB (32.2 specifically) but our /dev/sda1 partition is still at 19GBs?!

sadmin@ubuntu:~$ sudo fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0001bae9

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    37750783    18874368   83  Linux
/dev/sda2        37752830    41940991     2094081    5  Extended
/dev/sda5        37752832    41940991     2094080   82  Linux swap / Solaris

sadmin@ubuntu:~$ df -H | grep sda
/dev/sda1        19G  1.4G   17G   8% /

What we have done is expanded the allowable space to be used, but we didn’t actually adjust the partition size. We need to do that with some more awesome open source tools.

Steps to Increase your VMware Fusion partition

First we are going to use a Linux Live CD called GParted. Download their 234MB ISO to your VMware Fusion host so you can attached the ISO to the CD/DVD drive. Once attached, use the Startup Disk options in VMware Fusion to select the CD/DVD drive.

EasyVHD 2 EasyVHD 3
GParted attached as a CD/DVD drive, then booting from that drive.

Assuming you are a native English speaking individual and that you have a “US” keyboard setup, you can safely hit the Enter key for a couple of times to get to the GParted application. GParted will show you some critical information that we must overcome:

  • Our original partition of 20GB is at the beginning
  • Our swap space is in the middle
  • Our extra space is at the end

Unfortunately with this GUI application you cannot just “drag” or “move” the extra space next to our original drive to expand your partition. Instead, we have to methodically move things around so everything lines up in the proper order. To do this we’ll perform the following steps in order:

  • Enlarge the “extended” space to take over our unallocated area
  • Move our swap space from the beginning to the end of our “extended” space
  • Truncate the “extended” space to only focus on the swap space
  • Enlarge our primary partition to use the new unallocated area
EasyVHD 4
Select the /dev/sda2 "extended" and Resize/Move to take over the unallocated area, and hit apply.
EasyVHD 5
Select the /dev/sda5 "linux-swap" and Resize/Move to the end of our extended area, and hit apply.
EasyVHD 6
Select the /dev/sda2 "extended" to create new unallocated space preceding the "linux-swap" space.
EasyVHD 7
Select the /dev/sda1 and Resize/Move to take over our new unallocated area.
EasyVHD 8
Verify our primary partition now has the 30GB storage (minus 2GB for swap in this example).

To verify everything is running again, change your startup disk back to your Hard Drive in VMware Fusion, restart your VM and run the same commands from the beginning.

sadmin@ubuntu:~$ sudo fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000752bd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    58724351    29361152   83  Linux
/dev/sda2        58724352    62914559     2095104    5  Extended
/dev/sda5        58726400    62914559     2094080   82  Linux swap / Solaris

sadmin@ubuntu:~$ df -H | grep sda
/dev/sda1        30G  1.4G   27G   5% /

Sources

One thing that I love about Octopress is the support is GREAT! I’ve posted several questions in the past month in troubleshooting new features with Octopress; with Brandon Mathis providing quick, easy to understand, and pleasant replies. You also have the resources of other Octopress/Jekyll users in using their plugins to enhance your site such as adding adding Flickr images or embedding Twitter posts by referencing their unique identifier. This is all done by using each third-party’ (Flickr or Twitter) dev environments.

Twitter API Token

I wanted a plugin that will pull and display a tweet it as if it was being viewed on a browser (as seen on this post). My quick Google searching resulted in this Jekyll plugin https://github.com/rob-murray/jekyll-twitter-plugin which seemed perfect as it was a gem that could be defined vs. having to install a plugin. The only change I needed to perform from the setup documentation was the gem needed to be declared inside the group :jekyll_plugins do section vs. under the main list (see my current Gemfile as the example). The Twitter plugin performs API calls and pulls the tweet as desired and displays it perfectly (example as illustrated in the jekyll-twitter-plugin’s README.md).

In order to place API calls to Twitter you need to create an API application by going to https://apps.twitter.com/app/new and filling out their form. Once it’s complete you can see your new App listed in the https://twitter.com/settings/applications section on your Twitter account. Your new app has four important items to make API calls:

  • consumer_key
  • consumer_secret
  • access_token
  • access_token_secret

To use these tokens, you have two choices: embed them into your shell environment or declare them into your Octopress environment. I personally use the fish shell, and for whatever reason I couldn’t set the variables correctly, so now I’ll have to attempt option #2. But wait! That means my super-secrete, special, precious keys may be in the public as I push my code changes to a github repo (for better support by Brandon)! That won’t work! I did a little more research and found that Jekyll has the ability to reference multiple .yml files to build or server a site by using the -c flag. Example: 1

jekyll s -c _config.yml,_AccessKeys.yml,_localhost.yml --drafts

I then created a “AccessKeys.yml” that now stores all my API tokens and made sure that the new .yml file is listed in my .gitignore. Tokens are safe, fancy API stuff works, and I’m happy.

Footnotes


  1. The _localhost.yml in this example is using the same jekyll "-c" feature by declaring my site as "http://localhost:4000" so I can look and verify how my page will be displayed without publishing to my site directly. When I do publish, I perform a "jekyll b -c _config.yml,_AccessKeys.yml; octopress deploy".

Generic Ubuntu Server Setup Scripts for Networking and VMware Tools

Lately I’ve been doing a lot of Ubuntu Server installs for JumpStarts with their intended use to become a JSS or JDS server. It’s easy to spin up a full clone or linked clone on my laptop, but when I’m at customer’s location they usually only have an ISO that was downloaded some time ago… so we’re starting from scratch. With a brand new Ubuntu Server VM, there are a few steps that you need to perform to make your life easier in the long run.

Server Setup

On ever Ubuntu Server setup there are a couple of items that you should do first before trying to install the JDS or JSS installers. We need the following:

  • Server FQDN (hopefully you have already populated your internal DNS with the associated IP address)
  • Networking info (IP Address, gateway, subnet mask, etc)
  • Install openssh-server (and possibly curl) on our new VM

Assuming we have the above items, console into your new Ubuntu VM and perform a sudo apt-get install openssh-server so we can SSH into the box from Terminal (it’s much easier to work with). We can then scp ubuntuSetup.sh and execute the script to make sure you have the latest and greatest version of Ubuntu Server (since this is from an ISO that who knows how long ago) by doing a apt-get update and apt-get dist-upgrade. These updates may take some time, so be patient if you decided to run these commands.

Next we’re going to input our FQDN and Networking info into the script so it can update the following files on our behalf:

  • /etc/hosts
  • /etc/hostname
  • /etc/network/interfaces

This script is available on my github repo at: https://github.com/justinrummel/Random-Scripts/blob/master/VMWare/ubuntuSetup.sh, watch it in action below.

VMware Tools

The next script makes sure that you have the proper VMware Tools installed on Ubuntu Server just in case you need to share a folder on your host computer to your Ubuntu server. The storage point will be /mnt/hgfs/<<your folder name>>. This script will try to mount the CDROM on your VM, so be sure it is pointing to the VMware Linux Tools ISO by choosing Virtual Machine => Install VMware Tools.

#!/bin/bash

# Copyright (c) 2015 Justin Rummel
# 
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# 
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

# Created by Justin Rummel
# Version 1.0.0 - 11/15/2012

# Modified by
# Version 


### Description 
# Goal is to install VMWare Tools on an Ubuntu Server.  Don't forget to mount the CD first! 

# variables
cdMNT="/mnt/cdrom/"
cdDEV="/dev/cdrom/"

### Be sure to select "Install VMWare Tools" from the "Virtual Machine" dropdown menu in VMWare Fusion
[ ! -d "${cdMNT}" ] && { echo "creating ${cdMNT}"; sudo mkdir "${cdMNT}"; } || { echo "${cdMNT} already exists.  Moving on..."; }
[ ! -d "${cdDEV}" ] && { echo "mounting ${cdDEV} to ${cdMNT}"; sudo mount "${cdDEV}" "${cdMNT}"; }

vmTGZ=`find "${cdMNT}" -name "VMwareTools*"` 2>/dev/null

cd /tmp
if [ -e "${vmTGZ}" ]; then
	cp "${cdMNT}${vmTGZ}" ./
	tar xzvf "${vmTGZ}" 
	cd vmware-tools-distrib/
	sudo apt-get install build-essential
	sudo apt-get install build-essential linux-headers-`uname -r`
	sudo ./vmware-install.pl --default
	sudo reboot
else
	echo "Something went wrong.  Stopping now."
	exit 1
fi
exit 0