Zh/SteamCMD: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
(fix error)
(translation to SteamCMD Guardian 1.2)
Line 281: Line 281:
===SteamCMD Guardian 1.2===
===SteamCMD Guardian 1.2===


The following script was tested on Debian Wheezy.
下面的脚本已在Debian系统Wheezy版本上测试。
 
在这里查看并下载:
View and download here:
http://pastebin.com/hcpMpmaZ
http://pastebin.com/hcpMpmaZ




'''Installation'''  
'''安装教程'''  


To make this script work, we need a location. Preferrably you created a user (e.g. steam) with it's own home directory (/home/steam) and are logged in as it via SSH, tty or using su.
为了使这个脚本的工作,我们需要一个工作位置。你最好创建个用户(例如steam)以及它自己的根目录(/home/steam)并且通过SSH,tty且使用su来登录它。


# Make the file.
# 创建文件
#: <code>nano updateserver.sh</code>
#: <code>nano updateserver.sh</code>
# Paste in the code
# 粘贴脚本代码
# Modify the code, add '''at least''' 1 game to the <code>DL_SV*=</code> rows.
# 修改脚本代码,在<code>DL_SV*=</code>一行的最后添加一个游戏。
# Close the file with {{Key|Ctrl|O|}}, followed by {{Key|enter}} and concluding with {{Key|Ctrl|X}}.
# 使用{{Key|Ctrl|O|}}关闭文件,其次是{{Key|enter}},最后{{Key|Ctrl|X}}
# Give the file execute rights for the user
# 给用户执行文件的权限
#: <code>chmod u+x ./updateserver.sh</code>
#: <code>chmod u+x ./updateserver.sh</code>
# Run the file
# 运行文件
#: <code>./updateserver.sh</code>
#: <code>./updateserver.sh</code>


The file will auto-download SteamCMD, update it and install all chosen games (up to 4). Run the file again to update the games.
这个文件将自动安装,更新SteamCMD,以及安装所有选定的游戏(最多4个)。再次运行该文件将更新游戏。


== Known issues ==
== 已知的问题 ==
===ERROR! Failed to install app 'xxxxxx' (No subscription)===
===ERROR! Failed to install app 'xxxxxx' (No subscription)===



Revision as of 21:05, 18 August 2016

Template:Otherlang2 Steam命令行客户端SteamCMD)是一个命令行版本的Steam客户端。它的主要用途是在一个命令行界面的Steam客户端上安装和更新各种可用的专用服务端。它适用于使用SteamPipe内容分发系统的游戏。所有游戏已经从旧的半条命专用服务器更新工具迁移到了SteamCMD。

下载 SteamCMD

Windows系统

1. 创建一个为SteamCMD准备的文件夹。

“例如”

C:\steamcmd

2. 下载Windows系统专用的SteamCMD:https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip

3. 解压Zip文件中的文件到文件夹。

Linux系统

1. 首先安装运行环境用以运行SteamCMD。

Ubuntu/Debian 64位

sudo apt-get -y install lib32gcc1

RedHat/CentOS 32位

sudo yum -y install glibc libstdc++

RedHat/CentOS 64位

sudo yum -y install glibc.i686 libstdc++.i686

2. 建议创建一个SteamCMD专用的用户。在任何情况下,请 不要root 身份下运行SteamCMD,这可能会导致严重的安全隐患! 运行以下命令以root身份创建“Steam”用户,并登录它:

useradd -m steam
su - steam

如果你喜欢使用 sudo,更换第二行代码为以下命令:

sudo -iu steam

3. 创建一个为SteamCMD准备的目录,并切换到它

mkdir ~/steamcmd
cd ~/steamcmd

3. 下载Linux系统专用的SteamCMD

wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz

4. 解压文件到目录。

tar -xf steamcmd_linux.tar.gz

macOS系统

1.打开终端并创建一个为SteamCMD准备的目录。

mkdir ~/steamcmd
cd ~/steamcmd

2. 下载macOS系统专用的SteamCMD。

curl -O https://steamcdn-a.akamaihd.net/client/installer/steamcmd_osx.tar.gz

3. 解压文件到目录。

tar -xvzf steamcmd_osx.tar.gz

运行 SteamCMD

在第一次运行SteamCMD时将自动更新并显示一个 Steam> 的输入提示。输入 help 来获取更多信息。

Windows系统

打开一个命令行窗口并启动SteamCMD。

cd C:\steamcmd
steamcmd

Linux/macOS系统

打开一个终端并启动SteamCMD。

cd ~/steamcmd
./steamcmd.sh

