کامپیوتر و اُپن سورس(Computer & Open Source)

آموزش دروس رشته کامپیوتر - نرمافزار اشنایی باسخت افزار سیستم عامل لینوکس شبکه برنامه نویسی معرفی نرم افزار

کامپیوتر و اُپن سورس(Computer & Open Source)

آموزش دروس رشته کامپیوتر - نرمافزار اشنایی باسخت افزار سیستم عامل لینوکس شبکه برنامه نویسی معرفی نرم افزار

Use dpkg to Install .deb Files

Using the apt-get application is the quickest way to find and install debian packages. The installation part is done by an application named dpkg. Dpkg doesn’t have to be used by apt-get, you can use it manually as well.

From the man dpkg command:

dpkg - a medium-level package manager for Debian

Whatever that means.

In keeping with GNU/Linux system security, only the superuser can use the dpkg application. Dpkg is a typical GNU/Linux application that is controlled by command-line switches. Possibly the most common use of dpkg is to install a local .deb file.

To install a .deb file, become root and use the command:

dpkg -i filename.deb

Dpkg can also be used to:

  • dpkg –unpack: unpacks the file but does not install it
  • dpkg –configure: presents whatever configuration options are available for the package
  • dpkg –remove: removes a package

Some of the package manipulation commands are actually carried out by an application called dpkg-deb. In those cases, dpkg just acts as a front end to dpkg-deb and passes the commands to it.

Dpkg-deb can also be used to manipulate .deb files. Some of the more useful commands of dpkg-deb are:

dpkg-deb –show filename.deb

Debian Package Managment

RPM Commands

This document contains an overview of the principal RPM commands for installing, uninstalling, upgrading, querying, listing, and checking RPM packages on your Red Hat Linux system.


# rpm -ivh foo-2.0-4.i386.rpm

# rpm -i ftp://ftp.redhat.com/pub/redhat/RPMS/foo-1.0-1.i386.rpm

# rpm -i http://oss.oracle.com/projects/firewire/dist/files/kernel-2.4.20-18.10.1.i686.rpm

Used to install a RPM package. Note that RPM packages have file naming conventions like foo-2.0-4.i386.rpm, which include the package name (foo), version (2.0), release (4), and architecture (i386). Also notice that RPM understands FTP and HTTP protocols for installing and querying remote RPM files.


# rpm -e foo

To uninstall a RPM package. Note that we used the package name foo, not the name of the original package file foo-2.0-4.i386.rpm above.


# rpm -Uvh foo-1.0-2.i386.rpm

# rpm -Uvh ftp://ftp.redhat.com/pub/redhat/RPMS/foo-1.0-1.i386.rpm

# rpm -Uvh http://oss.oracle.com/projects/firewire/dist/files/kernel-2.4.20-18.10.1.i686.rpm

To upgrade a RPM package. Using this command, RPM automatically uninstall the old version of the foo package and install the new package. It is safe to always use rpm -Uvh to install and upgrade packages, since it works fine even when there are no previous versions of the package installed! Also notice that RPM understands FTP and HTTP protocols for upgrading from remote RPM files.


# rpm -qa

To query all installed packages. This command will print the names of all installed packages installed on your Linux system.


# rpm -q foo

To query a RPM package. This command will print the package name, version, and release number of the package foo only if it is installed. Use this command to verify that a package is or is not installed on your Linux system.


# rpm -qi foo

To display package information. This command display package information including the package name, version, and description of the installed program. Use this command to get detailed information about the installed package.


# rpm -ql foo

To list files in installed package. This command will list all of files in an installed RPM package. It works only when the package is already installed on your Linux system.


# rpm -qf /usr/bin/mysql

mysql-3.23.52-3

Which package owns a file? This command checks to determine which installed package a particular file belongs to.


# rpm -qpl kernel-2.4.20-18.10.1.i686.rpm

# rpm -qpl ftp://ftp.redhat.com/pub/redhat/RPMS/foo-1.0-1.i386.rpm

# rpm -qpl http://oss.oracle.com/projects/firewire/dist/files/kernel-2.4.20-18.10.1.i686.rpm

List files in RPM file. This command allows you to query a (possibly) uninstalled RPM file with the use of the the "-p" option. You can use the "-p" option to operate on an RPM file without actually installing anything. This command lists all files in an RPM file you have in the current directory. Also note that RPM can query remote files through the FTP and HTTP protocols.


# rpm --verify mysql

To verify an installed package. This command will list all files that do NOT pass the verify tests (done on size, MD5 signature, etc). Where a file does NOT pass, the output is listed using the following codes that signify what failed:

    S File size

  M Mode (includes permissions and file type)

  5 MD5 sum

  L Symlink

  D Device

  U User

  G Group

  T Mtime

