你可以在你的软件包中添加一个postinst脚本:总体来说,preinst脚本在(特定版本的)软件包解压之前被调用,而postinst脚本在之后被调用... postinst脚本应该尝试执行其依赖所需的任何操作,因为它们通常是可用的,但如果这些操作失败,考虑正确的错误处理方法。 http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html 一个例子Opera浏览器正在使用postinst脚本将自己添加到/etc/apt/sources.list.d/opera.list中:http://pastebin.com/u6SR6krY