This commit is contained in:
yumoqing 2025-03-15 19:40:45 +08:00
parent d3473ba24f
commit a6b0b4cabd

View File

@ -9,17 +9,11 @@
create_user() create_user()
{ {
sudo deluser {{user}}
sudo delgroup {{user}}
sudo useradd -m -g {{user}} -s bash -d {{home}} {{user}}
echo "{{user}}:{{passwd}}" | sudo chpasswd {{user}}
} }
curusr=$(id -un)
curgrp=$(id -gn)
sudo apt install git-lfs sudo apt install git-lfs
sudo rm -rf {{home}} sudo rm -rf {{home}}
sudo mkdir {{home}} sudo mkdir {{home}}
sudo chown -R $(curusr):$(curgrp) $(home) sudo chown -R $(id -un):$(id -gn) {{home}}
sudo apt -y install python3-venv sudo apt -y install python3-venv
mkdir {{home}}/.pip mkdir {{home}}/.pip
cat <<EOF> {{home}}/.pip/pip.conf cat <<EOF> {{home}}/.pip/pip.conf
@ -35,7 +29,7 @@ cat <<EOF>{{home}}/run.sh
32b --gpu-memory-utilization 0.9 --max_model_len 40960 --tensor-parallel-size 4 32b --gpu-memory-utilization 0.9 --max_model_len 40960 --tensor-parallel-size 4
EOF EOF
chmod +x {{home}}/run.sh chmod +x {{home}}/run.sh
sudo cat <<EOF>/etc/systemd/system/{{user}}.service cat <<EOF>{{user}}.service
[Unit] [Unit]
Wants=systemd-networkd.service Wants=systemd-networkd.service
Requires=nginx.service Requires=nginx.service
@ -47,9 +41,13 @@ ExecStop=su - {{user}} "killname vllm"
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
sudo cp {{user}}.service /etc/systemd/system
python3 -m venv {{home}}/py3 python3 -m venv {{home}}/py3
{{home}}/py3/bin/pip install vllm {{home}}/py3/bin/pip install vllm
create_user sudo deluser {{user}}
sudo delgroup {{user}}
sudo useradd -m -g {{user}} -s bash -d {{home}} {{user}}
echo "{{user}}:{{passwd}}" | sudo chpasswd
sudo chown -R {{user}}:{{user}} {{home}} sudo chown -R {{user}}:{{user}} {{home}}
systemctl enable {{user}}.service systemctl enable {{user}}.service
systemctl start {{user}}.service systemctl start {{user}}.service