Beruflich Dokumente
Kultur Dokumente
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.
5. Listing all files included in the not yet installed package wget by entering the following:
rpm -V wget
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
rpm -e wget
if the package is not installed it will install it for You, like option "-ivh"
Q2. Write down the various steps to install package in TAR format.
Ans-
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.)
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).
¨ −f This option forces the overwriting of old (existing) files with their newer counterparts.
3. Now we 'unTAR' the package to release the files with it. This is done with the following
command.
pychkwww/
pychkwww/CVS/
pychkwww/README
pychkwww/TODO
pychkwww/VERSION
pychkwww/pychkwww.py
pychkwww/Makefile
pychkwww/changelog
♦ −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
...
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
· Administrative commands
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
$ cd /home/deepakt
For example:
$ cd /home/deepakt
$ pwd
/home/deepakt
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 .
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
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
$ rm tigers.txt
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
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.
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
$ su
Password:
bash# id
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
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.
# 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:
# 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
/home/user/hw1/hw2/hw3/hw4
■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:-
mkdir -p /home/user/hw1/hw2/hw3/hw4
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:
ln –s /hw1/hw2/filesoft hw1/hw2/hw3/hw4/assignment
/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
‘filesoft’ name.
‘assign.tar’ name.
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.
2. To test it type:
/etc/init.d/httpd status
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
$ 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.
Starting vsftpd
Stopping vsftpd
$ ftp 192.168.0.99
Connected to 192.168.0.99
220(vsftpd 1.1.3)
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:
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:
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
#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:
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