{"id":1881,"date":"2025-12-06T07:11:59","date_gmt":"2025-12-06T07:11:59","guid":{"rendered":"https:\/\/alexisiumus.ru\/?p=1881"},"modified":"2025-12-06T07:26:30","modified_gmt":"2025-12-06T07:26:30","slug":"%d0%ba%d0%b0%d0%ba-%d1%83%d0%b4%d0%b0%d0%bb%d0%b8%d1%82%d1%8c-%d0%ba%d0%be%d0%bd%d1%82%d0%b5%d0%b9%d0%bd%d0%b5%d1%80-marzban-%d0%b8%d0%b7-debian","status":"publish","type":"post","link":"https:\/\/alexisiumus.ru\/?p=1881","title":{"rendered":"\u041a\u0430\u043a \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 Marzban \u0438\u0437 Debian"},"content":{"rendered":"\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 <strong>Marzban<\/strong> \u0438\u0437 Debian, \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d \u0431\u044b\u043b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u2014 \u0447\u0435\u0440\u0435\u0437 <strong>Docker Compose<\/strong>, \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0447\u0435\u0440\u0435\u0437 <code>docker run<\/code>, \u0438\u043b\u0438 \u043a\u0430\u043a systemd\u2011\u0441\u0435\u0440\u0432\u0438\u0441. \u042f \u0434\u0430\u043c \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0439 \u0440\u0430\u0437\u0431\u043e\u0440 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430:<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udc33 \u0415\u0441\u043b\u0438 Marzban \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u0447\u0435\u0440\u0435\u0437 Docker Compose<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u041f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u0433\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <code>docker-compose.yml<\/code>: <code>cd \/opt\/marzban # \u0438\u043b\u0438 \u0432\u0430\u0448 \u043f\u0443\u0442\u044c<\/code><\/li>\n\n\n\n<li>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b: <code>docker compose down<\/code> \u042d\u0442\u043e \u0443\u0434\u0430\u043b\u0438\u0442 \u0432\u0441\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b, \u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u043e\u0431\u0440\u0430\u0437\u044b \u0438 \u0442\u043e\u043c\u0430.<\/li>\n\n\n\n<li>\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438 \u043e\u0431\u0440\u0430\u0437\u044b: <code>docker compose down --rmi all<\/code><\/li>\n\n\n\n<li>\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438 \u0442\u043e\u043c\u0430 (\u0434\u0430\u043d\u043d\u044b\u0435): <code>docker compose down --volumes<\/code><\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udc0b \u0415\u0441\u043b\u0438 Marzban \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u0447\u0435\u0440\u0435\u0437 <code>docker run<\/code><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u041d\u0430\u0439\u0434\u0438\u0442\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440: <code>docker ps -a | grep marzban<\/code><\/li>\n\n\n\n<li>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u0435\u0433\u043e: <code>docker stop &lt;container_id&gt;<\/code><\/li>\n\n\n\n<li>\u0423\u0434\u0430\u043b\u0438\u0442\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440: <code>docker rm &lt;container_id&gt;<\/code><\/li>\n\n\n\n<li>\u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u0435 \u043e\u0431\u0440\u0430\u0437: <code>docker rmi marzban<\/code><\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2699\ufe0f \u0415\u0441\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043a\u0430\u043a systemd\u2011\u0441\u0435\u0440\u0432\u0438\u0441<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u0441\u0435\u0440\u0432\u0438\u0441: <code>sudo systemctl stop marzban<\/code><\/li>\n\n\n\n<li>\u041e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u0443\u0441\u043a: <code>sudo systemctl disable marzban<\/code><\/li>\n\n\n\n<li>\u0423\u0434\u0430\u043b\u0438\u0442\u0435 unit\u2011\u0444\u0430\u0439\u043b: <code>sudo rm \/etc\/systemd\/system\/marzban.service<\/code><\/li>\n\n\n\n<li>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 systemd: <code>sudo systemctl daemon-reload<\/code><\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\uddf9 \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435, \u043d\u0435\u0442 \u043b\u0438 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u0442\u043e\u043c\u043e\u0432: <code>docker volume ls docker volume rm &lt;volume_name&gt;<\/code><\/li>\n\n\n\n<li>\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u0435 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b: <code>docker system prune -a<\/code><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0439 \u0437\u0430\u0447\u0438\u0441\u0442\u043a\u0438 Marzban \u0438\u0437 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/p>\n<\/blockquote>\n\n\n\n<p>\u0412\u043e\u0442 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 <strong>bash\u2011\u0441\u043a\u0440\u0438\u043f\u0442<\/strong> \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0439 \u0437\u0430\u0447\u0438\u0441\u0442\u043a\u0438 Marzban \u0438\u0437 Debian. \u041e\u043d \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b, \u043e\u0431\u0440\u0430\u0437\u044b, \u0442\u043e\u043c\u0430, systemd\u2011\u044e\u043d\u0438\u0442\u044b \u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b. \u0421\u043a\u0440\u0438\u043f\u0442 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d \u043d\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 Docker\/Docker Compose, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 systemd\u2011\u0441\u0435\u0440\u0432\u0438\u0441\u044b:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n# marzban-cleanup.sh\n# \u041f\u043e\u043b\u043d\u0430\u044f \u0437\u0430\u0447\u0438\u0441\u0442\u043a\u0430 Marzban \u0438\u0437 \u0441\u0438\u0441\u0442\u0435\u043c\u044b Debian\n\nset -euo pipefail\n\nLOGFILE=\"\/var\/log\/marzban-cleanup.log\"\nexec > >(tee -a \"$LOGFILE\") 2>&amp;1\n\necho \"&#91;INFO] \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f Docker...\"\nif ! command -v docker &amp;>\/dev\/null; then\n  echo \"&#91;ERROR] Docker \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d!\"\n  exit 1\nfi\n\necho \"&#91;INFO] \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 Marzban...\"\ndocker ps -a --filter \"name=marzban\" -q | xargs -r docker rm -f\n\necho \"&#91;INFO] \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u0432 Marzban...\"\ndocker images --format \"{{.Repository}} {{.ID}}\" | grep marzban | awk '{print $2}' | xargs -r docker rmi -f\n\necho \"&#91;INFO] \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0442\u043e\u043c\u043e\u0432 Marzban...\"\ndocker volume ls --filter \"name=marzban\" -q | xargs -r docker volume rm\n\necho \"&#91;INFO] \u041e\u0447\u0438\u0441\u0442\u043a\u0430 systemd unit-\u0444\u0430\u0439\u043b\u043e\u0432...\"\nfor svc in marzban marzban.service; do\n  if systemctl list-unit-files | grep -q \"$svc\"; then\n    sudo systemctl stop \"$svc\" || true\n    sudo systemctl disable \"$svc\" || true\n    sudo rm -f \"\/etc\/systemd\/system\/$svc\"\n  fi\ndone\nsudo systemctl daemon-reload\n\necho \"&#91;INFO] \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438...\"\nsudo rm -rf \/opt\/marzban \/var\/lib\/marzban \/etc\/marzban\n\necho \"&#91;INFO] \u041e\u0447\u0438\u0441\u0442\u043a\u0430 dangling \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 Docker...\"\ndocker system prune -af --volumes\n\necho \"&#91;SUCCESS] Marzban \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u0434\u0430\u043b\u0451\u043d \u0438\u0437 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.\"\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udd27 \u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044e<\/h3>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u0441\u043a\u0440\u0438\u043f\u0442 \u0432 \u0444\u0430\u0439\u043b:bash<code>nano marzban-cleanup.sh <\/code>\u0412\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435.<\/li>\n\n\n\n<li>\u0421\u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c:bash<code>chmod +x marzban-cleanup.sh<\/code><\/li>\n\n\n\n<li>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043e\u0442 root \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 <code>sudo<\/code>:bash<code>sudo .\/marzban-cleanup.sh<\/code><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">\u26a0\ufe0f \u0412\u0430\u0436\u043d\u043e<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0421\u043a\u0440\u0438\u043f\u0442 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 <strong>\u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 Marzban<\/strong> (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0431\u0430\u0437\u044b, \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u0438 \u043a\u043b\u044e\u0447\u0438). \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438\u043b\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u2014 \u0441\u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u0443\u044e \u043a\u043e\u043f\u0438\u044e \u0437\u0430\u0440\u0430\u043d\u0435\u0435.<\/li>\n\n\n\n<li>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0447\u0438\u0449\u0435\u043d\u0430 \u043e\u0442 Marzban, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043d\u043e\u0432\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u0435\u0437 \u043d\u0435\u0433\u043e.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0439 \u0437\u0430\u0447\u0438\u0441\u0442\u043a\u0438 Marzban \u0438\u0437 Debian: \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432, \u043e\u0431\u0440\u0430\u0437\u043e\u0432, \u0442\u043e\u043c\u043e\u0432, systemd-\u044e\u043d\u0438\u0442\u043e\u0432 \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432. \u041f\u043e\u043b\u043d\u0430\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u0442 Marzban \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Docker \u0438 systemd.<\/p>\n","protected":false},"author":1,"featured_media":1882,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[33],"tags":[222,213,214,216,215,217,223,219,218,221,220],"class_list":["post-1881","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-33","tag-bash-","tag-debian","tag-docker","tag-docker-compose","tag-marzban","tag-systemd","tag--marzban","tag-219","tag-218","tag-221","tag-220"],"_links":{"self":[{"href":"https:\/\/alexisiumus.ru\/index.php?rest_route=\/wp\/v2\/posts\/1881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alexisiumus.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alexisiumus.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alexisiumus.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alexisiumus.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1881"}],"version-history":[{"count":2,"href":"https:\/\/alexisiumus.ru\/index.php?rest_route=\/wp\/v2\/posts\/1881\/revisions"}],"predecessor-version":[{"id":1884,"href":"https:\/\/alexisiumus.ru\/index.php?rest_route=\/wp\/v2\/posts\/1881\/revisions\/1884"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/alexisiumus.ru\/index.php?rest_route=\/wp\/v2\/media\/1882"}],"wp:attachment":[{"href":"https:\/\/alexisiumus.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alexisiumus.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alexisiumus.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}