krypted.com

Tiny Deathstars of Foulness

I’ve done a number of articles on using Ubuntu 10 as a server recently, but haven’t actually looked at doing the base installation of an Ubuntu 10 host. In this example, I’ll look at using Ubuntu 10.04 Desktop. In many of the previous examples I’ve been looking at Ubuntu 10.10 Server; the reason I’m using 10.04 Desktop here is because I believe there is a smaller learning curve and that inherently Mac OS X Systems Administrators who might be following this thread actually like a GUI. There are a number of aspects of this type of setup that are simply not GUI oriented; however, the base OS can easily be, so here goes.

First up, download the installer of Ubuntu from http://www.ubuntu.com/desktop/get-ubuntu/download. Then,¬†install Fusion. Once installed you’ll be prompted with the welcome screen.

Next, use Command-N to create a new virtual machine, orclick on the File menu and then select the New menu item (first in the list).

The New Virtual Machine Assistant will then open. Click on the button to Continue without disc.

The Installation Media screen of the New Virtual Machine Assistant will be next. Here, click on the radio button for Use operating system installation disk image file.

You will then be prompted to select an iso. Browse to the file that you downloaded from Ubuntu before you got started and then click on the Choose button in the lower right hand corner of the screen.

The Operating System and version should be filled in by default. Provided they are correct, click on the Continue button to proceed.

You will then be prompted for credentials that the virtual machine will give the guest operating system when it is installed. Here, type the administrative user name and password that you want to use. You can also choose whether or not you want to make the home folder you use in Mac OS X available to the virtual machine as well as what type of access the virtual machine has to that directory. When you’re satisfied with your settings, click on the Continue button.

At the Finish screen of the New Virtual Machine Assistant, you will be able to review the settings that have been provided to the virtual machine. You can change these later if you see fit. For now, let’s click on the Finish button.

Finally, choose where you want to install the virtual machine at. By default, the virtual machine will be placed in the Virtual Machines folder of your home directory. I usually like to move it to a Virtual Machines directory on the root of the volume that houses my Virtual Machines, but you can place yours wherever you like. When you’ve selected the folder that best fits your needs, click on the Save button.

The virtual machine will then install. This process can take some time, so it’s probably a good chance to grab a bite. When it’s done, you’ll be at the login screen for Ubuntu. Enter the username and password that you provided earlier in the process and then click on the Log In button.

Once you have logged in, let’s get the networking straight. In the menu at the top of the screen, click on Settings in the VMware toolbar and then click on Network.

By default, the virtual machine will be sharing the network connection of the Mac. Click on the second radio button (Connect directly to the physical network) and then the indicator light for the interface will go red. Wait for the light to go green, indicating that it’s picked up the correct interface and then close the Settings.

The IP will then need to be set for the guest OS. From Ubuntu, click on the System menu at the top of the screen and then click on Preferences and then Network Connections. Here, click on the Auth eth0 interface and then click on the Edit button.

You should now see the Editing Auth eth0 screen. Here, click on the IPv4 Settings tab and then provide the Address, Subnet mask (Netmask) and Gateway for your environment. You should also take this opportunity to provide a DNS server.

Click on Apply to commit your changes and then reboot the virtual machine so the new network settings are enforced. When Ubuntu comes back online, you should then be able to ping your router or some other device on your network. If you decided to use Ubuntu Server then you will need to go to /etc/network/interfaces and add some lines to bring up the interface using nano or vi, then set the IP to static and then provide your settings. They would appear as follows:

auto lo
iface lo inet loopback
iface eth0 inet static
address 192.168.210.254
netmask 255.255.255.0
gateway 192.168.210.1

Note: Check out ‘man interfaces’ for more information on building out your interfaces file.

You would also need to provide DNS information in your /etc/resolv.conf file:

nameserver 192.168.210.2
nameserver 192.168.55.41
nameserver 4.2.2.2

Note: Check out man resolv.conf for more information on the correct syntax and options if you need more that what we have provided here.

As you can see, doing so in the GUI vs. the command line is almost identical in terms of the amount of time it takes. Next, check the hostname. For this, let’s use the terminal emulator (not as spiffy as the one in Mac OS X, but nice nonetheless). Click on the Applications menu, Accessories and then Terminal. As with Mac OS X Server the forward and reverse names should match. Provided they do, you’re ready to get some services installed; otherwise you will need to set the hostname to be the same as the DNS name. Assuming the DNS name is ubuntu08.krypted.com:

hostname ubuntu08.krypted.com

To then make it persistent across a restart, check /etc/hostname and replace the hostname with whatever you see there. Once set, you should see the hostname at the login window. Finally, I ran into an instance a few years back where Debian (not Ubuntu but close enough) wouldn’t change the hostname even after I tweaked the /etc/hosts and /etc/hostname files. Very annoying. The only thing that would work was to do it using sysctl (continuing on with the same example):

sysctl kernel.hostname=ubuntu08.krypted.com

Assuming that your Ubuntu box isn’t also acting as your DNS server, you will also need to check the DNS to make sure it’s correctly set. You can use nslookup for this:

nslookup ubuntu08.krypted.com

November 21st, 2010

Posted In: Mac OS X, Ubuntu, Unix, VMware

Tags: , , , , , , , , , , , , ,

