Mathematical Field Notes

Upgrading…

leave a comment »

I just installed Linux (Fedora 17 LXDE) on my Eee PC 1015CX and this blog post is to (a) remind me how, and (b) serve as a guide for other confused and technically non-savvy people. Indeed, it was very easy in the end: my biggest hang-ups were psychological and I wanted to see blog-posts saying things like “yes you can delete that partition” to give me confidence.

So, yes. You can delete that partition.

No, not that one.

The other one.

Disclaimer: This worked for me. It might not work for you, but extensive Googling should help.

When I bought my Eee PC last summer (for LaTeXing on the long commute from Oxford to London) it came with Windows 7 Starter. I was sad that I couldn’t change the desktop background to a picture of my choice (so I changed it to blank). I became increasingly frustrated with it opening random programs on startup and updating of its own accord. So over Easter, when I finally had some time and an 8Gb USB stick, I downloaded various distributions of Linux and started booting off the USB stick.

It’s very easy to run Linux off a USB stick – you just need to download the relevant ISO file and run a program to turn the USB into something bootable. There are various such programs around and plenty of stuff written online to help set it up.

There are many different distributions of Linux around – I picked Fedora 17 with LXDE. LXDE is “lightweight”, i.e. fast and doesn’t use many resources, so good for my little laptop. I really didn’t like the look of some of the other desktops: I use Gnome 2 on my desktop in work and I like that, but Gnome 3 is horrible and KDE is a bit gimmicky too.

This particular combination also recognised my Wacom Bamboo tablet without me having to do anything. You can determine this kind of thing while still running it off the USB stick.

I wanted to set up my computer to dual-boot Windows and Linux. To do this I had to make space for Linux on the hard drive. You can see the structure of the hard drive if you open up Disk Management in Windows 7 (via Control Panel > System and Security > Administrative Tools > Computer Management > Disk Management). On the Eee PC 1015CX it was set up like this:

* sda1: A volume of about 100 Gb with Windows on it.

* sda2: A small FAT32 volume of about 16 Gb with some kind of Windows recovery on it.

* sda3: A big volume of about 180 Gb with virtually nothing on it (a lot of “EULA” files which stands for End User Licence Agreements)

* sda4: A tiny volume at the end of the disc with something to help the laptop boot up faster.

I ummed and ahhed for a while before using the Windows Disk Management to delete the big, virtually empty partition (hoping it wouldn’t mess anything up) and that worked fine. This turned it into “unallocated space”. Linux was able to install itself in that space.

Next I booted up Linux from the USB and clicked the little “Install to Hard Drive” button on the desktop. This was Fedora 17 with LXDE. It has a very helpful wizard that takes you through the process – I chose the option to install into unallocated space so as not to overwrite Windows. The only part of the process that gave me worry was when it asked if I wanted to overwrite the thing (on the partition called sda1) that boots up Windows and replace it with GRUB, another program which allows you to boot different things. I worried that then Windows wouldn’t boot, but (after taking the plunge!) it works fine.

That’s it. Since then I’ve been playing around with it, installing different programs with varying degrees of success.

The first thing I did was change the background (screw you Windows 7 Starter). It’s mostly still black, but by choice this time.

Here are some things I’ve worked out:

0. LaTeX.

I needed to install TeXLive 2012 (many distributions come with this already loaded). I downloaded this from here:

http://www.tug.org/texlive/acquire-netinstall.html

and followed these instructions:

http://www.tug.org/texlive/quickinstall.html

This worked very well. To run LaTeX on a document, use a terminal to navigate to the directory containing that document and type

$ pdflatex filename.tex

(you don’t type $, that’s a symbol to denote what I’m writing is a terminal instruction). Unfortunately for this to work you need to tell your computer what “pdflatex” means. This is accomplished by changing the PATH environment variable. If I do this in the terminal (LXTerminal) by typing

$ PATH=/usr/local/texlive/2012/bin/i386-linux:$PATH

(you do type the second $, that indicates the value of the variable PATH) then it works, but after I close the terminal the PATH variable changes back to its original form. The fix is to find the (hidden) document called ~/.bash_profile (note that ~ means the folder associated with your user, on my computer it’s /home/fooo where fooo would be my username) and change the line

export PATH=$PATH

to

export PATH=/usr/local/texlive/2012/bin/i386-linux:$PATH

Now when you start a terminal it should automatically recognise the LaTeX commands.

1. Installing other programs

Most programs can be installed using the instruction

$ yum install programname

but you may need to tell yum where exactly it can find the program you’re telling it to install (from an online repository). I haven’t had that issue yet. I installed emacs (a text-editor which also does other things like LaTeX) this way.

2. Keystrokes

I was initially sad that my Windows key was now a useless appendage: pressing it didn’t call up the start menu any more. A bit of digging around revealed that in Linux this key is still recognised, but is a modifier key (like Alt or Ctrl). In other words, you can use it in combination with other things to do stuff. In LXDE this is accomplished by finding the file ~/.config/openbox/lxde-rc.xml and editing it. You look for the bit that says stuff like

<keybind key=”W-F1″>
<action name=”Desktop”>
<desktop>1
</action>
</keybind>

which means “When you press Windows key + F1, change to viewing desktop number 1″. You can make it do more interesting things like:

