ubuntu 镜像站部署

定时任务

#mirror web
*/5 * * * * cd /mirror && git pull
#mysql mirror
0 */3 * * * rsync -av --delete rsync://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-connectors-community-el7/ /mirror/mysql/yum/mysql-connectors-community-el7/ > /dev/null 2>&1;
0 */3 * * * rsync -av --delete rsync://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-tools-community-el7/ /mirror/mysql/yum/mysql-tools-community-el7/ > /dev/null 2>&1;
0 */3 * * * rsync -av --delete rsync://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql57-community-el7/ /mirror/mysql/yum/mysql57-community-el7/ > /dev/null 2>&1;
0 */3 * * * rsync -av --delete rsync://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql80-community-el7/ /mirror/mysql/yum/mysql80-community-el7/ > /dev/null 2>&1;
#centos mirror
0 */4 * * * rsync -av --delete rsync://mirrors.tuna.tsinghua.edu.cn/centos/ /mirror/centos/ > /dev/null 2>&1;
#epel mirror
0 */4 * * * rsync -av --delete rsync://mirrors.tuna.tsinghua.edu.cn/epel/ /mirror/epel/ > /dev/null 2>&1;
#ubuntu-mirror
0 */4 * * * bash /srv/sh/apt-mirror.sh
#zabbix-mirror
0 */6 * * * rsync -av --delete rsync://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/3.4/ /mirror/zabbix/3.4/ > /dev/null 2>&1;
0 */6 * * * rsync -av --delete rsync://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/ /mirror/zabbix/4.0/ > /dev/null 2>&1;

定时任务脚本

#!/bin/bash
killall -9 apt-mirror
killall -9 wget
rm -rf /mirror/apt-mirror/var/apt-mirror.lock
#同步
/usr/sbin/apt-mirror > /srv/logs/apt-mirror/apt-mirror-`date +%Y-%m-%d-%H:%M:%S`.log
sleep 10s
#自动清理
sh /mirror/apt-mirror/var/clean.sh
#删除一周前的日志
find /srv/logs/apt-mirror/*.log -type f -mtime +2 -exec rm {} \;

配置同步内容

# apt-mirror configuration file
## The default configuration options (uncomment and change to override)
set base_path /mirror/apt-mirror
set mirror_path $base_path/mirror
set skel_path $base_path/skel
set var_path $base_path/var ## set defaultarch <running host architecture>
set nthreads 20
set _tilde 0
set defaultarch amd64 ## mirror sources
#ubuntu14.04 LTS
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
#ubuntu16.04 LTS
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
#ubuntu18.04 LTS
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse ## Cleaner configuration example
# set cleanscript $var_path/clean.sh
# Cleaning section
clean https://mirrors.tuna.tsinghua.edu.cn/ubuntu
上一篇:【学习】Zepto与jQuery 差别


下一篇:Oracle之SQL语句性能优化(34条优化方法)