得分
382
Advertisement
答案 (11)
解决方案找到了!
Advertisement
Advertisement
得分
53
2015-07-12 18:36:26 +0000
注意,如果你也想在互动提示出现时自动按默认答案,你可以使用DEBIAN_FRONTEND=noninteractive
单次安装:
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install [packagename]
E.g. :
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install postfix
所有更新:
sudo DEBIAN_FRONTEND=noninteractive apt-get -y update
你可以用-o Dpkg::Options::="--force-confdef"和-o Dpkg::Options::="--force-confold"设置更精细的选项。 执行一个无人值守的 Debian 软件包的安装](http://www.microhowto.info/howto/perform_an_unattended_installation_of_a_debian_package.html)
Franck Dernoncourt
http://superuser.stackexchange.com/users/41978
Advertisement
得分
7
2010-07-16 20:37:01 +0000
apt-get -y update
apt-get -y install [package]
steve.lippert
http://superuser.stackexchange.com/users/41978
Advertisement
得分
4
2014-11-17 16:51:42 +0000
apt-get -y --force-yes install package
yes | apt-get -y --force-yes install package
如果不成功,可以尝试使用yes命令。
Summer-Sky
http://superuser.stackexchange.com/users/41978
Advertisement
得分
1
2018-07-31 15:28:56 +0000
如果你总是想要 -y 参数,我建议在你的 .bashrc 中加入
alias apt-get='apt-get -y' #Automatic -y argument on apt-get commands
。正如注释中解释的那样,这将自动将 -y 参数添加到你所有的 apt-get 命令中,从而批准所有的下载。
Joseph Stevens
http://superuser.stackexchange.com/users/41978
得分
1
2018-09-10 13:29:06 +0000
我一直在寻找一种在脚本中选择非默认的方法,特别是在安装wireshark的时候,最后用tmux与shell交互,如下所示:
# Start a detached root session
sudo tmux new-session -d
# Send the command
sudo tmux send-keys "DEBIAN_FRONTEND=readline apt-get -qq install wireshark-common; exit" enter
# Wait for the tmux session to get to the interactive stage
sleep 5
# Answer the question
sudo tmux send-keys "yes" enter
# Now attach to the session so we wait for command completion
sudo tmux attach
Stephen Ramm
http://superuser.stackexchange.com/users/41978