- 安装必要软件及官方库
官方库:
yum install -y https://$(< /etc/yum/vars/signalwireusername):$(< /etc/yum/vars/signalwiretoken)@freeswitch.signalwire.com/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm epel-release
yum install createrepo wget -y
- 创建仓库文件夹
cd /www/wwwroot/
mkdir freeswitch-repo
- 使用
reposync
同步仓库
reposync -r freeswitch -np freeswitch-repo/
reposync -r freeswitch-source -np freeswitch-repo/
reposync -r freeswitch-debuginfo -np freeswitch-repo/
- 创建yum仓库数据库文件
cd freeswitch-repo/
createrepo -p freeswitch
createrepo -p freeswitch-debuginfo
createrepo -p freeswitch-source
- 下载仓库Key文件
wget https://$(< /etc/yum/vars/signalwireusername):$(< /etc/yum/vars/signalwiretoken)@files.freeswitch.org/repo/yum/centos-release/RPM-GPG-KEY-FREESWITCH
- 搭建yum源文件服务器
yum install nginx -y
配置网站
server
{
listen 80;
server_name freeswitch.clx.fun;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/freeswitch-repo;
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
#SSL-END
#ERROR-PAGE-START 错误页配置,可以注释、删除或修改
#error_page 404 /404.html;
#error_page 502 /502.html;
#ERROR-PAGE-END
#PHP-INFO-START PHP引用配置,可以注释或修改
include enable-php-00.conf;
#PHP-INFO-END
#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
include /www/server/panel/vhost/rewrite/freeswitch.clx.fun.conf;
#REWRITE-END
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
location / {
root /www/wwwroot/freeswitch-repo;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
charset utf-8,gbk;
}
#一键申请SSL证书验证目录相关设置
location ~ \.well-known{
allow all;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
error_log off;
access_log /dev/null;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log off;
access_log /dev/null;
}
access_log /www/wwwlogs/freeswitch.clx.fun.log;
error_log /www/wwwlogs/freeswitch.clx.fun.error.log;
}
- 设置自同步
创建shell文件:auto-sync-freeswitch.sh
#!/bin/bash
#中文-UTF8
mkdir /www/wwwroot/freeswitch-repo/
chmod 755 /www/wwwroot/freeswitch-repo/
wget -O /www/wwwroot/freeswitch-repo/RPM-GPG-KEY-FREESWITCH https://$(< /etc/yum/vars/signalwireusername):$(< /etc/yum/vars/signalwiretoken)@files.freeswitch.org/repo/yum/centos-release/RPM-GPG-KEY-FREESWITCH
reposync -r freeswitch -np /www/wwwroot/freeswitch-repo/
reposync -r freeswitch-source -np /www/wwwroot/freeswitch-repo/
reposync -r freeswitch-debuginfo -np /www/wwwroot/freeswitch-repo/
if [ ! -d "/www/wwwroot/freeswitch-repo/freeswitch/repodata/" ];then
mkdir /www/wwwroot/freeswitch-repo/freeswitch/repodata/
else
echo "文件夹已经存在"
fi
createrepo -po /www/wwwroot/freeswitch-repo/freeswitch /www/wwwroot/freeswitch-repo/freeswitch/repodata/
if [ ! -d "/www/wwwroot/freeswitch-repo/freeswitch-source/repodata/" ];then
mkdir /www/wwwroot/freeswitch-repo/freeswitch-source/repodata/
else
echo "文件夹已经存在"
fi
createrepo -po /www/wwwroot/freeswitch-repo/freeswitch-source /www/wwwroot/freeswitch-repo/freeswitch-source/repodata/
if [ ! -d "/www/wwwroot/freeswitch-repo/freeswitch-debuginfo/repodata/" ];then
mkdir /www/wwwroot/freeswitch-repo/freeswitch-debuginfo/repodata/
else
echo "文件夹已经存在"
fi
createrepo -po /www/wwwroot/freeswitch-repo/freeswitch-debuginfo /www/wwwroot/freeswitch-repo/freeswitch-debuginfo/repodata/
crontab -e
0 0 * * * /www/wwwroot/auto-sync-freeswitch.sh
crontab -l
附:已搭建好的FreeSWITCH仓库:http://freeswitch.clx.fun:12130
- 分类: FreeSWITCH linux
- 标签: FreeSWITCH yum仓库 本地yum源