登录 SteamCMD

匿名登录

下载大多数游戏服务端,你可以选择匿名登录。

login anonymous

Steam帐户登录

一些服务端需要你使用一个Steam帐户来登录。

Note.png注意:为了安全起见建议您创建一个服务端专用的Steam帐户。
Note.png注意:一个用户同时只能在一处登录(无论是在图形界面客户端还是在SteamCMD登录)。
login <用户名>

下一步请输入您的密码。

如果Steam 令牌已经在用户帐户上激活,查看你电子邮箱中的Steam 令牌验证码并输入它。这仅仅只是第一次登录时需要(以及当你删除了SteamCMD用于存储登录信息文件的时候)。

如果你已经成功登录了你的帐户,你应该会看到一条消息。

下载一个应用

1. 打开SteamCMD并登录它。

2. 设置你的应用安装目录(注意:在Linux/macOS系统下使用正斜杠/,在Windows系统下使用反斜杠\)。

force_install_dir <路径>

例如 一个名叫csgo_ds的在当前目录下的目录:

force_install_dir ./csgo_ds/

在Windows系统: force_install_dir .\csgo_ds\

3. 安装或更新应用使用app_update命令(在这里提供Steam应用ID)。 要同时校验应用的话,需添加validate到命令里。要下载测试分支的话,使用-beta <测试名称>选项 – 例如,半条命专用服务器的测试分支名为beta以及起源专用服务器的测试分支名为prerelease。一些测试分支设置了密码;如果要从它那里下载,需同时添加-betapassword <密码>选项。

app_update <应用ID> [-beta <测试名称>] [-betapassword <密码>] [validate]

半条命专用服务器是一个特例:应用ID都是90,必须先选择模组。 这是通过设置配置选项mod来请求变量的。

app_set_config <应用ID> <选项名称> <变量选项>
例如:安装并校验反恐精英:全球攻势专用服务器:
app_update 740 validate
例如:安装并校验军团要塞专用服务器:
app_set_config 90 mod tfc
app_update 90 validate
Icon-Bug.png错误:半条命专用服务器 (应用ID 90)需要多次运行app_update命令才能安装完所有所需要的文件。只需运行app_update 90 validate多次直到没有更多的更新内容即可。  [todo tested in ?]
例如:安装并校验测试版本的半条命专用服务器(半条命)
app_update 90 -beta beta validate
例如:安装并校验测试版本的反恐精英:起源专用服务器:
app_update 232330 -beta prerelease validate
例如:安装并校验私人测试版本的物竞天择2专用服务器(测试名称alpha,测试密码natsel):
[测试名称]是私人测试分支的名称
[测试密码]是私人测试分支的密码
app_update 4940 -beta alpha -betapassword natsel validate

3. 完成之后,输入quit从而正确地从Steam服务器内注销帐户。

quit

验证

validate

验证是一个命令以用来检查服务端的所有文件以确保他们符合SteamCMD所应该下载到本地的文件。如果你认为文件可能已丢失或已损坏,那么此命令将会非常有用。

Note.png注意:验证将会覆盖已被更改了的文件。这可能会导致服务端的自定义问题。例如:如果你自定义了mapcycle.txt,此文件将会被覆盖至服务端的默认值。不是默认安装文件一部分的任何文件将不受影响。

建议你只在初次安装时或如果服务端有问题时才使用此命令。

所支持的服务端

已知可使用SteamCMD安装的服务端可在专用服务器列表页面查询。需要注意的是额外命令需在app_update之前被执行。

自动执行SteamCMD

这里有两个方法来自动执行SteamCMD。(在Linux/macOS系统下使用./steamcmd.sh来替代steamcmd。)

命令行

Note.png注意:当在命令行使用-beta选项时,它必须以一种特殊的方式被引用,比如+app_update "90 -beta beta"
Note.png注意:如果这不工作尝试将它用"+app_update 90 -beta beta"代替。

在命令行追加命令需要在其前面添加加号,例如:

steamcmd +login anonymous +force_install_dir ./csgo_ds +app_update 740 +quit

安装半条命的一个特定游戏模组,比如反恐精英:零点行动:

steamcmd +login anonymous +force_install_dir ./czero +app_set_config 90 mod czero +app_update 90 +quit

安装一个需要登录的游戏,就像杀戮空间:

steamcmd +login <用户名> <密码> +force_install_dir .\KFServer\ +app_update 215350 +quit

创建脚本

1. 把你的SteamCMD命令放置在文本文件中。(你可以添加注释,只需在其前面添加//。)例如:

// 更新反恐精英:全球攻势专用服务器
//
@ShutdownOnFailedCommand 1 //如果一次更新多个服务端请设置为0
@NoPromptForPassword 1
login <username> <password>
//一些服务端并不需要登录
//login anonymous 
force_install_dir ./csgo_ds
app_update 740 validate
quit

2. 带着+runscript选项运行SteamCMD,指向你之前创建的文件。例如:

steamcmd +runscript csgo_ds.txt

跨平台安装

它可以选择下载其他平台里SteamCMD所应该下载的文件,即使它不是当前正在运行的平台。 这是使用@sSteamCmdForcePlatformType变量来完成的(是的,在变量名称的开头有两个“s”。)例如:在Linux系统下载Windows端的反恐精英:全球攻势专用服务器,你可以运行下面的命令:

./steamcmd.sh +@sSteamCmdForcePlatformType windows +login anonymous +force_install_dir ../csgo_ds +app_update 740 validate +quit

或者使用下面的脚本:

@ShutdownOnFailedCommand 1
@NoPromptForPassword 1
@sSteamCmdForcePlatformType windows
login anonymous
force_install_dir ../csgo_ds
app_update 740 validate
quit

这个变量支持windowsmacoslinux

Windows系统 软件/脚本

condenser

condenser 是一个用于下载,配置和启动Steam专用服务器应用的引导程序。

SteamCMD AutoUpdater

安装和自动更新任何游戏服务端

GitHub仓库: https://github.com/C0nw0nk/SteamCMD-AutoUpdate-Any-Gameserver

SteamCMD GUI

这个工具可以使用户在Windows系统上不通过命令行或批处理文件来使用SteamCMD。

GitHub仓库: https://github.com/DioJoestar/SteamCMD-GUI

SteamCMD Guardian 1.2

在这里查看并下载:http://pastebin.com/BRUbsGQh

Linux系统 脚本

Linux Game Server Managers

Linux Game Server Manager

Linux Game Server Managers是一个快捷的命令行工具,通过SteamCMD来轻松地部署和管理各种游戏专用服务器。

特点

  • 安装服务端 (SteamCMD)
  • 启动/关闭/重启 服务端
  • 更新服务端 (SteamCMD)
  • 监控服务端 (包括用电子邮件通知)
  • 查看服务端的详细信息
  • 备份服务端
  • 可以进入服务端控制台

支持的服务端

现在支持40多个不同的游戏服务端并且数量还在上升。详情列表请访问网站。

链接

网站: http://gameservermanagers.com

GitHub仓库: https://github.com/dgibbs64/linuxgsm

Steam-cmd-installer

此脚本将自动执行SteamCMD的安装,并且选择性地安装游戏。目前此脚本已在Ubuntu系统中测试,但确认可以在Ubuntu系统,Mint系统,Centos系统,ZorinOS系统和Debian系统下工作。

如何安装

  1. 首先为SteamCMD创建一个用户 “adduser steam”。
  2. 用nano或vi创建一个叫“steamcmdinstaller.sh "的新文件。
  3. 从https://github.com/Gousaid67/steam-cmd-installer 查找steamcmdinstaller.sh的最新版本,并将其粘贴到新创建的文件中。
  4. chmod +x steamcmdinstaller.sh 使脚本可以被执行。
  5. 运行脚本 ./steamcmdinstaller.sh 。系统将提示你输入各种设置。
  6. 现在该脚本将自动下载并安装SteamCMD。 你还可以通过选项给它一个应用ID来安装你所选择的游戏服务端。

可选:定义自定义路径

这个脚本可设置自定义路径到 /home/steam/ 之外但需要编辑脚本。感谢dvdvideo1234在该功能上的帮助。

  1. 首先根据第四行的说明来编辑脚本。
  2. 之后执行./steamcmdinstaller.sh "自定义路径"之后再按照说明进行安装。如果你设置路径到受限目录比如 /etc,那么脚本将无法工作。

SteamCMD Guardian 1.2

下面的脚本已在Debian系统Wheezy版本上测试。 在这里查看并下载: http://pastebin.com/hcpMpmaZ


安装教程

为了使这个脚本的工作,我们需要一个工作位置。你最好创建个用户(例如steam)以及它自己的根目录(/home/steam)并且通过SSH,tty且使用su来登录它。

  1. 创建文件
    nano updateserver.sh
  2. 粘贴脚本代码
  3. 修改脚本代码,在DL_SV*=一行的最后添加一个游戏。
  4. 使用Ctrl+O关闭文件,其次是 Enter,最后Ctrl+X
  5. 给用户执行文件的权限
    chmod u+x ./updateserver.sh
  6. 运行文件
    ./updateserver.sh

这个文件将自动安装,更新SteamCMD,以及安装所有选定的游戏(最多4个)。再次运行该文件将更新游戏。

已知的问题

ERROR! Failed to install app 'xxxxxx' (No subscription)

If you get the 'No subscription' error, the game/server you are trying to download either requires a login or that you have purchased the game. You will therefore have to log in with a Steam username and password – if that doesn't help, you may need to purchase a copy of the game on Steam first. See Dedicated Servers List.

Note.png注意:For security reasons it is recommended that you create a new Steam account just for your dedicated servers.

For example

steamcmd +login <username> <password>

32-bit libraries on 64-bit Linux systems

Since SteamCMD is a 32-bit binary, 32-bit libraries are required.

The following error may occur:

steamcmd: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

The resolution depends on your distro:

Debian based distributions (Ubuntu, Mint, etc.)

sudo apt-get install lib32stdc++6
Note.png注意:ia32-libs are not required to install SteamCMD; lib32gcc1 is enough.

With Debian 7 "Wheezy" you may encounter this error:

The following packages have unmet dependencies: ia32-libs : Depends: ia32-libs-multiarch but it is not installable
E: Unable to correct problems, you have held broken packages.

To fix this, do the following:

 dpkg --add-architecture i386
 apt-get update
 apt-get install lib32gcc1

Red Hat based distributions (RHEL, Fedora, CentOS, etc.)

yum install glibc.i686 libstdc++.i686

Arch Linux

Don't forget to first enable the multilib repository.

pacman -S lib32-gcc-libs

Login Failure: No Connection

On linux servers, you may experience a "Login Failure: No Connection" error. This is related to missing iptables rules. You will want something along these lines:

iptables -A INPUT -p udp -m udp --sport 27000:27030 --dport 1025:65355 -j ACCEPT
iptables -A INPUT -p udp -m udp --sport 4380 --dport 1025:65355 -j ACCEPT

The port list is found here: https://support.steampowered.com/kb_article.php?ref=8571-GLVN-8711&l=english

On Windows servers, you may experience "SteamUpdater: Error: Download failed: http error 0" and "SteamUpdater: Error: Steam needs to be online to update. Please confirm your network connection and try again.". This is usually fixed by checking "Automatically detect settings" in IE (Internet Explorer) through the lan settings in the Internet option menu.

  1. Open Internet Explorer (IE).
  2. Click on ToolsInternet Options
  3. Click on the Connections tab
  4. At the bottom, you should see Local Area Network (LAN) Settings.
  5. Check the first box (Automatically detect settings)
  6. Hit OK, and Apply. Try running the SteamCMD again; if it still doesn't work. try lowering your Internet Security level zone to medium or lower. You can find that in the Security tab in Internet Options.

SteamCMD startup errors

Unable to locate a running instance of Steam

You may get the following error when starting a server with Linux:

[S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.dll.

Resolve the issue by linking steamclient.so to the ~/.steam/sdk32/steamclient.so directory:

ln -s steamcmd/linux32/steamclient.so ~/.steam/sdk32/steamclient.so

ulimit Linux startup error

Some users may get a ulimit error (no permission/cannot open file) while script is starting up. This error caused by a low setting of the -n parameter (number of file descriptors) of ulimit. SteamCMD uses standard commands inside of the initialization shell script to change the ulimit automatically, but some servers may forbid increasing ulimit values after startup (or beyond a limit set by root).

This can be fixed by changing the file descriptor number ulimit:

ulimit -n 2048

If an error appears (no permission), you will have to log in as root to change the parameter. To check the current setting, type ulimit -a; the system will reply with many rows, you need to find one:

open files                      (-n) 1024

In this case, 1024 is the current value.

root can also modify the limits in the /etc/security/limits.conf file.

In most instances you will simply get a warning message however it will not stop SteamCMD from running.

Only the HLDS engine is downloaded

When trying to download a HL1 mod like TFC, initially it only downloads the engine files of the HLDS, but not the mod. This happens with both the regular version and the beta. You may have to try multiple times until all the required files are downloaded, but once this is done, the files should update correctly next time.

Work-around for this issue here: http://danielgibbs.co.uk/2013/11/hlds-steamcmd-workaround-appid-90/

Just deleting the appmanifest files, without downloading replacements from a third party, may work as well! You will get an error at first though, complaining that something went wrong, which is due to the deleted files.

On a side note, for some reason CS is always installed as well.

See Also