1、本地yum搭建環(huán)境準(zhǔn)備
--最小化安裝CentOS7.2系統(tǒng)(CentOS-7-x86_64-Minimal-1511.iso)
--IPADDR=123.45.67.111/24
1.1 關(guān)閉防火墻、關(guān)閉SELinux
目前成都創(chuàng)新互聯(lián)已為1000+的企業(yè)提供了網(wǎng)站建設(shè)、域名、虛擬空間、網(wǎng)站托管、企業(yè)網(wǎng)站設(shè)計(jì)、順平網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
1.2 安裝基本軟件
yum -y install vim createrepo httpd
1.3 備份CentOS-Base.repo文件
mkdir /etc/yum.repos.d/backup
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/backup
1.4 重建repo文件
echo '[ocata]
name=CentOS-Ocata
baseurl=https://mirrors.aliyun.com/centos/7/cloud/x86_64/openstack-ocata/
enable=1
gpgcheck=0
[ocata-extras]
name=CentOS-Ocata-extras
baseurl=https://mirrors.aliyun.com/centos/7/extras/x86_64/
enable=1
gpgcheck=0
[centos7]
name=Centos-7
baseurl=https://mirrors.aliyun.com/centos/7/os/x86_64/
enable=1
gpgcheck=0
'>/etc/yum.repos.d/CentOS-Base.repo
1.5 更新系統(tǒng)及重啟
yum clean all
yum makecache
yum -y update
reboot
1.6 加載遠(yuǎn)端軟件包(共12G,我下載用時(shí)大約20分鐘)
cd /var/www/
reposync --repoid=ocata
reposync --repoid=ocata-extras
reposync --repoid=centos7
1.7 生成repodata
createrepo /var/www/ocata/
createrepo /var/www/ocata-extras/
createrepo /var/www/centos7/
1.8 配置httpd服務(wù)
vim /etc/httpd/conf/httpd.conf
119行將DocumentRoot "/var/www/html"改為DocumentRoot "/var/www/"
131行將改為
1.9 啟動(dòng)httpd并開(kāi)機(jī)啟動(dòng)
systemctl start httpd
systemctl enable httpd
1.10 驗(yàn)證httpd服務(wù)
瀏覽器地址欄輸入http://123.45.67.111/ocata 驗(yàn)證
2、重建本地repo文件以使用yum源
2.1 備份本地CentOS-Base.repo文件
mkdir /etc/yum.repos.d/backup
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/backup
2.2 重建repo文件
echo '[ocata]
name=CentOS-Ocata
baseurl=http://123.45.67.111/ocata/
enable=1
gpgcheck=0
[ocata-extras]
name=CentOS-Ocata-extras
baseurl=http://123.45.67.111/ocata-extras/
enable=1
gpgcheck=0
[centos7]
name=Centos-7
baseurl=http://123.45.67.111/centos7/
enable=1
gpgcheck=0
'>/etc/yum.repos.d/CentOS-Base.repo
2.3 測(cè)試yum配置及生成緩存文件
yum clean all
yum makecache
yum repolist all