centos7 install yum source

centos7 server, no yum, no wget command really unable to move, and after summary inquiry, now count get, sum up the experience, so we have to waste time looking for the cause;

Yum yum install wget need to install the rpm package, so the premise is to have wget, wget is no package on the server how to do, go home to look for the source of the mirror, I'm looking for here is the 163, HTTP: // Mirrors. 163.com/centos/7/os/x86_64/Packages/

 

What needs to be found for download from the inside down like, pay attention, if you see someone else's blog, give an example, you go to download and found that the package does not exist , then go to this address to find the latest downloads

1. Download the rpm package wget

First go to http://mirrors.163.com/centos/7/os/x86_64/Packages/ find wget rpm package, copy the link, use the curl command to download

 

 

 Using curl to download

curl http://mirrors.163.com/centos/7/os/x86_64/Packages/wget-1.14-18.el7_6.1.x86_64.rpm

After just great with the rpm command to install wget:

rpm -ivh wget-1.14-18.el7_6.1.x86_64.rpm

2. Install yum

  1. Delete the original yum

# rpm -aq|grep yum|xargs rpm -e --nodeps

 2. Download yum, pay attention to your LINUX system version, version of what went into the relevant version of the catalog to download. However, the small version of the directory would not have entered. Such as version 6.5, you only need to enter 6 catalog, version 7.2, simply enter 7 directory

  Some find the following rpm package and download

1、yum-*.rpm    

2、yum-metadata-parser-*.rpm

3、yum-plugin-fastestmirror-*.rpm 

4、python-iniparse-*.rpm

3. Use wget to download

# wget http://mirrors.163.com/centos/7/os/i386/Packages/yum-3.2.29-60.el6.centos.noarch.rpm 
# wget http://mirrors.163.com/centos/7/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm  
# wget http://mirrors.163.com/centos/7/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm 
# wget http://mirrors.163.com/centos/7/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

 4. When the download package safety switch dependent yum

# rpm -ivh python-iniparse-*.rpm
# rpm -ivh yum-*.rpm  yum-metadata-parser-*.rpm  yum-plugin-fastestmirror-*.rpm 

NOTE: Because of file 1 have interdependencies, so install python-iniparse - * rpm file, and then install the other three files, so that the error will not.

         2.rpm -ivh to install rpm --nodeps --force (plus --nodeps --force for the mandatory installation, regardless of dependent files)

         3. After you have installed, you can use the rm command to delete the current RPM files in the directory (Bahrain on useless)

5. Download yum-3.4.3 ( if the package is installed yum-3.4.3-163.el7.centos.noarch.rpm this can be ignored, the package is tar )

HTTP wget: // yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz 
tar -zxvf yum- 3.4 . 3 .tar.gz 
cd yum - 3.4 . 3 
executed:. /yummain.py Update 
select y
May report CRITICAL execution ./yummain.py update: yum.cli: Config Error: Error accessing file for config file: ///etc/yum.conf, meaning there is no file in the etc yum.conf 
created in the etc you can: touch /etc/yum.conf

3. Modify the yum source

  1. Access to the directory system yum source:

#cd /etc/yum.repos.d

  2. Download yum source

#wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

  3. Modify the source file name (note need to be deleted before, or instead .bak file)

#mv CentOS7-Base-163.repo CentOS-Base.repo

4. Run makecache generate the cache to validate the configuration

#yum makecache  

5. Verify source yum

#yum repolist 
see if there is proof of identity 163 domestic 163 configuration mirroring success

7. Run yum clean all (equivalent to yum cleanheaders; yum cleanpackages);

Clean All # yum 
yum will download the package and the header is stored in the cache, rather than automatically deleted. If you feel that consume disk space, you can use yum clean commands to clear, more precise usage is yum clean headers clear the header, yum clean packages remove the downloaded rpm package, yum clean all a Clear All.

8. Update YUM file updated all packages

#yum  update

10.yum common operations

yum install XXX

yum remove XXX

yum list

yum list installed

 

 

 

 

Guess you like

Origin www.cnblogs.com/guanbin-529/p/11980400.html