linux create local repo

In this example
- the server 192.168.0.1 contains all packages in /export/rhel72/Packages
- the /export directory is exported

log in to vm_client
1. create a mountpoint:
# mkdir /software
create a repodir
# mkdir /localrepo

2. mount the /export/ directory from the server to /software
# mount 192.168.0.1:/export /software

3. copy the rhel72 packages from the server to /localrepo
# cd /software/rhel72/Packages
# tar cvf - . | ( cd /localrepo ; tar xvf - )

this will take some time

4. install the following packages from /software
# cd /software/rhel72/Packages
# rpm -ivh python-delta*
# rpm -ivh deltarpm*
# rpm -ivh createrepo*

5. create the repository
# createrepo /localrepo

this will take some more time

6. create the repo file
# echo "[local]" > /etc/yum.repos.d/local.repo
# echo "name=localrepo" >> /etc/yum.repos.d/local.repo
# echo "baseurl=file:///localrepo/" >> /etc/yum.repos.d/local.repo
# echo "enabled=1" >> /etc/yum.repos.d/local.repo
# echo "gpgcheck=0" >> /etc/yum.repos.d/local.repo

7. because there is no internet connection, remove the
repo file redhat.repo
# rm /etc/yum.repos.d/redhat.repo

8. run the following command
# yum clean all

9. test your repository
# yum install ksh

This entry was posted in Uncategorized. Bookmark the permalink.

Comments are closed.