mathjax

Thursday, August 22, 2013

Setting up MATLAB on EC2 Cluster

So at this time of this writing, when you search this in google -- you get directed to a bunch of websites with dead links to the MathWorks pdf. Which was kind of annoying. So for the sake of my future-self who might use this and the e-universe that might find this useful, I'm writing this. It's not too bad to figure out using google foo, but its still annoying to trouble shoot.

When I was looking up how to do this, I found a really cool set of directions that sent compiled MATLAB directives from a licensed computer to your EC2 instance. It seemed like a lot of work though and unlike that poor fellow, I was fortunate enough to have a access to a designated machine license key (so no connecting to license server BS).

These directions are to install MATLAB on an Ubuntu EC2 cluster. I don't imagine the instructions are much different for another *nix machine.

  1. Start an EC2 instance -- make sure you have SSH access, login
  2. Obtain a copy of the MATLAB install files
    1. Take your activation key (which you got from an administrator or something) & go the the matlab website and sign up for an account
    2. With your activation key create your license. You'll need to associate the license with the mac address of the EC2 instance you're using. You can obtain that with the following command:
      /sbin/ifconfig eth0 | grep HWaddr
    3. Email the license file & number to yourself (there should be an option to do this in the dialogue box)
  3. SCP the MATLAB installer files to your EC2 instance
    scp -ri /path/to/*.pem /path/to/folderToTransfer ubuntu@ec2-*.compute.amazonaws.com:/path/to/destination
    r - recursive copy, so copy all folders and subfolders in filepath
  4. Create a folder where you want the install to go (in the previous step, you transfered the installer -- when you make this folder, you're making the folder where MATLAB will actually go). Use chmod 777 to change the permissions on the new folder, so that the installer can write to it.
  5. Unzip the installer (you'll need to apt-get unzip). Make a copy of installer_input.txt and open the copy. In the copy, scroll down and set the appropriate variables. I set: destinationFolder, fileInstallationKey (which you emailed to yourself in step 2), agreeToLicense, and mode.
  6. In the same folder run: ./install -inputfile [nameOfEditedInputFile]
  7. The install should start running now. After its done navigate to path where you created your folder. Create a directory called: licenses. Navigate into it.
  8. Go back to your email from step 2 -- there should be an attachment to it. It contains all the toolboxes you're licensed for. Start nano (or whatever text editor you use), and copy and paste its content into the terminal. Save as license.lic
  9. I got stuck at this point for a while. You can't start matlab yet because it will complain that it's missing some libraries. After some google foo, I realized that it's looking for some window management display libraries. They don't come preinstalled with the EC2 instance because you're running everything on command line. So just install the libraries.
    sudo apt-get install libxt6
    sudo apt-get install libxmu6
  10. Navigate to MATLABROOT/bin (where MATLABROOT is where you installed MATLAB). Run ./matlab
  11. Add to .profile: alias matlab="MATLABROOT/bin/matlab"
  12. If you want the compiler to, run mbuild -setup.

    fin

Monday, January 7, 2013

Bing Wallpaper Changer

Check out this script that take the bing.com picture of the day and posts it as your wallpaper. I run Ubuntu 12.04 -- but even if you run this OS, you'll need to modify the script a little bit. Make sure to read the README -- getting it to work with cron was painful, but the solution (for me) was easy.