- Java锁的逻辑(结合对象头和ObjectMonitor)
- 还在用饼状图?来瞧瞧这些炫酷的百分比可视化新图形(附代码实现)⛵
- 自动注册实体类到EntityFrameworkCore上下文,并适配ABP及ABPVNext
- 基于Sklearn机器学习代码实战
1、企业内网需求:企业内部许多服务器是不能连接互联网,但每台centos主机安装软件包时都配置本地yum源很麻烦,也缺少第三方yum源,因此在内网搭建一台yum源服务器满足这一需求,同时网络层面策略只允许此yum源服务器每周日晚限时联网同步阿里云的yum源.
参考连接: http://blog.itpub.net/70004783/viewspace-2790196/ 。
2、准备两台测试主机,一台用作yum源服务器(能连互联网),一台用作客户端.
3、系统版本:CentOS 7.9 。
。
备份原系统的repo 。
[root@yumserver ~]# mkdir /etc/yum.repos.d/backup
[root@yumserver ~]# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup
添加阿里云yum源并缓存(Centos-7.repo是软件仓库配置文件,epel-7.repo是扩展源、提供额外的软件包) 。
[root@yumserver ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
[root@yumserver ~]# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
[root@yumserver ~]# yum makecache
[root@yumserver ~]# yum repolist
[root@yumserver ~]# yum install -y wget make cmake gcc gcc-c++ pcre-devel zlib-devel openssl openssl-devel httpd yum-utils createrepo
备注:
yum-utils:yum-utils是yum的工具包集合,reposync一个同步工具。
createrepo:createrepo是一个对rpm文件进行索引建立的工具,就是对指定目录下的rpm文件进行检索,把每个rpm文件的信息存储到指定的索引文件中,这样方便远程yum命令在安装更新时进行检索。
httpd:通过Apache软件提供web服务,也可以使用nginx。
创建存放软件包目录/mirror,(chown设置文件所有者和文件关联组,chmod控制用户对文件的权限) 。
[root@yumserver ~]# mkdir -p /mirror
[root@yumserver ~]# chown -R apache:apache /mirror
[root@yumserver ~]# chmod -R 755 /mirror
同步阿里云yum源软件包 。
###参数-n指下载最新软件包,-p指定目录,指定本地的源--repoid(如果不指定就同步本地服务器所有的源),下载过程比较久(10个小时左右)
[root@yumserver ~]# reposync -n --repoid=extras --repoid=updates --repoid=base --repoid=epel -p /mirror
[root@yumserver ~]# du -sh /mirror/*
9.0G /mirror/base
16G /mirror/epel
323M /mirror/extras
3.3G /mirror/updates
createrepo -po /mirror/base/ /mirror/base/
createrepo -po /mirror/extras/ /mirror/extras/
createrepo -po /mirror/updates/ /mirror/updates/
createrepo -po /mirror/epel/ /mirror/epel/
createrepo --update /mirror/base/
createrepo --update /mirror/extras/
createrepo --update /mirror/updates/
createrepo --update /mirror/epel/
6.1、启动Apache(httpd)服务(如果没有httpd,需要yum install -y httpd 安装一下) 。
[root@yumserver ~]# systemctl start httpd
[root@yumserver ~]# systemctl enable httpd
[root@yumserver ~]# systemctl status httpd
6.2、系统防火墙放行80端口(apache服务使用的是80端口) 。
[root@yumserver ~]# firewall-cmd --permanent --zone=public --add-port=80/tcp
success
[root@yumserver ~]# firewall-cmd --reload
success
备注: 必要时可以运行 systemctl restart httpd 重启一下服务.
6.3、关闭selinux(SELINUX=disabled) 。
[root@yumserver ~]# vi /etc/selinux/config
6.4、配置httpd.conf文件 。
[root@yumserver ~]# vi /etc/httpd/conf/httpd.conf
DocumentRoot "/mirror/"
<Directory "/mirror/">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Require all granted
</Directory>
注意: 上面配置的httpd.conf文件,需要找到如下图DocumentRoot字样的行进行更改,而不是直接复制粘贴插入.
6.5、修改web界面的 index.html 文件 。
###修改Apache默认首页index.html,直接复制粘贴执行
cat << EOF > /usr/share/httpd/noindex/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CentOS 7 镜像</title>
<script>document.createElement("myHero")</script>
<style>
myHero {
display: block;
background-color: #ddd;
padding: 10px;
font-size: 20px;
}
</style>
</head>
<body>
<h1>简介</h1>
<hr>
<p>CentOS,是基于 Red Hat Linux 提供的可自由使用源代码的企业级 Linux 发行版本,是一个稳定,可预测,可管理和可复制的免费企业级计算平台。</p>
<hr>
<br>
<br>
<h1>CentOS 7 配置内部YUM源</h1>
<br>
<h2>1、备份</h2>
<myHero>mkdir /etc/yum.repos.d/backup</myHero>
<myHero>mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup/</myHero>
<br>
<h2>2、下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/ </h2>
<myHero>curl -o /etc/yum.repos.d/CentOS-Base.repo http://xx.xx.xx.xx/repo/CentOS-Base.repo</myHero>
<br>
<h2>3、运行 yum makecache 生成缓存</h2>
<br>
<h2>4、运行 yum repolist 查看已经生成缓存</h2>
<br>
<br>
</body>
</html>
EOF
注意: 上文中的 http://xx.xx.xx.xx 填写自身yum源服务器的ip地址.
创建repo文件夹 。
[root@yumserver ~]# mkdir -p /mirror/repo/
###复制粘贴执行,注意:xx.xx.xx.xx需要更改为服务器ip地址。
[root@yumserver ~]# cat << EOF > /mirror/repo/CentOS-Base.repo
[base]
name=CentOS- Base - xx.xx.xx.xx
failovermethod=priority
baseurl=http://xx.xx.xx.xx/base/
enable=1
gpgcheck=0
#released updates
[updates]
name=CentOS- Updates - xx.xx.xx.xx
failovermethod=priority
baseurl=http://xx.xx.xx.xx/updates/
enable=1
gpgcheck=0
#additional packages that may be useful
[extras]
name=CentOS- Extras - xx.xx.xx.xx
failovermethod=priority
baseurl=http://xx.xx.xx.xx/extras/
enable=1
gpgcheck=0
#additional packages that may be useful
[epel]
name=CentOS- Epel - xx.xx.xx.xx
failovermethod=priority
baseurl=http://xx.xx.xx.xx/epel/
enable=1
gpgcheck=0
EOF
登录客户端操作系统执行以下命令( 注意: xx.xx.xx.xx为yum源服务器的ip地址) 。
[root@client ~]# mkdir /etc/yum.repos.d/backup/
[root@client ~]# mv /etc/yum.repos.d/* /etc/yum.repos.d/backup/
[root@client ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://xx.xx.xx.xx/repo/CentOS-Base.repo
[root@client ~]# yum makecache
用户也可以用浏览器访问 http://xx.xx.xx.xx 查看配置客户端yum源的方法 。
编辑脚本 。
[root@yumserver ~]# cat /mirror/script/centos_yum_update.sh
#!/bin/bash
echo 'Updating Aliyum Source'
DATETIME=`date +%F_%T`
exec > /var/log/aliyumrepo_$DATETIME.log
reposync -np /mirror
if [ $? -eq 0 ];then
createrepo --update /mirror/base
createrepo --update /mirror/extras
createrepo --update /mirror/updates
createrepo --update /mirror/epel
echo "SUCESS: $DATETIME aliyum_yum update successful"
else
echo "ERROR: $DATETIME aliyum_yum update failed"
fi
添加定时任务,每周一凌晨1点执行 。
[root@yumserver ~]# crontab -l
0 1 * * 1 /bin/bash /mirror/script/centos_yum_update.sh
至此,结束。。.
。
问题:有时服务器端的yum源仓库索引没有更新成功。
手动更新:
[root@yumserver ~]# createrepo --update /mirror/base/
[root@yumserver ~]# createrepo --update /mirror/extras/
[root@yumserver ~]# createrepo --update /mirror/updates/
[root@yumserver ~]# createrepo --update /mirror/epel/
最后此篇关于CentOS7.9搭建内部yum源服务器同步阿里yum源的文章就讲到这里了,如果你想了解更多关于CentOS7.9搭建内部yum源服务器同步阿里yum源的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。
为了构建 CentOS 6.5 OSM 切片服务器,我正在寻找一些文档和/或教程。 我试过this one正如我在我的 previous post 中所说的那样但它适用于 Ubuntu 14.04,而
我正在寻找可用于集成任何源代码控制管理系统的通用 git 桥(如 git-svn、git-p4、git-tfs)模板。 如果没有这样的模板,至少有一些关于如何在 git 端集成基本操作的说明(对于其他
1、前言 redis在我们企业级开发中是很常见的,但是单个redis不能保证我们的稳定使用,所以我们要建立一个集群。 redis有两种高可用的方案: High availabilit
简介 前提条件: 确保本机已经安装 VS Code。 确保本机已安装 SSH client, 并且确保远程主机已安装 SSH server。 VSCode 已经安装了插件 C/
为什么要用ELK ELK实际上是三个工具,Elastricsearch + Logstash + Kibana,通过ELK,用来收集日志还有进行日志分析,最后通过可视化UI进行展示。一开始业务量比
在日常办公当中,经常会需要一个共享文件夹来存放一些大家共享的资料,为了保证文件数据的安全,最佳的方式是公司内部服务器搭建FTP服务器,然后分配多个用户给相应的人员。今天给大家分享FileZilla搭
最近由于业务需要,开始进行 Flutter 的研究,由于 Flutter 的环境搭建在官网上有些细节不是很清楚,笔者重新整理输出 1. 配置镜像 由于在国内访问 Flutter
目录 1. 安装go软件包 2. 配置系统变量 3. 安装git 4. 设置go代理 5. 下载gin框架 6. 创建项目 7.
Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任
上篇文章给大家介绍了使用docker compose安装FastDfs文件服务器的实例详解 今天给大家介绍如何使用 docker compose 搭建 fastDFS文件服务器,内容详情如下所示:
目录 1.创建Maven 2.Maven目录和porm.xml配置 3.配置Tomcat服务器 1.创建Maven
laravel 官方提供 homestead 和 valet 作为本地开发环境,homestead 是一个官方预封装的 vagrant box,也就是一个虚拟机,但是跟 docker 比,它占用体积
这个tutorial显示了 Razor Pages 在 Asp.Net Core 2 中的实现。但是,当我运行 CLI 命令时: dotnet aspnet-codegenerator razorp
我创建了一个单独的类库项目来存储数据库上下文和模型类。在同一解决方案中,我创建了一个 ASP.NET MVC 项目并引用了类库项目,并在项目的 Web.config 文件中包含了数据库上下文的连接字符
关于代码托管,公司是基于Gitlab自建的,它功能全而强大,但是也比较重,我个人偏向于开源、小巧、轻便、实用,所以就排除了Github,在Gogs和Gitea中选者。Gogs在Github有38
目录 1、高可用简介 1.1 高可用整体架构 1.2 基于 QJM 的共享存储系统的数据同步机制分析 1.3 NameNode 主
Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,它已经在该站点运行超过两年半了。Igor 将源代码以类BSD许可证的形式发布。 在高并发连接的情况
对于我们的 ASP.NET Core 项目,我们使用包管理器控制台中的 Scaffold-DbContext 搭建现有数据库。 每次我们做脚手架时,上下文类与所有实体一起生成,它包含调用 option
我正在使用 .net 核心 2.0。我已经安装了以下 nuget 包:1: Microsoft.AspNetCore.All2: Microsoft.EntityFrameworkCore.Tools
我正在使用 NetBeans 及其 RAD 开发功能开发 JEE6 JSF 应用程序。我想使用脚手架来节省更新 Controller 和模型 View 的时间。 OneToMany 关联在 View
我是一名优秀的程序员,十分优秀!