Linux下軟體安裝方法

2021-04-24 03:28:11 字數 3764 閱讀 1129

.tar.gz包的安裝方法。  

二、安裝需要編譯的.tar.gz包

由於rpm包使用的侷限性(必須安裝rpm),目前更多的軟體使用的是源**形式的.tar.gz包。這種軟體的安裝通常要經過解壓縮、軟體配置、軟體編譯及安裝的過程。

解壓縮通常有兩種命令方法:一種是「gunzip filename-version-os.tar.gz | tar xvf -」,它實質是兩條命令「gunzip filename-version-os.tar.gz」和「tar xvf filename-version-os.tar」;另一種是「tar xzvf filename-version-os.tar.gz」。一般來說在軟體解壓縮後會生成乙個目錄filename-version-os。

軟體的配置、編譯、安裝是最讓初學者望而生畏的事了,但筆者認為掌握一些規律還是不難的。一般來說,在解壓縮生成的目錄中都會有名為readme、 rnstall或readme.install之類的檔案。這些檔案通常會對軟體的功能、特性、版權許可、安裝以及相關

知識加以介紹,並且會提到關於安裝的方法和步驟。舉例來說:在apache_1.3.6的install檔案中說明了如下內容(此處只列出總的條目,具體內容省略):

1.overview for the impatient(概括說明配置的全過程)

$./configure--prefix=prefix

$make

$make install

$prefix/bin/apachectl start

2.requirements(需要的條件)

3.configuring the source tree(配置的引數說明)

4.building the package(編譯軟體的方法)

5.installing the package(安裝軟體的方法)

6.testing the package(軟體測試

)理解並能熟練使用這些說明檔案後,就可以利用一些規律來安裝大多數的軟體。對於那些沒有說明檔案的軟體(當然這種情況比較少見),這些規律通常也是適用的。一般來說,與安裝軟體有直接關係的檔案只有兩個:configure 、makefile。

其中,configure檔案具有可執行的屬性,是用來配置軟體的,它的引數比較多,用法也比較靈活。當然,不同的軟體引數也不相同,這時候就需要借助它的help引數,執行下面的命令就會讓你感到豁然開朗:

#〉 ./configure -help

usage: configure [options]

options: [defaults in brackets after descriptions]

general options:

--quiet, --silent do not print messages

--verbose,-v print even more messages

--sha [=dir] switch to a shadow tree (under dir) for building

stand-alone options:

--help,-h print this message

--show-layout print installation path layout (check and debug)

installation layout options:

--with-layout=[f:]id use installation path layout id (from file f)

--target=target install name-associated files using basename target

……接下來,就可以執行「./configure [options]」來配置該軟體。注意,命令列中的「./」非常重要,它告訴系統要執行的命令就在當前目錄下(否則系統就會到$path變數指定的路徑下去執行命令)。執行命令後可以生成makefile檔案或者修改已有的檔案配置。

makefile檔案通常是用來編譯和安裝軟體的。執行make命令時系統會自動根據makefile檔案中的設定對軟體進行編譯和安裝。make命令有時還可以帶一些引數,如:all、build、config、install等。具體要帶哪個引數可以參看makefile檔案。在linux中絕大部分檔案是文字檔案,makefile就是乙個shell程式(linux中shell程式與dos中的批處理檔案有很多相似之處,當然功能要強得多),很容易讀懂,尤其是編譯時可帶的引數都會明確寫出,例如:

##********************====

## targets

##********************====

# default target

all: build

##------------------------

## build target

##------------------------

# build the package

build:

……# the non-verbose variant for package maintainers

build-quiet:

@$(make) -f $(top)/$(mkf) $(mflags) $(mfwd) quiet=1 build

# build the additional support stuff

build-support:

……##------------------------

## installation targets

## -----------------------

# the install target for installing the complete apache

# package. this is implemented by running subtargets for the

# separate parts of the installation process.

install:

……# the non-verbose variant for package maintainers

install-quiet:

@$(make) -f $(top)/$(mkf) $(mflags) $(mfwd) quiet=1 install

# create the installation tree

install-mktree:

……上面這段**是apache_1.3.6的makefile檔案的一部分,從這段程式可以看出all引數表示完全編譯(預設引數)。此外,編譯時還可以帶 build、build-quiet、build-surpport等引數;安裝時可以帶install、install-quiet、install- surpport等引數。它們的功能分別在「#」表示的注釋中進行了說明。需要額外說明的是,有些軟體(例如linux的核心公升級程式)不用 configure命令來配置軟體,而是用make config來完成這項工作,所以,具體使用

哪種方法要具體問題具體分析。  

圖形介面下的軟體安裝  

在圖形環境下,同樣可以彈出乙個**終端以文字的方法來安裝軟體,但那樣就太笨了,因為在x window中有一些簡單的方法可以幫您完成軟體安裝。下面筆者以redhat 6.0為例做介紹。

一、圖形介面下安裝.tar.gz包

在x window下,安裝這種形式的包簡化程度並不大,只是在解壓縮軟體時方便

的系統管理員時,你就能靈活地處理這些問題了。

linux下軟體安裝常用方法

1 軟體安裝解除安裝,分幾種情況 a rpm包,這種軟體包就像windows的exe安裝檔案一樣,各種檔案已經編譯好,並打了包,哪個檔案該放到哪個資料夾,都指定好了,安裝非常方便,在圖形介面裡你只需要雙擊就能自動安裝。愛好者博墅 tvp5w zo xyzz 如何解除安裝 h vbx m 01 開啟乙...

Linux下軟體安裝方法總結

linux下軟體安裝方法總結 一 rpm包安裝方式步驟 quote 二 deb包安裝方式步驟 quote 三 tar.gz源 包安裝方式 quote 四 tar.bz2源 包安裝方式 quote 五 apt方式安裝 quote 1 開啟乙個終端,su 成root使用者 2 apt cache sea...

Linux下軟體安裝方法總結

linux下軟體安裝方法總結 一 rpm包安裝方式步驟 quote 二 deb包安裝方式步驟 quote 三 tar.gz源 包安裝方式 quote 四 tar.bz2源 包安裝方式 quote 五 apt方式安裝 quote 1 開啟乙個終端,su 成root使用者 2 apt cache sea...