Sie sind auf Seite 1von 14

1. Discuss RPM advantages disadvantages and RPM command line.

Ans:- rpm is a powerful Package Manager, which can be used to build, install, query, verify,
update, and erase individual software packages. A package consists of an archive of files and
meta-data used to install and erase the archive files. The meta-data includes helper scripts, file
attributes, and descriptive information about the package. Packages come in two varieties:
binary packages, used to encapsulate software to be installed, and source packages, containing
the source code and recipe necessary to produce binary packages.

One of the following basic modes must be selected: Query, Verify, Signature Check,
Install/Upgrade/Freshen, Uninstall, Initialize Database, Rebuild Database, Resign, Add
Signature, Set Owners/Groups, Show Querytags, and Show Configuration.

Advantages of RPM: -
 Simplicity: RPM simplifies the task of installing software. RPM packages can be managed using
the RPM GUI interface, or via the command line.
 Upgradeability: RPM gives us the flexibility to upgrade existing packages without having to
reinstall them. You can freshen and upgrade parts, or all, of your system automatically, with the
minimum of fuss.
 Manageability: RPM makes it easy to manage software packages. It maintains a database of all
the packages installed on the system, so you know exactly what you've got installed, what version
it is, and when it was added.
 Package queries: RPM provides options to query packages for more details in different ways.
You can search the package installed on the system. You can also find out what package a file
belongs to. It helps in keeping track of all packages installed on your system.
 Uninstalling: RPM makes it easy to uninstall packages. This helps us to keep the system clean.
 System verification: RPM also provides a feature to verify packages. In case of any doubt about
file deletion, packages can be verified against the original package information using RPM. This
checks all the files on the system with the package information and verifies that the files on the
system are the same as those installed from the package originally.
 Security: RPM provides commands for the user to check the integrity of packages. Packages can
be checked using md5sum to verify that they have not been corrupted or tampered with since they
were created. RPM also provides functionality to verify a package provider's identity and
package integrity using gnupg (very handy if you're downloading sensitive material from the
Internet, as you want to be sure that you're installing what you think you're installing).
Disadvantages of RPM: -
- Dependencies can be HARD to resolve. RPMs depend, and won't install unless required RPMs
are already installed. Apt-get fixes this.
- Not optimized for your system.
- RPM is criticized for inconsistency in package names and content, which makes automatic
dependency handling difficult.
- The RPM packages created for a particular Linux distribution may not work with another
distribution due to missing dependency.
This dependency problem is termed as 'dependency hell'.

► The RPM Command Line Interface tool (RPM) provides a solution to the Package Manager's
limitations.

RPM is very versatile and can be used to manipulate packages in a great number of ways. In the
remainder of this section we'll look at some of the most common tasks you're likely to want to perform,
and consider how best to do them.

HERE wget IS PACKAG TO USE COMMAND

1. Getting detailed information about the package wget:

rpm -qi wget

2. Determining which package installed the file /usr/bin/wget:

rpm -qf /usr/bin/wget

3. Showing all the files installed by the package wget:

rpm -ql wget

4. Viewing the documentation files for the command wget:

rpm -qd wget

5. Listing all files included in the not yet installed package wget by entering the following:

rpm -qpl /mnt/iso/suse/i586/wget-1.10.2-78.i586.rpm

6. Listing all files included in the installed package wget:

rpm -ql wget

7. Verifying that a package is no longer installed by entering:

rpm -qa | grep wget


8. Seeing what has changed in the files on your hard drive since the wget RPM was
originally installed by entering the following:

rpm -V wget

9. Checking package to ensure its integrity and origin

NOTE: gpg or pgp software must be installed on your system before you use this
command)

rpm -K /mnt/iso/suse/i586/wget-1.10.2-78.i586.rpm

== Install / Uninstall / Upgrade commands

10. Installing the package wget:

rpm -ivh /mnt/iso/suse/i586/wget-1.10.2-78.i586.rpm

