Installing An Ubuntu Desktop

From The Brainwrecked Wiki
Revision as of 12:16, 26 September 2014 by BrainwreckedTech (talk | contribs) (Updated version support information.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Future version
Currently supported
8 months left
4 months left
Not supported
12.04 Precise April 2017
12.10 Quantal April 2014
13.04 Raring January 2014
13.10 Saucy June 2014
14.04 Trusty April 2019
14.10 Utopic June 2015

Ubuntu is a Debian-based Linux distribution from Canonical that is renowned for its accessibility to newcomers. Version 10.04 made great strides in presenting a pleasing aesthetic, while 11.04 brought forth the Unity desktop for increased usability.

This page will only provide information for the desktop editions of Ubuntu that are still supported. Refer to the chart on the right.

Pre-Installation

Please read Drive Partitioning first. It contains useful information and points to consider when installing OSes on your computer.

If you want to use a swap file instead of a swap partition, you can do so even while using the Live version of the installer.

You may want to give the "mini.iso" version of the installer a spin. Think "alternate" except all packages are downloaded.

CDNM=trusty   # precise qauntal raring saucy trusty
ARCH=amd64    # amd64 i386

wget http://archive.ubuntu.com/ubuntu/dists/${CDNM}/main/installer-${ARCH}/current/images/netboot/mini.iso

Post-Installation Configuration

Console Font

If you want something other than the default console or GRUB font (eg, Terminus16):

sudo dpkg-reconfigure console-setup

APT

The following are steps to customize apt-get.

sources.list

Canonical sets up the /etc/apt/sources.list file a bit schizophrenicly, It's designed to make it easier for newcomers to tell what they're getting into, but it ends up making it hard to navigate when things go wrong.

# Ctrl+\ in nano to find+replace precise with quantal, raring, saucy, trusty, etc.
# Can replace [us|security].ubuntu.com with mirror like lug.mtu.edu, etc.
# If you'd like sources, duplicate deb lines and change to deb-src

deb http://us.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu precise-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu precise partner
deb http://extras.ubuntu.com/ubuntu precise main

Launchpad PPAs

sudo add-apt-repository ppa:ubuntu-x-swat/x-updates   #Xorg Updates (Stable)
sudo add-apt-repository ppa:skunk/pepper-flash        #Pepper Flash (<14.04)
sudo add-apt-repository ppa:tualatrix/ppa             #Unity Tweak  (<13.04)
sudo add-apt-repository ppa:mc3man/trusty-media       #gs-ffmpeg    (>13.10)

sources.list.d

With the advent of the add-apt-repository command comes /etc/apt/sources.d with a bunch of .list files. What happens is that the command grabs the PPA key and adds an entry to /etc/apt/sources.d in one shot. The command apt-get will read /etc/apt/sources.list and all the files in /etc/apt/sources.d. This can lead to confusion if you are used to /etc/apt/sources.list being the sole location of repositories.

If you wish to get everything back into the /etc/sources.list file, you can execute the following commands:

find /etc/sources.list.d -name "*.list" -exec cat {} >> /etc/sources.list
rm /etc/sources.list.d/*.save
rm /etc/sources.list.d/*.list

Service Configuaration

These services are self-explanatory and most users don't need them:

update-rc.d bluetooth disable
update-rc.d pcmciautils disable

If you want more control over services, apt-get install rcconf and look in /etc/init.

WARNING: Ubuntu tries to rely on UpStart but some things haven't been converted or still need SysV Init. If you use a SysV Init editor, all available services will be shown but only the handful of services that still rely on SysV are enabled. If you know you don't need a service and see it enabled in the SysV editor, it's safe to disable it. If you wish to enable a service, check the UpStart jobs in /etc/init first. If you wish to disable a service that you know is enabled but is listed as disabled in the SysV Init editor, check the Upstart jobs in /etc/init first.

XDG Base Directories

Programs that are XDG-aware will treat certain folders in your /home directory differently from others. These are the Desktop, Documents, Downloads, Music, Pictures, Public, Templates, and Videos folders. Proper-case names are a drag to type.

This script will go through these special folder names and either move them or (when the move fails) create them.

for $XDDUC in Desktop Downloads Templates Public Documents Music Pictures Videos; do
  XDDLC=$(echo "$XDDUC" | tr '[A-Z]' '[a-z]')
  mv ~/$XDDUC ~/$XDDLC || mkdir -p ~/$XDDLC
done

You can then replace the ~/config/user-dirs.dirs file with:

XDG_DESKTOP_DIR="$HOME/desktop"
XDG_DOWNLOAD_DIR="$HOME/downloads"
XDG_TEMPLATES_DIR="$HOME/templates"
XDG_PUBLICSHARE_DIR="$HOME/public"
XDG_DOCUMENTS_DIR="$HOME/documents"
XDG_MUSIC_DIR="$HOME/music"
XDG_PICTURES_DIR="$HOME/pictures"
XDG_VIDEOS_DIR="$HOME/videos"

Make sure these directories exist, or else non-existing directories will be set to $HOME the next time xdg-update-user-dirs is run. (By default, it is run upon login to Gnome.)

GRUB2

I really don't care for Canonical's default methodology for putting listings on the GRUB menu.

  • Version of Ubuntu is not listed. (Just Ubuntu instead of Ubuntu 9.10 or Ubuntu 10.4 LTS.)
    • This can be fixed by editing the following line in /etc/default/grub
sed -i 's/lsb_release -i -s/lsb_release -ds/g' /etc/default/grub
  • Recovery option for each Ubuntu kernel found doubles the listings.
    • This can be fixed by uncommenting the following line in /etc/default/grub
sed -i 's/^#GRUB_DISABLE_LINUX_RECOVERY/GRUB_DISABLE_LINUX_RECOVERY/g' /etc/default/grub
  • Memtest 86+ serial console superfluous for most home users.
    • You can disable the Memtest entries entirely by using chmod a-x /etc/grub.d/20_memtest86+
    • You must edit the script if you wish to disable the serial console entry for Memtest86+ only.
  • No version detection for Windows Vista and Windows 7, defaulting to Windows [Vista | 7] (loader) (on /dev/sdx).
    • Recovery partitions that use Vista or 7 Pre-installation Environments will also show up as Windows [Vista | 7] (loader) (on /dev/sdx).
    • The /etc/grub.d/30_os-prober script must be directly edited to customize entries.
  • Any changes made made to the files 00_default, 10_linux, 20_memtest86+, and 30_os-prober may be over-written by an update.

You can try to argue with the scripts over the particulars of names. Or you can use 40_custom and be done with it.

WARNING: The scripts in /etc/grub.d are designed to automate the creation of /boot/grub/grub.cfg so you don't have to worry about changes made to the disk. By using the following method to regain control of the menu, you also take on the responsibility for changing menu entries when changes occur on the disk. You can mitigate changes to Linux by using symlinks that point to the current kernel and initrd image. You will still have to manually edit the file when UUIDs change.

The intent with the following script is to keep the current grub.cfg generation in place but move everything that the linux, memtest86+, and os-prober scripts would normally generate into the custom script. It accomplishes this by first disabling the header and theme scripts and then temporarily generating an invalid grub.cfg file for cating into the custom script. The header and theme scripts will be then be re-enabled and the linux, memtest86+, and os-prober scripts will then be disabled. After making some changes to the custom script and the kernel-img.conf file, a new initrd and grub.cfg will be generated.

mv /etc/grub/grub.cfg /etc/grub/grub.bak
chmod a-x /etc/grub.d/{00,05}* && update-grub
cat /boot/grub/grub.cfg >> /etc/grub.d/40_custom 
chmod a+x /etc/grub.d/{00,05}* && chmod a-x /etc/grub.d/{1,2,3}0*
sed -i 's/\/boot\/initrd\.img.*/\/initrd\.img/g' /etc/grub.d/40_custom
sed -i 's/\boot\/vmlinuz.*/\/vmlinuz/g' /etc/grub.d/40_custom
sed -i 's/link_in_boot = no/link_in_boot = yes/g' /etc/kernel-img.conf
update-initramfs -u && update-grub

Edit the entries in /etc/grub.d/40_custom to suit your taste.

MTU

If you are using Gigabit Ethernet, you can change the MTU setting for better performance. Gigabit Ethernet accepts MTUs up to 9000, but a lot of Gigabit Ethernet chipsets do not go this high. This number cannot be any higher than any server you plan to communicate with.

Use the following command to determine which Ethernet device you are using. The one with an IP address is the one you are interested in.

ip addr

You'll get output like this:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether hh:hh:hh:hh:hh:hh brd ff:ff:ff:ff:ff:ff
    inet nnn.nnn.nnn.nnn/24 brd 192.168.1.255 scope global eth0
    inet6 hhhh::hhhh:hhhh:hhhh:hhhh/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether hh:hh:hh:hh:hh:hh brd ff:ff:ff:ff:ff:ff

Use the following command to determine the the max MTU setting.

sudo ip link set [device] mtu [1500-9000]

You'll basically be playing a game of guess-the-number. No feedback means the command was successful. You'll know you've gone too far when you see [DRIVER] answers: Invalid argument.

Once you've determined the largest valid number you can use, you need to to make sure that your network hub or router isn't a limiting factor and that the drivers aren't allowing you to set the MTU higher than the actual hardware can handle.

ping -s [size-minus-8] [ip-address]

If you do not receive a response with the MTU setting you got earlier (less 8 bytes for the ICMP header) then something is goofed and you will have to play the number guessing game again until you can make a successful ping.

Once you find your optimal MTU setting, it's time to get the setting to stick on every boot.

While the /etc/rc.local way is almost always guaranteed work in Debian, Debian won't absolutely guarantee the network is up before init reaches rc.local, so it's best to use /etc/network/interfaces instead.

If you're using DHCP:

auto eth0
iface eth0 inet dhcp
post-up /sbin/ip link set eth0 mtu [nnnn]

If you're using static addressing:

auto eth0
iface eth0 inet static
  address 192.168.1.nnn
  network 192.168.1.0
  netmask 255.255.255.0
  gateway 192.168.1.1
  broadcast 192.168.1.255
  mtu nnnn

Plymouth

Ubuntu's boot splash screen Plymouth runs just fine most of the time, automatically detecting the highest resolution your monitor supports and using that. However, if you install the proprietary NVIDIA or ATI drivers, the screen will default down to 640x480.

Install the v86d package needed to use uvesafb

apt-get -y install v86d

$RES=800x600 && $COLORDEPTH=24
$UVS=mode_option=$RES-$COLORDEPTH,mtrr=3,scroll=ywrap

# EDIT GRUB2 CONFIG

sed -i 's/quiet splash/quiet splash nomodeset video=uvesafb\:'$UVS'/g' /etc/default/grub
sed -i 's/#GRUB_GFXMODE=.*/GRUB_GFXMODE='$RES'/g' /etc/default/grub

echo "uvesafb $UVS" >> /etc/initramfs-tools/modules         # EDIT INITRAMFS MODULES
echo 'FRAMEBUFFER=y' > /etc/initramfs-tools/conf.d/splash   # CONFIGURE SPLASH SCREEN
sudo update-initramfs -u &&  sudo update-grub2              # UPDATE EVERYTHING

Post-Installation Packages

Base Programs

These programs should be installed on all Ubuntu systems.

sudo apt-get install apt-file acpid cpufrequtils curl cfldd iotop lm-sensors ncdu \
     tmux nfs-common openssh-server pastebinit whois arj lzop p7zip unrar zip

sudo apt-file update
sudo sensors-detect

Configuration

Get Synaptic/GDebi back

Older/Power users of Ubuntu may be more comfortable with Synaptic & GDebi.

sudo apt-get install synaptic gdebi

Unity/Compiz Settings

sudo apt-get install compizconfig-settings-manager compiz-plugins-extra [unity-tweak-tool|ubuntu-tweak]
  • unity-tweak-tool is avaialble only for Ubuntu 13.04 and later
  • ubuntu-tweak is for Ubuntu 12.xx and requires the ppa:tualatrix/ppa repository.

Editing

sudo apt-get install geany

Internet

sudo apt-get install adobe-flashplugin gstreamer0.10-ffmpeg chromium-browser midori pep[per]flashplugin-nonfree skype xchat-gnome
  • adobe-flashplugin and skype require the Cannonical partner repository
  • pepperflashplugin-nonfree is for Ubuntu 14.04 onwards -- earlier version use pepflashplugin-nonfree from the ppa:skunk/pepper-flash repository.
  • gstreamer0.10-ffmpeg is for HTML5 video in Firefox and requires the ppa:mc3man/trusty-media repository starting with Ubuntu 14.04

Graphics

sudo apt-get install gimp gimp-help-en inkscape

Emulation

WINE

sudo apt-get install wine

If you manage to completely screw something up:

sudo apt-get purge ^wine*
rm -r ~/.wine
rm -r ~/.config/menus/applications-merged/wine*
rm -r ~/.local/share/applications/wine
rm -r ~/.local/share/desktop-directories/wine*
rm -r ~/.local/share/icons/????_*.xpm

Qemu

sudo apt-get install qemu-kvm kvm-pxe
sudo addgroup `whoami` kvm

Multimedia

sudo apt-get install avidemux mkvtoolnix-gui mpv

Security

Beginning with 12.04, KeePass is now available in the official repos.

sudo apt-get install keepass2

Fonts

Most of the Windows fonts can be had from the repository

sudo apt-get install msttcorefonts

However, Tahoma and the newer SegoeUI is not included. If you have an existing Windows installation, you can copy them from there.

You can simply double-click a TTF file to get the Font Preview and use the Install button, but that will only install the font for yourself.

To install fonts for all users, copy the TTF file to /usr/share/fonts/truetype. Then run these commands.

sudo fc-cache -fv
fc-cache -fv