Ubuntu installation: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
Line 46: Line 46:
Upgrade to 16.04 LTS
Upgrade to 16.04 LTS
  do-release-upgrade
  do-release-upgrade
== Upgrading Ubuntu 12.04 to 14.04 LTS ==
Upgrading from 12.04 LTS should be fairly simple.
=== Prior to upgrading ===
Upgrade all the 12.04 packages (!)
apt-get update
apt-get dist-upgrade
apt-get autoremove
Switch back to the Ubunty desktop (I used Cinnamon since I couldn't cope with Unity)
* Log out
* Log in with Unity. To do so, click on the Ubuntu icon.
Remove bad repositories (PPAs)
* Run ''apt-get update'' again if you forgot which ones are broken. Use the GUI or the Command line
* Ubuntu Software Center; Menu: Edit->Software Sources"; Click on Other Software tab
* Command line
add-apt-repository --remove ppa:PPA_Name/ppa
: In addition, you may have to edit files or directories (e.g. Mendely made a famous job of bad packaging)
Remove no longer supported desktops
sudo apt-get remove cinnamon
=== Upgrade ===
Upgrade
sudo do-release-upgrade -d
: The whole process may take about 2 hours (on a fast Internet connection)
Forcing it, before the 12.04.01 release was out, not so recommended ...
sudo do-release-upgrade -d
=== Fixes to the interface ===
Arrange monitors
* Settings -> Displays
: Drag the monitors, e.g. the right to the left one.
Get rid of the global menu
* Settings -> Appearance -> Behavoir tab
: Select "In the window's title bar"


== Ubuntu 12.04 LTS ==
== Ubuntu 12.04 LTS ==

Revision as of 15:36, 14 February 2017

Ubuntu

Ubuntu is a popular Linux distribution, best suited for desktop computers. It is based on Debian, therefore the packaging (*.deb) works rather well.

Disclaimers

  • This page so far is by no means a configuration and installation guide, but it contains some information that could be of use to some people. Daniel K. Schneider decided to put some of his installation notes in this wiki, so he won't loose them.
  • I am be no means a systems expert. As you can see from other entries in this wiki I deal with lots of stuff and lots of it I don't really master ...
  • Feel encouraged to add stuff :)

Find out what distribution you already have:

more /etc/issue
uname -a

Find the serial number for your machine (e.g. a Dell service tag)

sudo dmidecode -s system-serial-number

Installation documentation

Start with the official Ubuntu site (sometimes a bit lengthy):

Sometimes it is useful to hunt down short installation documentation on other sites than Ubuntu. If you are looking for an other practical, short and excellent installation guides (and that may include how to add non-free software):

After installing (Thanx a lot to you guys, the articles below really did help me to get a somewhat decent working environment - Daniel K. Schneider 22:06, 20 September 2012 (CEST))

Upgrading Ubuntu 14.04 to 16.04 LTS

This upgrade was available since July 21 2016 (16.04.1 LTS)

Upgrade to latest 14.04 (not sure that this is really needed)

apt-get update
apt-get dist-upgrade
apt-get autoremove

Upgrade to 16.04 LTS

do-release-upgrade

Ubuntu 12.04 LTS

Below are just some notes that apply to the following case. Your old box is dead and you got a new one, but:

  • Video card won't work at all
  • Networking won't work
  • You hate the menu on top, the icons bar to the left and other new stuff in the new 12.04 GUI.

Getting the good installation CD

I didn't manage to read the "normal" CD for my new DELL Optiplex 990 with an Quadro 600 graphics card. In addition, you can't just hook up a screen to the built-in graphics card. The machine will complain and not boot :(

lspci|grep -i nvidia

Result (seen from the repair CD):

VGA compatible controller: NVIDIA Corporation GF108 [Quadro 600] (rev a1)

Solution:

You now can see the installation menu (arrows based), however this is only one problem solved.

Video and network not working (details)

It is best to redo the install if the video is not working, since somehow other stuff will not work either. Once I got the VGA video going from the repair CD, the network was dead. Of course it can be done, but that would require true admin skills.

Do the following:

  • Download (as I said before) the alternative version
  • Walk through the whole dialogue, but at the end when the CD asks to finalize the install (sorry forgot the exact phrasing), hit ESC (say no!)

You will see the main installation menu. Open a shell and do the following:

  • Change the bootloader so that it will use a dumb graphics setting
  • Inhibit IP6 networking (not so sure about this, but in our institution this got my networking going .....)

1) Changes in Networking

cd /target/etc/network
nano interfaces

Comment out the line that goes

  1. iface eth0 inet6 auto

This basically will just make sure that you use good old IP4 Internet

2) Changes in Grub (bootloader)

 nano /etc/default/grub

Change a line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"
save (CTRL-O) + ENTER
exit (CTRL-X)

Then, just hit ESC.

3) Replace the bootloader with your new one

  • In the installation menu, write out the Grub (menu item) and then finish installation (menu item)

Now your machine should boot and you should have bad, but usable VGA graphics.

Installing a correct video driver and configure the screens

The new Ubuntu system thinks that users are even worse idiots than I am. In the application bar, one can't even find a terminal. Good old system admin tools are also missing.

  • To get a terminal: Click on "Dash Home" and type term in the search box

(1) Install the Video driver

  • Click on the system settings icon
  • Under Hardware: Click on Additional Drivers. This (in my case) detected the NVIDIA card.
  • Click on Activate. This should download and install the driver.
  • Restart the system

(2) Enter correct settings for the display(s)

  • System settings -> Displays

That should work for one screen, i.e. I could set the screen to 1920x1200. Though I find it irritating that the screen is called a laptop.

(3) configure Nvidia settings

  • Open a terminal
  • Type: nvidia-settings

Make a copy of your /etc/X11/xorg.conf file (!) This always can go badly wrong.

Then in the nvidia tool:

  • Click on X Server Display configuration
This should find the other screen(s)
  • Select TwinView (that's what I use, i.e. 2 screens make up one large desktop)
  • Fix the position if needed (mine was right of instead of left-of
  • Write out file /etc/X11/xorg.conf

Restart the machine. You now should have two displays. In Twinview mode, when you click on System settings->Displays, you now can see that you have a Laptop with a 3520x1200 resolution. Not great, but acceptable. Have to buy new bigger screens sometimes soon.

....now that was easy :) I still am angry at Ubuntu for not being able to produce an install CD that works with a mainstream config (Dell Optiplex 990 + Nvidia Quadro). I can understand that users must configure the video card, but can't understand why the screen had to show a blinking chaos and why the network didn't work ...

Fixing the desktop and add missing admin tools

update (9/2013): Installing Cinnamon fixed the problems, i.e. instead of fixing Unity, get rid of it. It's not dangerous, since you always can decide what desktop to use before you log in. Alternatively, try LXDE or Mate.

sudo add-apt-repository ppa:gwendal-lebihan-dev/cinnamon-stable
sudo apt-get update 
sudo apt-get install cinnamon

Problems:

  • Moving the menu bar can't be done intuitively (e.g. using the appearance tool, by dragging the bar, by clicking on the grey bar on top, etc.)
  • The grey menu bar on top acts like a Mac. I find this hugely irritating. I do hate the Mac one-menu-for all approach. Doesn't make sense if your desktop is large and you got several open applications.
  • Synaptic package manager and other essential tools are missing.

Install a better GUI tweaking tool (Ubuntu Tweak)

 sudo add-apt-repository ppa:tualatrix/ppa 
 sudo apt-get update
 sudo apt-get install ubuntu-tweak

Unsettings

 sudo add-apt-repository ppa:diesch/testing
 sudo apt-get update
 sudo apt-get install unsettings
Offers more tweaking options for people that are unhappy with the new GUI, read on for yet more options and also more specific tweaks.
In particular, you can disable the global menu which is something that Ubuntu tweak cannot.

Gnow-teak gnome weaking tool

Get it:

sudo apt-get install gnome-tweak-tool
This simple tool allows quickly to 1) to change themes, fonts, window themes, etc. and 2) to set the all important mouse focuse mode (over instead of click). I am not using Linux in order to have a Windows clone !

In a terminal, type (else search it in the launcher)

gnome-tweak-tool

CCSM

Get it:

sudo apt-get install compizconfig-settings-manager

Yet another tweaking tool with many options. E.g. it allows to fix the opacity of the dashboard

  • Menu left -> Desktop -> Ubuntu Unity Plugin


Gconf-editor

Get it:

sudo apt-get install gconf-editor

This tool allows to edit each an every property (I believe). If you can't find it in a tool, it's here:

If you want to get rid of stupid windows maximizing when you move a window to the top, type:

gconf-editor &
Browser to:
apps -> compiz-1 -> plugin -> grid -> screen0 -> options -> top_edge_action
set this value to 0

Disable menu-bar integration of Firefox

In Firefox 23 (and maybe 22)

In the URL address field, type

about:config

Search for unity, then toggle from true to false

In older versions

In the grey menu bar on top, where you can read "Firefox Web Browser"

  • Tools –> Add-ons –> Extensions
  • Then Disable 'Global Menu Bar integration'

Install synaptic manager

While apt-get is more practical if you know what you want, synaptic is better suitable for browsing.

sudo apt-get install synaptic

Btw. Ubunt Tweak also has a download manager, but it only includes a short list of selected software. Good choice, but some stuff is missing, e.g. emacs.

Get rid of the mac-like menu bar

Not sure that this works, see the unsettings tool

sudo apt-get autoremove appmenu-gtk appmenu-gtk3 appmenu-qt

To install it again:

sudo apt-get install appmenu-gtk appmenu-gtk3 appmenu-qt

Remaining problems:

  • Moving the menu bar to some other place
  • There is some fallout, e.g. thunderbird continues to use a central menu. Some popup menus can get lost, e.g. appear in another workspace. Some applications (e.g. openscad) will loose menu items after a few hours of use ..... that's quite a disgrace I'd say.

Install easy admin tools

The default ones do nothing. Can't even change a group id :(

sudo apt-get install gnome-system-tools
  • Then, in the Dash Home search users or type users-admin& in a shell

Ubuntu upgrades

Which version do I run

Type:

lsb_release -a

Minor upgrades

From the command line, to update the repository information:

sudo apt-get update

To upgrade

sudo apt-get dist-upgrade
will do the upgrade fairly smartly (make sure that all dependencies work)
sudo apt-get dist-upgrade
will upgrade the existing packages to the latest version

Hash Sum mismatch issues

If something like GPG error: http://mirror.switch.ch hardy-updates Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com> happens, you might change the server. Either,

  • Edit /etc/apt/sources.list

Or

  • change with menu System->Administration->Software sources

Or get a new key (2) Identify the missing ones

sudo apt-get update
sudo apt-key adv --recv-key --keyserver keyserver.ubuntu.com XXXXXXXXXX
XXXXXXXXX is the missing key.

Major upgrades

  • You can upgrade from LTS to LTS (however that takes a little bit of waiting, e.g. 12.04 LTS will upgrade to 12.04.01
  • Upgrade first the existing installation
  • Clean repository information. I.e. remove those that don't work anymore (read this (command-line) or that (details, search for "removing").
apt-get dist-upgrade

To upgrade

do-release-upgrade -d

PHP/MySQL trouble with a 10.04 to 12.04 upgrade

  • Read this and similar. It helped. I had to force remove remove everything mysql before I could install a 5.5 version + all the other things that were remove (like php-mysql).
  • PHP can't find some extensions. Install these again, e.g.
apt-get install php5-gd php5-mcrypt php5-suhosin

Networking file systems and users

Mounting external NFS partitions

Read more about this topic:

Installing mnt and mount points

It's a bad idea to keep your files on your personal PC. Since we have sun servers with daily backup I just mount partitions via NFS. NFS may not be included in your install

apt-get install nfs-common
mkdir /mnt/YYY

then edit /etc/fstab and enter line(s) like this

XXX.unige.ch:/export/home /mnt/YYY nfs defaults 0 0

Then mount these

mount -a
Changing your user id
  • If you installed from the standard distribution, your user is is not compatible with the one you have on an other machine, so you have to change it. You can use the user management tool in the System menu (click on "unlock").
  • Create a new group first and use the gid from your server (type id- a on the server machine)
  • To change your user id is more tricky, can't do this while you are in the desktop. An easy method is to use the usermod tool (after logging out from the GUI !!), e.g.to change user dks to uid=6000
usermod -u 6001 dks

or if you want to change the uid too:

usermod -g 6000 -u 6001 dks

Exporting partitions with NFS

Become root, or add "sudo" in front of all commands ...

Either NFS or Samba allow to share a partition with other (client) machines. In order to use NFS:

1) Install NFS on your server machine

apt-get install nfs-kernel-server

2) Configure the directories to be exported by adding them to the /etc/exports file. For example:

/export/data mymachine.yourorg.org(rw,sync,no_subtree_check)

will export the directory /export/data/ for the host (computer) mymachine.yourorg.org with (with-permissions). Do not use something like:

/export/data *(rw,sync,no_root_squash)

I.e. only give specific machines access to your partition and do not let your client machine be root.

2b) If your client machine (e.g. a personal Linux computer) is not in the DNS, then you can either provide an Internet number (I believe) or define your machine in the /etc/hosts file, e.g.

129.xx.y.z  mymachine

Then in the /etc/exports use something like

 /data mymachine(rw,sync,no_subtree_check)

or

 /data mymachine(rw,sync,no_subtree_check) mylaptop(rw,sync,no_subtree_check)

After doing so, type in the shell

exportfs -a

And check:

exportfs

3) Mount the exported directory on your client machines, i.e.

  • Create an empty directory, e.g.
mkdir /mnt/data
  • Edit file /etc/fstab on your client machine
 servermachine.x.y:/export/data /mnt/data nfs defaults 0 0
  • Then yype on your client machine:
 mount -a (on your machine)

If it doesn't work, look at the log files of the server machine. Most likely you failed to give permission. Also, you should restart the NFS daemon on the server. Type:

/etc/init.d/nfs-kernel-server restart

4) User id and group ids

If you want to write files in the server, then user and group id's must match on both machines....

Creating users

  • On your desktop machine, you can use the system menus
  • On a server, you can use useradd. Make sure that user and group id's match those of other machines in case you plan to mount partitions (e.g. a web server directory on your desktop).
useradd -ggroup_name -uNNNNN -m -p XXXXX login_name
group_name = name of primary group
NNNNN = uid number, e.g. 160001
XXXXX = password
login_name = login + home directory name, e.g. dks

If you want to add the user to other groups, use the -G flag or use usermod. E.g.

usermod -Gadmin,adm dks
will add the user dks to the adm and the admin group.
id -a [login]
will display an id of a user

Using Samba

SFTP demon

sudo apt-get install openssh-server

Read: OpenSSH server

Displays

Principles

Most Linux distribution's installer (at least the free ones) can't handle some slightly more fancy hardware automatically

Usually you have to do either of two things

  1. Configure the drivers from the ubuntu desktop (if your are lucky) and then use nvidia-settings
  2. Hand edit the /etc/X11/xorg.conf file to tweak things.

Also read:

  • Remember to save every version (preferably on an other machine or in a wiki) that worked.

Graphic drivers not working

E.g. can not display the desktop. You could try to deinstall current driver and replace by a new one. Below is for Ubuntu 16.04x (dec 2016).

CTRL-ALT F1: To get a terminal
sudo apt-get purge nvidia-*
sudo add-apt-repository ppa:graphics-drivers/ppa and then sudo apt-get update.
sudo apt-get install nvidia-370 // Make sure to take the best driver you need. Best can be the latest, but not necessarily so...

Configuration

Search System settings, then Displays. Ubuntu should autodetect your monitors. You then can change resolution, rotation and position for each.

For more advanced settings, search CompizConfig in the Dashboard, or type ccsm. You may have to install it and if you have a double monitor configuration, you must install the extras

sudo apt-get install compizconfig-settings-manager compiz-plugins-extra
ccsm &
  • Click on Window Management
  • Tick "Put" (for double monitor)

In addition you could change the hot key for switching.

... Having to install an advanced configuration tool with advanced extras is totally ridiculous. Under Windows adding a second monitor is plug and play. Under Ubuntu this takes 1 hour ore more to figure out.

Ubuntu 12.x Nvidia Quadro FX + 2 digital monitors

Recent Ubuntu editions handle Quadro cards quite well (iff and after you managed to install the system, see above). Stuff below is obsolete, though may be useful for tweaking or if you have a card that is different.

The easy way (Ubuntu 8.01 Hardy)

By Daniel K. Schneider. I had a Quadro FX 3450 card, a 24 and a 20 monitors. This is an executive summary. Find better explanation on Google or in the the Ubuntu documentation

