日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

软件安装及软件包管理

發(fā)布時間:2023/12/14 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 软件安装及软件包管理 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

1、rpm包

由紅帽公司開發(fā)用于軟件包的安裝、升級、卸載與查詢的包管理工具

[root@localhost ~]# rpm -qa tree

tree-1.6.0-10.el7.x86_64 tree(軟件包名)-1.6.0(發(fā)布版本)-10(發(fā)布次數(shù)).el7(系統(tǒng)版本).x86_64(硬件平臺).rpm(擴展名)

①命令格式

rpm 【選項】【軟件包名稱】

-i 安裝rpm

-v 顯示安裝信息

-h 顯示安裝進度

-e 卸載軟件包

-e --force --nodeps 強制卸載

②rpm包安裝方法

[root@localhost ~]# cd /usr/src(操作系統(tǒng)存放源碼目錄)

[root@localhost src]# wget +rpm包網(wǎng)址鏈接

[root@localhost src]# rpm ivh 包名

軟件包直接拖進去

③查詢

rpm 【選項】【軟件包名稱】

-qa 查有系統(tǒng)中已安裝的所有RPM軟件包列表

-ql 查詢指定軟件包所安裝的目錄、文件列表

-qc 查詢指定軟件包的配置文件

-qi 查詢指定軟件的詳細信息

-qf 查詢文件或目錄屬于哪個RPM軟件包

優(yōu)點:軟件開發(fā)商預(yù)先編譯打包,安裝簡單,安裝路徑固定。

缺點:版本可能偏低,安裝有很嚴重依賴關(guān)系。

2、yum安裝管理

①什么是yum?

Yum是RedHat以及CentOS中的軟件包管理器。能夠通過互聯(lián)網(wǎng)下載rpm包并且安裝,并可以自動處理依賴性關(guān)系,無須繁瑣地一次次下載、安裝。(yum是生產(chǎn)常用安裝工具)

②什么是yum源

要想使用yum工具安裝、更新軟件,就需要有一個包含各種rpm軟件包的軟件倉庫,這樣的軟件倉庫就稱為yum源(yum 源默認都在/etc/yum.repos.d目錄下,以*.repo結(jié)尾)

yum源分為:

a.互聯(lián)網(wǎng)yum源

b.局域網(wǎng)yum源

c.服務(wù)器本地 yum源

③yum用法

yum list 查詢

yum install [軟件名] -y(非交互) 安裝軟件包

yum clean 刪除緩存數(shù)據(jù)

yum makecache 創(chuàng)建元數(shù)據(jù)緩存

④本地yum倉庫搭建

[root@localhost ~]# mount /dev/sr0 /mnt

[root@localhost yum.repos.d]# cd /etc/yum.repos.d/

[root@localhost yum.repos.d]# mkdir wmc

[root@localhost yum.repos.d]# mv *.repo wmc/

[root@localhost yum.repos.d]# vim cc.repo

[cc]? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? # 倉庫名稱

name=wmc? ? ? ? ? ? ? ? ? ? ?#倉庫描述信息

baseurl=file:///mnt? ? ? ? ? #yum源url地址,可以是file://(本地) ftp://(局域網(wǎng)) http://(公網(wǎng))

enable=1? ? ? ? ? ? ? ? ? ? ? ? ?#是否使用該yum源(1代表激活,0代表禁用)

gpgcheck=0? ? ? ? ? ? ? ? ? ? ? ?#是否驗證軟件簽名(1代表激活,0代表禁用)

[root@localhost yum.repos.d]# yum clean all $$ yum makecache

已加載插件:fastestmirror, langpacks wmc | 3.6 kB 00:00

(1/4): wmc/group_gz | 156 kB 00:00

(2/4): wmc/filelists_db | 3.1 MB 00:00

(3/4): wmc/primary_db | 3.1 MB 00:00

(4/4): wmc/other_db | 1.2 MB 00:00

Determining fastest mirrors 元數(shù)據(jù)緩存已建立

3、源碼安裝

①什么是源碼包?

源碼包指的是開發(fā)人員編寫好的程序源代碼,但并沒有將其編譯為一個能正常使用的工具或軟件。

②為什么要源碼包安裝

部分軟件宮網(wǎng)僅提供源碼包,需要自行編譯并安裝。

部分軟件在新版本有一些特性還沒來得及制作成rpm包時,可以自行編譯軟件增加或使用其新特性。

③源碼包的優(yōu)缺點

優(yōu)點:可以自行修改源代碼,可以定制需要的相關(guān)功能。

缺點:相對yum安裝軟件會復(fù)雜很多,標準化實施困難,白動化運維復(fù)雜。

④編譯安裝源碼包軟件

步驟1:tar解包 用途:解壓并釋放源代碼包到指定的目錄

步驟2:/configure配置 用途:設(shè)置安裝目錄、安裝模塊等選項、生成makefile

步驟3:make編譯 用途:將makefile生成可執(zhí)行的二進制文件

步驟4:make install安裝 用途:復(fù)制二進制文件到系統(tǒng),配置應(yīng)用環(huán)境

【例】通過編譯Nginx來展現(xiàn)源碼包編譯過程

a.基礎(chǔ)環(huán)境準備

[root@localhost ~]# yum install httpd -y

b.下載源碼包

[root@localhost ~]# wget -q https://nginx.org/download/nginx-1.20.2.tar.gz

[root@localhost ~]# ls nginx-1.20.2.tar.gz

c.解壓源碼包,并進入相應(yīng)目錄

[root@localhost ~]# tar xf nginx-1.20.2.tar.gz

[root@localhost ~]# cd nginx-1.20.2/

d.配置相關(guān)的選項,并生成makefile

[root@localhost nginx-1.20.2]# ./configure --prefix=/nginx-1.20.2

e.將makefile文件編譯可執(zhí)行二進制程序

[root@localhost nginx-1.20.2]# make

f.將二進制程序拷貝至對應(yīng)的目錄中

[root@localhost nginx-1.20.2]# make install

###############################################

[root@localhost nginx-1.20.2]# /nginx-1.20.2/sbin/nginx

[root@localhost nginx-1.20.2]# netstat -lntup|grep nginx

tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 9663/nginx: master

[root@localhost nginx-1.20.2]# curl 127.0.0.1

?

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

?

?

For online documentation and support please refer to?nginx.org.
Commercial support is available at?nginx.com.

??

Thank you for using nginx.

?

</body> </html>

##############################################

#配置相關(guān)的選項,并生成makefile,報錯解決方案

./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option.

[root@localhost nginx-1.20.2]# yum install pcre-devel -y

./configure: error: the HTTP gzip module requires the zlib library. You can either disable the module by using --without-http_gzip_module option, or install the zlib library into the system, or build the zlib library statically from the source with nginx by using --with-zlib=<path> option.

[root@localhost nginx-1.20.2]# yum install zlib-devel -y

總結(jié)

以上是生活随笔為你收集整理的软件安装及软件包管理的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。