我刚刚购买了带有 Ubuntu 10.10 的新 VPS。我遵循本指南http://l2jserver.com/wiki/Setup_Server_-_Ubuntu用于创建 Lineage2 服务器,但这并不重要。我尝试使用命令java -version
,但出现错误:
-bash: java: command not found
如果我跳过这一步并使用此命令(用于安装 Java):sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk
我会收到此错误:
Unable to locate package sun-java6-bin
Unable to locate package sun-java6-jre
Unable to locate package sun-java6-jdk
它有什么问题?谢谢你的回答。
更新 #1
当我输入:java -version
我收到错误:-bash: java: command not found
当我输入:sudo add-apt-repository "deb http://archive.canonical.com/ maverick partner
我收到错误:sudo: add-apt-repository: command not found
当我输入:sudo apt-get update
我收到错误:
Ign http://archive.ubuntu.com maverick Release.gpg
Ign http://archive.ubuntu.com/ubuntu/ maverick/main Translation-en
Ign http://archive.ubuntu.com/ubuntu/ maverick/restricted Translation-en
Ign http://archive.ubuntu.com/ubuntu/ maverick/universe Translation-en
Ign http://archive.ubuntu.com maverick-updates Release.gpg
Ign http://archive.ubuntu.com/ubuntu/ maverick-updates/main Translation-en
Ign http://archive.ubuntu.com/ubuntu/ maverick-updates/restricted Translation-en
Ign http://archive.ubuntu.com/ubuntu/ maverick-updates/universe Translation-en
Ign http://archive.ubuntu.com maverick-security Release.gpg
Ign http://archive.ubuntu.com/ubuntu/ maverick-security/main Translation-en
Ign http://archive.ubuntu.com/ubuntu/ maverick-security/restricted Translation-e n
Ign http://archive.ubuntu.com/ubuntu/ maverick-security/universe Translation-en
Ign http://archive.ubuntu.com maverick Release
Ign http://archive.ubuntu.com maverick-updates Release
Ign http://archive.ubuntu.com maverick-security Release
Ign http://archive.ubuntu.com maverick/main amd64 Packages
Ign http://archive.ubuntu.com maverick/restricted amd64 Packages
Ign http://archive.ubuntu.com maverick/universe amd64 Packages
Ign http://archive.ubuntu.com maverick-updates/main amd64 Packages
Ign http://archive.ubuntu.com maverick-updates/restricted amd64 Packages
Ign http://archive.ubuntu.com maverick-updates/universe amd64 Packages
Ign http://archive.ubuntu.com maverick-security/main amd64 Packages
Ign http://archive.ubuntu.com maverick-security/restricted amd64 Packages
Ign http://archive.ubuntu.com maverick-security/universe amd64 Packages
Ign http://archive.ubuntu.com maverick/main amd64 Packages
Ign http://archive.ubuntu.com maverick/restricted amd64 Packages
Ign http://archive.ubuntu.com maverick/universe amd64 Packages
Ign http://archive.ubuntu.com maverick-updates/main amd64 Packages
Ign http://archive.ubuntu.com maverick-updates/restricted amd64 Packages
Ign http://archive.ubuntu.com maverick-updates/universe amd64 Packages
Ign http://archive.ubuntu.com maverick-security/main amd64 Packages
Ign http://archive.ubuntu.com maverick-security/restricted amd64 Packages
Ign http://archive.ubuntu.com maverick-security/universe amd64 Packages
Err http://archive.ubuntu.com maverick/main amd64 Packages
404 Not Found [IP: 91.189.92.200 80]
Err http://archive.ubuntu.com maverick/restricted amd64 Packages
404 Not Found [IP: 91.189.92.200 80]
Err http://archive.ubuntu.com maverick/universe amd64 Packages
404 Not Found [IP: 91.189.92.200 80]
Err http://archive.ubuntu.com maverick-updates/main amd64 Packages
404 Not Found [IP: 91.189.92.200 80]
Err http://archive.ubuntu.com maverick-updates/restricted amd64 Packages
404 Not Found [IP: 91.189.92.200 80]
Err http://archive.ubuntu.com maverick-updates/universe amd64 Packages
404 Not Found [IP: 91.189.92.200 80]
Err http://archive.ubuntu.com maverick-security/main amd64 Packages
404 Not Found [IP: 91.189.92.200 80]
Err http://archive.ubuntu.com maverick-security/restricted amd64 Packages
404 Not Found [IP: 91.189.92.200 80]
Err http://archive.ubuntu.com maverick-security/universe amd64 Packages
404 Not Found [IP: 91.189.92.200 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/maverick/main/binary-a md64/Packages.gz 404 Not Found [IP: 91.189.92.200 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/maverick/restricted/bi nary-amd64/Packages.gz 404 Not Found [IP: 91.189.92.200 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/maverick/universe/bina ry-amd64/Packages.gz 404 Not Found [IP: 91.189.92.200 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/maverick-updates/main/ binary-amd64/Packages.gz 404 Not Found [IP: 91.189.92.200 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/maverick-updates/restr icted/binary-amd64/Packages.gz 404 Not Found [IP: 91.189.92.200 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/maverick-updates/unive rse/binary-amd64/Packages.gz 404 Not Found [IP: 91.189.92.200 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/maverick-security/main /binary-amd64/Packages.gz 404 Not Found [IP: 91.189.92.200 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/maverick-security/rest ricted/binary-amd64/Packages.gz 404 Not Found [IP: 91.189.92.200 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/maverick-security/univ erse/binary-amd64/Packages.gz 404 Not Found [IP: 91.189.92.200 80]
E: Some index files failed to download, they have been ignored, or old ones used instead.
我的 /etc/apt/sources.list 如下所示:
有人能帮助我吗?
答案1
您需要取消注释 /etc/apt/sources.list 中引用“partner”的两行尝试:
sudo nano /etc/apt/sources.list
用已安装的文本编辑器(如 vi 等)替换“nano”。
取消注释涉及“合作伙伴”的两行(删除#)
如果没有存储库,请添加一个:
sudo add-apt-repository "deb http://archive.canonical.com/ maverick partner"
现在,
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-bin sun-java6-jdk
答案2
尝试执行 sudo apt-get install openjdk-6-jre, openjdk-6-bin, openjdk-6-jdk
答案3
我遇到了类似的问题,这是框架(pythons、ruby、perl)的问题。所以我将 Ubuntu 操作系统更改为 12.04。解决此问题的最佳方法是升级操作系统