1. 程式人生 > >3.6 7.6-7.9聽課筆記

3.6 7.6-7.9聽課筆記

./configure epel echo $? 源碼包安裝 yum下載rpm


yum更換國內源

操作步驟:

1. 刪除目錄/etc/yum.repos.d/中原有的Baserepos文件

*操作完成後無法再下載包

2. 使用curl –O http://mirrors.163.com/.help/CentOS7-Base-163.repo 地址下載需要的repos文件(該操作也可以用wget來完成)

3. 清理原先的yum緩存(yum clean all

4. 查看列出的可安裝的包(yum list

安裝擴展源epel

base基礎源

[root@localhost yum.repos.d]# yum install -y epel-release 安裝擴展源

[root@localhost yum.repos.d]# ls

CentOS7-Base-163.repo CentOS-fasttrack.repo CentOS-Vault.repo

CentOS-CR.repo CentOS-Media.repo epel.repo

CentOS-Debuginfo.repo CentOS-Sources.repo epel-testing.repo

yum下載rpm

[root@localhost yum.repos.d]# yum install zsh --downloadonly

已加載插件:fastestmirror

Loading mirror speeds from cached hostfile

* epel: mirrors.tuna.tsinghua.edu.cn

軟件包 zsh-5.0.2-28.el7.x86_64 已安裝並且是最新版本

無須任何處理

[root@localhost yum.repos.d]#

*僅下載包但不安裝包(當該包已經安裝時無法下載)

[root@localhost yum.repos.d]# yum install zvbi –downloadonly 只下載不安裝

已加載插件:fastestmirror

Loading mirror speeds from cached hostfile

* epel: mirrors.ustc.edu.cn

正在解決依賴關系

--> 正在檢查事務

---> 軟件包 zvbi.x86_64.0.0.2.35-1.el7 將被 安裝

--> 正在處理依賴關系 libpng15.so.15(PNG15_0)(64bit),它被軟件包 zvbi-0.2.35-1.el7.x86_64 需要

--> 正在處理依賴關系 libpng15.so.15()(64bit),它被軟件包 zvbi-0.2.35-1.el7.x86_64 需要

--> 正在檢查事務

---> 軟件包 libpng.x86_64.2.1.5.13-7.el7_2 將被 安裝

--> 解決依賴關系完成

依賴關系解決

===================================================================================

Package 架構 版本 大小

===================================================================================

正在安裝:

zvbi x86_64 0.2.35-1.el7 epel 415 k

為依賴而安裝:

libpng x86_64 2:1.5.13-7.el7_2 base 213 k

事務概要

===================================================================================

安裝 1 軟件包 (+1 依賴軟件包)

總下載量:628 k

安裝大小:1.9 M

Background downloading packages, then exiting:

(1/2): libpng-1.5.13-7.el7_2.x86_64.rpm | 213 kB 00:00:00

warning: /var/cache/yum/x86_64/7/epel/packages/zvbi-0.2.35-1.el7.x86_64.rpm.1985.tmp: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY

zvbi-0.2.35-1.el7.x86_64.rpm.1985.tmp 的公鑰尚未安裝

(2/2): zvbi-0.2.35-1.el7.x86_64.rpm | 415 kB 00:00:00

-----------------------------------------------------------------------------------

總計 651 kB/s | 628 kB 00:00

exiting because "Download Only" specified

[root@localhost yum.repos.d]#

[root@localhost yum.repos.d]# cd /var/cache/yum/x86_64/7/

[root@localhost 7]# cd base

[root@localhost base]# ls

0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite.bz2

9346184be1deb727caf4b1ecf4a7949155da5da74af9b92c172687b290a773df-c7-x86_64-comps.xml.gz

cachecookie

gen

packages

repomd.xml

[root@localhost base]# cd pachages

-bash: cd: pachages: 沒有那個文件或目錄

[root@localhost base]# ls -l

總用量 6052

-rw-r--r--. 1 root root 6023293 9 6 05:51 0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite.bz2

-rw-r--r--. 1 root root 159667 9 6 05:51 9346184be1deb727caf4b1ecf4a7949155da5da74af9b92c172687b290a773df-c7-x86_64-comps.xml.gz

-rw-r--r--. 1 root root 0 3 6 20:08 cachecookie

drwxr-xr-x. 2 root root 31 3 6 20:08 gen

drwxr-xr-x. 2 root root 46 3 6 20:33 packages

-rw-r--r--. 1 root root 3735 9 6 05:51 repomd.xml

[root@localhost base]# cd packages

[root@localhost packages]# ls

libpng-1.5.13-7.el7_2.x86_64.rpm

/var/cache/yum/x86_64/7/base/packages libpng包存放在該目錄下

[root@localhost packages]# yum install zvbi --downloadonly --downloaddir=/tmp/ 下載包並指定下載路徑

已加載插件:fastestmirror

Loading mirror speeds from cached hostfile

* epel: mirrors.tuna.tsinghua.edu.cn

正在解決依賴關系

--> 正在檢查事務

---> 軟件包 zvbi.x86_64.0.0.2.35-1.el7 將被 安裝

--> 正在處理依賴關系 libpng15.so.15(PNG15_0)(64bit),它被軟件包 zvbi-0.2.35-1.el7.x86_64 需要

--> 正在處理依賴關系 libpng15.so.15()(64bit),它被軟件包 zvbi-0.2.35-1.el7.x86_64 需要

--> 正在檢查事務

---> 軟件包 libpng.x86_64.2.1.5.13-7.el7_2 將被 安裝

--> 解決依賴關系完成

依賴關系解決

===================================================================================

Package 架構 版本 大小

===================================================================================

正在安裝:

zvbi x86_64 0.2.35-1.el7 epel 415 k

為依賴而安裝:

libpng x86_64 2:1.5.13-7.el7_2 base 213 k

事務概要

===================================================================================

安裝 1 軟件包 (+1 依賴軟件包)

總下載量:628 k

安裝大小:1.9 M

Background downloading packages, then exiting:

exiting because "Download Only" specified

[root@localhost packages]#

[root@localhost packages]#yum reinstall zvbi --downloadonly --downloaddir=/tmp/ 在包已經被安裝時重新下載這個包

源碼包安裝

約定服務器源碼包安裝位置:

/usr/local/src

可以到r.aminglinux.com(輸入後自動跳轉頁面),下載源碼包

[root@localhost src]# ls

httpd-2.2.34 httpd-2.2.34.tar.gz

[root@localhost src]# cd httpd-2.2.34

[root@localhost httpd-2.2.34]# ls

ABOUT_APACHE config.layout httpd.spec LICENSE README.platforms

acinclude.m4 configure include Makefile.in README-win32.txt

Apache.dsw configure.in INSTALL Makefile.win ROADMAP

build docs InstallBin.dsp modules server

BuildAll.dsp emacs-style LAYOUT NOTICE srclib

BuildBin.dsp httpd.dep libhttpd.dep NWGNUmakefile support

buildconf httpd.dsp libhttpd.dsp os test

CHANGES httpd.mak libhttpd.mak README VERSIONING

*兩個分別為安裝文檔和說明文檔

[root@localhost httpd-2.2.34]#

[root@localhost httpd-2.2.34]# ./configure --prefix=/usr/local/apache2 指定安裝路徑

checking for chosen layout... Apache

checking for working mkdir -p... yes

checking build system type... x86_64-unknown-linux-gnu

checking host system type... x86_64-unknown-linux-gnu

checking target system type... x86_64-unknown-linux-gnu

Configuring Apache Portable Runtime library ...

checking for APR... reconfig

configuring package in srclib/apr now

checking build system type... x86_64-unknown-linux-gnu

checking host system type... x86_64-unknown-linux-gnu

checking target system type... x86_64-unknown-linux-gnu

Configuring APR library

Platform: x86_64-unknown-linux-gnu

checking for working mkdir -p... yes

APR Version: 1.5.2

checking for chosen layout... apr

checking for gcc... no

checking for cc... no

checking for cl.exe... no

configure: error: in `/usr/local/src/httpd-2.2.34/srclib/apr':

configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details

configure failed for srclib/apr

[root@localhost httpd-2.2.34]# echo $? 如果不知道上一條命令是否執行成功可以使用

1 1則失敗,為0成功

[root@localhost httpd-2.2.34]# echo $? 指明該命令的上一條命令是正確的

0

[root@localhost httpd-2.2.34]# ./configure --prefix=/usr/local/apache2 ./configure是配置的過程,過程中出現問題就會停下報錯,解決問題後再重運行直到配置完全完成

*配置的過程中會生成一個makefile文件,根據該文件進行編譯

[root@localhost httpd-2.2.34]# make 對該目錄下產生的makefile文件進行編譯

[root@localhost httpd-2.2.34]# echo $? 檢測

0

[root@localhost httpd-2.2.34]# make install 將編譯完成的文件放到prefix指定的目錄下

[root@localhost httpd-2.2.34]# echo $?

0

[root@localhost httpd-2.2.34]# ls /usr/local/apache2

bin cgi-bin error icons lib man modules

build conf htdocs include logs manual

發現源碼包安裝的文件都在prefix指定的目錄下,所以若要卸載這個包只要刪除對應的目錄就可以

*源碼包最好到可信任的站點下載,否則可能被攻擊


3.6 7.6-7.9聽課筆記