站点图标 ITGeeker技术奇客

Zimbra 8.8.8自建yum升级源(Repository)on CentOS x64

首先要确保你已经更新Python到2.7系列版本,然后安装了最新的pip 10.0以上版本,如果还没升级,请参看ITGeeker技术奇客指导文档:升级Python到2.7.15 on CentOS 6 x64

安装Amazon网页服务命令

yum install python-pip
pip install awscli
#如果python或pip未升级,可能会出错。

创建放源文件的目录

mkdir /var/repositories
cd /var/repositories

获取源的文件

aws s3 sync s3://repo.zimbra.com/rpm/87 ./rpm/87 --no-sign-request --delete
aws s3 sync s3://repo.zimbra.com/rpm/zv1 ./rpm/zv1 --no-sign-request --delete
aws s3 sync s3://repo.zimbra.com/rpm/888patch ./rpm/888patch --no-sign-request --delete
aws s3 sync s3://repo.zimbra.com/rpm/888patch-nw ./rpm/888patch-nw --no-sign-request --delete

编辑Nginx配置

vi /etc/nginx/conf.d/default.conf

server {
listen 80;
listen 443 ssl;
server_name www.itgeeker.net;
# ssl_certificate /etc/nginx/certs/zimbra-wilcard.crt;
# ssl_certificate_key /etc/nginx/certs/zimbra-wilcard.key;
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# ssl_ciphers HIGH:!aNULL:!MD5;
## Let your repository be the root directory
root /var/repositories;

## Always good to log
access_log /var/log/nginx/repo.access.log;
error_log /var/log/nginx/repo.error.log;

## Prevent access to Reprepro's files
location ~ /(db|conf) {
deny all;
return 404;
}
}
#ITGeeker技术切开这里没有配置ssl,需要的请自行配置。相对应在客户机的Repository源文件链接要把https换成http
service nginx restart

关注一下硬盘空间,需要占用5-8G不等的空间

df -h

配置Cron自动执行源文件更新

crontab -e

30 3 * * * /usr/bin/aws s3 sync s3://repo.zimbra.com/rpm/87 /var/repositories/rpm/87 --no-sign-request --delete
30 3 * * * /usr/bin/aws s3 sync s3://repo.zimbra.com/rpm/zv1 /var/repositories/rpm/zv1 --no-sign-request --delete
30 3 * * * /usr/bin/aws s3 sync s3://repo.zimbra.com/rpm/888patch /var/repositories/rpm/888patch --no-sign-request --delete
crontab -l
service crond restar

# 也可以用的时候手动更新

aws s3 sync s3://repo.zimbra.com/rpm/87 /var/repositories/rpm/87 --no-sign-request --delete
aws s3 sync s3://repo.zimbra.com/rpm/zv1 /var/repositories/rpm/zv1 --no-sign-request --delete
aws s3 sync s3://repo.zimbra.com/rpm/888patch /var/repositories/rpm/888patch --no-sign-request --delete

以下在你的Zimbra邮件服务器配置yum repository

创建repo文件

vi /etc/yum.repos.d/zimbra.repo

[zimbra]
name=Zimbra RPM Repository
baseurl=http://www.itgeeker.net/rpm/87/rhel$releasever
gpgcheck=1
enabled=1 
[zimbra-v1]
name=Zimbra New RPM Repository
baseurl=http://www.itgeeker.net/rpm/zv1/rhel$releasever
gpgcheck=1
enabled=1
[zimbra-888-patch]
name=Zimbra New RPM Repository
baseurl=http://www.itgeeker.net/rpm/888patch/rhel$releasever
gpgcheck=1
enabled=1
#注意:这里是http,因为前面nginx没有配置ssl 443端口

导入源Key文件

rpm --import https://files.zimbra.com/downloads/security/public.key

测试是否成功

yum search zimbra
#成功的话会列出类似:
 zimbra-altermime.x86_64 : Zimbra's altermime build
 zimbra-amavis-logwatch.x86_64 : Zimbra's amavis-logwatch build
 zimbra-amavisd.x86_64 : Zimbra's amavisd build
退出移动版