From charlesreid1

Low Mem Ubuntu Instances for Virtual Boxes

http://blog.erratasec.com/2013/03/ubuntu-low-mem-install-for-vms.html#.VwD0EVqZdE5


Installing Ubuntu from a USB Stick

Here's a quick guide to creating a Ubuntu USB boot stick: Ubuntu Live USB

if you've already got rEFInd set up on your Mac, this makes it simple to boot into a Ubuntu live mode.

Installing Ubuntu OS on a headless server

The following article covers the installation of Ubuntu onto a headless server, using Mac OS X to prepare the disk image:

Headless Ubuntu

Upgrading Ubuntu OS

How to upgrade your Ubuntu version from the command line:

http://lawrit.lawr.ucdavis.edu/it-help-center/how-to/upgrading-ubuntu-via-command-line

Resetting to Defaults

Aptitude

You can replace your default aptitude sources.list file here:

http://repogen.simplylinux.ch/

Random Stuff

Fixing Sudo

I had the experience of accidentally nuking my own sudo abilities on a headless server, which is not a good thing to do.

The mistake I made was running

BAD BAD BAD ----> #   usermod -G somegroup username    # <------------------- BADDDDDD

but the user username was in a bunch of other groups, specifically admin, which meant that the user username had sudo capabilities (anyone in the admin group had sudo capabilities). HOWEVER, the above command removed ALL GROUPS of which username was a member, and replaced them with one group, somegroup.

The correct way to do this is:

usermod -a -G somegroup username

where the -a flag says to append the new group to the list of groups of which username is a part, not overwrite it completely.

Here's how I fixed the problem. Keep in mind you need physical access to the machine, otherwise you're out of luck.

1. Connect a monitor and keyboard

2. Reboot

3. After the hardware vendor's splash screen, start pressing Esc. There will be a message that shows up on the screen that says something like, "Grub boot loader is loading. Press Esc to select startup options from a menu." Pressing Esc will bring up this menu.

4. Select any option from the menu that says "Recovery Mode". Linux will proceed to load/start

5. You will be presented with a 4-option menu, and one of them is "Drop into a root shell." Do this one.

6. Once you get to your root shell, run the visudo command:

# visudo

and add the following lines to your visudo:

# Give all members of admin group sudo abilities
%admin          ALL=(ALL) ALL

# Give a specific user sudo abilities
username        ALL=(ALL) ALL

If you've removed username from the admin group, you can re-add username to the group by running the following command:

# /usr/bin/sudo -u username usermod -a -G admin username

That's it, now when you reboot you should have your sudo abilities back.

Annoyances

If using Ubuntu as a desktop OS, the alt key will open a menu that takes complete control of all input, and it's extremely annoying.

To turn it off, go to Settings > Keyboard and pick the "Shortcuts" tab. Change the shortcut for "Key to show the HUD menu" to something like Ctrl + Alt + Shift + \

References