The centos system sets up the local yum server

  • 2020-05-14 05:47:14
  • OfStack

preface

First of all, in particular, YUM is intended to address the dependencies of RPM, not one of the other software installation modes. Although you can use the yum source directly in centos, it is still isolated from the external network, so you need to set up the local yum source. See the detailed method below.

System: centos 6.5

1. Mount the CD under /mnt


# mount /dev/cdrom /mnt

2. Delete the repo files that come with the system


# cd /etc/yum.repos.d/ 
# mkdir bak 
# mv *.repo bak

3. Install createrepo (actually, you can install createrepo as long as you install createrepo, but you need other dependent packages, so you need to install createrepo as soon as possible)


# cd /mnt/Packages/ 
# rpm -ivh libxml2-python-2.7.6-14.el6.x86_64.rpm  
# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm  
# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm  
# rpm -ivh createrepo-0.9.9-18.el6.noarch.rpm

4. Use createrepo command to create yum warehouse and create index information

Note: here we have built the yum warehouse at /doiido/local


# mkdir /doiido/local 
# cp -rv /mnt/Packages/* /doiido/local 
# cd /doiido/local 
# createrepo -v /doiido/local

5. If grouping information is needed


# cp /mnt/repodata/b4e0b9342ef85d3059ff095fa7f140f654c2cb492837de689a58c581207d9632-c6-x86_64-comps.xml /doiido/local/comps.xml 
# createrepo -g /doiido/local/comps.xml /doiido/local

6. Edit your repo files


# vi /etc/yum.repos.d/local.repo 
# The library name  
[local_server] 
 
# The name of the description  
name=Thisis a local repo 
 
#yum The source directory  
baseurl=file:///doiido/local 
 
# Whether to enable the yum The source, 0 For the disabled  
enabled=1 
 
# check GPG-KEY ( 0 In order not to check, 1 To check)  
gpgcheck=0

7. Load the yum cache


# yum clean all 
# yum makecache

8. Test download


# yum -y install php

You can see here that you can install php directly without downloading it from the Internet.

conclusion

The above is the method of setting up the local yum server under the centos system. I hope the content of this paper can bring you some help in your study or work. If you have any questions, you can leave a message to communicate.


Related articles: