搭建本地YUM源

建立本地yum源html


1,安裝一個Apache環境,我這裏就是採用yum安裝,比較方便。
vim

[root@Ansible ]#yum -y install httpd

稍微改一下配置文件便可
centos

[root@Ansible ]# vim  /etc/httpd/conf/httpd.conf 
改一下ServerName 
ServerName 10.93.58.70:80

重啓一下服務
瀏覽器

[root@Ansible ]# /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

最後在瀏覽器上輸入http://10.93.58.70/若是有http默認的頁面就對了。ide


2,新建一個centos6文件夾
測試

[root@Ansible ]#mkdir -p /var/www/html/centos6

3,掛載一個ISO鏡像文件,並將文件拷貝到/var/www/html/centos6路徑下面
url

[root@Ansible ]#mount   /dev/dvd/ /mnt/
[root@Ansible ]#cd /mnt
[root@Ansible mnt ]# cp -rp ./*  /var/www/html/centos6/

4,刪除 /etc/yum.repods.d下面的文件只保留CentOS-Base.repo
spa

[root@Ansible yum.repos.d]#vim  CentOS-Base.repo
[base]
name=CentOS-$releasever -Base
baseurl=http://10.93.58.70/centos6/
enabled=1
gpgcheck=0
gpgkey=http://10.93.58.70/centos6/RPM-GPG-KEY-CentOS-6

5,最後測試一下鏡像
rest

[root@Ansible ~]#yum repolist
Loaded plugins: aliases, changelog, fastestmirror, kabi, ovl, presto, refresh-packagekit,
              : security, tmprepo, verify, versionlock
Loading support for CentOS kernel ABI
Loading mirror speeds from cached hostfile
repo id                               repo name                                    status
base                                  CentOS-6 -Base                               6,713
repolist: 6,713

6,把這臺設置好的CentOS-Base.repo拷貝一份直接導入到新安裝的系統裏面去這樣就可使用本地的yum源了。
htm

[root@Ansible ~]# scp -rp /etc/yum.repos.d/CentOS-Base.repo  root@10.93.58.72: /etc/yum.repos.d/CentOS-Base.repo
[root@Ansible ~]#yum repolist

7.結束,收工!

相關文章
相關標籤/搜索