O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

Ubuntu Workshop Kit - Study Material

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
DEBIAN GNU/LINUX
Debian is a computer operating system composed of software packages released as free and open source soft...
The Ubuntu project is entirely committed to the principles of free software development; people are encouraged to
use free...
Click Forward.

WARNING: Installing Ubuntu on your entire hard disk will erase all data that is currently on the drive.

O...
Anúncio
Anúncio
Anúncio
Anúncio
Carregando em…3
×

Confira estes a seguir

1 de 22 Anúncio

Ubuntu Workshop Kit - Study Material

Baixar para ler offline

Along with our knowledge intensive Linux/Fedora/Ubuntu seminars and workshops, we provide workshop kits to all the participants.

This PDF is a part of the workshop kit. Using this study material, students can jump into the world of Ubuntu.

Along with our knowledge intensive Linux/Fedora/Ubuntu seminars and workshops, we provide workshop kits to all the participants.

This PDF is a part of the workshop kit. Using this study material, students can jump into the world of Ubuntu.

Anúncio
Anúncio

Mais Conteúdo rRelacionado

Diapositivos para si (18)

Anúncio

Semelhante a Ubuntu Workshop Kit - Study Material (20)

Mais de NAILBITER (20)

Anúncio

Mais recentes (20)

Ubuntu Workshop Kit - Study Material

  1. 1. DEBIAN GNU/LINUX Debian is a computer operating system composed of software packages released as free and open source software under primarily the GNU General Public License along with other free software licenses. Debian GNU/Linux, which includes the GNU OS tools and Linux kernel, is a popular and influential Linux distribution. It is distributed with access to repositories containing thousands of software packages ready for installation and use. Debian is known for relatively strict adherence to the Unix and free software philosophies as well as using collaborative software development and testing processes. Debian can be used as a desktop as well as server operating system. It focuses on stability and security and is used as a base for many other distributions. Debian Organization The Debian Project is governed by the Debian Constitution and the Social Contract which set out the governance structure of the project as well as explicitly stating that the goal of the project is the development of a free operating system. Debian is developed by over three thousand volunteers from around the world and supported by donations through several non-profit organizations around the world. Most important of these is Software in the Public Interest, the owner of the Debian trademark and umbrella organization for various other community free software projects. UBUNTU Ubuntu is a computer operating system based on the Debian GNU/Linux distribution and distributed as free and open source software. It is named after the Southern African philosophy of Ubuntu ("humanity towards others"). Ubuntu is designed primarily for use on personal computers, although a server edition also exists. Ubuntu holds an estimated global usage of more than 12 million desktop users, making it the most popular desktop Linux distribution with about 50% of Linux desktop marketshare. It is fourth most popular on web servers,[12] and its popularity is increasing rapidly. Ubuntu is sponsored by the UK-based company Canonical Ltd., owned by South African entrepreneur Mark Shuttleworth. Canonical generates revenue by selling technical support and services related to Ubuntu, while the operating system itself is entirely free of charge. Ubuntu Workshop – iWillStudy.com Page 1
  2. 2. The Ubuntu project is entirely committed to the principles of free software development; people are encouraged to use free software, improve it, and pass it on. To Install Ubuntu Ubuntu can be installed with the graphical CD. Make sure that your computer is set to boot from a CD before a hard drive. 1. Insert the Ubuntu disc into your CD drive. 2. Start or restart your computer. The Language screen appears. 3. Select your desired language and click Install Ubuntu 10.04 LTS. The Where are you? window appears. 4. Select the location closest to your location and click Forward. The Keyboard layout window appears. 5. If the Suggested option is not correct, select the correct keyboard layout. Click Forward. The Allocate drive spacewindow appears. 6. If you want to install Ubuntu over your entire hard drive, then Select Erase disk and install Ubuntu and select the hard drive that you want to install Ubuntu. Ubuntu Workshop – iWillStudy.com Page 2
  3. 3. Click Forward. WARNING: Installing Ubuntu on your entire hard disk will erase all data that is currently on the drive. OR 6. If you want to install Ubuntu on a single partition Dual Booting, Select Guided – resize. In the New partition size area, drag the area between the two partitions to create your desired partition sizes. Click Forward. 7. The Who are you? window appears. 8. Enter the requested information, and click Forward. The Ready to install window appears. 9. Verify that the language, layout, location, and personal information are correct and click Install. The installation wizard begins. 10. When the installation wizard finishes, the Installation complete window appears. 11. Click Restart now to restart your computer. Ubuntu is now installed. Installation Introduction Installing software in Ubuntu is easy, and this guide will show you how to do it. By default, many useful programs are already installed when you put Ubuntu onto your computer. However, you may need a particular piece of software that serves a purpose not served by the default applications. You might just want to try an alternative program to one which is already installed. In other words, you need new software. Packages and Package Management This section covers the basic concepts of packages and package management. You will learn about what a package is, the differences between different types of package and also how package management works on Ubuntu. Ubuntu Workshop – iWillStudy.com Page 3
  4. 4. What is a package? Software is a very broad term, and is generally taken to mean a program which you can run on your computer. However, such programs often need other resources to work. When you install software, thousands of files may be required just to let the program start! When you think that they all have to be put in exactly the right location, and some of those files may need to be changed depending on what type of computer you have, it can all get very complicated. Luckily, Ubuntu can look after this complexity. Source or Binary? Normally, when someone makes a package for a program, they put all of the source code for the program into that package. Source code is written by programmers and is essentially a list of instructions to a computer which humans are able to read and write. Computers can only understand this code if it is interpreted for them into a form that they can use directly. One such way of interpreting source code for a computer is by translating or compiling it into binary, which computers can understand. Source packages are simply packages which just include source code, and can generally be used on any type of machine if the code is compiled in the right way. Binary packages are ones which have been made specifically for one type of computer, or architecture. Ubuntu supports the x86 (i386 or i686), AMD64 and PPC architectures. The correct binary packages will be used automatically, so you don't have to worry about picking the right ones. To find out which one you are using, open Applications → Accessories → Terminal, typeuname -m then hit the enter key. Package Dependencies Programs often use some of the same files as each other. Rather than putting these files into each package, a separate package can be installed to provide them for all of the programs that need them. So, to install a program which needs one of these files, the package containing those files must also be installed. When a package depends on another in this way, it is known as apackage dependency. By specifying dependencies, packages can be made smaller and simpler, and duplicates of files and programs are mostly removed. When you install a program, its dependencies must be installed at the same time. Usually, most of the required dependencies will already be installed, but a few extras may be needed, too. So, when you install a package, don't be surprised if several other packages are installed too - these are just dependencies which are needed for your chosen package to function properly. An example of dependencies Ubuntu Workshop – iWillStudy.com Page 4
  5. 5. Package Managers A package manager is an application which handles the downloading and installation of packages. Ubuntu includes a few package managers by default, and which one you use depends on how advanced the package management tasks are that you want to achieve. Most people will only need to use the most basic package manager, the Add/Remove tool, which is very easy to use. Software Channels/Repositories Where can you get packages from? Ubuntu stores all of its packages in locations called software channels or repositories. A software channel is simply a location which holds packages of similar types, which can be downloaded and installed using a package manager. A package manager will store an index of all of the packages available from a software channel. Sometimes it will 're-build' this index to make sure that it is up to date and knows which packages have been upgraded or added into the channel since it last checked. There are four Ubuntu software channels for each architecture - Main, Restricted, Universe and Multiverse. Each has a different purpose. By default, only packages from Main and Restricted can be installed. Installing a Package This section explains how to install packages using the various tools available in Ubuntu,Xubuntu,Edubuntu and Kubuntu. Via your web browser In the Ubuntu Documentation, you will sometimes find sentences like for example: " To install this software in Ubuntu, install the following package: supertux. " Click on the name of the package ("supertux" in the example):  if the apturl protocol is enabled on your computer, you will be proposed to install the package called "supertux". Via a basic graphical method Note that some packages can't be installed via this method, in this case please use another method. for Ubuntu: "Sofware Centre " In recent versions of Ubuntu, the "Add/Remove" option in the Applications menu has been replaced by the Ubuntu Software Center. for Kubuntu : "Add/Remove Programs" Kubuntu's new and easy method of installing packages is to use the 'Add/Remove Programs' tool. Click K- Menu → Add/Remove Programs to start it. Ubuntu Workshop – iWillStudy.com Page 5
  6. 6. Add/Remove Programs is a simple graphical way of installing and removing applications in Kubuntu. To launch Add/Remove Programs, choose K Menu → Add/Remove Programs from the desktop menu system. To install new applications select the category on the left, then check the box of the application you want to install. When finished click Apply, then your chosen programs will be downloaded and installed automatically, as well as installing any additional applications that are required. The default selection is restricted to KDE suite, but GNOME applications can be installed simply by selecting from dropdown menu at the top. Alternatively, if you know the name of the program you want, use the Search tool at the top. Software from additional repositories may be installed by enabling the Show: Unsupported and Show: proprietary softwarecheckboxes if they are enabled in your repository list. Once this has finished, click Close.Your new programs are installed, ready to use! Via an advanced graphical method for Ubuntu/Xubuntu/Edubuntu : Synaptic The Synaptic Package Manager offers a more advanced way of installing packages. If you have problems finding a suitable package with the Add/Remove tool, try using the search in Synaptic. This searches all of the packages in the available repositories, even the ones which don't contain programs. Via a Text Based Methods Text based methods can be used across Ubuntu, Kubuntu and Xubuntu, but require familiarity with the terminal. When helping users to install packages, you should consider using an AptURL instead of apt-get or aptitude. Ubuntu Workshop – iWillStudy.com Page 6
  7. 7. Aptitude - the text-based method Aptitude is a text-based package manager, which must be run from a Terminal. apt-get - the technical method The apt-get program is a command-line package manager, which should be used if the Add/Remove tool and Synaptic ever run into problems. It provides an advanced interface to APT, the underlying package management system which Ubuntu uses, but is reasonably easy to operate. Power users may find that apt-get is quicker to use and more powerful than the graphical options above. Installing downloaded packages You may wish to install a package you have downloaded from a website, rather than from a software repository. These packages are called .deb files. Because they may have been created for a different Linux distribution, you might find that there's dependency issues with Ubuntu, meaning that they may be uninstallable. To find a package which you have previously downloaded using Synaptic, aptitude or apt-get, look in /var/cache/apt/archives Using GDebi to install packages GDebi is a graphical application used to install .deb packages. It automatically checks packages for their dependencies and will try to download them from the Ubuntu software repositories if possible. You may first need to install GDebi - simply install thegdebi package using one of the package managers listed above, or open a Terminal and type sudo apt-get install gdebi. Once you have installed GDebi, use the File Browser to find the package you wish to install. Package files will look similar to this: Ubuntu Workshop – iWillStudy.com Page 7
  8. 8. Double-click the package to open it with GDebi. If all dependencies have been met for the selected package, simply click the 'Install package' button to install it. GDebi will warn you if there are unmet dependencies, which means that there's dependencies that aren't resolved in the repositories that you're using. Using dpkg to install packages dpkg is a command-line tool used to install packages. To install a package with dpkg, open a Terminal and type the following: cd directory sudo dpkg -i package_name.deb Note: replace directory with the directory in which the package is stored and package_name with the filename of the package. It is recommended that you read the dpkg manual page before using dpkg, as improper use may break the package management database. To view the manual page for dpkg, open a Terminal and type man dpkg. Getting a list of recently installed packages You can also use the dpkg logs to discover recently installed packages; this is handy if you want to roll back some recent installations to a previous system state. zcat -f /var/log/dpkg.log* | grep " install " | sort Automatic updates: Update Manager Ubuntu will automatically notify you when security updates and software upgrades are available. The Ubuntu Update Manager is a simple and easy to use application that helps users to keep their system software updated. Simply click the update icon (which will appear in the notification area), type in your super-user/administrator password and follow the instructions on-screen to download and install the updates. Keeping up to date is important, as security fixes which protect your computer from harm are delivered in this way. Installing packages without an Internet connection Sometimes, an internet connection is unavailable to install programs. Here are the methods proposed by the official Ubuntu documentation: https://help.ubuntu.com/8.04/add-applications/C/offline.html Ubuntu Workshop – iWillStudy.com Page 8
  9. 9. But it is also possible to do it without CDs or DVDs, using a simple USB key for example to transfer only the packages you need.Here are two methods to do this: Use Keryx Keryx is a portable, cross-platform package manager for APT-based (Ubuntu, Debian) systems. It provides a graphical interface for gathering updates, packages, and dependencies for offline computers. Keryx is free and open source. You can get Keryx here: http://keryxproject.org/ Use the Synaptic package download script Short instructions:  Launch Synaptic on the offline computer  Mark the packages you wish to install  Select File->Generate package download script  Save the script to your USB key  Take the USB key to an online Linux computer and run the script there from the USB key. It will download only the packages required by the offline computer to the USB key.  Insert the USB key into the offline computer  Launch Synaptic and click on File->Add downloaded packages  Select the directory on your USB key containing the downloaded *.deb files and press Open. The packages will be installed. Note: If you don't have access to a PC with GNU/Linux or emulating/virtualizing GNU/Linux (Cygwin, VMware, VirtualBox, Qemu, etc), just open the script with a text editor and enter all the URLs you see in your browser to download the corresponding packages. If you have all the necessary libraries and/or dependencies, the simplest way is of course to just download the .deb package you need, just as you would with a Windows installer, and double-click the package to install it with GDebi. All Ubuntu packages are available on http://packages.ubuntu.com/ and http://www.debian.org/distrib/packages . Offline apt-get update If you can't even select the packages on your offline PC because you can't add the repository / update the package info, try this:AptGet/Offline/Repository Basically, it consists in creating your own local repository, except that it won't contain the packages themselves, only the dependency information. The solution is to post-process the script by replacing the URLs with the correct one. Assuming you created the local repository at "/home/username/repository" and got the different files from "http://archive.ubuntu.com/ubuntu/", this can easily be done with the following command: sed 's#file:///home/username/repository#http://archive.ubuntu.com/ubuntu#' download_script.sh > download_script2.sh chmod +x download_script2.sh or directly without creating a second script: sed -i 's#file:///home/username/repository#http://archive.ubuntu.com/ubuntu#' download_script.sh Ubuntu Workshop – iWillStudy.com Page 9
  10. 10. or simply with any text editor featuring search&replace. Use apt-offline apt-offline allows you to easily upgrade or install new packages on your offline PC, by using another online PC. sudo apt-get install apt-offline Upgrading 1. On the offline PC: sudo apt-offline set /tmp/apt-offline.sig 2. On the online PC: sudo apt-offline get C:apt-offline.sig --bug-reports --threads 5 3. On the offline PC: sudo apt-offline install /media/USB/apt-offline.zip Installing 1. On the offline PC: sudo apt-offline set abuse-offline.sig --install-packages abuse --src-build-dep -- install-src-packages abuse 2. On the online PC: sudo apt-offline get abuse-offline.sig --no-checksum --bundle abuse-offline.zip 3. On the offline PC: sudo apt-offline install /media/USB/abuse-offline.zip Ubuntu Workshop – iWillStudy.com Page 10
  11. 11. Why use the command-line? "Under Linux there are GUIs (graphical user interfaces), where you can point and click and drag, and hopefully get work done without first reading lots of documentation. The traditional Unix environment is a CLI (command line interface), where you type commands to tell the computer what to do. That is faster and more powerful, but requires finding out what the commands are." -- from man intro(1) There are many varieties of Linux, but almost all of them use similar commands that can be entered from a command-line interface terminal. There are also many graphical user interfaces (GUIs), but each of them works differently and there is little standardization between them. Experienced users who work with many different Linux distributions therefore find it easier to learn commands that can be used in all varieties of Ubuntu and, indeed, in other Linux distributions as well. For the novice, commands-line interface commands can appear daunting: sudo gobbledegook blah_blah -w -t -h --long-switch aWkward/ComBinationOf/mixedCase/underscores_strokes/and.dots However, it is important to note that even experienced users often cut and paste commands (from a guide or manual) into the command-line terminal; they do not memorize them. It is important, of course, to know how to use the command-line terminal - and anyone who can manage typing, backspacing, and cutting and pasting can manage the command-line terminal (it is not more difficult than that). This page will outline a few crafty shortcuts which can make using a command-line interface easier. Using this page  All command names will be in bold.  Commands needing to be typed will be in "bold with quotes".  All of the commands on this page are to be issued from a command prompt in a terminal.  Note that the terminal is case sensitive. User, user, and USER are all different to Linux. Starting a Terminal In Unity Unity is the default Desktop Environment used in 11.04. The easiest way to open the Terminal is to use the 'search' function on the dash. Or you can click on the 'More Apps' button, click on the 'See more results' by the installed section, and find it in that list of applications. A third way, available after you click on the 'More Apps' button, is to go to the search bar, and see that the far right end of it says 'All Applications'. You then click on that, and you'll see the full list. Then you can go to Accessories > Terminal after that. So, the methods in Unity are: Dash -> Search for Terminal Dash -> More Apps -> 'See More Results' -> Terminal Dash -> More Apps -> Accessories -> Terminal Ubuntu Workshop – iWillStudy.com Page 11
  12. 12. Keyboard Shortcut: Ctl + Alt + T In Gnome Gnome is the Classic Desktop Environment for Ubuntu 11.04 (Natty) and is the default DE in earlier releases, such as Ubuntu 10.04 LTS (Lucid). Applications menu -> Accessories -> Terminal. In Xfce (Xubuntu) Applications menu -> System -> Terminal. In KDE (Kubuntu) KMenu -> System -> Terminal Program (Konsole). In LXDE (Lubuntu) Menu -> Accessories -> LXTerminal. Commands sudo: Executing Commands with Elevated Privileges  Most of the following commands will need to be prefaced with the sudo command. This elevates privileges to the root-user administrative level temporarily, which is necessary when working with directories or files not owned by your user account. When using sudo you will be prompted for your password. Only users with sudo (administrative) privileges will be able to use this command. File & Directory Commands  The tilde (~) symbol stands for your home directory. If you are user, then the tilde (~) stands for /home/user  pwd: The pwd command will allow you to know in which directory you're located (pwd stands for "print working directory"). Example: "pwd" in the Desktop directory will show "~/Desktop". Note that the Gnome Terminal also displays this information in the title bar of its window. A useful gnemonic is "present working directory."  ls: The ls command will show you ('list') the files in your current directory. Used with certain options, you can see sizes of files, when files were made, and permissions of files. Example: "ls ~" will show you the files that are in your home directory.  cd: The cd command will allow you to change directories. When you open a terminal you will be in your home directory. To move around the file system you will use cd. Examples: o To navigate into the root directory, use "cd /" o To navigate to your home directory, use "cd" or "cd ~" o To navigate up one directory level, use "cd .." o To navigate to the previous directory (or back), use "cd -" o To navigate through multiple levels of directory at once, specify the full directory path that you want to go to. For example, use, "cd /var/www" to go directly to the /www subdirectory of /var/. As another example, "cd ~/Desktop"will move you to the Desktop subdirectory inside your home directory.  cp: The cp command will make a copy of a file for you. Example: "cp file foo" will make an exact copy of "file" and name it "foo", but the file "file" will still be there. If you are copying a directory, you must use "cp -r directory foo" (copy recursively). (To understand what "recursively" means, think of it this way: to copy the directory and all its files and subdirectories and all their files and subdirectories of the subdirectories and all their files, and on and on, "recursively") Ubuntu Workshop – iWillStudy.com Page 12
  13. 13.  mv: The mv command will move a file to a different location or will rename a file. Examples are as follows: "mv file foo" will rename the file "file" to "foo". "mv foo ~/Desktop" will move the file "foo" to your Desktop directory but will not rename it. You must specify a new file name to rename a file. o To save on typing, you can substitute '~' in place of the home directory. o Note that if you are using mv with sudo you can use the ~ shortcut, because the terminal expands the ~ to your home directory. However, when you open a root shell with sudo - i or sudo -s, ~ will refer to the root account's home directory, not your own.  rm: Use this command to remove or delete a file in your directory.  rmdir: The rmdir command will delete an empty directory. To delete a directory and all of its contents recursively, use rm -r instead.  mkdir: The mkdir command will allow you to create directories. Example: "mkdir music" will create a directory called "music".  man: The man command is used to show you the manual of other commands. Try "man man" to get the man page forman itself.  System Information Commands  df: The df command displays filesystem disk space usage for all mounted partitions. "df -h" is probably the most useful - it uses megabytes (M) and gigabytes (G) instead of blocks to report. (-h means "human-readable")  du: The du command displays the disk usage for a directory. It can either display the space used for all subdirectories or the total for the directory you run it on. Example: user@users-desktop:~$ du /media/floppy 1032 /media/floppy/files 1036 /media/floppy/ user@users-desktop:~$ du -sh /media/floppy 1.1M /media/floppy/  -s means "Summary" and -h means "Human Readable"  free: The free command displays the amount of free and used memory in the system. "free -m" will give the information using megabytes, which is probably most useful for current computers.  top: The top command displays information on your Linux system, running processes and system resources, including CPU, RAM & swap usage and total number of tasks being run. To exit top, press "q".  uname -a: The uname command with the -a option prints all system information, including machine name, kernel name & version, and a few other details. Most useful for checking which kernel you're using.  lsb_release -a: The lsb_release command with the -a option prints version information for the Linux release you're running, for example: user@computer:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 6.06 LTS Release: 6.06 Codename: dapper  ip addr reports on your system's network interfaces. Adding A New User  "adduser newuser" command will create a new general user called "newuser" on your system, and to assign a password for the newuser account use "passwd newuser". Options Ubuntu Workshop – iWillStudy.com Page 13
  14. 14. The default behaviour for a command may usually be modified by adding a --option to the command. The ls command for example has an -s option so that "ls -s" will include file sizes in the listing. There is also a - h option to get those sizes in a "human readable" format. Options can be grouped in clusters so "ls -sh" is exactly the same command as "ls -s -h". Most options have a long version, prefixed with two dashes instead of one, so even "ls --size --human-readable" is the same command. "Man" and getting help man command, info command and command --help are the most important tools at the command line. Nearly every command and application in Linux will have a man (manual) file, so finding them is as simple as typing "man "command"" to bring up a longer manual entry for the specified command. For example, "man mv" will bring up the mv (Move) manual. Move up and down the man file with the arrow keys, and quit back to the command prompt with "q". "man man" will bring up the manual entry for the man command, which is a good place to start! "man intro" is especially useful - it displays the "Introduction to user commands" which is a well-written, fairly brief introduction to the Linux command line. There are also info pages, which are generally more in-depth than man pages. Try "info info" for the introduction to info pages. Some software developers prefer info to man (for instance, GNU developers), so if you find a very widely used command or app that doesn't have a man page, it's worth checking for an info page. Virtually all commands understand the -h (or --help) option which will produce a short usage description of the command and it's options, then exit back to the command prompt. Try "man -h" or "man --help" to see this in action. Caveat: It's possible (but rare) that a program doesn't understand the -h option to mean help. For this reason, check for a man orinfo page first, and try the long option --help before -h. Searching for man files If you aren't sure which command or application you need to use, you can try searching the man files.  man -k foo will search the man files for foo. Try "man -k nautilus" to see how this works. o Note that this is the same as doing apropos command.  man -f foo searches only the titles of your system's man files. Try "man -f gnome", for example. o Note that this is the same as doing whatis command. Other Useful Things Prettier Manual Pages Users who have Konqueror installed will be pleased to find they can read and search man pages in a web browser context, prettified with their chosen desktop fonts and a little colour, by visiting man:/command in Konqueror's address bar. Some people might find this lightens the load if there's lots of documentation to read/search. Ubuntu Workshop – iWillStudy.com Page 14
  15. 15. Pasting in commands Often, you will be referred to instructions that require commands to be pasted into the terminal. You might be wondering why the text you've copied from a web page using ctrl+C won't paste in with ctrl+V. Surely you don't have to type in all those nasty commands and filenames? Relax. ctrl+shift+V pastes into a Gnome terminal; you can also do Middle Button Click on your mouse (both buttons simultaneously on a two-button mouse) or Right Click and select Paste from the menu. However, if you want to avoid the mouse and yet paste it, use "Shift+Insert", to paste the command. If you have to copy it from another terminal / webpage, you can use "Ctrl+Insert" to copy. Save on typing Up Scrolls through the commands you've entered previously. Arroworctrl+p Down Takes you back to a more recent command. Arroworctrl+n Enter When you have the command you want. A very useful feature. It autocompletes any commands or filenames, if there's only one Tab option, or else gives you a list of options. Searches for commands you've already typed. When you have entered a very long, complex command and need to repeat it, using this key combination and then typing a ctrl+r portion of the command will search through your command history. When you find it, simply press Enter. The history command shows a very long list of commands that you have typed. Each command is displayed next to a number. You can type !x to execute a previously typed History command from the list (replace the X with a number). If youhistory output is too long, then use history | less for a scrollable list. Change the text The mouse won't work. Use the Left/Right arrow keys to move around the line. When the cursor is where you want it in the line, typing inserts text - ie it doesn't overtype what's already there. ctrl+a or Home Moves the cursor to the start of a line. ctrl+e or End Moves the cursor to the end of a line. ctrl+b Moves to the beginning of the previous or current word. ctrl+k Deletes from the current cursor position to the end of the line. ctrl+u Deletes the whole of the current line. ctrl+w Deletes the word before the cursor. LinuxLogFiles System Logs System logs deal primarily with the functioning of the Ubuntu system, not necessarily with additional applications added by users. Examples include authorization mechanisms, system daemons, system messages, and the all- encompassing system log itself, syslog. Ubuntu Workshop – iWillStudy.com Page 15
  16. 16. Authorization Log The Authorization Log tracks usage of authorization systems, the mechanisms for authorizing users which prompt for user passwords, such as the Pluggable Authentication Module (PAM) system, the sudo command, remote logins to sshd and so on. The Authorization Log file may be accessed at /var/log/auth.log. This log is useful for learning about user logins and usage of the sudo command. Use grep to cut down on the volume. For example, to see only information in the Authorization Log pertaining to sshd logins, use this: grep sshd /var/log/auth.log | less Daemon Log A daemon is a program that runs in the background, generally without human intervention, performing some operation important to the proper running of your system. The daemon log at /var/log/daemon.log and contains information about running systemand application daemons such as the Gnome Display Manager daemon gdm, the Bluetooth HCI daemon hcid, or the MySQLdatabase daemon mysqld. This can help you trouble-shoot problems with a particular daemon. Again, use grep to find specific information, plugging in the name of the daemon you're interested in. Debug Log The debug log at /var/log/debug and provides detailed debug messages from the Ubuntu system and applications which log tosyslogd at the DEBUG level. Kernel Log The kernel log at /var/log/kern.log provides a detailed log of messages from the Ubuntu Linux kernel. These messages mayprove useful for trouble-shooting a new or custom-built kernel, for example. Kernel Ring Buffer The kernel ring buffer is not really a log file per se, but rather an area in the running kernel you can query for kernel bootupmessages via the dmesg utility. To see the messages, use this: dmesg | less Or to search for lines that mention the Plug & Play system, for example, use grep like this: dmesg | grep pnp | less By default, the system initialization script /etc/init.d/bootmisc.sh sends all bootup messages to the file /var/log/dmesg as well. You can view and search this file the usual way. Messages Log The messages log contains informational messages from applications, and system facilities, and is available at/var/log/messages. This log is useful for examining message output from applications, and system facilities which log to the syslog / sysklog daemon at the INFO level. Ubuntu Workshop – iWillStudy.com Page 16
  17. 17. System Log The system log typically contains the greatest deal of information by default about your Ubuntu system. It is located at/var/log/syslog, and may contain information other logs do not. Consult the System Log when you can't locate the desired log information in another log. Application Logs Many applications also create logs in /var/log. If you list the contents of your /var/log subdirectory, you will see familiar names, such as /var/log/apache2 representing the logs for the Apache 2 web server, or /var/log/samba, which contains the logs for the Samba server. This section of the guide introduces some specific examples of application logs, and information contained within them. Apache HTTP Server Logs The default installation for Apache2 on Ubuntu creates a log subdirectory: /var/log/apache2. Within this subdirectory are two log files with two distinct purposes:  /var/log/apache2/access.log - records of every page served and every file loaded by the web server.  /var/log/apache2/error.log - records of all error conditions reported by the HTTP server By default, every time Apache accesses a file or page, the access logs record the IP address, time and date, browseridentification string, HTTP result code and the text of the actual query, which will generally be a GET for a page view. Look at the Apache documentation for a complete rundown; quite a lot can be gleaned from this file, and indeed many statistical packages exist that perform analyses of these logs. Also, every time any error occurs, Apache adds a line to the error log. If you run PHP with error and warning messages disabled, this can be your only way to identify bugs. CUPS Print System Logs The Common Unix Printing System (CUPS) uses the default log file /var/log/cups/error_log to store informational and errormessages. If you need to solve a printing issue in Ubuntu, this log may be a good place to start. Rootkit Hunter Log The Rootkit Hunter utility (rkhunter) checks your Ubuntu system for backdoors, sniffers and rootkits, which are all signs of compromise of your system. The log rkhunter uses is located at /var/log/rkhunter.log. Samba SMB Server Logs The Server Message Block Protocol (SMB) server, Samba is popularly used for sharing files between your Ubuntu computer and other computers which support the SMB protocol. Samba keeps three distinct types of logs in the subdirectory /var/log/samba:  log.nmbd - messages related to Samba's NETBIOS over IP functionality (the network stuff)  log.smbd - messages related to Samba's SMB/CIFS functionality (the file and print sharing stuff)  log.[IP_ADDRESS] - messages related to requests for services from the IP address contained in the log file name, for example, log.192.168.1.1. Ubuntu Workshop – iWillStudy.com Page 17
  18. 18. X11 Server Log The default X11 Windowing Server in use with Ubuntu is the Xorg X11 server, and assuming your computer has only one displaydefined, it stores log messages in the file /var/log/Xorg.0.log. This log is helpful for diagnosing issues with your X11environment. GrubHowto Modifying boot options in GRUB Legacy  If you need to get into the grub menu to modify boot options or choose a different kernel, you need to press 'ESC' just after it starts.  By default you have to press 'ESC' within three seconds. If you want to increase this time limit, you can edit the grub configuration file /boot/grub/menu.lst, increasing the seconds in the TIMEOUT part. Alternatively you could have the menu always come up at boot time. To do this, comment out 'hiddenmenu' by inserting a # at the beginning of the line. If the Ubuntu installer detected other operating systems on the disk during the installation, then the grub menu will be displayed by default and the timeout will be increased, so the step above will be unnecessary.  After pressing 'ESC' you will be presented with a list of kernels and operating systems that you can boot. You can press an up or down arrow key to highlight a different kernel or operating system to boot. For example, you might need to boot into 'recovery mode' to fix some problem with your operating system. To modify the boot options within the grub menu, highlight the operating system you want to edit and press 'e'. There you will be presented with lines starting with 'root', 'kernel', 'initrd', 'quiet' and 'savedefault'. You may wish to make changes to any of these lines before booting. Boot options can be appended to the end of the 'kernel' line, Boot Parameters. To receive a more verbose boot process you can remove the 'quiet' line by highlighting it and pressing 'd' to remove that line. You may also want to highlight the 'kernel' line press 'e' to edit and remove the word 'splash' from the end of the line. After making any necessary modifications you can press 'b' to boot that operating system. These modifications will not persist across reboots. Automagic Kernels List  Ubuntu uses a script called update-grub to modify menu.lst. Whenever you install kernel updates from the repositories,update-grub is run to update the grub settings. It automatically detects all of the kernels you have in the /boot directory, and applies various global settings to each one. The relevant parts of menu.lst that update-grub looks at are the ones in between the "### BEGIN AUTOMAGIC KERNELS LIST" and "### END DEBIAN AUTOMAGIC KERNELS LIST" lines. In this section of the menu.lst file, comments are preceded by at least two '#', e.g. '## this is a comment'. Global options are after single '#', e.g. '# groot=(hd0,4)'. The most common one to change is probably the groot option. Change this if /boot resides on a different partition than /(root). See the appropriate section on this page for more information about different /boot partitions. Another common option is 'kopt=', which are kernel options applied to all kernels in the menu.lst, read the next section below. Setting kernel parameters Ubuntu Workshop – iWillStudy.com Page 18
  19. 19.  In /boot/grub/menu.lst, you will find a line like this: # kopt=root=/dev/sda1 ro This looks like a comment, but do not remove the '# ' at the beginning. THIS IS IMPORTANT: grub sees this line as a comment and ignores it, but it is used as a configuration parameter by update-grub to generate the contents of the file thatgrub will read at boot. If you require additional kernel parameters (for example, if someone has asked you to test booting with certain parameters in order to troubleshoot a problem), add them to the end of the line, for example to add noapic:# kopt=root=/dev/sda1 ro noapic After editing the file, run: sudo update-grub  Note that you can temporarily add kernel parameters at the grub boot menu also, by pressing 'e ' and editing the kernel line. If /boot is on another partition  If /boot is mounted on another partition, it will mean that your Linux kernel will be restricted to the area of your hard disk where the /boot partition is located. That is a good way to overcome GRUB Error 18 in older computers. A Separate /boot partition is also needed when the root file system will be encrypted.  If your operating system was installed that way by the Ubuntu installer then it should work perfectly without the user needing to do anything. If for some reason you need to create your own separate /boot partition at some later time after the installation of your Ubuntu operating system, you must create an entry in your /etc/fstab file for it. You will also need to edit your /boot/grub/menu.lst file with the correct partition number in the groot line, see 'Automagic Kernels List' further up in this page. If you do those two things correctly then when you use update-grub, you should never run into any problems. A Separate /boot partition is not very good for people who want to boot more than one Linux operating system because iit is tricky to get more than one Linux to share the same Separate /boot partition peacefully. For that, you need a 'Dedicated GRUB Partition', which contains only GRUB files and not necessarily any Linux kernels, and is operating system independant. Changing the Disk that Grub Legacy is installed to  Consider the following problem: You have two hard drives, one SATA (/dev/sda), the other PATA (/dev/hda). Your BIOS seems to think that PATA drives should always be booted in preference of SATA drives, but you want to boot from the SATA drive. Grub can work around this problem. Finding groot  First, figure out what Grub names the drives. This is listed in /boot/grub/device.map. There you will find a table of Grub-style names (e.g. (hd0)) and Linux-style names (e.g. /dev/hda/). You need to know what drive and partition /boot is on. To find where /boot is, use df: df /boot This should tell you the Linux-style partition name where /boot is. Then simply match it with the Grub- style name indevice.map. This is what groot should be. Example:  $ df /boot  Filesystem Size Used Avail Use% Mounted on  /dev/sda5 46M 15M 30M 33% /boot Ubuntu Workshop – iWillStudy.com Page 19
  20. 20.   $ cat /boot/grub/device.map  (hd0) /dev/hda  (hd1) /dev/sda So groot should be (hd1,4) (note that Grub partition numbers are always one less than Linux numbers). Thus in/boot/grub/menu.lst, ## default grub root device ## e.g. groot=(hd0,0) # groot=(hd1,4) Finding kernel root  The other piece of the puzzle is telling the kernel where / is. Simply find out where / is mounted. df / This is what root should be in kopt. Example:  $ df /  Filesystem Size Used Avail Use% Mounted on  /dev/sda3 14G 8.3G 5.0G 63% / / is on /dev/sda3. Because this is going to be passed to the kernel, there's no need to translate to Grub notation. The 'ro' causes the kernel to mount the drive read-only initially; later the drive will be remounted read/write. This is generally done so fsck can run on / at bootup. ## default kernel options ## default kernel options for automagic boot options ## If you want special options for specifiv kernels use kopt_x_y_z ## where x.y.z is kernel version. Minor versions can be omitted. ## e.g. kopt=root=/dev/hda1 ro # kopt=root=/dev/sda3 ro In summary, groot is where /boot is, and is what Grub sees that drive as. kopt=root is where / is, and is what the kernel sees that drive as. Boot splash images  Grub allows an image to be displayed behind the menu. You can obtain a set of images with the package "grub-splashimages", or you can make your own. The images must be 640x480 pixels, contain no more than 16 colors (but a smaller number like 12 works better to allow some different colors for the menu text), and be in gzipped xpm format. The GIMP can be used to resize (Image -> Scale Image...), reduce colors (Image -> Mode -> Indexed...), and can save to .xpm.gz files. Manual configuration  After creating a splash image, add a line like splashimage=(hd0,4)/boot/grub/splash.xpm.gz to your menu.lst file. A useful trick is to make a symlink to the actual image named splash.xpm.gz. cd /boot/grub sudo ln -s my_image.xpm.gz splash.xpm.gz Ubuntu Workshop – iWillStudy.com Page 20
  21. 21. Grub loads the image from the disk upon boot; it is not stored in the MBR. If you use a symlink, you will not have to edit menu.lst and reinstall grub to change the image, you just have to change the symlink. Make sure any symlink does not point to a file on another partition, for instance if you have /boot on a separate partition. Backup, Repairing and Reinstalling GRUB  To make a backup a copy of the existing menu.lst file use: cp /boot/grub/menu.lst /boot/grub/menu.lst.old You can try re-installing the grub using the Ubuntu Live CD, in two different ways. GUI 1. Boot your computer up with Ubuntu CD 2. Go through all the process until you reach "[!!!] Disk Partition" 3. Select Manual Partition 4. Mount your appropriate linux partions / /boot swap ..... 5. DO NOT FORMAT THEM. 6. Finish the manual partition 7. Say "Yes" when it asks you to save the changes 8. It will give you errors saying that "the system couldn't install ....." after that 9. Ignore them, keep select "continue" until you get back to the Ubuntu installation menu 10. Jump to "Install Grub ...." 11. Once it is finished, just restart your computer Command line 1. Boot your computer up with Ubuntu CD 2. Open a terminal window or switch to a tty. 3. Go SuperUser (that is, type "sudo -s"). Enter root passwords as necessary. 4. Type "grub" 5. Type "find /boot/grub/stage1". You'll get a response like "(hd0,1)". Use whatever your computer spits out for the following lines. 6. Type "root (hd0,1)", or whatever your hard disk + boot partition numbers are for Ubuntu. 7. Type "setup (hd0)", to install GRUB to MBR, or "setup (hd0,1)" or whatever your hard disk + partition nr is, to install GRUB to a partition. 8. Quit grub by typing "quit". 9. Reboot and remove the bootable CD. If you can't boot into any of your Linux OSs: First, you need to get a grub prompt (grub>) somehow. So what you can do is:  Use a rescue disk, like Super Grub Disk, from which you can boot into your OS, or press the “c” key to get a GRUB prompt.  Use your Live *ubuntu CD. Boot into the LiveCD. Now get a terminal and proceed exactly as in Case 1, starting with sudo grub to get a GRUB prompt. Note: grub is not included with 9.10 Ubuntu LiveCD Manually boot into a Linux OS  These are the same 3 methods you see in a menu.lst, except in menu.lst you have “title” lines and you don’t need the boot command (since it’s implied). Ubuntu Workshop – iWillStudy.com Page 21
  22. 22. Method #1: Chainload To chainload Linux which is on (hdx,y): grub> root (hdx,y) grub> chainloader +1 grub> boot grub> root (hdx,y), grub> setup (hdx,y) Method #2: Use the specific kernel-initrd commands (as in a full menu.lst), ending with the boot command. Method #3: Configfile This almost always works! Example: To boot into Kubuntu on sdb3 (= (hd1,2)), type grub> configfile (hd1,2)/boot/grub/menu.lst # you’ll get the boot menu on sdb3 Important Links Kernel How-To: https://help.ubuntu.com/community/Kernel?action=show&redirect=KernelHowto Install the Server Kernel: https://help.ubuntu.com/community/EnablingPAE Upgrade Kernel: https://help.ubuntu.com/community/Kernel/Upgrade?action=show&redirect=UpgradeKernel Kernel Compile: https://help.ubuntu.com/community/Kernel/Compile Linux Kernel Source: https://help.ubuntu.com/community/LinuxKernelSource Ubuntu Kernel Source: https://help.ubuntu.com/community/UbuntuKernelSource Backup Your System: https://help.ubuntu.com/community/BackupYourSystem Software Management: https://help.ubuntu.com/community/SoftwareManagement Speeding Up Ubuntu on Low-End System: https://help.ubuntu.com/community/LowEndSystemSupport Ask us any question on Ubuntu in this group, and we will make sure to reply back within 24Hours. A free service in the free world of open standards! http://www.iwillstudy.com/group/ubuntu Ubuntu Workshop – iWillStudy.com Page 22

×