1、安装https和createrepo
yum install httpd createrepo -y
2、将ISO镜像挂载上
mkdir -p /data/cdrom/ 创建挂载目录
mount /dev/cdrom /data/cdrom/ 将ISO镜像挂载在创建的目录上
3、创建存放yum源的目录
mkdir /var/www/html/CentOS/
4、将yum源拷贝到上面的目录
\cp -a /data/cdrom/Packages /var/www/html/CentOS/
5、进入/var/www/html/
createrepo CentOS/
ls CentOS/
Packages repodata yum源搭建成功
6、将系统本身的repo文件备份
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bck
7、将之前的系统的CentOS-Base.repo删除,创建一个新的repo文件
cat CentOS.repo
[base]
name=CentOS
baseurl=http://102.168.1.67/CentOS/
8、启动httpd服务
/etc/init.d/httpd start
Starting httpd: httpd: apr_sockaddr_info_get() failed for test
httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName [ OK ]
9、列出可用的源
yum repolist
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
repo id repo name status
base CentOS
4,184
repolist: 4,184
10、安装一个tree命令
yum install tree -y