OK, so you don’t necessarily call rtsp on Ubuntu QuickTime Streaming Server. Instead, you call it Darwin Streaming Server (DSS). But the end result is basically what you have exposed in Mac OS X Server, but running on Linux. You don’t have the same functionality in Server Admin, but it does work. And the key to what it does is use the rtsp protocol to stream supported files from the server to clients. It is a little tougher than just clicking on the start button, but too much tougher provided you follow these directions (thanks to the good folks of the DSS list that I’ve been a member of for a few years for taking such good notes, making this much simpler to write when I just have to move from Ubuntu 7 to 10.04).

To get started (most all of this is going to need sudo or su), let’s use wget to download all the files that we’re going to need (except 1):

wget http://static.macosforge.org/dss/downloads/DarwinStreamingSrvr6.0.3-Source.tar
wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/dss-6.0.3.patch
wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/dss-hh-20080728-1.patch

Now let’s extract the tar file:

tar -xvf DarwinStreamingSrvr6.0.3-Source.tar

Now let’s create our qtss user and group:

addgroup –system qtss
adduser –system –no-create-home –ingroup qtss qtss

We’re going to need the build-essential package from apt-get, so let’s install that before moving on:

apt-get install build-essential

The base 6.0.3 installer was only built for Mac OS X, so let’s apply the patches we used wget to pull down:

patch -p0 < dss-6.0.3.patch
patch -p0 < dss-hh-20080728-1.patch

Now let’s cd into the actual dss installer directory and then grab a patched installer file, get rid of the old Install script and then grab a new one:

cd DarwinStreamingSrvr6.0.3-Source
mv Install Install.old
wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/Install

Then we’ll make the Install script executable and run the Buildit (no, not Configure) then Install scripts:

chmod +x Install
./Buildit
./Install

Finally, fire up the DSS:

/usr/local/sbin/DarwinStreamingServer

Now you should be able to go to a standard Mac OS X client and run a port scan of the rtsp port, 554 using stroke (swap the 192.168.210.254 IP here with whatever IP or hostname that you’re using):

/Applications/Utilities/Network Utility.app/Contents/Resources/stroke 192.168.210.254 554 554

DSS installs some sample movies into /usr/local/movies. Provided that the port is open, let’s open Safari and provide the following link to see if one of the stock sample movies will open:

rtsp://192.168.210.254/sample_h264_300kbit.mp4

Provided that you see the sample movie from Apple then you can move the sample movies elsewhere and drop your own in here. You’ve now got a fully functional DSS. The DSS will stream .mov, .mp4 and .3gp files. If you enable the QTSSHttpFileModule you can also stream mp3 files. If you go into the /etc/streaming folder you will see a number of files that look similar to what you have been working with on Mac OS X Server (assuming you’ve been working with Mac OS X Server). In here, you’ll find the qtusers and qtgroups files for managing users and groups in rtsp as well as the streamingserver.xml file, which is where the modules are loaded and unloaded. In /var/streaming you’ll also find a directory called logs, which is interestingly enough where the logs reside and another directory called playlists, which is where you will drop playlists in the event that you decide to make your own radio station. My music tastes are bad enough where I’ve never really considered this, but feel free to get all WKRP in Cincinnati if you so choose, I promise not to judge (or maybe just a little)…

You’ll also end up likely looking to embed these rtsp streams (that seems to be what everyone does). If so, get to know the XML structure:

<?xml version=”1.0″?>
<?quicktime type=”application/x-quicktime-media-link”?>
<embed src=”rtsp://192.168.210.254/sample_h264_300kbit.mp4″ autoplay=”true” />

Ultimately, building and using QuickTime Streaming on Mac OS X Server is far superior in a number of ways to doing so in Linux. For starters, the steps here are all done by clicking on a Start button in Mac OS X Server. But even further than that, updates are even more rare to DSS. If you’re in the rack density game, a number of Mac mini servers in the right sized rack might just get you more bang for your square inch!

November 20th, 2010

Posted In: Mac OS X Server, Ubuntu, Unix

Tags: , , , , , , , , , , ,

Jumbo frames can completely suck. But they can also boost network throughput performance. The MTU in networking terminologies is the Maximum Transmission Unit in bytes that protocol data can send over the wire. MTU is configured per interface and needs (er, prefers) the network infrastructure to match about the same MTU sizes. By default, eth0 (en0 in Mac OS X) is set to 1500. But increasing that to 9000 means that you’re sending less error correction and addressing data and more payload (but as usual the payload can get messy if all parties aren’t knowledgeable that they’re taking it).

Before you get started, install ethtool:

apt-get install ethtool

Then run ethtool with the -i operator along with the interface on your box that you plan on shoving jumbo frames into:

ethtool -i eth0

Now Google or browse to the manufacturers site and see what the maximum MTU that the interface can take is. Provided it can take your large payload, to enable a larger MTU on the fly is pretty easy. I’m using 9000 for the purposes of this article, but if you get an error like SIOCSIFMTU or something then your driver doesn’t support that, so go with something smaller (if >1500 is supported at all on said driver). Simply use ifconfig, specify the interface and then mtu followed by the actual MTU size:

ifconfig eth0 mtu 9000

To make the change permanent, add the following line to /etc/network/interfaces

MTU 9000

Then restart networking:

/etc/init.d/networking restart

And to check that it’s working, use ip to get the route information to a potential target device (output will show the MTU that is being attempted):

ip route get 10.0.0.96

Note: Redhat, Fedora and CentOS will store their config information per adapter (the way it should be IMHO) in files in the /etc/sysconfig/network-script/ directory.

November 15th, 2010

Posted In: Ubuntu, Unix

Tags: , , , ,