Tuesday, December 11, 2012

Ubuntu Install (12.04.1 LTS Precise Pangolin)

I've just made a new install of Ubuntu 12.04.1 on my two dell minis (a 10v and a 1018)

The installation goes a lot more smoothly now than it used to do, since all relevant drivers are already on the install CD, so Ubuntu just deals with it.

Unfortunately I hate the new Unity Interface, because it runs exceedingly slowly on these little machines. However that's easily solved by installing the xubuntu-desktop and logging into that instead, which provides a nice traditional desktop which runs fast.




Once the base system is installed, fix the boot process so that the kernel can explain what it's doing as it boots:


$ sudo vi /etc/default/grub
change
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
to
GRUB_CMDLINE_LINUX_DEFAULT=""


then run 
$ sudo update-grub





Enable the root account

$ sudo passwd root




Add the medibuntu repository, instructions here: https://help.ubuntu.com/community/Medibuntu

Roughly, what they say to do is:


$ sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring



Also Damien Cassou's emacs24 repository:

$ sudo add-apt-repository ppa:cassou/emacs




Make sure that you've got the latest versions of everything:


$ sudo apt-get update
$ sudo apt-get upgrade





Install the restricted extras:


$ sudo apt-get install ubuntu-restricted-extras


which is a huge metapackage that adds all sorts of non-free goodies. At one point it asks to agree to some sort of microsoft font licence. Sigh....


Then do:
$ sudo /usr/share/doc/libdvdread4/install-css.sh
to give your new system DVD reading abilities.




Here's a list of packages that I always end up installing: might as well get them all at once. You can make a cup of tea while this is happening. It takes about ten minutes.


$ sudo apt-get install w32codecs gitk mplayer smplayer epiphany-browser chromium-browser maven2 xxdiff tree git-gui mercurial rlwrap vim-gnome nautilus-open-terminal loop-aes-utils xclip filelight htop gparted idle3 unison build-essential gparted imagemagick fail2ban kate vlc openjdk-6-jdk xine-ui arandr xubuntu-desktop feh xscreensaver xscreensaver-data xscreensaver-gl gnome-shell app-install-data-medibuntu apport-hooks-medibuntu emacs24 emacs24-el emacs24-common-non-dfsg aptitude emacs-goodies-el tig ack-grep





Turn the firewall on:
$ sudo ufw enable


to check:
$ sudo ufw status


Change the default umask so that files are private for all users


$ sudo vi /etc/login.defs
change umask from 022 to 077

(This used to be in /etc/profile. I'm not at all sure that it still works like it used to. In my user account I'm seeing a umask of 0007, and if I create files then they're group readable, so I think it's getting set somewhere else now.).




Encrypt the swap partition:
$ sudo vi /etc/fstab
Change /dev/sda5 none swap sw 0 0 to:
 /dev/sda2 none swap sw,loop=/dev/loop7,encryption=AES256 0 0


and add cryptoloop to /etc/modules

If you want to run an ssh server (client is already installed)

$ sudo apt-get install ssh


Then go fix the config file
$ sudo vi /etc/ssh/sshd_config
Change UsePAM, PasswordAuthentication, PermitRootLogin to no
Also allow Port 443 for login over https port through captive portals


Then allow it through the firewall:

$ sudo ufw allow 22
(also 443, also fix the router to forward appropriately)




This completes system setup






Tweaks to a new user account 








In firefox install adblock plus, xmarks, and video download helper



Clone your repository from github:

$ ssh-keygen -t rsa -C "john@woc-desktop.aspden.com"
$ cat ~/.ssh/id_rsa.pub | xclip -sel clip
$ git clone git@github.com:johnlawrenceaspden/hobby-code.git

Make links to .bashrc etc

$ ~/hobby-code/makelinks.bash 




(I used to do these under gnome, not sure what the equivalents are in xfcd/xubuntu-desktop):

System/Preferences/Keyboard/Typing Break to turn on typing break
System/Preferences/Keyboard/Layouts/Options/Ctrl key position/Make CapsLock an additional Ctrl
Use United Kingdom keyboard, with United Kingdom International with dead keys to type foreign.
Disable all the Ctrl-Alt- shortcuts in GNOME using System/Preferences/Keyboard Shortcuts
Make Alt+F11 mean 'toggle fullscreen mode'





Clojure/EMACS setup

Install leiningen (version 2, the packaged version is only 1.7 at present)

M-x package-list-packages then i to mark packages, and x to do it.

to install clojure-mode, nrepl, and htmlize, undo-tree, ack


(Used to be slime, slime-repl for clojure, but nrepl seems to have won recently)



















Monday, November 26, 2012

user ids

john 1000
test 1001
okfn 1004

Monday, October 17, 2011

Mercurial get a single file

If you'd like to get back a single file (file.txt) from a previous revision (23456) in mercurial, the command is:


hg revert -r 23456 file.txt

Friday, October 7, 2011

make variables

When writing make rules, there's a certain set of vital cryptic syntax that is impossible to remember.

It always takes ages to find the definitions of these damned things which are unaccountably hidden deep in the manual, or remember what they're called, even though they're the one thing you always need when writing a makefile.

Make Automatic Variables

$@ target

$< first prerequisite

$^ all prerequisites

$* the stem from the pattern match in an implicit rule

These are the four that you always use, more can be found at:
http://www.gnu.org/s/hello/manual/make/Automatic-Variables.html#Automatic-Variables

Thursday, September 15, 2011

Making emacs TAGS files for a tree of source code

 This command makes an emacs tags file when you've got a tree of many types of file (in this case mixed C and assembler, with makefiles)

$ find .  \( -name "*.[ch]" -or -name "*.inc" -or -name "*.s" -or -name "*.mk" \) -print | xargs etags -a

Tuesday, March 29, 2011

git recover lost commits

Sometimes, if there's no reference to a commit, it looks as though git has thrown it away. (Indeed if you do git gc, it will throw it away).

In this situation,


$ gitk --show-dangling


will give you enough information to save your ass.

You can also use:

$ gitk --all $(git log -g --pretty=format:%h)

to much the same effect.

Thursday, March 24, 2011

Old Ubuntu

I logged into an old version of ubuntu the other day and was struck by how much I preferred it.

Tips to take into a new version. Use droid sans 10 for all fonts except fixed width, which should be monospace 10.
The battery icon used to have an entry called 'Power History' which I think was part of gnome-power-manager. That was really useful but it's gone.

Use the dust sand theme and a plain green background, panels at the side so as not to take up too much space.

Maybe it's time to go back to debian.

sudo apt-get install ttf-droid