<keybind key=”W-F1″>
<action name=”Execute”>
<command>lxsession-logout</command>
</action>
</keybind>

which calls up the logout window, or

<keybind key=”W-F1″>
<action name=”Execute”>
<command>lxterminal</command>
</action>
</keybind>

which opens up a terminal.

This is sometimes called the “Super Key”, because some keyboards have a “Super Key” (like Alt or Ctrl).

On the subject of shortcut keys, I have to stop pressing ctrl-v in emacs and expecting it to paste…

3. Wireless.

On my laptop the wireless can be enabled or disabled using Fn-F2. This no longer works in Linux. I haven’t worked out how to get a key combination to do this because the fix I found needs to be run as root. You need the (intimidatingly-named) program rfkill which you can get by typing

$ yum install rfkill

into a terminal. Once that exists, you can just type

$ su

to become root (you may have to enter a password) which will bring up a # instead of a $

# rfkill block wifi

or

# rfkill unblock wifi

to turn the wireless on or off.

Edit: I realised that this is not turning off (or on) the hardware – it’s only effecting a “soft block”. I’m not sure how to turn off the hardware without booting Windows and using Fn-F2. Suboptimal methinks. A good reason to own a laptop with a wifi button.

4. Inside the terminal

If there’s something you want to know about (for example wireless), you can type

$ man -k wireless

or

$ info wireless

into a terminal. Most of what it comes up with is pretty illegible to me, and stuff I found on forums via Google was more useful. Once you’re inside an info page in the terminal you can type q to get back to the command line.

Bear in mind that some things you want to do in a terminal require you to be “root” (like administrator in Windows). That’s easy, just type

$ su

and it will probably ask for your password (which you set up during the installation wizard). Then the $ will change to a # and you can do many more things (like deleting your hard drive or launching nuclear strikes against your neighbours – so be careful).

5. Getting the right-click desktop menu back

My desktop right-click menu disappeared at some point. The way to get it back is explained here:

http://www.pclinuxos.com/forum/index.php?topic=100661.0

In a terminal, type

$ pcmanfm --desktop-pref

which brings up the desktop preferences menu. You can untick the “show menus” option in the “advanced” tab to get the right-click menu back.

6. Emacs

I remember long ago when I started TeXing, I was given the advice that I should use Emacs. I didn’t like it because it behaved in funny ways, so I used TeXnicCenter (and Kile). Now, years later, I’ve worked out that you can make it behave the way you want quite easily. First you install AUCTex (which you can do from the “Manage Emacs Packages” menu option) which gives you a bit more LaTeX functionality. Then you create a file called .emacs in your home directory and fill it with stuff like this (hopefully the comments, after ;; make this self explanatory…):

;; Changing Colors
(set-background-color "bisque1")
(set-foreground-color "grey10")

;; Changing dimensions of default emacs window
(add-to-list 'default-frame-alist '(height . 24))
(add-to-list 'default-frame-alist '(width . 80)) 

;; Compile and view using PDFLaTeX
(setq TeX-PDF-mode t)
(setq TeX-view-program-list '(("Epdfview" "epdfview %o")))
(setq TeX-view-program-selection '((output-pdf "Epdfview")))

;; Don't show startup screen
(setq inhibit-startup-message t)

;; Define key bindings
(global-set-key (kbd "C-v") 'yank);;               Paste = C-v
(global-set-key (kbd "C-z") 'undo);;               Undo  = C-z
(global-set-key (kbd "C-s") 'save-buffer) ;;       Save  = C-s
(global-set-key (kbd "C-f") 'isearch-forward);;    Find  = C-f
(global-set-key (kbd "C-c c") 'kill-ring-save);;   Copy  = C-c c
(global-set-key (kbd "C-n") `find-file);;          New   = C-n
;; For opening specific locations
(global-set-key (kbd "C-c d")
  (lambda ()
    (interactive)
    (dired "~/Documents/")));; Documents folder = C-c d
(global-set-key (kbd "C-c p")
  (lambda ()
    (interactive)
    (dired "~/Documents/Papers-in-Progress/")));; Papers folder = C-c p

;; Define key bindings for TeX
(defun my-run-latex ();; Define a function which saves and builds the master file
  (interactive)
  (TeX-save-document (TeX-master-file))
  (TeX-command "LaTeX" 'TeX-master-file -1))
(global-set-key (kbd "C-<f7>") 'my-run-latex);;    LaTeX  = C-F7
(global-set-key (kbd "<f5>") 'TeX-view);;          View   = F5

;; Yes-or-no to y-or-n
(fset 'yes-or-no-p 'y-or-n-p)

;; Disable toolbar
(tool-bar-mode -1)

The following sites were helpful while coming up with all this:

http://www.masteringemacs.org/
http://sachachua.com/blog/category/emacs/
http://wttools.sourceforge.net/emacs-stuff/emacs-keybindings.html
http://stackoverflow.com/questions/92971/how-do-i-set-the-size-of-emacs-window
http://tex.stackexchange.com/questions/64565/defining-a-new-key-combination-in-emacs-to-run-latex
http://www.emacswiki.org/emacs/DiredMode

Advertisements

Written by Jonny Evans

April 27, 2013 at 5:38 pm

Posted in Emacs, Linux

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: