Quick Guide to Ubuntu



Network-based install

From USB

  1. Google for the latest Ubuntu mini.iso
  2. Plug a USB keydrive into your workstation
  3. Format the USB drive in FAT32
  4. Download and run UNetbootin
  5. Choose Ubuntu > NetInstall
  6. Point it to where you downloaded mini.iso

From CD

Here, we'll just burn a small CD to fetch files from the Net:

  1. Download and burn mini.iso from the latest stable release (main/installer-i386/current/images/netboot/), and boot up
  2. At the prompt, type "cli"
  3. apt-get upgrade
  4. If you need to connect to the Ubuntu box from a remote host, once the base system is installed, log on with the non-admin account that you created during install, and type "sudo passwd ; su -; apt-get install openssh-server" followed by "netstat -nta" to check that SSHd is running


First, check which hardware is available through "dmesg" and "lspci -knn"

Check that this hardware has a Linux driver. If not, check that you can use NDISWrapper and the Windows driver. If still NOK, you'll have to ask if there's any way to get that hardware to work with Linux.

Once the hardware is available, run "iwconfig".







Install Lighttpd

  1. apt-get install lighttpd
  2. netstat -nat
  3. If document root (/var/www) is owned by root.root, chown www-data.www-data (that UID should be available in /etc/passwd)

Install Samba

What packages do we need?

samba - SMB/CIFS file, print, and login server for Unix

samba-common - common files used by both the Samba server and client

samba-common-bin - common files used by both the Samba server and client

samba-dbg - Samba debugging symbols

samba-doc - Samba documentation

samba-doc-pdf - Samba documentation in PDF format

smbclient - command-line SMB/CIFS clients for Unix

winbind - Samba nameservice integration server

samba-tools - Samba testing utilities

swat - Samba Web Administration Tool


  1. apt-get install samba samba-client samba-common samba-common-bin
  2. apt-get install smbfs winbind
  3. update-rc.d smbd defaults
  4. update-rc.d nmbd defaults
  5. cd /etc/samba
  6. mv smb.conf smb.conf.orig
  7. vi smb.conf

    workgroup = WORKGROUP
    netbios name = LINUX
    server string = Samba Server %v
    security = user
    ;guest account = nobody
    ; logs in /var/log/samba/
    log level = 3

    comment = Ubuntu File Server Share
    path = /var/www
    browsable = yes
    writable = yes
    nt acl support = no
    valid users = www-data
    admin users = root

    ;access will be permitted as the default guest user
    guest ok = yes
    read only = no
    create mask = 0755
    available = yes
    public = yes
  8. Add user to Samba database: smbpasswd -a www-data
  9. To list Samba users: pdbedit -w -L
  10. service nmbd restart
  11. service smbd restart (if you get "Unknown instance, try "service smbd start")
  12. c:\> net view
  13. Authenticate to list shares: net use \\linux /user:www-data
  14. net view \\linux
  15. Map a letter with "net use z: \\linux\share"


To get more detailed logs:

log level = 3

To check who is connected: smbstatus -b

To check the options used to compile Samba: smbd -b

Under Windows, to get rid of the "System error 5 has occurred. Access is denied." error when listing shares on a server, you must first authenticate against the server itself: "net use \\ubuntu /user:jdoe". Then, you can list whatever shares the server has: "net view \\ubuntu".

Installing a TFTPd server

  1. apt-get install xinetd tftpd tftp
  2. vi /etc/xinetd.d/tftp

    service tftp
    protocol = udp
    port = 69
    socket_type = dgram
    wait = yes
    user = nobody
    server = /usr/sbin/in.tftpd
    server_args = /tftpboot
    disable = no

  3. mkdir /tftpboot
  4. chmod -R 777 /tftpboot
  5. chown -R nobody /tftpboot
  6. /etc/init.d/xinetd start (or restart)
  7. netstat -nau
  8. fuser -v -n udp 69

Keeping an eye on temps

  1. apt-get install lm-sensors
  2. sensors-detect: Hit Enter to choose the default answer to each question
  3. /etc/init.d/module-init-tools restart (or "service service module-init-tools restart")
  4. sensors

Dead-simple SMTP server

Here's how to set up a really simple SMTP server so that PHP applications can send e-mail through your ISP's SMTP server. Note that I'm running PHP5 as a FastCGI process (hence, the need to restart the beast):

  1. apt-get install nullmailer
  2. Leave hostname as-is, but do type the address of your ISP SMTP server, eg. smtp.isp.com
  3. vi /etc/php5/php.ini:

    [mail function]
    #-f = From
    sendmail_path = sendmail -t -i -fme@isp.com

  4. /etc/init.d/php5 restart
  5. vi /var/www/mail.php


    try {
            mail('you@acme.com', 'the subject', 'the message', null,'-fme@isp.com');
            print "Sent!";
    } catch (Exception $e) {
        echo 'Exception :',   $e->getMessag(), "\n";;

  6. E-mails are spooled in /var/spool/nullmailer/queue/. Check for errors in /var/log/mail.err.

Package management

According to Wikipedia, "The Advanced Packaging Tool, or APT, is a free user interface that works with core libraries to handle the installation and removal of software on the Debian GNU/Linux distribution and its variants. APT simplifies the process of managing software on Unix-like computer systems by automating the retrieval, configuration and installation of software packages, either from binary files or by compiling source code. APT was originally designed as a front-end for dpkg to work with Debian's .deb packages, but it has since been modified to also work with the RPM Package Manager system via apt-rpm."

"apt-get" is recommended on Ubuntu hosts, while "aptitude" is recommended on Debian hosts. Both are front-ends to the APT package manager, but you shouldn't mix and match, as the APT database will get confused.

Updating the list of available applications in depots

apt-get update: Connects to the depots listed in /etc/apt/sources.list, and updates the local cache of applications available in the depots.

Upgrading installed applications

apt-get dist-upgrade

Note: You can also update a single package by running "apt-get install some.already.installed.package"

Checking if a given package is available in a remote repository

apt-cache search mypackage

To restrict search to package names:

aptitude search mypackage

To find the version of a package:

apt-cache -n showpkg mypackage

Check package information

apt-cache show mypackage

Checking what files are provided by a non-installed package

Note: Shows all the files that have "mypackage" name in it

apt-get install apt-file

apt-file update

apt-file show mypackage


  1. apt-get -d install mypackage
  2. dpkg -L mypackage.deb

Download package without installing it

  1. apt-get -d install mypackage
  2. ls -al /var/cache/apt/archives/ | grep mypackage

Checking all non-installed packages have "blah" in their name:

apt-cache search mypackage | grep mypackage

Checking which non-installed package provides a given file

apt-file search myfile

Extract files from .deb package file

dpkg-deb -x /var/cache/apt/archives/mypackage.deb /tmp

Checking what packages are currently installed

dpkg -l

Here's how to limit output to a given package...

dpkg -l 'libreoffice*' | grep '^ii'

...and 2) the first column:

dpkg -l 'libreoffice*' | grep '^ii' | awk '{print $2}'

Checking how must space is used by installed packages

dpkg-query -W --showformat='${Installed-Size;10}\t${Package}\n' | sort -k1,1n

Checking infos about an installed package

dpkg -L mypackage

dpkg -s mypackage

Dry-run before apt-get upgrade

apt-get upgrade --dry-run

Sorting install packages by size

  1. apt-get install debian-goodies
  2. dpigs

Removing a package

apt-get remove mypackage

Full removal: apt-get --purge remove mypackage

Making sure it's cleanly removed: aptitude purge ~c


smbpasswd vs. pdbedit?

"The two main user management tools are smbpasswd and pdbedit. The former is the original tool for setting user passwords in an smbpasswd file. During the Samba 3.0 development cycle, it was thought that this tool would be superseded by pdbedit. However, this has not yet happened, and pdbedit is considered by some as the example of how not to build a command-line interface. " (source)

Vi displays A,B,C,D when using arrow keys

apt-get install vim

How to set local time instead of UTC?

dpkg-reconfigure tzdata (curses-based application that writes the right data in /etc/timezone)

apt-get install ntpdate

ntpdate ntp.ubuntu.com (instant time sync)

apt-get install ntp (ntpd: gradual, regular time sync)

vi /etc/ntp.conf, and add servers close to you, eg. for France:

server 0.fr.pool.ntp.org
server 1.fr.pool.ntp.org
server 2.fr.pool.ntp.org
server 3.fr.pool.ntp.org

/etc/init.d/ntpd restart

How to untar a BZ2 tarball?

tar -xjvf mytar.bz2

How to prevent an application to start at boot-time?

update-rc.d -f myapp remove

How to check the version of Ubuntu I'm running?

lsb_release -a

How to check which application opened a port?

fuser -v -n udp 68

How to get a root prompt?

  1. sudo passwd root
  2. su -