yum更换源和下载rpm包、Linux软件源码包方式安装
更换yum仓库源
- cp -r /etc/yum.repos.d/ /etc/yum.repos.d.bak # 备份系统自带仓库源配置
- rm -f /etc/yum.repos.d/* # 删除所有的仓库源配置
- cd /etc/yum.repos.d/ # 进入到仓库源目录
- wget http://mirrors.163.com/.help/CentOS7-Base-163.repo(wget安装: yum install -y wget)
- 或者curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo
实际操作
[root@centos01 yum.repos.d]# curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1572 100 1572 0 0 291 0 0:00:05 0:00:05 --:--:-- 351 [root@centos01 yum.repos.d]# ls CentOS7-Base-163.repo [root@centos01 yum.repos.d]# yum repolist all # 显示系统中所有的yum仓库 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile repo id repo name status base/7/x86_64 CentOS-7 - Base - 163.com enabled: 9,911 centosplus/7/x86_64 CentOS-7 - Plus - 163.com disabled dvd install dvd enabled: 3,538 extras/7/x86_64 CentOS-7 - Extras - 163.com enabled: 432 updates/7/x86_64 CentOS-7 - Updates - 163.com enabled: 1,543 repolist: 15,424 [root@centos01 yum.repos.d]# yum list |tail -n20 yum-plugin-upgrade-helper.noarch 1.1.31-46.el7_5 updates yum-plugin-verify.noarch 1.1.31-46.el7_5 updates yum-plugin-versionlock.noarch 1.1.31-46.el7_5 updates yum-rhn-plugin.noarch 2.0.1-10.el7 base yum-updateonboot.noarch 1.1.31-46.el7_5 updates yum-utils.noarch 1.1.31-46.el7_5 updates zenity.x86_64 3.22.0-1.el7 base zlib.i686 1.2.7-17.el7 base zlib.x86_64 1.2.7-17.el7 base zlib-devel.i686 1.2.7-17.el7 base zlib-devel.x86_64 1.2.7-17.el7 base zlib-static.i686 1.2.7-17.el7 base zlib-static.x86_64 1.2.7-17.el7 base zsh.x86_64 5.0.2-28.el7 base zsh-html.x86_64 5.0.2-28.el7 base zziplib.i686 0.13.62-5.el7 base zziplib.x86_64 0.13.62-5.el7 base zziplib-devel.i686 0.13.62-5.el7 base zziplib-devel.x86_64 0.13.62-5.el7 base zziplib-utils.x86_64 0.13.62-5.el7 base
安装扩展源epel
[root@centos01 yum.repos.d]# ls CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Sources.repo CentOS-Vault.repo [root@centos01 yum.repos.d]# yum install -y epel-release Loaded plugins: fastestmirror base | 3.6 k (1/2): base/7/x86_64/group_gz | 166 k (2/2): base/7/x86_64/primary_db | 5.9 M Determining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: centos.ustc.edu.cn Resolving Dependencies --> Running transaction check ---> Package epel-release.noarch 0:7-11 will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================================================================== Package Arch Version Repository ========================================================================================================== Installing: epel-release noarch 7-11 extras Transaction Summary ========================================================================================================== Install 1 Package Total download size: 15 k Installed size: 24 k Downloading packages: epel-release-7-11.noarch.rpm | 15 k Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : epel-release-7-11.noarch Verifying : epel-release-7-11.noarch Installed: epel-release.noarch 0:7-11 Complete! [root@centos01 yum.repos.d]# ls CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Sources.repo CentOS-Vault.repo epel.repo epel-testing.r [root@centos01 yum.repos.d]# yum list | grep epel | head # 可以看到新增的epel扩展源里的rpm包 * epel: mirrors.huaweicloud.com epel-release.noarch 7-11 @extras 0ad.x86_64 0.0.22-1.el7 epel 0ad-data.noarch 0.0.22-1.el7 epel 0install.x86_64 2.11-1.el7 epel 2048-cli.x86_64 0.9.1-1.el7 epel 2048-cli-nocurses.x86_64 0.9.1-1.el7 epel 2ping.noarch 3.2.1-2.el7 epel 389-admin.x86_64 1.1.46-1.el7 epel 389-admin-console.noarch 1.1.12-1.el7 epel
yum下载rpm包
- yum install -y 包名 --downloadonly
- yum install -y 包名 --downloadonly --downloaddir=/tmp/ # 指定下载路径是/tmp/
- yum reinstall -y 已安装过的包名 --downloadonly --downloaddir=/tmp/ # 指定下载路径是/tmp/
[root@centos01 yum.repos.d]# yum install zsh --downloadonly Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirrors.huaweicloud.com * extras: mirrors.aliyun.com * updates: centos.ustc.edu.cn Resolving Dependencies --> Running transaction check ---> Package zsh.x86_64 0:5.0.2-28.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================================================================== Package Arch Version Repository Size ========================================================================================================== Installing: zsh x86_64 5.0.2-28.el7 base 2.4 M Transaction Summary ========================================================================================================== Install 1 Package Total download size: 2.4 M Installed size: 5.6 M Background downloading packages, then exiting: zsh-5.0.2-28.el7.x86_64.rpm | 2.4 MB 00:00:05 exiting because "Download Only" specified # 查看下载的rpm包 [root@centos01 yum.repos.d]# ls /var/cache/yum/x86_64/7/base/packages/ zsh-5.0.2-28.el7.x86_64.rpm
源码包安装
- cd /usr/local/src/ # 一般源码包下载目录
- wget http://archive.apache.org/dist/httpd/httpd-2.2.9.tar.gz # 下载要安装的软件源码包
- tar zxvf httpd-2.2.9.tar.gz
- cd httpd-2.2.9
- ./configure --prefix=/usr/local/apache2 # 配置并指定安装目录
- make
- make install
- 卸载: 删除安装文件
实际操作
[root@centos01 httpd-2.2.9]# ./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.3.0 checking for chosen layout... apr checking for gcc... no checking for cc... no checking for cl.exe... no configure: error: no acceptable C compiler found in $PATH See `config.log' for more details. configure failed for srclib/apr [root@centos01 httpd-2.2.9]# echo $? # 查看上一条命令的操作结果 1表示失败 0表示成功 1 [root@centos01 httpd-2.2.9]# yum install gcc [root@centos01 httpd-2.2.9]# ./configure --prefix=/usr/local/apache2 [root@centos01 httpd-2.2.9]# echo $? 0 [root@centos01 httpd-2.2.9]# make Making all in srclib make[1]: Entering directory `/usr/local/src/httpd-2.2.9/srclib' Making all in apr ... [root@centos01 httpd-2.2.9]# echo $? 0 [root@centos01 httpd-2.2.9]# make install Making install in srclib make[1]: Entering directory `/usr/local/src/httpd-2.2.9/srclib' ... [root@centos01 httpd-2.2.9]# echo $? 0 [root@centos01 httpd-2.2.9]# ls /usr/local/apache2/ # 查看安装目录 bin build cgi-bin conf error htdocs icons include lib logs man manual modules
相关推荐
flycappuccino 2020-09-27
87901735 2020-08-19
ningningmingming 2020-07-26
VFCSDN 2020-07-05
87447007 2020-07-04
yudiewenyuan 2020-06-09
wannagonna 2020-06-08
杨友山 2020-06-03
89284553 2020-05-26
lizhengfa 2020-05-02
yishouwangnian 2020-06-21
昭君出塞 2020-06-04
FCLAMP 2020-05-20
xiemanR 2020-09-21
数据人 2020-10-26
张立军的架构之路 2020-09-28