BITS: Introduction to Linux -  Software installation the graphical and the command-line way
Upcoming SlideShare
Loading in...5
×
 

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

on

  • 1,597 views

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

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

See http://www.bits.vib.be/index.php?option=com_content&view=article&id=17203890%3Abioperl-additional-material&catid=84&Itemid=284

Statistics

Views

Total Views
1,597
Views on SlideShare
1,163
Embed Views
434

Actions

Likes
0
Downloads
13
Comments
0

5 Embeds 434

http://www.bits.vib.be 423
http://translate.googleusercontent.com 6
http://www.slashdocs.com 3
http://www.docseek.net 1
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

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

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