Ubuntu及Centos本地镜像服务器

前端之家收集整理的这篇文章主要介绍了Ubuntu及Centos本地镜像服务器前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

最近因为要安装一个软件,发现阿里云的源都没有了,我这边用的Centos5,然后现在似乎是过期了. 国内很多镜像源都没有centos5的.


然后才想起要折腾一个本地源.

centos的话,直接 rsync 就OK了.

#!/bin/bash

#centos
rsync-av--bwlimit=3072rsync://rsync.mirrors.ustc.edu.cn/centos/--exclude-from=/local_home/mirrors/conf/exclude_centos.list/local_home/mirrors/centos/

#epel
rsync-av--bwlimit=3072rsync://rsync.mirrors.ustc.edu.cn/epel/--exclude-from=/local_home/mirrors/conf/exclude_epel.list/local_home/mirrors/epel/

#ubuntu
apt-mirror

ubuntu 就用 apt-mirror

相关配置:

cat/etc/apt/mirror.list
#############config##################
#
setbase_path/local_home/mirrors/ubuntu
#
#setmirror_path$base_path/mirror
#setskel_path$base_path/skel
#setvar_path$base_path/var
#setcleanscript$var_path/clean.sh
#setdefaultarch<runninghostarchitecture>
#setpostmirror_script$var_path/postmirror.sh
#setrun_postmirror0
setnthreads20
set_tilde0
setlimit_rate3072K#限制速度
#
#############endconfig##############

#precise
debhttp://mirrors.aliyun.com/ubuntuprecisemainrestricteduniversemultiverse
debhttp://mirrors.aliyun.com/ubuntuprecise-securitymainrestricteduniversemultiverse
debhttp://mirrors.aliyun.com/ubuntuprecise-updatesmainrestricteduniversemultiverse
#debhttp://mirrors.aliyun.com/ubuntuprecise-proposedmainrestricteduniversemultiverse
#debhttp://mirrors.aliyun.com/ubuntuprecise-backportsmainrestricteduniversemultiverse

#trusty
debhttp://mirrors.aliyun.com/ubuntu/trustymainrestricteduniversemultiverse
debhttp://mirrors.aliyun.com/ubuntu/trusty-securitymainrestricteduniversemultiverse
debhttp://mirrors.aliyun.com/ubuntu/trusty-updatesmainrestricteduniversemultiverse
#debhttp://mirrors.aliyun.com/ubuntu/trusty-proposedmainrestricteduniversemultiverse
#debhttp://mirrors.aliyun.com/ubuntu/trusty-backportsmainrestricteduniversemultiverse

#xenial这个版本虽然只有amd64的服务器,但也要加上i386的.要不没办法更新,会提示
#E:Unabletolocatepackage软件名
debhttp://mirrors.aliyun.com/ubuntu/xenialmainrestricteduniversemultiverse
debhttp://mirrors.aliyun.com/ubuntu/xenial-securitymainrestricteduniversemultiverse
debhttp://mirrors.aliyun.com/ubuntu/xenial-updatesmainrestricteduniversemultiverse
#debhttp://mirrors.aliyun.com/ubuntu/xenial-proposedmainrestricteduniversemultiverse
#debhttp://mirrors.aliyun.com/ubuntu/xenial-backportsmainrestricteduniversemultiverse
deb-i386http://mirrors.aliyun.com/ubuntu/xenialmainrestricteduniversemultiverse
deb-i386http://mirrors.aliyun.com/ubuntu/xenial-securitymainrestricteduniversemultiverse
deb-i386http://mirrors.aliyun.com/ubuntu/xenial-updatesmainrestricteduniversemultiverse
#debhttp://mirrors.aliyun.com/ubuntu/xenial-proposedmainrestricteduniversemultiverse
#debhttp://mirrors.aliyun.com/ubuntu/xenial-backportsmainrestricteduniversemultiverse

cleanhttp://mirrors.aliyun.com/ubuntu

######################################################
###DOCKER
######################################################
deb-amd64https://apt.dockerproject.org/repoubuntu-xenialmain

cleanhttps://apt.dockerproject.org

apt-mirror 下载的目录其实比较乱,完成后,可以直接 ln -s 到www目录


另外我这用的是 ubuntu 12.04 做的镜像服务器. apt安装的apt-mirror 有点问题要升级,直接到

https://github.com/apt-mirror/apt-mirror 下载最新的.


最后配置好本地更新配置文件就好了.

Centos:

###########################CentOS6&&CentOS5##################
[base]
name=CentOS-$releasever-Base-mirror.test.net
baseurl=http://mirror.test.net/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.test.net/centos/RPM-GPG-KEY-CentOS-$releasever
[updates]
name=CentOS-$releasever-Updates-mirror.test.net
baseurl=http://mirror.test.net/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.test.net/centos/RPM-GPG-KEY-CentOS-$releasever
[extras]
name=CentOS-$releasever-Extras-mirror.test.net
baseurl=http://mirror.test.net/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.test.net/centos/RPM-GPG-KEY-CentOS-$releasever
[centosplus]
name=CentOS-$releasever-Plus-mirror.test.net
baseurl=http://mirror.test.net/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.test.net/centos/RPM-GPG-KEY-CentOS-$releasever
[contrib]
name=CentOS-$releasever-Contrib-mirror.test.net
baseurl=http://mirror.test.net/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.test.net/centos/RPM-GPG-KEY-CentOS-$releasever

###########################CentOS5###############################
[addons]
name=CentOS-$releasever-Addons-mirror.test.net
baseurl=http://mirror.test.net/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.test.net/centos/RPM-GPG-KEY-CentOS-5

Epel:

[epel]
name=ExtraPackagesforEnterpriseLinux$releasever-$basearch
baseurl=http://mirror.test.net/epel/$releasever/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=http://mirror.test.net/epel/RPM-GPG-KEY-EPEL-$releasever

Ubuntu:

#precise12.04
debhttp://mirror.test.net/ubuntu/precisemainrestricteduniversemultiverse
debhttp://mirror.test.net/ubuntu/precise-securitymainrestricteduniversemultiverse
debhttp://mirror.test.net/ubuntu/precise-updatesmainrestricteduniversemultiverse

#trusty14.04
debhttp://mirror.test.net/ubuntu/trustymainrestricteduniversemultiverse
debhttp://mirror.test.net/ubuntu/trusty-securitymainrestricteduniversemultiverse
debhttp://mirror.test.net/ubuntu/trusty-updatesmainrestricteduniversemultiverse

#xenial16.04
debhttp://mirror.test.net/ubuntu/xenialmainrestricteduniversemultiverse
debhttp://mirror.test.net/ubuntu/xenial-securitymainrestricteduniversemultiverse
debhttp://mirror.test.net/ubuntu/xenial-updatesmainrestricteduniversemultiverse

Docker:

#xenial16.04
debhttp://mirror.test.net/docker/ubuntu-xenialmain
原文链接:https://www.f2er.com/ubuntu/353150.html

猜你在找的Ubuntu相关文章