Take for example the following:

  # rpm --verify mysql

  S.5....T c /etc/my.cnf

This example indicates that file /etc/my.cnf failed on:

  File size

  MD5 Sum

  Modified Time

However, the "c" tells us this is a configuration file so that explains the changes. It should still be looked at to determine what the changes were.


# rpm --checksig foo

To check a RPM signature package. This command checks the PGP signature of specified package to ensure its integrity and origin. Always use this command first before installing a new RPM package on your system. Also, GnuPG or Pgp software must be already installed on your system before you can use this command.

ضرورت کار در خط فرمان

با ظهور اولین سیستمهای عامل نظیر ام اس داس و یونیکس همه کاربران کامپیوتر و کسانی که مایل به فراگیری علوم کامپیوتر یا کار باسیستمهای رایانه ای بودند میبایست ابتدا فرامین مختلف کامپیوتر را یکی پس از دیگری آموخته و این فرامین را جهت اجرای برنامه ها یا انجام عملیات خاص نظیر کپی فایل، تغییرنام فایلها، فرمت دیسک و .... در محیط متنی تایپ و بکار می بستند .  لیکن با پیدایش سیستمهای عامل جدیدتر خصوصا از زمان ایجاد رابطهای گرافیکی در سیستمهای عامل نیاز به فراگیری این دستورات روز بروز کمتر و کمتر شده تا جائی که در حال حاضر یک کاربر ساده کامپیوتر میتواند بیشتر عملیات مورد نظر خود را تنها با چند کلیک ساده ماوس یا اجرای یک برنامه در محیط گرافیکی ویندوز یا لینوکس براحتی به اجرا گذارد . این موضوع رفته رفته نیاز کاربران را به استفاده از صفحه کلید کامپیوتر و مراجعه به خط فرمان متنی سیستمهای عامل کمتر و کمتر نموده و در پاره ای موارد حتی  لزوم آموزش و پرداختن به این موضوع کاملا به دست فراموشی سپرده شده است و امروزه میتوان کاربرانی را دید که با محیط متنی و خط فرمان command prompt یا shell کاملا بیگانه هستند .

حال این سئوال پیش می آید که آیا براستی عمردستورات متنی و شلهای فرمان متنی به سر رسیده است ؟!!

همانطوریکه میدانید به دلائل زیر جواب این سئوال منفی است :

1-      برخی دستورات و فرامین پایه ای سیستمهای عامل از جمله پیکر بندی اولیه سیستمها و حتی شبکه های کامپیوتری را  هنوز هم فقط در محیط فرامین متنی میتوان به اجرا گذاشت .

2-      اصولا کار در خط فرمان متنی بدلیل اجتناب ازبکارگیری رابطهای گرافیکی که حجم بالائی از منابع سیستم از جمله حافظه را اشغال میکنند بسیار سریعتر و کم خطر تر است .

3-      در واقع کلیه برنامه های اجرائی در محیط گرافیکی به نحوی پس از اخذ دستورات ویژوال یا بصری از کاربر همان فرامین متنی را برای انجام عملیات خود در پس زمینه اجرا میکنند و چه بسا بدلیل ایرادات موجود در نرم افزارها گاهی این دستورات یا به کندی اجرا شده و یا آنها را به درستی نیز اجرا نمی نمایند .

4-      کار در محیط فرمان متنی و اجرای دستورات در محیطهای shell از جمله نیازهای اصلی مدیران سیستم و کاربران پیشرفته کامپیوتر است و هیچگاه به کلی منسوخ نخواهد شد .

5-      برخی سیستمهای عامل همچون  لینوکس با وجود توسعه چشمگیر رابطهای گرافیکی نظیر KDE و GNOME و 000 هنوز به فرامین متنی وابسته اند و بدون دانستن این فرامین نمیتوان از این سیستمها بطور کامل و موثر بهره برد .

امیدوارم این مقدمه و دلائل بسیار دیگری که برای استفاده از محیط فرمان متنی خصوصا در مورد لینوکس  وجود دارند همه دوستان را به آموختن کامل و استفاده از این دستورات آن هم بصورت حرفه ای ترغیب نماید . به نظر من هر فرد پس از مدتی کار با خط فرمان و اجرای دستورات و مشاهده نتایج حیرت انگیز آن پی خواهد برد که کار در این محیط نه تنها مشکل تر از محیط گرافیکی نیست بلکه انعطاف پذیری و امکانات منحصر بفرد خودش را هم بهمراه دارد .
 
منبع : کدباز