Unless otherwise specified, all of these applications must be run as the root user.
The date can be used to change the date and time on your computer. The format of the command is odd, but straightforward:
date MMDDhhmmYYYY
where the letters have the following meanings:
For example, to change the date and time to 4:45pm on June 15, 2007, type
date 061516452007
If you have Internet access, you can also set the date using NTP, the Network Time Protocol. To use this you need the ntpdate package installed on your computer. This command will connect to servers on the Internet and use them to set your clock.
You may want to read the section file ownership and permissions[REF] before running the commands in this section.
To change file permissions, use the chmod command. The form of the command is:
chmod (who)(operation)(what) filename
where the arguments take on the following values:
For example, to give the owner of the file myscript.sh execute permissions, type
chmod u+x myscript.sh
To take away read, write, and execute permissions on resume.rtf for everybody except the file's owner, type
chmod go-rwx resume.rtf
To give everybody access to a public_html directory, type
chmod ugo+x public_html
or equivalently
chmod a+x public_html
A file's owner can change that file's permissions, so this command does not necessarily need to be run as root.
The root user can also change the ownership of files -- that is, the group and user associated with the file -- using the chown command:
chown user:group filename
For example, to give user linuxuser and group staff ownership of the file resume.rtf, type
chown linuxuser:staff resume.rtf
At some point, you may want to create additional user accounts on your computer. Separate user accounts allow each user to keep his or her own set of files, preferences and customizations. Note if your computer is set to login a user automatically, you may want to turn off autologins so that different users can log in to your machine. [REF turning off autologins]
The adduser command allows you to add user accounts. Here is the format:
adduser accountname
where accountname is the username of the account to create (for example, linuxuser). After running the command you will be prompted for the following information:
A password for the user. If you are having problems creating a good password, you can run the apg command to generate some possibilities. The user will need this password in order to log into the computer, so don't forget it. You will be prompted for this password twice.
A full name, such as "Charles McColm". This is optional, but it can be useful.
A room number, work phone, home phone, and "other" entry. It is acceptable to leave these blank.
Note that by default the new user will need to login using a password. If the user will never use this password (for example, if the user will always be automatically logged in) then it is safer to create an account that does not have a password. To do this, type
adduser --disabled-password username
If you use multiple user accounts on your systems, you probably want users to log in using passwords.
Your computer may be configured to automatically log in a user when it boots. Two files are used to configure this behaviour. The file /etc/wclp/autologin_user contains the name of the user account to log in automatically. The file /etc/wclp/autologin_enable controls whether autologin is activated. If you wish to turn off autologins, you can delete this file. If for some reasons autologins have been disabled and you wish to re-enable autologins, type
touch /etc/wclp/autologin_enable
to reactivate autologins.
In order to log in a different user account automatically, you need to change the contents of /etc/wclp/autologin_user .
These two files do not guarantee that graphical mode will start on bootup. If you change the autologin_user file and the user is logged into a command-line window (called the console), you need to change the autologin user's configuration. Look for a file called .bash_profile in the user's home directory. It should contain the following lines:
# WCLP addition: Try to start X if the terminal is # linux (and this is tty1?) ttytype=`tty` autologin_enable=/etc/wclp/autologin_enable is_xserver=/etc/X11/X if [[ -f $autologin_enable && $TERM == "linux" \ && $ttytype == "/dev/tty1" && -f $is_xserver ]]; then green='\[\033[32m\]' nocolour='\[\033[0m\]' echo "${green}Starting graphical mode... please wait ${nocolour}" exec startx fi
The most important line is the "exec startx" line. If that is not present, then graphical mode will not start. By adding the above code the user you chose should be able to be automatically logged in.
Note that if your system was not set up to autologin users by default, adding the /etc/wclp/autologin_enable and /etc/wclp/autologin_user files will not enable autologins. In this case, you may want to install wdm or gdm to configure automated logins. [MORE INSTRUCTIONS?]
One of the strengths of the open source movement is that a lot of software is available that you can try out for little or no cost. At some point you may find yourself needing software that is not available on your computer. If you use your computer to access the Internet, you will certainly want to keep your computer's software updated for security reasons. This section explains how the package update system on your computer works, and some of the tools you can use to install and maintain software packages on your system.
As usual, we will cover enough information to get you started. If you wish to learn more, a good document to read is the APT-HOWTO, available in the apt-howto package or on the Internet at [WHERE?].
The software installed on your computer is packaged by a Linux distribution called Debian, which is well-known for its large selection of software and powerful software management tools. Debian organizes the software it releases into packages. Each package ends with the file extension .deb, and contains some software which provides some specific functionality. Packages usually have dependencies, which means that they require other packages to work properly. Complex software packages such as Abiword have dozens of dependencies, all of which must be installed on a computer before Abiword will run. Furthermore, the packages on which Abiword depends will themselves have dependencies, which in turn will have other dependencies.
There are several relationships packages can have with each other. A package can depend on, suggest, recommend, or conflict with another package. All of these relationships are called dependencies.
In addition to dependencies, packages also have versions. Newer versions of packages generally fix bugs and add features. Often packages will depend on specific versions of other packages, which further increases the headache of dealing with package management. Downloading and installing packages manually quickly becomes painful, which is why package management systems exist.
A package management system keeps track of which packages are installed on your computer, which packages are available, and the relationships between packages, and version information about all these packages. The package management system in Debian is called APT, which stands for "A Package Tool".
Fundamental to APT is the idea of a repository. A repository stores a collection of packages which could potentially be installed on your computer. Most Debian package repositories are on the Internet, but APT supports repositories on CD-ROM, local hard drives and local networks as well.
APT keeps track of the packages offered by all the repositories listed in the /etc/apt/sources.list configuration file. It organizes information about these packages, their versions, and their dependencies. When you select a package for installation, APT checks whether all of the dependencies for that package are satisfied. If not, it will automatically select other packages to satisfy the missing dependencies until all dependencies are satisfied. You can then install the resulting set of packages with a single command, which makes trying out new software very easy.
In the open-source world, the word distribution has two meanings. A distribution refers to an organization whose job is to collect and package software that works together. Some popular Linux distributions include Debian, Red Hat/Fedora, Mandrake, Gentoo, SuSE, Arch Linux, and Slackware. A distribution also refers to the set of software packaged by a distribution.
Although in some sense WCLP is a Linux distribution, in reality the project is closely tied to the Debian distribution. We install Debian packages onto your computer, and you can install and upgrade software from Debian repositories. Learning a little bit about how the Debian project organizes its distribution will help you when you want to install new software on your system and when you want to get help.
Debian simultaneously maintains three collections of software: a "stable" distribution, a "testing" distribution, and an "unstable" distribution. Each collection has a codename, and the stable release has a version number. As of early 2005, the stable release was codenamed "woody" and versioned Debian 3.0, the testing release was codenamed "sarge", and the unstable release was (and always will be) codenamed "sid".
The Debian project works hard to ensure that the stable release has a high degree of quality: that the packages do not contain too many severe bugs, that the packages all work with each other, that security updates are available for the packages, and that the Debian installers work correctly to install the distribution. Software from the stable distribution tends to run well, but because the Debian project does not release stable distributions frequently, the software is often out of date.
The testing distribution is used to prepare the next stable release. The testing distribution offers a few guarantees about the software -- the packages should all be installable -- but the testing distribution typically contains some software with bad problems, and software in the testing distribution can change versions unexpectedly and quickly. Every so often, the Debian organization "freezes" the testing distribution, makes it stable as possible, and releases it as the new stable distribution. As of the current writing (early 2005) the Debian project is preparing to make sarge its stable release. Once it does so, woody will become unsupported, and the testing distribution will be renamed to "etch". When the Debian project decides to prepare another stable release, etch will be frozen and eventually be released as stable, and the testing distribution will get a new name.
The other distribution is the "unstable" distribution, which is where package developers release the latest versions of their packages. The unstable distribution is well-named; package versions change quickly, and sometimes installing the packages from the unstable distribution will break dependencies on your computer. The purpose of the unstable distribution is to find bugs and get the software ready to migrate to the testing distribution, although some people use the unstable distribution because it has the latest package versions.
The version of Debian used on your computer is specified by the entries in the file /etc/apt/sources.list. For example, the following lines come from the stable distribution, woody:
deb ftp://ftp.debian.org/debian/ woody main non-free contrib deb-src ftp://ftp.debian.org/debian/ stable main non-free contrib deb http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free
The first line specifies the codename of the distribution ("woody") and the second and third indicate the type of distribution ("stable"). Either format is acceptable, but we use codenames in the sources.list files that we set up.
Depending on the age of the stable distribution, you will either be running the stable or the testing distribution of Debian. When starting out with your computer, you will not want to change these lines. However, as you gain experience (or as newer versions of Debian are released), you may want to change your distribution. You will do this by changing the entries in your sources.list . For instructions on upgrading your distribution, see [WHERE?]
A package can be in one of several states on your system. The vast majority of packages are uninstalled. Some packages are installed and configured -- these are the packages that are usable on your system. A package can be installed but not configured -- in this case the package is known as half-installed, and it may or may not be usable on your system.
The APT database keeps track about packages you have installed, then removed. There are two senses in which a package can be removed. When a package has been removed, the program files are deleted but the configuration information is kept. This is useful if you later decide to reinstall the package -- since the configuration is preserved, the package will behave as if it had never been removed. A purged is one that has had both its program files and its configuration files removed from your system; it is as if you never installed the package.
Sometimes packages are broken on your system. This can happen when a package dependency is not satisfied, or when a package installation run failed for some reason. Often broken packages must be fixed before you can carry out further APT operations.
Aptitude is a package manager -- a program that allows you to browse, search through, install, upgrade and remove packages in your computer's APT database. It is interactive, but not graphical.
In this chapter we will describe how to use aptitude to manage packages on your system. Several other package managers exist for Debian. apt-get is a popular command-line package manager, and synaptic is a fully-graphical offering. You are welcome to experiment with these package managers if you wish, but we will focus on aptitude for the following reasons:
Unlike most administrative programs, you need not be the root user to use aptitude. You can start aptitude as a regular user, which is useful when you are simply browsing through the package lists. If you attempt some function that requires root privileges, you will be prompted for the root password.
To start aptitude in interactive mode, type
aptitude
The program will initialize with a Loading Cache message. Then you should see a screen similar to the following appear: [SCREENSHOT]
aptitude is a keyboard-driven program. There are a few basic keystrokes that you will want to learn:
The q key quits a view. aptitude works with the idea of views -- every time you display a new information screen (for example, when looking at a package's dependency information) aptitude opens a new view. The q key quits the latest opened view.
The moral of the story is that in order to fully-quit the program you may have to press the q key several times.
The arrow keys are used for navigation. The enter is used to select a description (but not to choose a package for installation).
The F10 key accesses the drop down menus. From these menus you can access most of the main functions in aptitude.
To undo your last action, press ctrl-u . This is very useful when you accidentally select packages for removal.
Selecting packages for installation and removal uses a funny set of keys that takes some time getting used to. The + key selects a package (and all its dependencies) for installation. The - key unselects a selected package, or selects a package (and maybe its dependencies) for removal. The = puts a package on hold -- it will stay installed or uninstalled until you specify otherwise. (This is useful when aptitude insists on removing a package you would rather keep. You can put the package on hold to tell aptitude to leave the package alone.)
The g key carries out a package installation/removal request. (The g stands for "get"). When pressing this key, a view will appear that summarizes the action you are about to take. Review this summary carefully before proceeding, and don't be afraid to opt out of the update by pressing q.
If the summary seems reasonable, press the g key a second time to initiate the action. aptitude will then do one of two things:
If you are running aptitude as the root user (or you previously typed in the root password to aptitude) then the action should proceed, installing, upgrading, and removing packages as indicated by the summary.
If you are running aptitude as a normal user, aptitude will prompt you to type the root password. If you do this successfully, you will see the summary screen again. At this point you will have to type g a third time to actually initiate the action.
The u updates package information in the local APT database. You want to do this if you have added an entry to your /etc/apt/sources.list file, or if you have APT sources on the Internet.
Updating package lists requires root privileges, so you will be prompted for the password if you have not authenticated your root privileges with aptitude yet.
You will usually want to update package information before installing and removing packages, in case package versions have changed.
The U key upgrades packages -- it tells aptitude to upgrade all the packages it can to their latest versions. Often, you will want to upgrade your packages after updating package information.
The U key does not actually upgrade the packages. It simply selects applicable packages for upgrade. To complete the upgrade you must press g (and possibly enter your root password).
Packages in aptitude are grouped into categories. Categories are nested in each other. When you have navigated to a section title, you can press Enter to open the category, revealing subcategories. Pressing [ will open the category and all of its subcategories, and pressing ] will close the category and all of its subcategories.
For example, using the arrow keys to highlight the Installed Packages category and pressing [ will show all the packages that are installed on your computer.
Package selection keys (+, -, =) also work when category titles are highlighted. Pressing a package selection key will apply that action to all packages in the category. This is usually not what you want to do, so use this feature with caution.
Highlighting a package name and pressing Enter will reveal further information about that package, including its dependencies, its size, and a long description.
One of the most useful keys is the search key, which is / . Pressing this key and then entering a word will navigate to the nearest package that contains that word. You can repeat searches by pressing the n.
Perhaps the best way to illustrate aptitude is to use it to explore some packages:
aptitude
This walk-through should give you a sense of how to use aptitude and some of its basic functions. For more information, you will want to read the manual, which can be accessed in the Help menu.
When selecting packages for installation or removal, you might inadvertantly break the package dependencies. In aptitude you will see a count of broken packages appear in the top left of the display. Package dependencies break for a number of reasons:
You want to fix broken dependencies before attempting to install or remove additional software on your system. Often aptitude will refuse to complete package installations when packages are broken.
The first step in fixing broken dependencies is to identify the broken packages. The easiest way to find broken dependencies is to go to the main view and search for them. Press the / and type
~b
to find broken packages. Looking at the package details should tell you why the package is broken. Depending on the reason, you have the following options:
[ARE THERE OTHER THINGS HERE? WHAT ABOUT PUTTING PACKAGES ON HOLD?] [SCREENSHOT]
You can run many aptitude operations from the command line, without fussing with full-screen mode. This is useful if you know exactly the names of the packages you wish to install/remove, or if you are just upgrading the packages on your machine.
Unlike interactive mode, you should be root before using aptitude to do package management from the command line.
Here are some examples that illustrate the use of aptitude on the command line. To install package jester, type
aptitude install jester
To remove package jester, type
aptitude remove jester
To update your package lists, type
aptitude update
To upgrade the packages on your system, type
aptitude upgrade
You can also search for packages in aptitude from the command line, but unless you are writing shell scripts using interactive mode is easier.
Often you will find yourself looking for software that accomplishes a particular task, but you will not know the names of software that accomplishes that task. In this section we will discuss some strategies and tools you can use to discover candidate packages.
For example, say you were looking for a spreadsheet application, but you did not know the names of any spreadsheets that run under Linux. How could you discover the names of spreadsheet packages?
A good starting point is to use the command apt-cache. This command can search through all the descriptions of all packages your APT database knows about. A good starting query to apt-cache might be:
apt-cache search spreadsheet
The "search" parameter tells apt-cache to return a listing of all the packages whose names or descriptions contain your search term. The command searches all the packages in your computer's APT package database.
Once you have found some promising package names, you can read the long descriptions by typing
apt-cache show packagename
For example, you could type
apt-cache show gnumeric
to display information about the Gnumeric package.
You can also perform these operations in aptitude. Press / to start a search, and then type a "~d" before your search term to search through the package descriptions. For example, the following search term finds a package containing the search term "spreadsheet":
~dspreadsheet
As usual, you can repeat searches by using the n key.
In addition to generic software types, you might search for the names of common data formats and competing software. For example, the following search terms can all be effective in finding spreadsheets:
apt-cache search xls
apt-cache search csv
apt-cache search excel
In aptitude, you can often explore package dependencies to turn up lists of packages that provide the same functionality. For example, the package www-browser is a virtual package. Other packages provide this virtual package if they provide a web browser. Thus, the www-browser package will reveal browser alternatives.
The packages in Debian are organized into categories. For example, the "web" section collects all programs that are Internet related. You can browse through these programs to find web browsers. Similarly, gnumeric is in the "math" section. Browsing through this section can reveal other spreadsheets.
The Internet is good way to search for package names as well. Search for the software you are looking for, and the words "linux" or "debian". For example, you might search for the terms "spreadsheet linux" or "spreadsheet debian" or "excel xls linux" to find spreadsheets.
If you find the names of spreadsheet programs that are available you can then search for their package names using apt-cache or aptitude
Sometimes people publish lists of spreadsheet alternatives. To find these lists, you might search for all the alternatives you know. For example, the search terms "linux gnumeric oleo siag" might turn up a list of Linux spreadsheet alternatives, which may include alternatives you have not listed.
One of the most important reasons to learn about package management is to install security updates -- packages which fix important security holes that others could exploit to break into your computer or worse. [REF safe_computing] The Debian project releases security updates for its distribution at <url>http://security.debian.org</url> . If you have a line similar to the following in your /etc/apt/sources.list, you are able to get security updates for your packages:
deb http://security.debian.org/ stable/updates main contrib non-free
You can fetch and install security updates by using the upgrade function of aptitude: first update the package lists, and then upgrade your packages.
If your computer has access to the Internet, you should be installing security updates frequently. Once a week is not too often, and some people check for security updates every day. Once security holes become known, it does not take long before they are used to break into computers.
The dpkg command is used to manage individual packages. Usually you will not deal with dpkg directly. Instead, you will use APT, which will fetch all the package dependencies and then use dpkg to install the individual packages on your machine. However, some programs (notably Opera) do not have associated APT repositories. In these cases you may have to download the .deb package manually and use dpkg to install it.
In order to use this method, you first need to download the package and all of its uninstalled dependencies into a directory on your computer. Then you would become the root user and type
dpkg --install *.deb
This will attempt to install all the packages at once. The dpkg command will select the packages for installation, unpack them on the hard disk, and attempt to configure them. If dependencies are missing then dpkg will fail at the configuration step. You will then need to download the dependencies, install them using dpkg and possibly execute the following command:
dpkg --configure --pending
to fix the broken packages.
This process is error-prone, and you should avoid it when you can. The case of Opera is not that bad, however, because in most cases you only need to install one package.
The dpkg command can also be used to generate a textfile listing all the installed packages on your system. To do this, type
dpkg -l
As this command generates a lot of output, you may want to pipe the command through less or redirect it to a file:
dpkg -l > /tmp/package-listing
This will generate a list that looks something like the following:
Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) ||/ Name Version Description +++-==============-==============-============================================ ii aalib1 1.4p5-13 ascii art library ii acroread 4.05-3 Adobe Acrobat Reader: Portable Document Form ii adduser 3.47 Add and remove users and groups ii anacron 2.3-6 a cron-like program that doesn't go by time ii apt 0.5.4 Advanced front-end for dpkg ii apt-utils 0.5.4 APT utility programs rc apt-zip 0.13.2 Update a non-networked computer using apt an
The first two letters indicate the install status of the package. In the above example, all of the listed packages are installed except for apt-zip which has been removed. As indicated, the remaining columns indicate the package name, the version, and the short description of the package.
You can also get a list of package selections by typing
dpkg --get-selections
This will generate simpler output:
aalib1 install acroread install adduser install anacron install apt install apt-utils install apt-zip deinstall aptitude install
This just lists the name of the package, followed by either "install" or "deinstall". The output of this command can be used to tell dpkg which packages to install on another computer using the --set-selections flag of dpkg.
If you keep your computer for long enough, you may find that your version of Debian becomes obsolete and another version is released as the stable distribution. In this case you can upgrade your system to the new distribution without having to reinstall your computer from scratch. You simply need to change your sources.list entries to reflect the new distribution, and then use aptitude to upgrade all of your packages.
Some people mix distributions on one system, but unless you learn more about APT and its tools, you should not attempt this.