阿里yum源無法使用時,離線安裝wget命令。系統版本CentOS8.0。
安裝wget需要用到的依賴環境:

以上安裝包也可以在此獲取https://download.csdn.net/download/android541/80419173
以上四個壓縮包統一放在/usr/local/目錄下面
一、安裝wget
1、下載:https://ftp.gnu.org/gnu/wget/wget-1.21.tar.gz
2、解壓:tar zxvf wget-1.21.tar.gz
3、配置:進入wget解壓目錄,輸入命令 ./configure
可能提示錯誤:
configure: error: Package requirements (gnutls) were not met:
No package 'gnutls' found
下載gnutls: https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.15.tar.xz
如果沒有此報錯,可以跳過二、三、四步驟,直接到步驟五
二、安裝gmp6.2(這是為了安裝nettle的准備)
下載gmp: https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz
xz -d gmp-6.2.1.tar.xz
tar xvf gmp-6.2.1.tar
cd gmp-6.2.1
# /usr/local換成自己的安裝路徑
./configure --prefix=/usr/local/
#編譯安裝
make
make check
make install
#配置環境變量
vim ~/.bashrc
加入下面的語句
#配置剛才的安裝路徑
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
#保存后執行
source ~/.bashrc
三、安裝nettle(這是為了安裝gnutls做准備)
https://ftp.gnu.org/gnu/nettle/nettle-3.4.1.tar.gz
tar -zxf nettle-3.4.1.tar.gz
cd nettle-3.4.1
./configure --prefix=/usr --enable-mini-gmp && make
make install
四、安裝gnutls
xz -d gnutls-3.6.15.tar.xz
tar xvf gnutls-3.6.15.tar
cd gnutls-3.6.15
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --with-included-libtasn1 --with-included-unistring --without-p11-kit
如果這里出錯和gmp相關,那就是gmp沒安裝好,大概是路徑問題。
make
make install
五、繼續安裝wget
./configure
make
make install
