$Id: debian.txt 1896 2008-09-24 23:35:41Z mjs $ ## HOWTO: Find/search for packages to install $ apt-cache search ## HOWTO: Install a package $ sudo apt-get install ## HOWTO: Remove/uninstall a package $ sudo apt-get remove ## HOWTO: Update the package list Many (most?) of the operations listed here operate on the local package cache; the following instruction updates the cache. $ sudo apt-get update (Running this command may be necessary if, for example `apt-get update` complains about packages not found.) ## HOWTO: Clean the downloaded package cache All the downloaded packages are stored in `/var/cache/apt/archives`; to clean this out do: $ sudo apt-get clean ## HOWTO: Upgrade outdated packages $ sudo apt-get -u upgrade `-u` to show which packages will be upgraded, and allow you to confirm whether you want to upgrade them or not. (It seems that "upgrade" will upgrade to a new distribution.) [More information](http://www.debian.org/doc/manuals/apt-howto/ch-apt-get.en.html#s-upgrade). ## HOWTO: List outdated packages $ apt-show-versions -u Note: you may need to install the `apt-show-versions` package first. ## HOWTO: List currently-installed packages $ dpkg -l Note: if you're looking for a convenient way to backup and restore your current system, you can do: # backup $ sudo dpkg --get-selections > pkglist # restore $ sudo dpkg --set-selections < pkglist $ sudo apt-get dselect-upgrade ## HOWTO: Get information about a package The following shows brief description dependencies, version, maintainer, etc.: $ apt-cache show To see the files installed by a package, use (really slow!): $ apt-file list Note: you may need to install the "apt-file" package first! ## HOWTO: List the files installed by a package (i.e. package contents) $ apt-file list ... though this may not be up to date; update the database with: $ sudo apt-file update Note: you may need to install the `apt-file` package first! ## HOWTO: Determine package dependencies $ apt-cache depends ## HOWTO: Determine which package a particular file came from $ dpkg -S ## HOWTO: Determine which package will provide/install a particular file # substring anywhere $ apt-file search # substring in basename $ apt-file -F search # regexp anywhere $ apt-file -x search # exact basename $ apt-file -x search '\/$' Note: you may need to install the `apt-file` package first! This command takes a long time to run; the [web version](http://packages.ubuntu.com) may be faster. ## FAQ: How can I search for packages? Apart from the command-line tools, you can use: * * ## FAQ: Where's `killall`? It's in the package `psmisc`. ## FAQ: Where's `dig`? It's in the package `dnsutils`. ## FAQ: Where's `apachectl`? It's probably called `apache2ctl`. ## FAQ: How do I find out what services I'm running? (Network and non-network.) ??? ## FAQ: How do I set up a firewall? ??? Do you need to? This is supposedly much easier in 8.04, which incorporates `ufw`. ## HOWTO: Monitor network traffic $ sudo iftop As documented in the manpage, by default this will show DNS lookups--turn these off with the `-n` option, or filter them out with the "not port domain" filter. ## ERROR: "The following packages have been kept back" There's some dependency problem, or something. The [official solution](http://www.debian.org/doc/manuals/apt-howto/ch-apt-get.en.html#s-dist-upgrade) seems to be to get `apt` to try harder: $ sudo apt-get -u dist-upgrade ## HOWTO: Install Ubuntu 8.04 JeOS under VMware Fusion 1. Start the "New Virtual Machine Assistant." 1. Select "Continue without disk." 1. Select "Use operating system installation disk image." 1. Select the `jeos*.iso` image. 1. Confirm that the operating system is Linux and the version is Ubuntu. 1. Fill in your account details on the "Linux Easy Install" screen. 1. Select the "Customize Settings" button. 1. Enter a name for the virtual machine you're about to create. VMware then creates your virtual machine, and opening the settings screen for this machine. (This is a bit awkward and interrupts the flow a bit, but it otherwise works as you'd expect.) 1. In the CDs & DVDs setting, VMware has probably configured CD/DVD to be the `autoinst.iso`, and CD/DVD 2 to be the `jeos*.iso`. This appears to confuse the Ubuntu installer--it looks at the first CD/DVD drive, doesn't find the CD it was expecting, and gets insecure. Change CD/DVD to point to `jeos*.iso`, and remove `autoinst.iso`. 1. If appropriate, make changes on the "Hard Disks" (20GB is the default) and "Processors & RAM" (512MB is the default) screens. 1. Start the virtual machine from the "Virtual Machine Library" window. (You're effectively out of the Virtual Machine Assistant now.) 1. The virtual machine will probably boot into the graphical Ubuntu installer. On my system, selecting a language and then "Install Ubuntu JeOS" causes VMware to crash. Starting it up again causes the Ubuntu installer to continue in text mode, and everything works from there on. However, if you want to avoid the crash, select a language, hit F4 (Fn-F4 on Macs), choose "Install a command-line system", and then choose "Install Ubuntu JeOS." (Note that for some reason you can't hit F4 of the choose-a-language screen.) 1. Continue through the (text mode) installer as usual. Note that if you want to be offered United Kingdom time zones you need to choose "United Kingdom" for your language. 1. Once Ubuntu is installed, install the VMware tools to enable drive sharing and some other features. First select Virtual Machine | Install VMware Tools to make a virtual CD available (equivalent to placing in a drive), then: $ mount /dev/cdrom /cdrom $ cd /tmp $ tar xfz /cdrom/VMwareTools* $ sudo /tmp/vmware-tools-distrib/vmware-install.pl If the VMware Tools are installed successfully, you should have a directory in `/mnt/hgfs` that contains whatever drives you've configured to be shared. (Use the virtual machine's "Settings" screen to dynamically add/remove/rename shared directories.) 1. Unfortunately, for some reason it's set up to be owned by the user with id 501; you'll probably want to change this so that it's owned by your user. To do this, first run `id`: $ id uid=1000(mjs) gid=1000(mjs) groups=4(adm),20(dialout),24(cdrom),25(floppy),29(audio),30(dip),44(vide o),46(plugdev),107(lpadmin),108(admin),1000(mjs) Then edit `/etc/fstab` and change the line: # Beginning of the block added by the VMware software .host:/ /mnt/hgfs vmhgfs defaults,ttl=5 0 0 # End of the block added by the VMware software to # Beginning of the block added by the VMware software .host:/ /mnt/hgfs vmhgfs defaults,ttl=5,uid=1000,gid=1000 0 0 # End of the block added by the VMware software Where the values for `uid` and `gid` come from the output of the `id` command as above. Remount `/mnt/hgfs`: $ sudo umount /mnt/hgfs $ sudo mount /mnt/hgfs 1. Update the package list: $ sudo apt-get update 1. Install `openssh`: $ sudo apt-get install openssh-server 1. Get the IP address of the Virtual Machine: $ ifconfig 1. Logout, then remotely login (the local terminal probably easier to use than VMware's). 1. Install some useful packages: sudo apt-get install openssh-server sudo apt-get install subversion sudo apt-get install build-essential sudo apt-get install autoconf sudo apt-get install htop sudo apt-get install iftop sudo apt-get install jed sudo apt-get install telnet sudo apt-get install xsltproc sudo apt-get install mysql-server-5.0 sudo apt-get install apache2-mpm-worker sudo apt-get install libapache2-mod-fastcgi sudo apt-get install cronolog apt-get install linux-headers-$(uname -r) # headers for existing kernel build 1. Configure apache: sudo a2enmod rewrite sudo a2enmod actions sudo a2enmod deflate sudo a2enmod headers sudo a2dissite 000-default $ sudo cat > /etc/apache2/sites-enabled/000-init # Enable virtual hosts. NameVirtualHost * # To eliminate the "apache2: Could not reliably determine the server's # fully qualified domain name" error. ServerName beebo.local # Create a stub server to handle server-status. # # ServerName localhost # ServerAlias 127.0.0.1 # sudo /etc/init.d/apache2 reload 1. Configure MySQL to allow "remote" access from the virtual machine's host. MySQL configuration is, as usual, stupid. The first thing you need to do is edit `/etc/mysql/my.cnf` and comment out the line that reads: bind-address = 127.0.0.1 This makes it possible to connect from hosts other than localhost (like the virtual machine host). However, at this point no user (not even root) has permission to connect remotely, and--seemingly as an optimisation--if you attempt to connect remotely (even telnetting directly to the port), you get an error immediately (i.e. before you get the chance to enter a username), because MySQL knows that there's no possible user that can successfully connect: $ telnet syd.local 3306 Trying 172.16.88.129... Connected to syd.local. Escape character is '^]'. DHost '172.16.88.1' is not allowed to connect to this MySQL server Connection closed by foreign host. (Note that this happens before you get the chance to provide a username.) To fix this, you need to give `root` remote access. Enter, from the virtual machine: $ mysql -uroot Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 34 Server version: 5.0.51a-3ubuntu5.1 (Ubuntu) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; Query OK, 0 rows affected (0.00 sec) Another possible is to bootstrap yourself by using `ssh` port forwarding from the host to the MySQL running on the virtual machine, and then using the GUI tools on your local machine to create accounts: $ ssh mjs@syd.local -L 3307:localhost:3306 (At this point you should be able to connect to the MySQL running on the virtual machine using MySQL Administrator pointed at 127.0.0.1 (*not* `localhost`!), port 3307. Give `root` permission to access MySQL from `%`, and while you're there, also make sure `root` has all privileges to the `mysql` table, so that it can create users while connected remotely.) ## FAQ: How can I add the "universe" and "multiverse" repositories? See [Adding the Universe and Multiverse Repositories](https://help.ubuntu.com/community/Repositories/CommandLine#Adding%20the%20Universe%20and%20Multiverse%20Repositories).