时光2020

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

局域网yum源配置(纯内网)并安装development tools

 

准备工作:

  • yum源安装服务器一台
  • Centos的镜像文件一份

开始配置

一、配置局域网本地yum源

1、上传Centos系统镜像文件到yum源安装服务器/home目录下
2、在/mnt目录下创建cdrom目录
3、执行挂载命令


mount -o  loop /home/CentOS-7-x86_64-DVD-1708.iso   /mnt

4、备份原有repo文件,新建repo文件

mkdir /etc/yum.repos.d/bak -p
mv /etc/yum.repos.d/* /etc/yum.repos.d/bak
cat<<EOF>/etc/yum.repos.d/local.repo
[local]
name=local
baseurl=file:///mnt
enabled=1
gpgcheck=0
gpgkey=file:///mnt/cdrom/rpm-gpg/RPM-GPG-KEY-CentOS-7
EOF

 

5、清除yum原有信息,载入新的缓存

yum clean all
yum makecache

 6、测试本地yum源

yum repolist   #查看当前yum源可用资源数;repolist显示不为0说明本地yum源搭建成功
或
yum list       #显示所有可安装的软件清单

二、配置局域网yum源 

1.关闭服务端防火墙

systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld

 2、安装http服务

yum install -y httpd
systemctl start httpd

 3、验证http服务是否启动
在浏览器中输入服务器ip验证

 

4、创建软连接

ln -s /mnt/cdrom/ /var/www/html/centos7

 测试访问

 

 5、在同一局域网内其他服务器配置yum源地址

 

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://192.168.100.88/centos7
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=http://192.168.100.88/centos7
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=http://192.168.100.88/centos7
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=http://192.168.100.88/centos7
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
6、清除yum原有信息,载入新的缓存
yum clean all
yum makecache

 7、测试本地yum源

 

yum repolist   #查看当前yum源可用资源数;repolist显示不为0说明本地yum源搭建成功
或
yum list       #显示所有可安装的软件清单

三、Yum安装development tools

yum groupinstall "Development Tools"

 

yum groupinstall "KDE (K Desktop Environment)"
yum install pirut k3b mikmod
yum groupinstall "Server Configuration Tools"
yum groupinstall "Sound and Video"
#yum groupinstall "GNOME Desktop Environment"
yum groupinstall "Legacy Software Support"
yum groupinstall "Development Libraries"
#yum groupinstall "Windows File Server"
yum groupinstall "System Tools"
yum groupinstall "X Window System"
yum groupinstall "Chinese Support"

 

 

posted on 2022-05-13 10:03  时光2020  阅读(2295)  评论(0编辑  收藏  举报