If you have a GUI running (the default Ubuntu desktop)

  1. Menu System->Administration->Hardware drivers
  2. Enable the driver (this will download the nvidia-glx-new package
  3. Reboot

Then:

  1. Menu: System->Preferences
  2. Screen resolution (works with a 1920x1200 screen)

Then add your second monitor if you got one:

  1. Read Nvidia Multi Monitors first
  2. Install the nvidia settings tool, in a terminal type this (or get via the synaptic)
sudo apt-get nvidia-settings

Then use this tool to configure

  • Menu System->Administration->Nvidia X Server settings

I do not want the default twin view, i.e. I want to be able to switch to a different workspace in one screen and keep the current one. So I went for two different screens

  • XServer Display Configuration:
    • Click on 'configure... and select twin view
    • Than play with the options until it looks good

Hit apply and if required CTRL-ALT BACKSPACE to restart the XServer.

  • I noticed that at some point it couldn't overwrite the /etc/X11/xorg.conf file. Look at the preview and then copy paste , i.e. open an editor under root :)

Anyhow this is a start, but some manual tweaking seems to be necessary

Warning:

  • this tool will append to the current xorg file by default. I.e. you may several conflicting definitions if you don't watch out.
  • On the other hand if you don't append, your keyboard definition is gone, i.e. you have to know how to type US style. Make backups !!
  • If you can't login after a XServer restart, you simply may have a US

keyboard. Don't panic.

See below for tweaking and repairing ...

The hard way

Depending on the day (if it's rainy or sunny or the particular Ubuntu version) installing an Nvidia driver can be an absolute nightmare. If things fail, it is probably a good idea to:

  • Make a copy of your /etc/X11/xorg.conf file
  • Remove everything that has to do with Nvidia
    • E.g. even drastic and dangerous apt-get remove nvidia*
    • it also can mean to remove manually files and other stuff (see various forums)
  • Also the machine needs to completely halted at some point and be restarted in recovery mode (Hit ESC when linux starts loading)
  • Make sure you can get a terminal (local or remote)
    • Make sure you have another machine nearby, e.g. Windows with a putty (ssh client) installed.
    • Hit ctrl-alt-F5 to enter a terminal mode or see above.
    • Avoid removing power (reset) ... this can damage files, try ctrl-alt-delete first (or a halt from a remote terminal)
  • Log files
    • Look at the log files, in particular /var/log/Xorg.0.log and search for "(EE)".
    • It's likely that your keyboard won't work. E.g. if you use special characters in your password you must know the layout of the US keyboard. That can be fixed again in the xorg.conf file.
    • X also remembers stuff in your personal home directory and there are logs too.

Anyhow, if by miracle, things go well, here is the rough procedure:

(0) Make sure you got a nvidia card, type:

 lspci | grep -i nvidia

(1) You need to download the Nvidia driver.

  • Either from Nvidia. E.g. file NVIDIA-Linux-x86-1.0-9755-pkg1.run
  • Or via apt (a package manager), this is the better solution if it works:
 sudo apt-get install nvidia-glx-new

.. or maybe nvidia-glx (the older version)

(2) Save the xorg.conf file

 cp /etc/X11/xorg.conf /etc/X11/xorg.conf.save1

(3 - manual install) Install the driver (in case you got it from Nvidia only. This is not recommended !)

 sh NVIDIA-Linux-x86-1.0-9755-pkg1.run

(4) Run the X server configurator (but make sure you have a copy of your old xorg.conf file !!) nvidia-xconfig

There exist options which are described in the man page. Type

 man nvidia-xconfig

(5) The result won't do it, but it's a start. You have to hand-edit and merge information from the old xorg.conf.save1 file !!!

You also can try to install the nvidia graphics control panel

 apt-get install nvidia-settings

and run the config. utility (on the desktop as described above !)

gksu nvidia-settings

A particular nasty bug in older installation scripts (not Ubuntu 8.01 Hardy) is the name of the driver. If you use the ubuntu distribution, the driver's name may be "nv" and not nvidia. Remember this when your system wants to boot into low resolution mode.

A working configuration

Here is a configuration that works with my Graphics card and two monitors: A Dell Precision 380 with a Quadro FX 3450 card, and two DELL monitors: a 24 (1920x1200) and a 20 (1600x1200).

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 1.0  (buildmeister@builder57)  Thu Jul 17 18:39:19 PDT 2008

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
    RgbPath         "/usr/X11R6/lib/X11/rgb"
EndSection

Section "Module"
    Load           "dbe"
    Load           "extmod"
    Load           "freetype"
    Load           "glx"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
    Option         "XkbModel" "pc105"
    Option         "XkbLayout" "ch"
    Option         "XkbVariant" "fr"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    HorizSync       30.0 - 110.0
    VertRefresh     50.0 - 150.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinView" "True"
    Option         "MetaModes" "nvidia-auto-select, nvidia-auto-select"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Make sure that there are no syntax errors, and that you have and empty line at the end of this file.

Fine tuning the desktop
  • Put a panel on top of each screen (right click on the one panel you have and make a "new")
  • Right-click, select properties to define position (top,bottom, left right)
  • Do not use "Visual effects" (System->Preferences) or get sea sick !
  • Add more stuff to the panels ... and you are back to work :)

If you have dual monitor system like the one described above:

  • Right-click on an existing panel to add a new one
  • Right-click on the new panel, select properties and untick "Expand"
  • Then move the panel to the other screen, and tick "Expand again"

Each panel widget can be move to another panel (right-click->move). Then move it to the new panel.

Displaying remote programs with X11

According to this Stackexchange, If you are root on another machine and you get " X11 connection rejected because of wrong authentication." try the following (worked for me)

ssh remote_host -XY -luser
sudo su
cd
xauth merge /home/user/.Xauthority

Desktop

Change window control buttons

By default the window control buttons are to the left in Ubuntu 10.04 LTS - the Lucid Lynx - released in April 2010 (annoying for older people like me who don't want to retrain procedures for no good reason).

To fix this, i.e. move the control buttons to the right as before: Press ALT-F2 or open a terminal and type gconf-editor. Navigate to /apps/metacity/general and change the button_layout to :minimize,maximize,close (the : must be in front).

Of course, you also could specify :maximize,minimize,close ....

Hot keys for the brave

So your GUI is stuck ....

To open a console terminal (no GUI):

CTRL-ALT F1
... same for F2 to F6 (so you can have 6 different terminals)

Then you can for instance restart the Window manager:

sudo restart lightdm

To go back to the desktop:

CTRL-ALT F7

To see boot system messages

CTRL-ALT F8

To restart the X server (your GUI)

CTRL-ALT BACKSPACE

Packages

Basically, an end-user can do most of this stuff with a GUI tool, i.e. the synaptic package administrator. However it is good to know a few command line things for 2 reasons:

  • You may have damaged your desktop when trying to install a new video driver
  • It's sometimes faster. In particular when you see on some website that this and this package should be installed in this and that order ...

A list of command-line stuff (you must be root or add "sudo" in front of each). Sometimes there are equivalent commands for abt-get and aptitude. See the apt howto at Debian.

Installing packages from a package archive

To fix the ubuntu archive mirrors

(if you can, you can also do this from the desktop package manager) Edit /etc/apt/sources.list

You should at least have:

deb http://archive.ubuntu.com/ubuntu/ hardy main universe multiverse restricted
deb http://archive.ubuntu.com/ubuntu/ hardy-updates main universe multiverse restricted

... but the it's better to use a nearby mirror, e.g. for Switzerland:

deb http://mirror.switch.ch/ftp/mirror/ubuntu/  (... same for the rest ...)

To check if there are any partially installed packages. It will try to complete these installations.

 dpkg --configure -a

To find a package XXX

 aptitude search XXX
Installing
apt-get install XXX

If this fails because of dependency issues, you then can try:

apt-get -f install
Cleaning and such

To detect and fix dependency problems

 aptitude -f install

To remove packages from the local cache

 apt-get clean

To update the package list

 aptitude update

To reinstall a package XXX that seems to be broken

 apt-get --reinstall install XXX
Upgrading

To upgrade conservatively

 aptitude safe-upgrade

To upgrade with a an message showing packages

 apt-get -u upgrade

To upgrade to a new release

 apt-get -u dist-upgrade
Removing

To really remove package XXXX

 apt-get --purge remove XXXX

If a package doesn't want to go (e.g. something went wrong during install, e.g. a decompression error and a crash in the middle of the install) and an installer (or you) wants it go, look for the package in /var/lib/dpkg/status and make it install ok installed Followed by:

 apt-get remove --purge XXXX
 apt-get update
 apt-get dist-upgrade (or whatever you planned to install)

Installing deb files

Sometimes, software is distributed as package for download, i.e. a *.deb file

To install it:

 dpkg -i XXX.deb

If you run into dependency error messages you'll have to add packages (no problem) or remove packages (avoid !).

Example (for the eXe eLearning authoring system):

 dpkg -i python2.5-exe_1.04.0.3532-ubuntu1_i386.deb

will give:

 Unpacking python2.5-exe (from python2.5-exe_1.04.0.3532-ubuntu1_i386.deb) ...
 dpkg: dependency problems prevent configuration of python2.5-exe:
 python2.5-exe depends on python-zopeinterface (>= 3.0.0-6); however:
 Package python-zopeinterface is not installed.
 dpkg: error processing python2.5-exe (--install):
 dependency problems - leaving unconfigured

First thing to do is to try something like:

 apt-get install python-zopeinterface

Information about packages

xxx is the package name or package file (*.deb) name

Getting information about a package
apt-cache search xxx
apt-cache showpkg xxx
apt-cache show xxx
To find a package on your system, if you know a file name
dpkg -S xxx_file_name

or

apt-file search filename
To list all packages and search for a name.
dpkg -l | grep xxx
To extract a deb file without really installing it
dpkg --unpack xxx.deb
To list the contents of a package file
dpkg -c xxx.deb

Holding packages

In theory:

apt-make hold packagename

However, this doesn't seem to work as expected, i.e. Ubuntu will try to update dependencies of a package that you not want to upgrade. For exemple if your package uses and old Java, it will try to update it, although it is gone from the repository.

Edit file /var/lib/dpkg/status

  • Remove unwanted old packages from Dependencies:

Boot files

List all installed images:

 dpkg -l linux-image-\* | grep ^ii

If the following does not work (e.g. because the file partition is full):

sudo apt-get purge linux-image-3.2.0-55

try:

sudo dpkg --purge linux-image-3.2.0-55-generic
... etc.

Then, in order to complete a previous failed installation:

sudo apt-get -f install

Finally, now clean a whole lot of other old ones, eg.

sudo apt-get purge linux-image-3.2.0-58 linux-image-3.2.0-59 linux-image-3.2.0-60 linux-image-3.2.0-61

And remove other stuff you don't need

sudo apt-get autoremove

Printers

Printers don't necessarily work automatically either:

A good bet is to use this application:

Before you do so, it is like that you need a a PPD file (a file that defines properties of your postscript printer). Get it from:

Example Infotec

Example for Infotec ISC 1032 (A low end color copy and printer machine)

X Windows

We run a few sun servers and I prefer to run emacs (GUI) on a remote machine instead of mounting all these file systems. Also I prefer to have a root terminal open instead of typing 'sudo' all the time. If you want allow for this:

Reconfigure the window manager (gdm)
  • Edit /etc/gdm/gdm.conf and change:

DisallowTCP=true

  • Then, you'll need to restart your X session (Ctrl + Alt + Backspace)
Allow remote hosts to connect
  • Then you can allow certain hosts to connect e.g. to allow root on your own machine type
xhost + localhost
  • To allow somebody on a different machine, type:
xhost + xxx.yyy.zzz
  • It's important not to to type 'xhost +'. Since anyone may then connect to your screen. However, type xhost + something is boring, so it's more practical to edit /etc/X0.hosts. Just put the names or IP numbers of authorized machines there.
If it doesn't work

You can install nmap to scan ports (X is on 6000).

  • If you don't have nmap:
sudo apt-get install nmap
  • Then type (as user):
nmap -v -A localhost

In some cases you may have to define the display of your machine on your client machine. On your client machine type something like:

export DISPLAY=xxx.yyy.zzz:0

or

setenv DISPLAY xxx.yyy.zzz:0

Or more practical, log into the the client machine like this:

ssh -XY

Java

By default Ubuntu comes with some Java compatible version that is free. For some applications though, you need Java 7 or 8 from Oracle (Java formerly was made by Sun)

Java 8

(tested with Ubuntu 14.x LTS)

Read this:

Install it:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

Test it:

java -version

You should see something like

java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

Java 7 (depracated)

Read this:

Worked for me (thanx webupd8 !!!)

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

End of trace:

...
Oracle JDK 7 installed

u pdate-alternatives: using /usr/lib/jvm/java-7-oracle/jre/lib/amd64/libnpjp2.so to provide /usr/lib/mozilla/plugins/libnpjp2.so (libnpjp2.so) in auto mode.

Oracle JRE 7 browser plugin installed

java -version gives:

java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

Summary:

  • You can get Sun Java as Ubuntu package in various ways.
  • Note: If you already have a free Java installed, then you could consider making the Sun version the default (also explained in the above doc).

Sound

Sound may not work either.

  • Install all the ALSA stuff (e.g. via the synaptic package manager)
  • Then test with Menu System->Preferences-Sound
  • Then set the right default volume with Menu Applications->Sound and Video->ALSA Mixer GUID (in particular PCM ! It may be as simple as that ...)

Sound trouble ?

If sound doesn't work search the Ubuntu forums: http://ubuntuforums.org/. A particular good overview posting was:

To list you sound hardware, type:

  aplay -l

If there are none, type:

  lspci -v

... and search through the list until you find something like:

 00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 01)

This means that you do have a sound card, but that the drivers or something else is missing....

Anyhow it may take some time (between a few minutes and a few days) to find a solution. Often, the only thing you'd have to do is to add a line to /etc/modprobe.d/alsa-base (needs root permissions). I have for my DELL/Sigmatel:

 options snd-hda-intel model=ref

Then, reboot !

Note: To list all drivers on your machine, type:

lsmod

If I understand right, drivers are kernel modules.

Application hints

Rhythmbox

To edit a playlist (i.e. reorder items), there are two options

  • You can drag items up and down (untick "browse" in the View menu, if you need more space)
  • You can edit the XML (better for very large lists, maybe do a save before you do this)
.local/share/rhythmbox/playlists.xml

Also, it's a good idea to remember that you can copy this file, if you decide to re-install your machine and start with a clean/new setup

Who else has Linux nearby ?

sudo nmap -O xxx.yyy.zzz.1-255 | grep "Running: " | sort | uniq -c

Non-standard software

Some organization maintain their own Debian/Ubuntu package servers.

Mediabuntu

Read this:

Skype

E.g. to install Skype, you could

  • Add the Skype repository like this in the Synaptic Package Manager (through settings->Repositories->Third-Party Software)

deb http://download.skype.com/linux/repos/debian/ stable non-free

  • Reload or update the package information and search for "skype"
  • Install the skype package.

Google Chrome

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - 
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get install google-chrome-stable

Security

SSH Keys
Firewall

Show

 sudo ufw status
sudo ufw --help

To allow port 7777 for tcp for everyone:

sudo ufw allow 7777/tcp

To allow everything from a given IP

sudo ufw allow from ip_number_here

After that, reload the firewall:

sudo ufw reload

Opinions and alternatives

Add yours ...

DKS

  • Daniel K. Schneider uses Ubuntu since March 2007, because he got fed up with Mandriva updates not working correctly. I hate all OS's (Unix, Mac, Win) but prefer to work on Unix because it's fairly stable and appropriate for what I do. I also do have Windows machines for doing stuff that needs Win 7. (E.g. Flash, word processing with Framemaker, X3D, Games). Our servers (e.g. for this wiki) run mostly under Ubuntu too. Before we ran Solaris which is much more difficult to install and maintain but extra solid.
  • Indeed (it's now August 2007 and I went through a major upgrade) I find that Ubuntu and its packaging system is far more robust. Though I once failed with a non supported package, i.e. Cinelerra that I got from another site. It installed, but crashed on start. Have to try again at some point.
  • If your applications crash (e.g. Firefox) check your bloody RAM. It may be defective and you can loose 3 days of work trying to reinstall when there is absolutely no need. Ubuntu is solid, even if the installation can be messy !
  • I don't like the new 12.04 Desktop. Not very efficient for people who know what they are doing (see the installation notes on top)

Alternatives

  • Linux Mint, can be described as some kind of easier to use Ubuntu. There is also a Linux Mint Debian Edition that is directly based on Debian and it may be of interest to people who want to be closer to Debian. Both editions should behave in the same way. Read the Wikipedia article and Linux Mint 15 A better Ubuntu for the desktop (May 2013).
sudo add-apt-repository ppa:gwendal-lebihan-dev/cinnamon-stable
sudo apt-get update 
sudo apt-get install cinnamon

Then, log out and you will have the option to use Cinnamon. The normal Ubuntu Desktop will remain there and you can therefore switch back easily....

Links

(there are many others)

Official
Other