Make a bootable Linux Mint USB key with sage installed

This guide might be outdated. Use at your own risk.

I couldn't set up sage in the live-version of Linux Mint, even with 4090MB persistence, so I had to install the OS on another USB-key. This means two keys are needed, so this guide is somewhat tedious! You should really consider installing Linux Mint to your harddrive instead of following this guide. Linux Mint can be installed alongside Windows, so no harm will be done to your files. Still want to proceed? Fine then!

You need two USB-keys. A small one with at least 2GB, and a big one with at least 8GB. We will put the Linux Mint installer on the small one, and install it from the small one to the big one. Both will be formatted.

I will assume you have Windows installed.

  1. Go to http://www.linuxliveusb.com/en/download and download the Linux Live USB creator. Start it to install it. Then start the USB creator and insert your small key.

  2. Do the following:
    Step 1: Press the update button and choose the small key
    Step 2: Click Download, select 'Linux Mint 14.1 "Nadia" (MATE) DVD' from the dropdown-menu and click to download automatically.
    Step 3: When downloading and verifying is complete, choose a 0MB persistence.
    Step 4: Choose to format the key, as we will need almost all the space.
    Step 5: Click the lightning-icon to create the key, and wait for it to complete.

  3. Go to http://sagemath.org/download-linux.html and download the variant for ubuntu (Linux Mint is derived from Ubuntu). I'm downloading sage-5.8-linux-32bit-ubuntu_12.04.2_lts-i686-Linux.tar.lzma. Save the compressed file on the remaining space on the small key.
  4. When it's done, reboot your system (with the small key inserted). If your system does not start up in Linux Mint you have to enter your BIOS to change the boot order. BIOS are different for different computers, so I can't make a throughout step on this. Usually you enter BIOS by pressing a certain key at startup (sometimes F2, F10, F12 or delete).

    Once you found your way to the BIOS look around for something probably called the BOOT order or BOOT priority, and set your newly created USB-key as the primary. Now save and reboot. (If you have never entered BIOS before, be a little careful: Some of the options in the BIOS are dangerous to change. Eg. there could be options to lower the speed of your CPU-fan, which could fry your CPU. But if you're careful, you should be fine. There should also be an option to load the defaults in case you mess up a little.)

    If this step is done correctly, your computer should startup in Linux Mint from the USB-key when it is present at startup. To startup in windows, just have the key removed before you turn on your computer.

  5. When in Linux Mint (live mode), insert your big USB-key. Then begin to "Install Linux Mint" from the desktop. Click continue until you arrive at the "Installation type" menu. (if the button changes to "install now", you have gone to far). If the installer asks wether to try to unmount partitions on a disk, click yes.

  6. BE CAREFUL DURING THIS STEP!
    Choose "something else" and click continue.

    Look at the drop-down menu under "Device for boot loader installation". The device for your big USB-key is something like "/dev/sdX" with X a letter. There will probably be two options like that. Use the name and space next to the devicenames to determine which device is your big USB-key. Then select that device (it must contain no numbers). WARNING: If you choose the wrong device, you will install Linux Mint on your computers harddrive, wiping out Windows and everything.

    Lets say the devicename for you big key is /dev/sdX. Now select that device in the table above and click "New Partition Table..." and "continue"

    Now select the free space below /dev/sdX and click "Add...". Select:
    Partition type: Primary
    Partition size: Set to the maximal possible value (is probably default)
    Location: Beginning
    Use as: Ext4
    Mount point: Select "/"
    Click OK

    I am not adding a swap-area because we need all 8GB for Linux Mint and sage. If you have a larger key, you should probably make a swap-area.

    In the table, be sure the format-checkbox is checked for the newly created ext4-partition

    Verify that the device in the drop-menu is still the big key and not the harddrive.

    When you're ready, click "Install Now"

  7. Follow the wizard and wait till the installation is complete. Remember your username and password, which you will need later. Once complete, shut down the computer. Once off, remove the small key.

    Leave only the big key in, and start up again to boot up on the big key. (If both keys are inserted, your computer may boot on the wrong one). You will probably see a GRUB boot screen. Just choose Linux mint (not the recovery mode) or let the timer run out.

  8. Once you're back at the Linux Mint desktop, you're running a fully-fledged linux OS. Reinsert the small key. Your small key should appear on the desktop (with the name MYLINUXLIVE). Open it, rightclick the compressed sage file and click "Open with Archive Manager"

  9. When it's ready, click Archive -> Extract... Enter your home-folder (the home folder is to the left. It has a house-icon and its name is the username you choose in the installation) and click Extract. Close the archive manager when it is done.

  10. Open your home-folder from the desktop. Find the newly extracted folder and rename it to "Sage" (case sensitive, without the quotes). Rightclick this folder again and click "Open in Terminal". A Black box (the terminal) will appear.

    Enter "./sage -notebook" (lowercase, without quotes), and wait while sage does its sage-stuff. Then enter a password for sage. After this, the sage notebook should start after a while. Then close the browser, press CTRL+C in the terminal, and enter "exit".

Now you can start sage by clicking Menu -> Terminal, and entering: "Sage/sage -notebook". Exit the terminal by pressing CTRL+C and enter "exit".

You can also create a desktop launcher for Sage: Open a text editor (pluma or gedit) and enter (case sensitive!):

Save this file as sage.desktop on the desktop and close the editor.
The first time you run it you may have to click "Mark as Trusted". In that case you may have to launch it a second time (be patient. It can take a half minute from the doubleclick until the browser pops up).

Warning: Undefined array key "nocount" in /customers/0/1/f/dansoy.dk/httpd.www/linux-sage/index.php on line 95

This guide was written 15/4 - 2013 and has since been visited 3736 times.