From 69b8ef5e7a8c057e676cf56e760c9b573f2f32eb Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 16 Jul 2025 14:28:58 +0800 Subject: [PATCH] first commit --- README.md | 2 + dbdump.sh | 5 + deploy.sh | 49 +++++++++ docs/certbot_use_dns_check.md | 46 ++++++++ f5tts/f5tts.json | 10 ++ f5tts/f5tts.sh | 81 ++++++++++++++ f5tts/f5tts.ui | 3 + hf-cli/hf-cli | 3 + hf-cli/md-dl | 9 ++ install | 79 ++++++++++++++ killname | 3 + ldapserver/ldapserver.sh | 38 +++++++ mailserver/mailserver.sh | 200 ++++++++++++++++++++++++++++++++++ makeenv | 146 +++++++++++++++++++++++++ proxy | 15 +++ qwen25-omni.sh | 30 +++++ qwq32b/qwq32b.json | 9 ++ qwq32b/qwq32b.sh | 56 ++++++++++ qwq32b/qwq32b.ui | 3 + servicify | 32 ++++++ socks | 46 ++++++++ 21 files changed, 865 insertions(+) create mode 100644 README.md create mode 100755 dbdump.sh create mode 100755 deploy.sh create mode 100644 docs/certbot_use_dns_check.md create mode 100644 f5tts/f5tts.json create mode 100644 f5tts/f5tts.sh create mode 100644 f5tts/f5tts.ui create mode 100755 hf-cli/hf-cli create mode 100644 hf-cli/md-dl create mode 100644 install create mode 100755 killname create mode 100644 ldapserver/ldapserver.sh create mode 100644 mailserver/mailserver.sh create mode 100755 makeenv create mode 100755 proxy create mode 100644 qwen25-omni.sh create mode 100644 qwq32b/qwq32b.json create mode 100644 qwq32b/qwq32b.sh create mode 100644 qwq32b/qwq32b.ui create mode 100644 servicify create mode 100755 socks diff --git a/README.md b/README.md new file mode 100644 index 0000000..271b781 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# shtools + diff --git a/dbdump.sh b/dbdump.sh new file mode 100755 index 0000000..60acfa7 --- /dev/null +++ b/dbdump.sh @@ -0,0 +1,5 @@ +#!/usr/bin/bash + +date=$(date +%Y-%m-%d) +mysqldump -utest -ptest123 sage > ~/db/sage-${date}.sql +find ~/db -name "*.sql" -mtime +1 -print|awk '{print("rm -f", $1)}'| sh diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..b2b52c8 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# 开始要检查安装nvidia驱动 + +if [ "$#" -lt 3 ]; then + echo "用法: $0 " + exit 1 +fi +git_url=$1 +pkgname=$(basename $git_url) +port=$2 +usrname=$(id -un) +grpname=$(id -gn) +pkg_home=$(pwd)/$pkgname +venvpath=$pkg_home/$pkgname.env +git clone $git_url +if [ ! -d "$pkg_home" ];then + echo git clone $git_url error + exit 1 +fi +cd $pkg_home +python3 -m venv $venvpath +source $venvpath/bin/activate +pip install setuptools wheel +pip install git+https://git.kaiyuancloud.cn/yumoqing/apppublic +pip install git+https://git.kaiyuancloud.cn/yumoqing/sqlor +pip install git+https://git.kaiyuancloud.cn/yumoqing/ahserver +pip install -r requirements.txt +mkdir $pkg_home/script +cat <$pkg_home/script/$pkgname.service +[Unit] +Wants=systemd-networkd.service + +[Service] +User=$usrname +Group=$grpname +WorkingDirectory=$pkg_home +# ExecStart=killname app/$3 +ExecStart=$venvpath/bin/python app/$3 -p $port +StandardOutput=append:/var/log/$pkgname/$pkgname.log +StandardError=append:/var/log/$pkgname/$pkgname.log +SyslogIdentifier=DeepSeek32B-kyyds671b.log + +[Install] +WantedBy=multi-user.target +EOF +sudo ln -s $pkg_home/script/$pkgname.service /etc/systemd/system +sudo mkdir /var/log/$pkgname +sudo systemctl start $pkgname.service diff --git a/docs/certbot_use_dns_check.md b/docs/certbot_use_dns_check.md new file mode 100644 index 0000000..c1d9887 --- /dev/null +++ b/docs/certbot_use_dns_check.md @@ -0,0 +1,46 @@ +# 使用dns检查发放let‘s encrypt的证书 + +## 依赖软件 + +* [certbot](https://certbot.eff.org) + +* [acme-dns-certbot](https://github.com/joohoi/acme-dns-certbot-joohoi/raw/master/acme-dns-auth.py) + +## 域名控制权 +所使用的域名能增加域名解析 + +## 安装软件 + +### 安装certbot +以nginx pip为例 +``` +apt update +apt install python3 python3-venv libaugeas0 +python3 -m venv /opt/certbot/ +/opt/certbot/bin/pip install certbot certbot-nginx +ln -s /opt/certbot/bin/certbot /usr/bin/certbot +``` + +### 安装acme-dns-certbot +``` +wget https://github.com/joohoi/acme-dns-certbot-joohoi/raw/master/acme-dns-auth.py +chmod +x acme-dns-auth.py +vi acme-dns-auth.py +####CHANGE FIRST LINE TO +#!/usr/bin/env python3 +####END +mkdir mv /etc/letsencrypt/ +mv acme-dns-auth.py /etc/letsencrypt/ +``` + +## 申请证书 +``` +sudo certbot certonly --manual --manual-auth-hook /etc/letsencrypt/acme-dns-auth.py --preferred-challenges dns --debug-challenges -d \*.your-domain -d your-domain +``` +按照程序输出中的内容(类似这样:_acme-challenge.psaqc.com CNAME 052a7281-14b4-42eb-8691-ca97618cc7ae.auth.acme-dns.io. )添加到你的域名的解析中。 + +解析生效后回车让程序执行完成,即完成了证书的申请 + +## 使用证书 +生成的证书在/etc/letsencrypt/下寻找,找到好可以将证书放在nginx可以找到的地方,既可以使用了 + diff --git a/f5tts/f5tts.json b/f5tts/f5tts.json new file mode 100644 index 0000000..b3f9a4f --- /dev/null +++ b/f5tts/f5tts.json @@ -0,0 +1,10 @@ +{ + "home":"/data/f5tts", + "user":"f5tts", + "passwd":"xxxxx", + "modelpath":"/share/models/SWivid/F5-TTS/F5TTS_Base", + "device":"cuda", + "port":8101, + "ws_port":8102, + "gpucnt":8 +} diff --git a/f5tts/f5tts.sh b/f5tts/f5tts.sh new file mode 100644 index 0000000..04782a8 --- /dev/null +++ b/f5tts/f5tts.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# 变量 +# +# home +# user +# passwd +# modelpath +# llms_path +# +# modelname +# gpucnt +# port +# +# 开始要检查安装nvidia驱动 +# 需要下载两个模型 +# 1)SWivid/F5-TTS +# 2)charactr/vocos-mel-24khz +sudo apt install git-lfs +sudo rm -rf {{home}} +sudo mkdir {{home}} +sudo chown -R $(id -un):$(id -gn) {{home}} +sudo apt -y install python3-venv +if [ -f "/usr/bin/hf-cli" ];then + echo "hf-cli exists" +else + sudo cat </usr/bin/hf-cli +#!/usr/bin/bash + +export HF_ENDPOINT=https://hf-mirror.com +huggingface-cli download --resume-download $1 --local-dir {{llm_path}}/$1 +EOF +fi +sudo chmod +x /usr/bin/hf-cli +nohup hf-cli SWivid/F5-TTS & +nohup hf-cli charactr/vocos-mel-24khz & +mkdir {{home}}/.pip +cat < {{home}}/.pip/pip.conf +[global] +index-url = https://pypi.tuna.tsinghua.edu.cn/simple +[install] +trusted-host = https://pypi.tuna.tsinghua.edu.cn +EOF +cat <{{home}}/run.sh +#!/bin/bash + +{{home}}/py3/bin/python {{home}}/py/f5tts/app/f5tts.py -w {{home}}/py/f5tts -p {{port}} 2>>{{home}}/py/f5tts/logs/f5tts.log & +{{home}}/py3/bin/python {{home}}/py/f5tts/app/f5tts.py -w {{home}}/py/f5tts -p {{ws_port}} 2>>{{home}}/py/f5tts/logs/f5tts.log & + +EOF +chmod +x {{home}}/run.sh +cat <{{home}}/{{user}}.service +[Unit] +Wants=systemd-networkd.service + +[Service] +Type=forking +ExecStart=su - {{user}} -c "{{home}}/run.sh" +ExecStop=su - {{user}} "killname {{home}}/py/f5tts/app/f5tts.py" +[Install] +WantedBy=multi-user.target +EOF +sudo mv {{home}}/{{user}}.service /etc/systemd/system +/usr/bin/python3 -m venv {{home}}/py3 +{{home}}/py3/bin/pip install torch==2.4.0+cu124 torchaudio==2.4.0+cu124 --extra-index-url https://download.pytorch.org/whl/cu124 +mkdir {{home}}/py +{{home}}/py3/bin/pip install git+https://git.kaiyuancloud.cn/yumoqing/apppublic +{{home}}/py3/bin/pip install git+https://git.kaiyuancloud.cn/yumoqing/sqlor +{{home}}/py3/bin/pip install git+https://git.kaiyuancloud.cn/yumoqing/ahserver +{{home}}/py3/bin/pip install f5-tts +cd {{home}}/py +git clone https://git.kaiyuancloud.cn/yumoqing/f5tts +sudo deluser {{user}} +sudo delgroup {{user}} +sudo groupadd {{user}} +sudo useradd -m -g {{user}} -s /usr/bin/bash -d {{home}} {{user}} +echo "{{user}}:{{passwd}}" | sudo chpasswd +sudo chown -R {{user}}:{{user}} {{home}} +sudo systemctl enable {{user}}.service +sudo systemctl start {{user}}.service + +exit 0 diff --git a/f5tts/f5tts.ui b/f5tts/f5tts.ui new file mode 100644 index 0000000..0db3279 --- /dev/null +++ b/f5tts/f5tts.ui @@ -0,0 +1,3 @@ +{ + +} diff --git a/hf-cli/hf-cli b/hf-cli/hf-cli new file mode 100755 index 0000000..502a53e --- /dev/null +++ b/hf-cli/hf-cli @@ -0,0 +1,3 @@ +#!/usr/bin/bash + +nohup ~/py3/bin/huggingface-cli download --resume-download $1 --local-dir ~/models/$1 > ~/logs/$$.log & diff --git a/hf-cli/md-dl b/hf-cli/md-dl new file mode 100644 index 0000000..5c85bca --- /dev/null +++ b/hf-cli/md-dl @@ -0,0 +1,9 @@ +#!/d/ymq/py3/bin/python + +import sys +import os +from modelscope.hub.snapshot_download import snapshot_download +home=os.environ['HOME'] +path = sys.argv[1] +snapshot_download(path, cache_dir=f'{home}/models') + diff --git a/install b/install new file mode 100644 index 0000000..1ebd781 --- /dev/null +++ b/install @@ -0,0 +1,79 @@ +#!/usr/bin/python3 + +import os +import sys +import codecs + +if len(sys.argv) < 3: + print(f'Usage:\n{sys.argv[0]} venvname') + sys.exit(1) + +user = os.getlogin() +home = os.environ.get('HOME') +try: + os.mkdir(f'{home}/ve') +except: + pass + +venv = sys.argv[1] +port = int(sys.argv[2]) +if not os.path.exists(f'{home}/{venv}'): + os.system(f'python3 -m venv ~/{venv}') +pwd = os.getcwd() +name = os.path.basename(pwd) +if os.path.exists(f'./app/{name}.py'): + print('env exists') + sys.exit(1) + +dirs = f'./app ./conf ./files ./wwwroot ./script ./logs'.split(' ') +for d in dirs: + try: + os.mkdir(d) + except: + pass +files=f'app/{name}.py conf/config.json files/README.md wwwroot/index.dspy'.split(' ') +for f in files: + os.system(f'touch {f}') + +service = f"""[Unit] +Description={name} service +Wants=systemd-networkd.service +Requires=nginx.service + +[Service] +Type=forking +ExecStart=su - {user} -c "{pwd}/script/{name}.sh" +ExecStop=su - ymq "{home}/bin/killname {name}.py" +[Install] +WantedBy=multi-user.target +""" + +with codecs.open(f'./script/{name}.service', 'w', 'utf-8') as f: + f.write(service) + +with codecs.open(f'./script/{name}.sh', 'w', 'utf-8') as f: + f.write(f"""#!/usr/bin/bash + +killname {pwd}/app/{name}.py +{home}/{venv}/bin/python {pwd}/app/{name}.py -w {pwd} > {pwd}/logs/stderr.log 2>&1 & +exit 0 +""") + +with codecs.open(f'./script/install.sh', 'w', 'utf-8') as f: + f.write(f"""#!/usr/bin/bash +sudo cp {name}.service /etc/systemd/system +sudo systemctl enable {name}.service +sudo systemctl start {name} +""") + +if not os.path.exists(f'{home}/bin'): + os.mkdir(f'{home}/bin') +if not os.path.exists(f'{home}/bin/killname'): + with codecs.open(f'{home}/bin/killname', 'w', 'utf-8') as f: + f.write("""#!/usr/bin/bash + +ps -ef|grep "$1"|grep -v grep|awk '{print("kill -9", $2)}'|sh +""") +os.system(f'chmod +x {pwd}/bin/*') +os.system(f'{pwd}/script/install.sh') + diff --git a/killname b/killname new file mode 100755 index 0000000..2535ab5 --- /dev/null +++ b/killname @@ -0,0 +1,3 @@ +#!/bin/sh + +ps -ef|grep "$1"|grep -v grep|awk '{print("kill -9", $2)}'|sh diff --git a/ldapserver/ldapserver.sh b/ldapserver/ldapserver.sh new file mode 100644 index 0000000..cc8efa6 --- /dev/null +++ b/ldapserver/ldapserver.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# 参数说明: +# organization: 组织名称(例如:"MyCompany") +# domain: LDAP 基域(例如:"example.com") +# split_domain: 分割后的 DC 格式(例如:"dc=example,dc=com") +# admin_password: 管理员密码 +# backend: 后端数据库类型(建议使用默认值 HDB,或替换为其他如 "MDB") +# instances: 实例名称(通常留空为默认,设置为 "") + +set -e + +echo "设置 Slapd 配置选项..." +echo "slapd shared/organization string {{organization}}" | sudo debconf-set-selections +echo "slapd slapd/domain string {{domain}}" | sudo debconf-set-selections +echo "slapd slapd/password1 password {{admin_password}}" | sudo debconf-set-selections +echo "slapd slapd/password2 password {{admin_password}}" | sudo debconf-set-selections +echo "slapd slapd/backend select {{backend}}" | sudo debconf-set-selections +echo "slapd slapd/instances string {{instances}}" | sudo debconf-set-selections +echo "slapd slapd/no_configuration boolean false" | sudo debconf-set-selections +echo "slapd slapd/allow_localhost boolean true" | sudo debconf-set-selections + +echo "正在安装 LDAP 服务..." +sudo apt-get update && sudo apt-get install -y slapd ldap-utils + +echo "启动并启用服务..." +sudo systemctl enable slapd && sudo systemctl restart slapd + +echo "配置防火墙 (允许 LDAP 端口)..." +sudo ufw allow 389/tcp + +echo "部署完成!" +echo "管理员 DN: cn=admin,{{split_domain}}" +echo "" +echo "测试命令:" +echo "ldapsearch -LL -x -H ldap://localhost -b {{split_domain}} -D 'cn=admin,{{split_domain}}' -W" + +exit 0 + diff --git a/mailserver/mailserver.sh b/mailserver/mailserver.sh new file mode 100644 index 0000000..3cf21f4 --- /dev/null +++ b/mailserver/mailserver.sh @@ -0,0 +1,200 @@ +#!/bin/bash + +############################################################## +# 参数占位(请根据实际情况替换) +# 注意事项:请在执行前确认所有参数均被正确替换 +############################################################## +MAIL_DOMAIN="{{your-mail-domain.com}}" # 邮件域名(如:example.com) +MAIL_IP="{{your-server-ip}}" # 邮件服务器IP地址 +ADMIN_EMAIL="{{admin@your-domain.com}}" # 管理员邮箱(用于Postfix收件) +USER_NAME="{{username}}" # 系统用户账号(用于邮箱存储) +USER_PASSWORD="{{password}}" # 用户密码 +WEBROOT_PATH="{{/var/www/html}}" # Certbot使用HTTP验证的网站目录 + +############################################################## +# 初始配置 +############################################################## +echo "==> 开始初始化..." + +# 预检测 +echo ">> 检查root权限..." +if [ "$(id -u)" != "0" ]; then + echo "请使用root权限执行脚本" >&2 + exit 1 +fi + +# 更新系统 +echo ">> 更新软件源..." +apt update && apt upgrade -y + +# 安装必要组件 +echo ">> 安装Postfix/Dovecot..." +apt install -y postfix mailutils dovecot-core dovecot-imapd dovecot-lmtpd openssl certbot + +echo ">> 初始配置完成" + +############################################################## +# 配置Postfix邮件服务器 +############################################################## +echo "==> 配置Postfix..." + +# 配置Postfix主配置文件 +cat > /etc/postfix/main.cf <> Postfix基础配置完成" + +############################################################## +# 配置邮箱用户与域名映射 +############################################################## +echo "==> 创建虚拟邮箱配置..." + +# 创建邮箱存储目录 +mkdir -p /var/mail/vhosts/$MAIL_DOMAIN +chown -R vmail:vmail /var/mail + +# 创建虚拟别名(管理员收件) +echo "$ADMIN_EMAIL" > /etc/postfix/virtual + +# 创建用户邮箱映射(示例用户) +echo "user1@example.com $MAIL_DOMAIN/user1/" > /etc/postfix/vmailbox + +# 生成哈希数据库 +postmap /etc/postfix/virtual +postmap /etc/postfix/vmailbox + +echo ">> 邮箱账户配置完成" + +############################################################## +# Dovecot 配置 +############################################################## +echo "==> 配置Dovecot..." + +# 创建主配置 +cat > /etc/dovecot/dovecot.conf < /etc/dovecot/conf.d/10-master.conf <> Dovecot配置完成" + +############################################################## +# 获取SSL证书(Let's Encrypt) +############################################################## +echo "==> 申请SSL证书..." + +if [ ! -d "/etc/letsencrypt/live/$MAIL_DOMAIN" ]; then + certbot certonly --standalone --agree-tos --no-eff-email \ + --email $ADMIN_EMAIL \ + -d $MAIL_DOMAIN + + # 设置定时更新 + (crontab -l ; echo "0 0 * * * certbot renew --quiet") | crontab - +fi + +echo ">> SSL证书获取完成" + +############################################################## +# 防火墙配置 +############################################################## +echo "==> 配置防火墙..." + +if ! systemctl is-active --quiet ufw; then + ufw allow 'OpenSSH' + ufw allow "$MAIL_IP"/4 + ufw enable +fi + +ufw allow 25/tcp # SMTP +ufw allow 587/tcp # Submission +ufw allow 465/tcp # SMTPS +ufw allow 143/tcp # IMAP +ufw allow 993/tcp # IMAPS +ufw reload + +echo ">> 防火墙配置完成" + +############################################################## +# 启动服务并测试 +############################################################## +echo "==> 启动服务..." + +systemctl restart postfix +systemctl restart dovecot + +# 检查服务状态 +systemctl status postfix +systemctl status dovecot + +echo "--------------------" +echo "部署完成,请验证服务:" +echo "1. 检查端口 25/587/993 是否开放" +echo "2. 发送测试邮件:echo \"测试邮件正文\" | mail -s \"测试标题\" $ADMIN_EMAIL" +echo "3. 查看日志:tail -f /var/log/mail.log" +echo "--------------------" + diff --git a/makeenv b/makeenv new file mode 100755 index 0000000..e8ae7bf --- /dev/null +++ b/makeenv @@ -0,0 +1,146 @@ +#!/usr/bin/python3 + +import os +import sys +import codecs + +if len(sys.argv) < 3: + print(f'Usage:\n{sys.argv[0]} venvname port') + sys.exit(1) + +user = os.getlogin() +home = os.environ.get('HOME') +try: + os.mkdir(f'{home}/ve') +except: + pass + +venv = sys.argv[1] +port = int(sys.argv[2]) +os.system(f'python3 -m venv ~/ve/{venv}') +pwd = os.getcwd() +name = os.path.basename(pwd) +if os.path.exists(f'./app/{name}.py'): + print('env exists') + sys.exit(1) + +dirs = f'./app ./conf ./files ./wwwroot ./script ./logs'.split(' ') +for d in dirs: + try: + os.mkdir(d) + except: + pass +files=f'app/{name}.py conf/config.json files/README.md wwwroot/index.dspy'.split(' ') +for f in files: + os.system(f'touch {f}') + +config_str=f""" +{{ + "logger":{{ + "name":"{name}", + "levelname":"info", + "logfile":"$[workdir]$/logs/sage.log" + }}, + "filesroot":"$[workdir]$/files", + "website":{{ + "paths":[ + ["$[workdir]$/wwwroot",""] + ], + "client_max_size":10000, + "host":"0.0.0.0", + "port":{port}, + "coding":"utf-8", + "indexes":[ + "index.html", + "index.tmpl", + "index.ui", + "index.dspy", + "index.md" + ], + "startswiths":[ + {{ + "leading":"/idfile", + "registerfunction":"idFileDownload" + }} + ], + "processors":[ + [".dspy","dspy"], + [".md","md"] + ], + "session_max_time":3000, + "session_issue_time":2500, + "session_redis_notuse":{{ + "url":"redis://127.0.0.1:6379" + }} + }}, + "langMapping":{{ + "zh-Hans-CN":"zh-cn", + "zh-CN":"zh-cn", + "en-us":"en", + "en-US":"en" + }} +}} +""" +service = f"""[Unit] +Description={name} service +Wants=systemd-networkd.service +Requires=nginx.service + +[Service] +Type=forking +ExecStart=su - {user} -c "{pwd}/script/{name}.sh" +ExecStop=su - ymq "{home}/bin/killname {name}.py" +[Install] +WantedBy=multi-user.target +""" + +with codecs.open(f'./script/{name}.service', 'w', 'utf-8') as f: + f.write(service) + +with codecs.open(f'./script/{name}.sh', 'w', 'utf-8') as f: + f.write(f"""#!/usr/bin/bash + +killname {pwd}/app/{name}.py +{home}/ve/{venv}/bin/python {pwd}/app/{name}.py -w {pwd} > {pwd}/logs/stderr.log 2>&1 & +exit 0 +""") + +with codecs.open(f'./script/install.sh', 'w', 'utf-8') as f: + f.write(f"""#!/usr/bin/bash +sudo cp {name}.service /etc/systemd/system +sudo systemctl enable {name}.service +sudo systemctl start {name} +""") + +od.system('chmod +x script/*.sh') + +with codecs.open(f'./conf/config.json', 'w', 'utf-8') as f: + f.write(config_str) + +with codecs.open(f'./requirements.txt', 'w', 'utf-8') as f: + f.write("""git+https://git.kaiyuancloud.cn/yumoqing/apppublic +git+https://git.kaiyuancloud.cn/yumoqing/sqlor +git+https://git.kaiyuancloud.cn/yumoqing/ahserver +""") + +if not os.path.exists(f'{home}/bin'): + os.mkdir(f'{home}/bin') +if not os.path.exists(f'{home}/bin/killname'): + with codecs.open(f'{home}/bin/killname', 'w', 'utf-8') as f: + f.write("""#!/usr/bin/bash + +ps -ef|grep "$1"|grep -v grep|awk '{print("kill -9", $2)}'|sh +""") +with codecs.open(f'{home}/bin/{venv}py', 'w', 'utf-8') as f: + f.write(f"""#!/usr/bin/bash + +~/ve/{venv}/bin/python $* +""") +with codecs.open(f'{home}/bin/{venv}pip', 'w', 'utf-8') as f: + f.write(f"""#!/usr/bin/bash + +~/ve/{venv}/bin/pip $* +""") + +os.system(f'chmod +x {home}/bin/{venv}*') + diff --git a/proxy b/proxy new file mode 100755 index 0000000..2db1366 --- /dev/null +++ b/proxy @@ -0,0 +1,15 @@ +### +# need change username and domain to your +# username +# domain +start_proxy() +{ + while [ "1" = "1" ] + do + ssh -N -D 0.0.0.0:1086 username@domain + done +} + +start_proxy & +socks start +echo "proxy started" diff --git a/qwen25-omni.sh b/qwen25-omni.sh new file mode 100644 index 0000000..cb87cbb --- /dev/null +++ b/qwen25-omni.sh @@ -0,0 +1,30 @@ +sudo apt install ffmpeg +sudo {{homepath}}/{{user}} +sudo chown -R $(id -nu):$(id -ng) {{homepath}}/{{user}} +cd {{homepath}}/{{user}} +python3 -m venv py3 +source py/bin/activate +pip install git+https://github.com/huggingface/transformers@3a1ead0aabed473eafe527915eea8c197d424356 +pip install accelerate +pip install qwen-omni-utils[decord] +pip install -U flash-attn --no-build-isolation +cat >> .bashrc < loadmodel.py < {{home}}/.pip/pip.conf +[global] +index-url = https://pypi.tuna.tsinghua.edu.cn/simple +[install] +trusted-host = https://pypi.tuna.tsinghua.edu.cn +EOF +cat <{{home}}/run.sh +#!/bin/bash + +{{home}}/py3/bin/python -m vllm.entrypoints.openai.api_server --model {{modelpath}} --served-model-name {{modelname}} --gpu-memory-utilization 0.9 --max_model_len {{max_model_len or 4096}} --tensor-parallel-size {{gpucnt}} --port {{port or 8001}} +EOF +chmod +x {{home}}/run.sh +cat <{{home}}/{{user}}.service +[Unit] +Wants=systemd-networkd.service + +[Service] +Type=forking +ExecStart=su - {{user}} -c "{{home}}/run.sh" +ExecStop=su - {{user}} "killname vllm" +[Install] +WantedBy=multi-user.target +EOF +sudo mv {{home}}/{{user}}.service /etc/systemd/system +python3 -m venv {{home}}/py3 +{{home}}/py3/bin/pip install torch==2.4.0+cu124 torchaudio==2.4.0+cu124 --extra-index-url https://download.pytorch.org/whl/cu124 +{{home}}/py3/bin/pip install vllm==0.7.3 +sudo deluser {{user}} +sudo delgroup {{user}} +sudo groupadd {{user}} +sudo useradd -m -g {{user}} -s /usr/bin/bash -d {{home}} {{user}} +echo "{{user}}:{{passwd}}" | sudo chpasswd +sudo chown -R {{user}}:{{user}} {{home}} +sudo systemctl enable {{user}}.service +sudo systemctl start {{user}}.service + +exit 0 diff --git a/qwq32b/qwq32b.ui b/qwq32b/qwq32b.ui new file mode 100644 index 0000000..0db3279 --- /dev/null +++ b/qwq32b/qwq32b.ui @@ -0,0 +1,3 @@ +{ + +} diff --git a/servicify b/servicify new file mode 100644 index 0000000..4456dd5 --- /dev/null +++ b/servicify @@ -0,0 +1,32 @@ +#!/bin/sh + +if [ ! -f "start.sh" ] || [ ! -f "stop.sh" ]; then + echo "current folder should have start.sh and stop.sh" + exit 1 +fi + +workdir=$(pwd) +servicename=$(basename `pwd`) +sudo cat >$servicename.service < 1 and sys.argv[1] == 'stop': + disableProxy() + else: + enableProxy()