在工作中会遇到服务器不能访问互联网,但是需要升级或者安装软件的情况,这个时候我们就不能使用包管理器来升级或安装程序,通常的做法是在个人电脑上将安装包下载下来,然后通过传输工具上传至服务器,再使用离线的方式完成软件的安装。接下来将介绍wget离线安装。
一、安装准备
系统版本为Centos7,提前准备以下安装包(其中gmp、gnutls、nettle是wget的依赖包),并将其上传至服务器:
二、安装gmp
解压源码安装包,并使用编译的方式安装:
[root@localhost ~]# xz -d gmp-6.2.1.tar.xz
[root@localhost ~]# tar xvf gmp-6.2.1.tar
[root@localhost ~]# cd gmp-6.2.1
[root@localhost gmp-6.2.1]# ./configure --prefix=/usr/local/
[root@localhost gmp-6.2.1]# make
[root@localhost gmp-6.2.1]# make check
[root@localhost gmp-6.2.1]# make install
配置环境变量:
[root@localhost ~]# echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
[root@localhost ~]# source ~/.bashrc
三、安装nettle
解压nettle安装包,编译安装:
[root@localhost ~]# tar -zxf nettle-3.4.1.tar.gz
[root@localhost ~]# cd nettle-3.4.1
[root@localhost nettle-3.4.1]# ./configure --prefix=/usr --enable-mini-gmp
[root@localhost nettle-3.4.1]# make
[root@localhost nettle-3.4.1]# make install
四、安装gnutls
解压gnutls安装包,编译安装:
[root@localhost ~]# xz -d gnutls-3.6.15.tar.xz
[root@localhost ~]# tar xvf gnutls-3.6.15.tar
[root@localhost ~]# cd gnutls-3.6.15
[root@localhost gnutls-3.6.15]# PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --with-included-libtasn1 --with-included-unistring --without-p11-kit
[root@localhost gnutls-3.6.15]# make
[root@localhost gnutls-3.6.15]# make install
五、安装wget
最后解压wget安装包,编译安装wget:
[root@localhost ~]# tar -zxvf wget-1.21.tar.gz
[root@localhost ~]# cd wget-1.21
[root@localhost wget-1.21]# PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure
[root@localhost wget-1.21] make
[root@localhost wget-1.21] make install
今天的分享就到这里了~