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

升级Python到2.7.15 on CentOS 6 x64

Centos 6 自带的2.6版本队友有些情况总会出现各种错误,例如:

File "/usr/lib/python2.6/site-packages/pip/_internal/index.py", line 526 
{str(c.version) for c in all_candidates}, ^ 
SyntaxError: invalid syntax

明确你的Linux版本

cat /etc/redhat-release

安装依赖:

yum groupinstall -y "Development tools"
yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel

下载最新版本并编译安装

cd /tmp
wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz
tar zxf Python-2.7.15.tgz
cd Python-2.7.15
./configure
make && make install

#新版目录

ll -tr /usr/local/bin/python*

#系统自带老版本目录

ll -tr /usr/bin/python*

备份老版本命令,创建新版本软连接

mv /usr/bin/python /usr/bin/python.old
rm -f /usr/bin/python-config
ln -s /usr/local/bin/python /usr/bin/python && ln -s /usr/local/bin/python-config /usr/bin/python-config && ln -s /usr/local/include/python2.7/ /usr/include/python2.7

检查一下是否正确

python --version

为新版 Python 安装 setuptools

wget https://bootstrap.pypa.io/ez_setup.py -O - | python
easy_install pip

然后就可以pip安装了

pip install itgeeker