Linux study 1 ---------- create a local yum source in Linux, ---------- linuxyum
I just started learning and used it as a note to record what I learned
I. mount a file
Put the iso file in the virtual machine. You can choose to share the file or upload it through a tool connected to Linux.
My uploads on/root/CentOS-6.6-x86_64-bin-DVD1.iso
Create a mount location: mkdir/root/iso
Mount the image file: mount-o loop/root/CentOS-6.6-x86_64-bin-DVD1.iso/root/iso/
2. Modify the yum configuration file to install createrepo
Back up the yum file:
Cd/etc/yum. repos. d/
Rename the file ending with repo: rename. repo. repo. bak *
Copy a file to configure the yum Source: cp CentOS-Base.repo.bak CentOS-Local.repo
Modify the configuration CentOS-Local.repo file: The vim CentOS-Local.repo content is as follows
[Cento6.6-dvd1]
Name = CentOS-Local
Baseurl = file: // root/iso
Enabled = 1
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Clear yum Source: yum clean all
View yum Source: yum repolist all
Install httpd and createrepo using yum:
Yum install-y httpd
Yum install-y createrepo
3. Copy the Packas package to the Apache path
Switch path: cd/var/www/html
Create a file: mkdir centos6.6
Copy Packages: cp-r/root/iso/Packages // var/www/html/centos6.6/
4. Start the Apache server service
View httpd status: services httpd status
Modify the CentOS-Local.repo configuration file: baseurl = file: // root/iso to http: // 192.168.146.233/centos6.6/Packages/
Disable firewall: service iptables stop
Start httpd service: service httpd start
Whether the Website access httpd starts properly: http: // 192.168.146.233/centos6.6/Packages/
Switch to the Packages Directory: cd/var/www/html/centos6.6/Packages/
# Start to create repodata data: createrepo. (Note: There is a "." After createrepo ".")
Clear yum Source: yum clean all
View yum Source: yum repolist all
If the yum source has an available package, the production is complete.
To use the yum installation package on other machines, you only need to modify/etc/yum. repos. d/The baseurl path of the CentOS-Local.repo file points to this line, so that each machine does not have to access the network