7.6 Yum replacing domestic sources
The Yum repository source is linked to a foreign source by default, and sometimes it is slow to download from a foreign source, so we can change the Yum source to a domestic warehouse source
, the steps are as follows:
CD/ETC/YUM.REPOS.D #进入到yum源配置目录
MV Centos-base.repo Centos-base.repo_bak #备份国外仓库源
Curl-o Http://mirrors.163.com/.help/CentOS7-Base-163.repo #下载163国内仓库源
or wget Http://mirrors.163.com/.help/CentOS7-Base-163.repo.
Yum List #查看下载的国内仓库源
7.7 Yum Download RPM package
(1)
Sometimes, it is not enough to have a default warehouse source, you can install the extension source Epel.
Yum install-y epel-release #安装扩展源epel
Yum List | grep Epel #查看扩展源epel包
(2)
Sometimes we need to download some RPM packages locally, so we can use the following command form:
Yum install-y Package Name--downloadonly
The system will download the RPM package to the/var/cache/yum/x86_64/7/directory by default.
You can also download and specify the storage path:
Yum install-y Package name--downloadonly--downloaddir= path
However, when a package is already installed, the above command cannot be used because it will no longer be downloaded, and should be changed slightly at this time:
Yum reinstall-y Package name--downloadonly--downloaddir= path
7.8/7.9 Source Package Installation
The third way to install software in Linux is to install it through the source package, which has the following steps:
Download Source Package--configuration--Install
For example, we want to install Apache with the following approximate steps:
cd/usr/local/src/
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.gz #下载apache
Tar zxvf httpd-2.4.29.tar.gz
CD httpd-2.4.29
./configure--prefix=/usr/local/apache2 #配置/Specify installation directory
Make #编译
Make install #安装
Tips:
Source package recommended in the/USR/LOCAL/SRC directory, easy to manage the source package.
Source package download Suggestions to the official or trustworthy website download, to ensure that the download source package does not have a Trojan and other security threats.
echo $? #返回上一条命令返回值, 0 means yes, 0 means there is an error and can help in troubleshooting .
The source package is unloaded by deleting its installation directory directly, because all of its files are in the installation directory.
2018-1-9 Linux Learning Notes