11. Uninstalling the package wget:

rpm -e wget

12. Upgrading the package wget:

if the package is not installed it will install it for You, like option "-ivh"

rpm -Uvh /mnt/iso/suse/i586/wget-1.10.2-78.i586.rpm

13. Extracting RPM file using rpm2cpio and cpio command

RPM content will be extracted the current directory

rpm2cpio wget-1.10.2-78.i586.rpm | cpio –idmv

Q2. Write down the various steps to install package in TAR format.

Ans-

Package Installation in TAR Format


While RPM is an excellent, feature rich, technology, it's not used universally, and you may occasionally
find yourself needing to deal with binary packages in TAR format.
A binary package is a precompiled package, and hence comes ready to install. By contrast, you may also
come across source code packages − these contain uncompiled code, and must be compiled before
installation.

A TAR file is an archive file created using the TAR command on a Linux system. TAR stands for Tape
Archive. TAR archives were initially used to store files on magnetic tape but now commonly occur on all
storage media.

TAR files are simply a method of sticking a number of smaller files together, so that a collection of files
becomes one larger (easier to handle) file. This larger file can then be compressed using a program like
gzip to reduce its size. (This is similar to the way that Windows creates ZIP files.)

►Various steps to install package in TAR format: -


1. Firstly we downloaded the file chkwww−0.4.3.tar.gz from www.sourceforge.net, and placed it in
our /usr/local directory (though we could have put it anywhere).

