2018.4.19 Second class in five weeks

yum replace domestic source

First, restore the experiment from yesterday and restore the yum backup.

[root@localhost ~]# cd /etc/yum.repos.d #Enter the directory
[root@localhost yum.repos.d]# ls #View the current file
dvd.repo
[root@localhost yum.repos.d]# rm -f dvd.repo #rm delete dvd.repo file
[root@localhost yum.repos.d]# cp /etc/yum.repos.d.bak/* /etc/yum.repos.d
#cp copied files Download all configuration files to this directory.

Replace the yum source and delete the source package

[root@localhost yum.repos.d]# ls #The first package to view the file is the core one in the source package
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS- CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
[root@localhost yum.repos.d]# rm -f CentOS-Base.repo #Delete this file

Next, go to download a source package, domestic

[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo #Here , since the source package is deleted, wget cannot be used
-bash: wget : command not found

[root@localhost yum.repos.d]# curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo #download , followed by a big "O"

Check if the download is complete

[root@localhost yum.repos.d]# ls
CentOS7-Base-163.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo

Test it and install it with yum

[root@localhost yum.repos.d]# yum install zsh
[root@localhost yum.repos.d]# yum clean all #Clear cache
[root@localhost yum.repos.d]# yum list #This step is necessary Executed, so that a cache can be generated, which is convenient for next use.

yum install RMP package, epel

Install the extension source epel (alternate source package)

[root@localhost yum.repos.d]# yum install -y epel-release
[root@localhost yum.repos.d]# yum list #This step is necessary to generate a cache for the next use.
[root@localhost yum.repos.d]# yum list |grep epel

How to install an rpm package;

  • Format yum install -y package name --downloadonly

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

View the default download path of rpm

[root@localhost yum.repos.d]# ls /var/cache/yum/x86_64/7/updates/
794f09bfe14c121f746efba16bb0aa24b38c2506bb93d0939e01df1158efc56d-primary.sqlite.bz2 packages
cachecookie repomd.xml
gen
2018.4.19 Second class in five weeks

If you specify the downloaded rpm path (if it is already installed, it cannot be specified)

[root@localhost yum.repos.d]# yum install -y znc --downloadonly --downloaddir=/tmp/
[root@localhost yum.repos.d]# ls /tmp/
1.txt.gz
d6z
dior1
ks-script-5ToQJK
systemd-private-d4565e90fd384c749a36d51b19e3e377-chronyd.service-91Lo0Y
systemd-private-d4565e90fd384c749a36d51b19e3e377-vgauthd.service-XKotz4
systemd-private-d4565e90fd384c749a36d51b19e3e377-vmtoolsd.service-NZwSqa
yum.log
yum_save_tx.2018-04-15.15-35.qfXziD.yumtx
yum_save_tx.2018-04-16.23-44.QDLlX9.yumtx
znc-1.6.6-1.el7.x86_64.rpm
2018.4.19 Second class in five weeks

To install the source code package, you must first download a source code package, according to your own needs

[root@localhost httpd-2.4.33]# echo $? Indicates whether the previous command is correct

安装源码包通常需要以下3个步骤:
1. ./configyre。这一步可以定制功能,加上相应的选项即可;
具体有什么选项可以通过命令 ./configure --help查看。
这一步会自动检测你的Linux系统于相关的套件是否有编译该源码包时所需要的库,
因为一但缺少某个库,就能完成编译。
2. make。使用这个命令,会进行预设参数编译。
3. make install,用于安装,用于创建相关软件的存放目录和配置文件
  • The default download path of the source package is /usr/local/src/ under this directory
  • First download an apache package, r.aminglinux.com can be found on this website

    [root@localhost src]# wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.33.tar.gz

  • Then unzip, tar

    [root@localhost src]# ls
    httpd-2.4.33.tar.gz
    [root@localhost src]# tar -zxvf httpd-2.4.33.tar.gz

  • Go to the unzipped document

    2018.4.19 Second class in five weeks

  • ./configuer --prefix=/usr/local/apache2, prefix specifies the installation path, apache2 indicates the version

    [root@localhost httpd-2.4.33]# ./configure --prefix=/usr/local/apache2
    [root@localhost httpd-2.4.33]# echo $? #Because of an error in the previous command,
    1 #here Indicates a non-zero number, which means there is an error

  • Due to the previous command, the dependency package (gcc compiler) is missing, continue to install.

    [root@localhost src]# tar -zxvf apr-1.6.3.tar.gz
    [root@localhost apr-1.6.3]# yum install -y apr
    [root@localhost apr-1.6.3]# ./configure --prefix=/usr/local/apache2
    [root@localhost apr-1.6.3]# echo $?
    0

  • At this point, the Makefile is successfully generated. Check the results as follows:

    [root@localhost apr-1.6.3]# ls -l Makefile
    -rw-r--r--. 1 root root 5092 4月 17 00:30 Makefile

  • Compile and install

    [root@localhost apr-1.6.3]# make & make install

  • To check whether the source package is installed, go to the /usr/local/apache2 directory in the corresponding path to see if there are many directories.

    [root@localhost apr-1.6.3]# cd /usr/local/apache2/
    [root@localhost apache2]# ls
    bin build-1 include lib

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324503941&siteId=291194637