RHEL7: Create a local repositor

Download an iso image of CentOS 7 available at the CentOS website.
You need to choose between a minimal image, a liveCD image, a DVD image or an ‘everything’ image. To build a local repository, don’t choose the minimal or the liveCD images, prefer the DVD (4GB) or the Everything images (7GB).

Create a directory for the CentOS 7 distribution:

# mkdir -p /var/www/html/centos7

Note: By creating the local repository in the /var/www/html directory, you will be ready to make it available on the network after installing an Apache webserver at a later stage.

Mount the previously downloaded Centos 7 distribution  (called here CentOS-7.0-1406-x86_64-DVD.iso) and copy it locally:

# mount -o loop CentOS-7.0-1406-x86_64-DVD.iso /mnt
# cd /mnt
# tar cvf - . | (cd /var/www/html/centos7; tar xvf -)
# cd /; umount /mnt

Go to the directory where the repository configuration is:

# cd /etc/yum.repo.d

Create the centos7.repo file and type:

[centos7]
name=centos7
baseurl=file:///var/www/html/centos7/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Clean up the yum configuration and check it:

# yum clean all
# yum repolist all

If you regularly add new packages in your local repository, don’t forget to update it. To do that, install the createrepo package and execute it with the repository path as argument:

# yum install -y createrepo
# createrepo /var/www/html/centos7
# yum clean all
# yum repolist all
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值