2. Next we to the /usr/local directory and uncompress the TAR file (you can tell it's been
compressed using GZIP, as it has a .gz suffix. (This step isn't always necessary).

# gzip −dv pychkwww_0.4.TAR.gz pychkwww_0.4.TAR.gz: 81.6% −− replaced with


pychkwww_0.4.TAR

The −dv options mean:

¨ −d This decompresses the file.

¨ −v This uses verbose mode, so it prints its progress to the screen.

¨ −f This option forces the overwriting of old (existing) files with their newer counterparts.

This creates an uncompressed TAR file called chkwww−0.4.3. tar

3. Now we 'unTAR' the package to release the files with it. This is done with the following
command.

You'll see a list of the files released:

# TAR −xvf pychkwww_0.4.TAR

pychkwww/

pychkwww/CVS/

pychkwww/README

pychkwww/TODO
pychkwww/VERSION

pychkwww/pychkwww.py

pychkwww/Makefile

pychkwww/changelog

The −xvf options mean:

♦ −x This option extracts the files.

♦ −v This uses verbose mode, so it prints its progress to the screen.

♦ −f This option forces the overwriting of old (existing) files with their newer counterparts.

4. That's it. Our software should now be installed. We'll check the directory created by unTARring
the package, to make sure it worked:

# ls −al pychkwww

total 64

drwxrwxr−x 4 1000 1000 4096 May 18 2002 .

drwxr−xr−x 13 root root 4096 Feb 12 00:40 ..

...

−rw−rw−r−− 1 1000 1000 480 Mar 27 2002 Makefile

−rwxr−xr−x 1 1000 1000 6841 May 18 2002 pychkwww.py

−rw−rw−r−− 1 1000 1000 164 Mar 27 2002 README

−rw−rw−r−− 1 1000 1000 46 Mar 27 2002 TODO

5. Finally the acid test − we move into the pychwww directory, and try to run the software:

# cd pychkwww

# /pychkwww.py

6. If you've got your Internet connection running, try feeding it the following URL to make sure the
software is working properly:

# ./pychkwww.py www.linux4biz.net

www.linux4biz.net (66.103.135.76): Apache/1.3.27 (Unix) mod_log_bytes/1.2

mod_bwlimited/1.0 PHP/4.3.0 FrontPage/5.0.2.2510 mod_ssl/2.8.12 OpenSSL/0.9.6b


Q3. Categorize various Common Shell Commands.

Ans- There are different categories of shell commands:


· File system commands, used for navigating and manipulating the file system

· Process management commands, used to manage processes

· Administrative commands

File System Commands


File system commands allow us to access and manipulate various parts of the Unix file system tree. In
UNIX, the file system is organized as a tree structure; in much the same way as in other operating
systems (each directory can contain files and subdirectories). For each machine, there is always one root
directory; this is the topmost directory, and contains subdirectories and files. We refer to the root
directory by using the forward slash (/).

1. Changing and Establishing the Working Directory

For example, to select the root directory to be the working directory, we would type the following:

$ cd /

To select the directory /home/deepakt (the home directory of the user deepakt) to be the working
directory, we

could type this:

$ cd /home/deepakt

2. Determining the Working Directory

For example:

$ cd /home/deepakt

$ pwd

/home/deepakt

3. Listing the Contents of a Directory

We can list the contents of a directory by using the ls (list directory contents) command. If we don't
specify a directory, then ls will list the contents of the present working directory:

$ ls −al

total 288
drwxr−xr−x 3 deepakt users 4096 Jan 16 14:29 .

drwxr−xr−x 11 deepakt users 16384 Jan 16 14:27 ..

−rw−r−−r−− 1 deepakt users 49714 Jan 16 14:27 f.html

−rw−r−−r−− 1 deepakt users 22696 Jan 16 14:29 ff.html

drwxr−xr−x 2 deepakt users 0 Jan 16 17:10 foo

−rw−r−−r−− 1 deepakt users 131498 Jan 16 14:20 showthread.php.html

4. Creating and Removing Directories

We use mkdir (make directory) and rmdir (remove directory) respectively to create or remove directories.
The following example creates a subdirectory under the present working directory, called grapple:

$ mkdir grapple

$ mkdir −p vehicles/cars/4wds

$ rmdir grapple

$ rm −r vehicles

5. Creating and Removing Files

A quick way to create a file is to use the touch command. The actual purpose of the touch command is to
update the timestamp of an existing file

$ touch tigers.txt

To remove a file, we use the rm (remove) command:

$ rm tigers.txt

6. Moving Files and Directories

To move a file or directory, we use the mv (move) command. This requires two arguments − the file or
directory to be moved, and the destination:

$ mv squidgy.txt squeezy.txt

►Process Management Commands


UNIX (and therefore Linux) has the notion of processes that are essentially tasks running on the operating
system infrastructure. Each time a command is invoked, the invocation results in one or more processes
being spawned. Processes belong to users, and in general are insulated from each other.
1. Listing Processes

To list the current processes spawned, which is started from a particular shell or its parent shell, we can
use the ps (processes spawned) command:

$ ps

2. To list all the processes on the system, we can use the ps command with the −A option:

$ ps −A

3. Terminating a Process

The kill command can be used to send a signal to a process − by specifying the signal to be sent and the
Process ID.

$ kill −s SIGTERM 5365

4. Watching System Processes

The top command allows us to see which processes consume maximum resources on the system. The top
command refreshes the screen periodically since the resource consumption on a system usually fluctuates
rapidly.

$ pstree

►Administrative Commands

It is Linux's administrative commands that set it apart from GUI−based operating systems. These
commands are as numerous as they are powerful.

1. Switching Identities

The su command can also be used to switch identities between two non−root users. The id command
prints the current user ID of the user:

$ id

uid=500(brucewayne) gid=513(users) groups=513(users)

$ su

Password:

bash# id

uid=0(root) gid=0(root) groups=0(root), 1(bin), 2(daemon)

bash# exit
2. Shutting Down and Rebooting

The shutdown command shuts down the system. This command is restricted to root users only. Shutdown
can be immediate (in which case the now argument is passed), or it can be delayed (by n seconds by
passing the −t n option).

3. Disk Usage

The df command displays a partition−by−partition summary of disk usage. We can supply arguments
such as

−k to indicate to df that it should report disk usage in increments of kilobytes, as shown here:

$ df −k

4. Mounting Disks and Media

Since Linux treats all peripheral devices as file systems, we need to mount or associate these physical
devices to a file system mount point − essentially a directory. The mount command can be used to mount
such media. We need to have root user privileges to mount and unmount devices.

Here's an example. Start by trying to use ls to list the contents of /mnt/cdrom:

# ls /mnt/cdrom

At this stage, no files are listed since there is no device associated with the /mnt/cdrom mount point. Now
put a disc in, mount the CD−ROM device to the /mnt/cdrom mount point, and list the contents again:

# mount /dev/cdrom /mnt/cdrom

# ls /mnt/cdrom

The exact listing you get depends on which CD is in your CD−ROM drive.

The complementary command is the umount command, which disassociates a device from a file system
mount point:

# umount /mnt/cdrom

5. Listing Users
You can achieve this with the ‘who’ command, which lists all users currently logged on to a machine:

# who

deepakt :0 Jan 13 12:03

hbatman 192.168.1.100 Jan 11 11:30

Q4. Give the series of commands to perform following operation:


■Create a hierarchy of directories:

/home/user/hw1/hw2/hw3/hw4

■Then create a file ‘assignment’ in above hierarchy.

■Now change the permissions of ‘assignment’ such that only the creator of that file may perform
all operations on it.

■After that, create a soft link of assignment file in /home/user/hw1/hw2 with ‘filesoft’ name.

■And in the end create backup of /home/user/hw1/hw2 in /home/user/hw1 with ‘assign.tar’ name.

Ans:-

• To create a hierarchy of directories:

mkdir -p /home/user/hw1/hw2/hw3/hw4

• To create a file create a file ‘assignment’:

touch /home/user/hw1/hw2/hw3/hw4/assignment

• To change the permissions of ‘assignment’ such that only the creator of that file
may perform all operations on it:

chmod 700 /home/user/hw1/hw2/hw3/hw4/assignment

• To create a soft link of assignment file in /home/user/hw1/hw2 with ‘filesoft’ name:

ln –s /hw1/hw2/filesoft hw1/hw2/hw3/hw4/assignment

• To create backup of /home/user/hw1/hw2 in /home/user/hw1 with ‘assign.tar’ name:

• Tar –cvf hw1/assign.tar hw1/hw2 Create a hierarchy of directories:

/home/user/hw1/hw2/hw3/hw4
• Then create a file ‘assignment’ in above hierarchy.

• Now change the permissions of ‘assignment’ such that only the creator of that

file may perform all operations on it.

• After that, create a soft link of assignment file in /home/user/hw1/hw2 with

‘filesoft’ name.

• And in the end create backup of /home/user/hw1/hw2 in /home/user/hw1 with

‘assign.tar’ name.

Q5. Differentiate between Super User Vs. Normal Users.


Ans:-

There are two major flavors of Linux distro's out there. Debian and Red Hat based distributions account
for a large percentage of the distributions out there.

The major difference between them is the package management. If they are debian based the most likely
use the dpkg& apt/deb system, if it’s a Red Hat system it most likely uses yum/rpm. A lot of distros pop
up because someone was unsatisfied with the package management so most will have some form of
graphical interface that is different, but the underlying system is the same.

If you learn how to use apt-get and yum, you'll cover 80% of the distro's out there, and 99% of the
systems you'll most likely encounter.

Each distro will do something a little different with the window manager. Most major distro's choose
between KDE and Gnome, with Gnome seeming to be the popular one at the moment. The great thing
about Linux though, is that you can change the window manager if you like (go window maker!).

If you learn the command line there is not "much" of a difference, but the GUI changes between distro's
will definitely sway you're choice. Also, some distro's ship with divers that will make it easy for certain
hardware likes video cards.

6. Give introduction to Apache server. Write the various steps to Install and
Start Apache server.
Ans:-

Installing Apache:-
In fact the different modules are contained in the different packages that we can install via the Red Hat
Package Manager(RPM).Recall that to start RPM’s graphical interface, you can select Main
Menu/System Settings/Add/Remove Applications, or type the following command at the command line:

$redhat-config-pacakges

The apache web server packages are listed in the Web Server package group, which is found under
applications category in the RPM.

Only one of these packages in the group is a Standard Package-that’s the httpd package that contains the
base apache web server functionality.

Steps for starting Apache are under as follow:-


1. To run Apache type the following at the command prompt:
/etc/init.d/httpd start

2. To test it type:
/etc/init.d/httpd status

3. If apache is running you should see something like the following:


httpd (pid 1844 1843 1842 1841 1840 1839 1838 1837 1828) is running...

4. There are several ways to run Apache at bootup, and here is one of the simple ones.To run
Apache at bootup type:
vi /etc/rc.local

5. This will open rc.local in the text editor "vi". Arrow down to the bottom of the text (there may
not be any yet, in which case it will be the first line) and add:
/etc/init.d/httpd start

7. How we can start and Test FTP server?


Ans:-

Starting FTP server:-


To start the FTP service, we can use the Service Configuration tool. To launch the tool, select
Main Menu/System Settings/Server Settings/Services, or type the following command line:-

$ redhat-config-services
Again you will be prompted for the root password, unless you are already logged on as root. To
start the vsftpd FTP Server, select the vsftpd entry in the list and then click the start button.

Again, if you want the FTP service to start automatically next time you reboot your machine
than check the checkbox too. Then click on File/Save Changes to save your new settings.

#service vsftpd start

Starting vsftpd

#service vsftpd stop

Stopping vsftpd

Testing FTP Server:-


Now you have set up your FTP server started the service, we will adopt the role of the client to
quickly test that the service is working. From a command line ftp command to start an FTP
session, naming your FT server that you want to connect to:-

$ ftp 192.168.0.99

Connected to 192.168.0.99

220(vsftpd 1.1.3)

Names (192.168.0.99: none)

8. How we can configure FTP server so that anonymous user can be able to
upload files.
Ans:-

Setting up the FTP Server for Anonymous user that can upload files

There are four steps here. We'll need to create the folder, set the appropriate permissions, and then enable
uploading in the FTP server configuration:

First, we need to create a writeable directory. Again, you'll need the root account for this. Let's create a
directory called /upload (in the /var/ftp/pub directory):

# cd /var/ftp/pub

# mkdir upload

 Next, we need to set the permission of the upload directory so that it allows write only access to
anonymous FTP users (so that they can write to the directory but not to download from it – this
restricts file sharing among FTP users). To do this, we'll first use the chgrp command to change
the group associated with the upload directory:

# chgrp ftp upload

Now, the owner of the folder is still root, but the directory's group is ftp − the set of FTP users. Now we'll
use the chmod command to assign read/write/execute access to the owner, write/access only to the group,
and deny access to other users:

# chmod −R u=rwx, g=wx, o−rxw upload

Finally, we must configure the vsftpd server to allow anonymous upload. To do this, we simply edit the
configuration file, /etc/vsftpd/vsftpd.conf. Open this file using gedit (or your favorite text editor), and
locate the following lines:

# Uncomment this to allow the anonymous FTP user to upload files. This only

# has an effect if the above global write enable is activated. Also, you will

# obviously need to create a directory writable by the FTP user.

#anon_upload_enable=YES

#anon_upload_enable=YES

 Finally, restart the vsftpd service by using the Restart button in the Server Configuration dialog,
or/ typing the following at the command line:

# service vsftpd restart

►Using an FTP Client to Test Anonymous Write Access

So, let's test our configuration with another simple session on our FTP client: Connect to the client and
log in (using the username anonymous or ftp) as you did before:

$ ftp 192.168.0.99

connected to 192.168.0.99 (192.168.0.99).

220 (vsFTPd 1.1.3)

Name (192.168.0.99:none): anonymous

Das könnte Ihnen auch gefallen