BITS: Introduction to Linux - Software installation the graphical and the command-line way


Published on

This slide is part of the BITS training session: "Introduction to linux for life sciences."


Published in: Education, Technology
1 Comment
1 Like
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

BITS: Introduction to Linux - Software installation the graphical and the command-line way

  1. 1. Dive into Linux <ul><li>Software installation the graphical way </li></ul><ul><li>Software installation the old-fashioned way </li></ul>BITS/VIB Bioinformatics Training – Oct 3, 2011 – Version 2 Joachim Jacob < [email_address] >; version 1 Luc Ducazu <>
  2. 2. Software for Linux <ul><li>There is an immense quantity of software programs available for Linux </li></ul><ul><ul><li>Server applications: </li></ul></ul><ul><ul><ul><li>Web (apache, lighttpd) </li></ul></ul></ul><ul><ul><ul><li>Mail (sendmail, postfix) </li></ul></ul></ul><ul><ul><ul><li>DNS (bind) </li></ul></ul></ul><ul><ul><li>User applications: </li></ul></ul><ul><ul><ul><li>GUIs (KDE, Gnome) </li></ul></ul></ul><ul><ul><ul><li>Office suites (OpenOffice, KOffice) </li></ul></ul></ul><ul><ul><li>Specialized applications: </li></ul></ul><ul><ul><ul><li>scientific and engineering </li></ul></ul></ul><ul><ul><ul><li>supercomputing (Beowulf) </li></ul></ul></ul>
  3. 3. Software for Linux <ul><li>Several ways exist to install software </li></ul><ul><ul><li>PREFERRED WAYS </li></ul></ul><ul><ul><li>Software center: every distribution as some kind of software manager in which you just search for software and click to install. The manager searches several URL for lists of software that can be installed. </li></ul></ul><ul><ul><li>Download from the internet: installation files can be downloaded, which are *.rpm (Fedora, openSuse, CentOS) or *.deb (Debian, Ubuntu,...) files. Just double-click and your software manager will handle it </li></ul></ul><ul><ul><li>Pro: software manager keeps track of installed softw, correct packages are installed (32 vs 64 bit, OS) </li></ul></ul>
  4. 4. Software for Linux <ul><li>Several ways exist to install software </li></ul><ul><ul><li>NOT SO PREFERRED WAYS </li></ul></ul><ul><ul><li>Compile from source: download a compressed file (.tar.gz or .tar.bz2), which contain instructions to compile (make an executable binary ) for your system </li></ul></ul><ul><ul><ul><li>Usually in the shell: ./configure ; make ; make install </li></ul></ul></ul><ul><ul><li>Download the binary : this is a 'raw' executable program. Mostly just referred to by the program name. Be extremely cautious with downloading and executing binaries </li></ul></ul><ul><ul><li>The above methods do not keep track of the software you have installed -> removal can be cumbersome. </li></ul></ul>
  5. 5. Software <ul><li>Hence, software is distributed in one of the following ways: </li></ul><ul><ul><li>Commerci a l software is usually binary only – installation instructions are provided by the vendor </li></ul></ul><ul><ul><li>Free (Open Source) Software is usually distributed in source packages (compressed tar ball, such as .tar.gz) You can </li></ul></ul><ul><ul><ul><li>Build the package yourself </li></ul></ul></ul><ul><ul><ul><li>Install a distro-specific binary package (RPM) </li></ul></ul></ul>
  6. 6. Software installation the graphical way <ul><li>As an example we are going to install 'gnome-do', a tool that enables you to 'Do things as quickly as possible (but no quicker) with your files, applications, contacts and more!' </li></ul>
  7. 7. Software installation
  8. 8. Software installation
  9. 9. Software installation
  10. 10. Dependencies <ul><li>Gnome-do is written in Mono (.Net for Linux) </li></ul><ul><li>It makes no sense to install a Mono program, without the Mono-runtime </li></ul><ul><li>The package manager is aware of the dependencies of packages, and it will automatically download the extra packages </li></ul>
  11. 11. Software installation
  12. 12. Multi-user aspects <ul><li>UNIX (and hence Linux) is a multi-user OS: multiple users can simultaneously log into a system (locally, via serial consoles, via the network, ...) </li></ul><ul><li>It is the responsibility of the OS to </li></ul><ul><ul><li>fairly share the system resources (CPU, memory, ...) </li></ul></ul><ul><ul><li>protect one user from another </li></ul></ul><ul><li>There is one user ' root ' aka the superuser that has the most privileges </li></ul><ul><li>Only 'root' is allowed to install packages, and (in Fedora) users that belong to the group wheel. </li></ul>
  13. 13. Software installation
  14. 14. Software installation
  15. 15. Test run press <win+space> and start typing “Fir”
  16. 16. Where to find software? <ul><li>In the software manager </li></ul><ul><li>Freshmeat </li></ul><ul><li>FSF/GNU </li></ul><ul><li>SourceForge </li></ul><ul><li>SAL (Scientific Applications on Linux) </li></ul><ul><li> </li></ul><ul><ul><li> </li></ul></ul>Important: 32 bit vs. 64 bit
  17. 17. Where does the software manager finds its packages? <ul><li>The Fedora project has a thriving community of packagers: </li></ul><ul><ul><li>On the installation DVD: 2.500+ packages </li></ul></ul><ul><ul><li>Available via the Internet: 22.000+ packages </li></ul></ul><ul><li>To be able to install packages from the Internet, one must: </li></ul><ul><ul><li>Enable the repository (='repo') : This contains the URL where the packages can be found </li></ul></ul><ul><ul><li>Import the repo key, this prevents hackers from distributing malicious software via the official repositories </li></ul></ul>
  18. 18. Enabling repositories
  19. 19. Enabling repositories
  20. 20. Exercise <ul><li>Graphically: Install the package 'bowtie'. Can you find it with the software manager? </li></ul><ul><li>RPM based: Install FastX toolkit. You will not find it in the software manager, but check perhaps. </li></ul>Choose 32 bit
  21. 21. Solution <ul><li>RPM based: Install FastX toolkit, using </li></ul>preferred
  22. 22. Solution
  23. 23. Solution
  24. 24. Fastx is a command-line tool So we will dive into the shell!
  25. 25. First and foremost...
  26. 26. Shell <ul><li>A shell is a program that waits for a user to enter a command and execute it </li></ul><ul><li>The shell offers far more than this: </li></ul><ul><ul><li>Command history </li></ul></ul><ul><ul><li>Scripting constructs to automate command sequences </li></ul></ul><ul><ul><li>Multiple jobs </li></ul></ul><ul><li>You get a shell when you </li></ul><ul><ul><li>Open a terminal (Applications -> System Tools -> Terminal) </li></ul></ul><ul><ul><li>Login to a system using ssh </li></ul></ul><ul><li>In Linux the most popular shell is bash (Bourne Again SHell) </li></ul>
  27. 29. You never walk alone <ul><li>A Linux system comes with batteries included: only they are called man -pages (manual) </li></ul><ul><li>If you know a program prg , you can find all the reference documentation by entering $ man prg </li></ul><ul><li>If you don't know the program, you can search the descriptions in the man-pages for relevant keywords $ apropos keyword </li></ul>
  28. 30. Man <ul><li>Interesting keys: </li></ul><ul><li> and  scroll up and down </li></ul><ul><li>PgUp previous page </li></ul><ul><li>PgDown or space next page </li></ul><ul><li>< and > begin and end of the text file </li></ul><ul><li>/ search (forward) </li></ul><ul><li>n next search hit </li></ul><ul><li>q to exit from less </li></ul><ul><li>The command man uses less under the hood to display the manual page. </li></ul>
  29. 31. Exercise <ul><li>On what day of the week were you born? </li></ul><ul><li>Translated: </li></ul><ul><ul><li>Can you display a calendar and what command would you use to do so? </li></ul></ul><ul><ul><li>What syntax are you going to use to display the calendar of the month and year you were born? </li></ul></ul>
  30. 32. Some solution <ul><li>What command would you use to display a calendar? </li></ul><ul><ul><ul><li>Look with: apropos calendar </li></ul></ul></ul><ul><ul><li>What syntax are you going to use to display the calendar of the month and year you were born? </li></ul></ul><ul><ul><ul><li>Look with: man calendar </li></ul></ul></ul>apropos calendar cal (1) - displays a calendar and the date of Easter calendar (1) - reminder service Date::Calc (3pm) - Gregorian calendar date calculations Date::Calendar (3pm) - Calendar objects for different holiday schemes Date::Calendar::Profiles (3pm) - Some sample profiles for Date::Calendar and Date::Calendar::Year Date::Calendar::Year (3pm) - Implements embedded &quot;year&quot; objects for Date::Calendar Ncal (1) - displays a calendar and the date of Easter
  31. 33. Getting formal about commands <ul><li>UNIX and Linux have many commands that perform a specific task </li></ul><ul><li>The way these commands perform their task depends on: </li></ul><ul><ul><li>specific build time options </li></ul></ul><ul><ul><li>environment variables </li></ul></ul><ul><ul><li>configuration files </li></ul></ul><ul><ul><li>command line options </li></ul></ul>
  32. 34. Commands <ul><li>To execute a command, type the name of the command at the prompt : $ ls </li></ul><ul><li>This command lists files and directories in the current working directory </li></ul><ul><li>On the file system, there exists an executable file with ' ls ' as its name. </li></ul><ul><li>Files in UNIX are case sensitive : $ LS bash: LS: command not found </li></ul>
  33. 35. Commands <ul><li>Options and arguments influence the way commands behave. They are separated from the command (and from each other) by spaces </li></ul><ul><li>Example: $ ls -l Desktop </li></ul><ul><li>Here is: </li></ul><ul><ul><li>-l : option (long list) </li></ul></ul><ul><ul><li>Desktop : program argument (list the contents of directory Desktop) </li></ul></ul>
  34. 36. Short options <ul><li>'Short' options consist of a – (single dash) immediately followed by a character (as in: no spaces) $ ls -1 </li></ul><ul><li>You can specify multiple options at the command line – the given order is seldom important $ ls -l -t $ ls -t -l </li></ul><ul><li>Multiple short options can be combined $ ls -r -l -t $ ls -rtl </li></ul>
  35. 37. Long options <ul><li>'Long' options consist of -- (two dashes) followed by the name of the option (string): $ ls -–recursive </li></ul><ul><li>Long options cannot be combined like their 'short' counterparts </li></ul>
  36. 38. Arguments <ul><li>There are two kinds of arguments: </li></ul><ul><ul><li>option arguments: </li></ul></ul><ul><ul><ul><li>the argument must follow the option </li></ul></ul></ul><ul><ul><li>$ ls -w 80 </li></ul></ul><ul><ul><ul><li>the space between option name and argument is optional </li></ul></ul></ul><ul><ul><li>$ ls –-sort=size </li></ul></ul><ul><ul><ul><li>the '=' sign is optional </li></ul></ul></ul><ul><ul><li>program arguments: $ ls *.c by convention program arguments are specified at the end of the command </li></ul></ul>
  37. 39. Arguments <ul><li>Examples $ ls -lr -w 80 /bin/*sh $ ls -rlw 80 /bin/*sh </li></ul><ul><li>$ ls -wrl 80 /bin/*sh # NOK $ ls -w80 /bin/*sh -lr </li></ul>
  38. 40. More about ls <ul><li>To show the content of a directory, you use ls ( list ) </li></ul><ul><li>Options: </li></ul><ul><ul><li>d: (for directories) – do not show the contents of the directory, but rather the directory itself </li></ul></ul><ul><ul><li>R: recursive – show the content of the subdirectories and their subdirectories, ... </li></ul></ul><ul><ul><li>r: reverse sort order </li></ul></ul><ul><ul><li>t: sort on modification time </li></ul></ul><ul><ul><li>S: sort on size </li></ul></ul>
  39. 41. Long List <ul><li>$ ls -l </li></ul><ul><li>-rwxr-xr--. 1 james users 357 Sep 5 21:36 clusterit.gz </li></ul><ul><li>Here is: - file type (ordinary file) rwxr-xr-- permissions . (indicates that there is a SELinux security context) 1 link count james owner users group 357 file size in bytes Sep 5 21:36 modification date clusterit.gz file name </li></ul><ul><li>On many distributions ll is defined as an alias for ls -l </li></ul>
  40. 42. Permissions <ul><li>$ ls -l </li></ul><ul><li>- rwxr-xr-- . 1 james users 357 Sep 5 21:36 clusterit.gz </li></ul><ul><li>Permissions come in 3 sets: </li></ul><ul><ul><li>the first set ( rwx ) applies to the owner ( james ) only </li></ul></ul><ul><ul><li>de second set ( r-x ) applies to all members of the group ( users ), except the owner ( james ) </li></ul></ul><ul><ul><li>de third set ( r-- ) applies to all other users </li></ul></ul><ul><li>User root is not restricted by permissions </li></ul>
  41. 43. File permissions <ul><li>There are 3 categories of file permissions: </li></ul><ul><ul><li>r ( read ) </li></ul></ul><ul><ul><li>w ( write ) </li></ul></ul><ul><ul><li>x ( execute ) </li></ul></ul><ul><li>To access the content of a file, you need read (r) permissions </li></ul><ul><li>To change the content of a file, you need write (w) permissions </li></ul><ul><li>To execute a file, you need execute (x) permissions </li></ul>
  42. 44. Executable files <ul><li>Whether a file is executable or not, does not depend on the file extension, but on the permissions: </li></ul><ul><ul><li>for a binary file, the execute (x) permission is sufficient </li></ul></ul><ul><ul><li>for a script (shell, Perl, …) you need both execute (x) and read (r) permissions </li></ul></ul>
  43. 45. Executable files <ul><li>Graphically: look for properties of a file (right-click, properties) </li></ul>
  44. 46. Directory permissions <ul><li>There are 3 categories of directory permissions: </li></ul><ul><ul><li>r ( read ) </li></ul></ul><ul><ul><li>w ( write ) </li></ul></ul><ul><ul><li>x ( access ) </li></ul></ul><ul><li>To read the content of a directory (eg ls ), you need read (r) permissions </li></ul><ul><li>To change the content of a directory (eg rm ), you need write (w) permissions </li></ul><ul><li>To access the inodes of the files in a directory, you need access (x) permissions </li></ul><ul><li>MORE on </li></ul>
  45. 47. Wildcards <ul><li>Wildcards are used to refer to a collection of files: </li></ul><ul><li>* all files ( except hidden files) </li></ul><ul><li>A* file names starting with A </li></ul><ul><li>*A file names ending with A </li></ul><ul><li>*A* file names containing an A anywhere </li></ul><ul><li>A? file names consisting of 2 characters, A being the first </li></ul><ul><li>[Aa]* file names starting with A or a </li></ul><ul><li>[!Aa]* file names that do not start with A or a </li></ul>
  46. 48. Hidden files <ul><li>A file whose name starts with a . ( dot ) is not shown when using ls </li></ul><ul><li>You can discover hidden files: $ ls .* $ ls -a ( all : including . and .. ) $ ls -A ( almost all : without . and ..) </li></ul>
  47. 49. Exercises <ul><li>List the contents of directory /usr/bin </li></ul><ul><li>Are there any files in this directory whose name starts with “ bo ”? </li></ul><ul><li>Show the permissions of directory /usr/bin </li></ul><ul><li>Do you understand why only user root can install software? </li></ul>
  48. 50. Solutions <ul><li>List the contents of directory /usr/bin </li></ul><ul><ul><li>$ ls /usr/bin </li></ul></ul><ul><li>Are there any files in this directory whose name starts with “ bo ”? </li></ul><ul><ul><li>$ ls /usr/bin/bo* </li></ul></ul><ul><li>Show the permissions of directory /usr/bin </li></ul><ul><ul><li>$ ls -dl /usr/bin </li></ul></ul><ul><li>Do you understand why only user root can install software? </li></ul><ul><ul><li>Nobody has write permissions to /usr/bin </li></ul></ul>
  49. 51. Command history <ul><li>BASH keeps track of the commands you type </li></ul><ul><li>Use the arrow keys  and  to navigate through the list </li></ul><ul><li>You can show a numbered list of executed command using $ history </li></ul>
  50. 52. Command history <ul><li>To execute a command again you can use: </li></ul><ul><li>$ ! nnn where nnn is the number in the history list or $ !cmd the last executed command starting with cmd </li></ul>
  51. 53. Tab expansion <ul><li>Executables and arguments are expanded using the <tab> -key: $ cd /h<tab> $ cd /home/ However $ cd /b<tab> gives you audible feedback: </li></ul><ul><ul><ul><li>there is no expansion possible </li></ul></ul></ul><ul><ul><ul><li>there is more than one way to expand </li></ul></ul></ul><ul><li>$ cd /b<tab><tab> shows suitable expansions bin/ boot/ </li></ul><ul><li>$ cd /bo<tab> $ cd /boot/ </li></ul>
  52. 54. Switch User <ul><li>To switch identity to another account, use $ su - account </li></ul><ul><li>If account is omitted, root is assumed </li></ul><ul><li>You need to enter the password of the target account , except if you are root </li></ul><ul><li>User root is able to switch to any identity, without needing a password, even if the target account has no (valid) password </li></ul>
  53. 55. Switch User <ul><li>Example: [james@volvox:~]$ whoami james [james@volvox:~]$ su - Password: [root@volvox:~]# whoami root </li></ul><ul><li>Notice that the prompt changes from $ to # This indicates that you have superpower, which is potentially dangerous </li></ul>
  54. 56. Switch User <ul><li>To execute a single command cmd as another user: $ su – account -c &quot; cmd &quot; </li></ul><ul><li>Again, if account is omitted, root is assumed </li></ul><ul><li>The quotes around cmd are needed to avoid su from confusing the arguments of cmd with its own arguments. </li></ul>
  55. 57. Switch User <ul><li>Example: [james@volvox:~]$ ls /root ls: cannot open directory /root: Permission denied [james@volvox:~]$ su - -c &quot;ls /root&quot; Password: anaconda-ks.cfg install.log.syslog ... </li></ul>
  56. 58. Yum <ul><li>YUM ( Yellow Dog Updater, Modified ) is a somewhat complex tool that allows you to maintain software packages (RPMs) on your system </li></ul><ul><li>YUM makes use of repositories on servers on the Internet: </li></ul><ul><ul><li>collection RPMs </li></ul></ul><ul><ul><li>knowledge about package inter-dependencies </li></ul></ul><ul><li>Under the hood is the command rpm </li></ul>
  57. 59. Yum repositories <ul><li>Repositories are defined in files that reside in directory /etc/yum.repos.d/ </li></ul><ul><li>Repositories are enabled by setting: enabled=1 and disabled by setting: enabled=0 for a particular repository </li></ul>
  58. 60. Yum repositories <ul><li>Repositories are defined in files that reside in directory /etc/yum.repos.d/ </li></ul><ul><li>The repository name is between brackets [Fedora] </li></ul><ul><li>Repositories are enabled by setting: enabled=1 and disabled by setting: enabled=0 for a particular repository </li></ul><ul><li>Note that baseurl and mirrorlist are used for finding a suitable repo server on the Internet </li></ul>
  59. 61. Yum - examples <ul><li>To get a list of installed packages $ yum list installed </li></ul><ul><li>To get a list of available packages $ yum list available </li></ul><ul><li>To get a list of installed packages for which updates are available $ yum list updates </li></ul><ul><li>To know which package provides a certain command (ideal for resolving dependencies) </li></ul><ul><li>$ yum whatprovides */transeq </li></ul>
  60. 62. Yum - examples <ul><li>YUM maintains a database on the local machine containing meta-information for all available packages </li></ul><ul><li>To search the database for a particular keyword # yum search keyword </li></ul><ul><li>To show a description and summary information # yum info pkg </li></ul><ul><li>To obtain dependency information # yum deplist pkg </li></ul>
  61. 63. Yum - examples <ul><li>To install a package (and its dependencies) # yum [-y] install pkg the option -y is used to run the command unattended </li></ul><ul><li>To remove a package (and its dependencies) # yum erase pkg </li></ul><ul><li>To update your entire installation # yum [-y] upgrade </li></ul>
  62. 64. Exercise <ul><li>With these exercises you will get the feeling of the command line and learn to install tools </li></ul><ul><li>Install the following package using YUM (in the listed order): yum-plugin-fastestmirror </li></ul><ul><li>Using YUM: which version of EMBOSS is available? </li></ul><ul><li>ADVANCED (compile exercise): Try to install the latest package from EMBOSS: </li></ul>
  63. 65. Solutions <ul><li>Install the following packages using YUM (in the listed order): </li></ul><ul><ul><li>Yum-plugin-fastestmirror </li></ul></ul><ul><ul><li>Answer: </li></ul></ul><ul><ul><li>$ su - </li></ul></ul><ul><ul><li># yum search fastestmirror </li></ul></ul><ul><ul><li># yum install yum-plugin-fastestmirror </li></ul></ul>
  64. 66. Solutions <ul><li>Using YUM: which version of EMBOSS is available? </li></ul><ul><ul><li>Answer: 6.3.1 </li></ul></ul><ul><ul><li>Solution: </li></ul></ul><ul><ul><li># yum info EMBOSS </li></ul></ul>
  65. 67. Solution <ul><li>.tar.gz: Try to install the latest package from EMBOSS: </li></ul><ul><ul><li>Solution: </li></ul></ul><ul><ul><li>1. Download from the website, under downloads, the EMBOSS-6.4.0.tar.gz file </li></ul></ul><ul><ul><li>2. extract by: $ su - -c “tar xvfz EMBOSS-6.4.0.tar.gz -C /opt” </li></ul></ul><ul><ul><li>3. Thing to do: always read the README or INSTALL file: $ less INSTALL </li></ul></ul><ul><ul><li>4. Resolve any dependencies with YUM </li></ul></ul>
  66. 68. Linux <ul><li>Put the fun back into computing </li></ul>