Yum replaces domestic source, yum downloads rpm package, source package installation

yum replace domestic source

The yum source is downloaded from foreign websites by default, and the speed is relatively slow. Can be replaced with a content source.

Steps: ls /etc/yum.repos.d to remove or rename CentOS-Base.repo.

[root@glinux-01 ~]# ls /etc/yum.repos.d
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo

Download the CentOS7-Base-163.repo file, command: wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

This command will download the file to the current directory and move it to /etc/yum.repos.d

[root@glinux-01 ~]# ls
1.txt  anaconda-ks.cfg  bad  boduo.av  CentOS7-Base-163.repo  cuowu  test.sh  zhengque

Note: It is best to install the wget package first, and then remove the CentOS-Base.repo. Or can't run the wget command

You can also download the CentOS7-Base-163.repo file with curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo.

yum clean all clears the cache.

Install the extension source epel

Some sources are useful, but the built-in sources are not, you need to install the extension source

method:

  • yum install -y epel-release install extension source
  • yum list|grep epel view extension source

 

yum download rpm package

  • yum install -y package name --downloadonly //Only download the package, not install it.
  • ls /var/cache/yum/x86_64/7/ Downloaded package save directory
  • yum install -y package name --downloadonly --downloaddir=path (specify the path to download)
  • yum reinstall -y package name --downloadonly --downloaddir=path (reinstall reinstall)

 The downloaded package is saved in the directory, and the folder downloaded from the repository is in the folder.

[root@glinux-01 ~]# ls /var/cache/yum/x86_64/7/
base  extras  timedhosts  timedhosts.txt  updates

Source package installation

Example: Apache source package installation steps

  • cd /usr/local/src/ Source package placement address, by convention, easy to find
  • wget  http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.32.tar.gz  //apache download address (look for the latest address online)
  • tar zxvf httpd-2.2.32.tar.gz
  • cd httpd-2.2.32
  • ./configure --prefix=/usr/local/apache2 (the specified path is /usr/local/apache2)
  • make
  • make install
  • To uninstall is to delete the installed files

After downloading, extract the tar -zxvf httpd-2.4.29.tar.gz 

[root@glinux-01 src]# ls
httpd-2.4.29  httpd-2.4.29.tar.gz
[root@glinux-01 httpd-2.4.29]# ls
ABOUT_APACHE     BuildBin.dsp    emacs-style     LAYOUT        NOTICE            srclib
acinclude.m4     buildconf       httpd.dep       libhttpd.dep  NWGNUmakefile     support
Apache-apr2.dsw  CHANGES         httpd.dsp       libhttpd.dsp  os                test
Apache.dsw       CMakeLists.txt  httpd.mak       libhttpd.mak  README            VERSIONING
apache_probes.d  config.layout   httpd.spec      LICENSE       README.cmake
ap.d             configure       include         Makefile.in   README.platforms
build            configure.in    INSTALL         Makefile.win  ROADMAP
BuildAll.dsp     docs            InstallBin.dsp  modules       server

The files README and INSTALL in the directory are generally installation information 

[root@glinux-01 httpd-2.4.29]# cat INSTALL 

  APACHE INSTALLATION OVERVIEW

  Quick Start - Unix
  ------------------

  For complete installation documentation, see [ht]docs/manual/install.html or
  http://httpd.apache.org/docs/2.4/install.html

     $ ./configure --prefix=PREFIX    //指定安装路径
     $ make                           //译成电脑识别的二进制文件
     $ make install                   //用于创建相关软件的存放目录和配置文件
     $ PREFIX/bin/apachectl start     //启动方法

./configure --prefix=/usr/local/apache2 (there are many options, you can view ./configure --help) specify the path

[root@glinux-01 httpd-2.4.29]# ./configure --prefix=/usr/local/apache2
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure: 
configure: Configuring Apache Portable Runtime library...
configure: 
checking for APR... no
configure: error: APR not found.  Please read the documentation.
[root@glinux-01 httpd-2.4.29]# echo $?
1

居然报错。。。configure: error: APR not found.  Please read the documentation.

Online search solutions: https://www.cnblogs.com/visec479/p/5160297.html

echo $? can detect whether the previous command was executed correctly (0) or incorrectly (1)

Download the apr package: wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz 

  1. [root @xt  test]# tar -zxf apr-1.4.5.tar.gz decompress
  2. [root@xt test]# cd  apr-1.4.5  
  3. [root@xt apr-1.4.5]# ./configure --prefix=/usr/local/apr  安装

Error again!

[root@glinux-01 apr-1.4.5]# ./configure --prefix=/usr/local/apr
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.4.5
checking for chosen layout... apr
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/src/apr-1.4.5':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

install gcc yum install gcc

Reinstall: [root @xt  apr-1.4.5]# ./configure --prefix=/usr/local/apr install

Reinstall ./configure --prefix=/usr/local/apache2 success

make

make install

 

 

 

 

Guess you like

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