搭建本地的yum仓库-较简单
1.创建目录安装软件程序
2.首选安装nginx,作为web展示
rpm -e nginx --nodeps
rm -rf /etc/nginx
yum install -y nginx
2.配置文件的编辑
cat > /etc/nginx/nginx.conf << EOF
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {worker_connections 1024;}
http {log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
server{
listen 80;
root /var/ftp/pub/;
autoindex on;} }
EOF
yum install vsftpd -y
systemctl start nginx
systemctl enable nginx
systemctl start vsftpd
systemctl enable vsftpd
mkdir -p /var/ftp/pub/epel/7/
mkdir -p /var/ftp/pub/centos/7/os/x86_64/
mkdir -p /var/ftp/pub/centos/7/updates/x86_64/
mkdir -p /var/ftp/pub/centos/7/extras/x86_64/
mkdir -p /var/ftp/pub/centos/7/centosplus/x86_64/
mkdir -p /var/ftp/pub/
cat > /var/ftp/pub/exclude.list <<EOF
SRPMS
aarch64
ppc64
ppc64le
debug
repodata
EFI
LiveOS
images
isolinux
CentOS_BuildTag
EULA
GPL
RPM-GPG-KEY-CentOS-7
RPM-GPG-KEY-CentOS-Testing-7
drpms
EOF
cat > /var/ftp/pub/centos7-rsync.sh <<EOF
#epel
rsync -avz --exclude-from=/var/ftp/pub/exclude.list rsync://mirrors.tuna.tsinghua.edu.cn/epel/7/ /var/ftp/pub/epel/7/
createrepo /var/ftp/pub/epel/7/
#centos7-base
rsync -avz --exclude-from=/var/ftp/pub/exclude.list rsync://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/ /var/ftp/pub/centos/7/os/x86_64/
createrepo /var/ftp/pub/centos/7/os/x86_64/
#centos7-updates
rsync -avz --exclude-from=/var/ftp/pub/exclude.list rsync://mirrors.tuna.tsinghua.edu.cn/centos/7/updates/x86_64/ /var/ftp/pub/centos/7/updates/x86_64/
createrepo /var/ftp/pub/centos/7/updates/x86_64/
#centos7-extras
rsync -avz --exclude-from=/var/ftp/pub/exclude.list rsync://mirrors.tuna.tsinghua.edu.cn/centos/7/extras/x86_64/ /var/ftp/pub/centos/7/extras/x86_64/
createrepo /var/ftp/pub/centos/7/extras/x86_64/
#centos7-centosplus
rsync -avz --exclude-from=/var/ftp/pub/exclude.list rsync://mirrors.tuna.tsinghua.edu.cn/centos/7/centosplus/x86_64/ /var/ftp/pub/centos/7/centosplus/x86_64/
createrepo /var/ftp/pub/centos/7/centosplus/x86_64/
EOF
3.最后一步,执行脚本同步
sh /var/ftp/pub/centos7-rsync.sh
4.做一个定时更新yum源的任务(可做可不做)
echo "#每天4点更新yum源
00 04 * * * /usr/bin/sh /var/ftp/pub/centos7-rsync.sh &> /dev/null" >> /var/spool/cron/root
最新文章
- MySQL基础笔记
- heightcharts
- AD域内DNS服务器如何解析公网域名
- Unity5中的MetaPass
- 自定义不等高cell—storyBoard或xib自定义不等高cell
- 【转】CDH5.x升级
- codeforces 374A Inna and Pink Pony 解题报告
- Androidi性能优化之高效使用内存
- json校验
- [转]论window和Linux之长短
- Dynamic - ExpandoObject学习心得
- python2.x urllib2和urllib的使用
- 功率W与dBm的对照表及关系(转)
- Jenkis Editable Email Notification Plugin 使用介绍
- Java 第三周总结
- The man Command
- bzoj 1082: [SCOI2005]栅栏
- 如何 DataTable格式转换json格式
- 如何快速地开发一个微信小程序
- docker image 详解