CentOS7 build local yum source server

Source: Internet
Author: User

CentOS7 build local yum source server

The first step, with a U disk to CentOS-7.0-1406-x86_64-DVD.iso

CentOS-7.0-1406-x86_64-DVD.iso copy to/tmp under root Partition
Step 2: open Terminal
Run su root # log on to the root account
Enter the root password


Step 3: copy the CD image file to/usr/local/src
Run cp/tmp/CentOS-7.0-1406-x86_64-DVD.iso/usr/local/src # If you copy the file to this directory directly with the File Manager, the system will prompt that you have insufficient permissions, first copy the past, finally, use the File Manager to remove the image in the tmp directory.


Step 4: attach a CD image
Run mkdir/media/CentOS7-Localsource # create the media/CentOS7-Localsource directory for later mounting

Run mount-t iso9660-o loop/usr/local/src/CentOS-7.0-1406-x86_64-DVD.iso/media/CentOS7-Localsource
# Mount the CD image under the/usr/local/src directory in read-only mode


Step 5: Set the automatic mounting of the CD image
Run vi/etc/fstab

(If fstab is entered incorrectly, the host cannot be started normally and enters the emergency mode emergency state ,)

Add the last line (Press a to enter edit mode, Press ESC to exit edit mode, and then press shift +: input: wq! Press enter to save and exit)
/Usr/local/src/CentOS-7.0-1406-x86_64-DVD.iso/media/CentOS7-Localsource iso9660 ults, ro, loop 0


Step 6: configure the source
Run vi/etc/yum. repos. d/CentOS7-Localsource.repo # To open the repo file, which is created if it does not exist
Press a to enter the editing mode
Enter the following content
CentOS7-Localsource
Name = CentOS7-Localsource
Baseurl = file: // media/Centos7-Localsource
Enabled = 1
Gpgcheck = 0


Press ESC to exit editing
Press Shift +: input: wq! Press enter to save and then exit


Step 7: generate the local yum Cache
Execute yum makecache


Delete the image in/tmp using the File Manager.

Now the local yum source has been set up!


In addition, if the local image DVD. iso is not available, configuring the domestic image site is also a good choice. After all, foreign image sites sometimes have poor network speeds ~
Recommend the source of HKUST
3. https://lug.ustc.edu.cn/wiki/mirrors/help/centos China University of Science and Technology mirror Station

Back up CentOS-Base.repo first
Run mv/etc/yum. repos. d/CentOS-Base.repo/etc/yum. repos. d/CentOS-Base.repo.backup


Use the File Manager to copy the downloaded *. repo to the/tmp directory,
On the terminal

Run cp/tmp/CentOS-Base.repo/etc/yum. repos. d/
Run the yum makecache command again.
In this way, the network image site is also configured.

The preceding content can be copied and pasted to terminal for execution.
Failed to set up the local image in this tutorial, the following reasons may be involved:
1. The image name is inconsistent with the command input, such as the CentOS-7.0-1406-x86_64-DVD.iso being renamed
2. Command error. For example, fstab is entered as fatab.

3. If a local server is not set up, use a local link in a format similar to ftp or http.

 

For more YUM tutorials, see the following:

RedHat 6.2 modify yum source in Linux use CentOS source for free

Configure the epel yum Source

Redhat local yum source configuration

Description of yum configuration file

Install yum in RedHat 6.1)

YUM installation and cleaning

Build yum local source on CentOS 6.4

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.