
我最近安裝了Ubuntu,並且一直嘗試使用apt-get 安裝一些程序,但它似乎從來沒有工作過,甚至apt-get update 也不起作用,這是我嘗試安裝某些東西時得到的結果,在這種情況下: java的jdk-7使用:
apt-get install openjdk-7-jre-headless
這是我得到的:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.2.0-29 linux-headers-3.2.0-29-generic-pae
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 24 not upgraded.
mkhas@mkhas-Inspiron-3520:~/Downloads$ sudo apt-get install openjdk-7-jre-headless
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.2.0-29 linux-headers-3.2.0-29-generic-pae
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
ca-certificates-java icedtea-7-jre-jamvm java-common openjdk-7-jre-lib tzdata-java
Suggested packages:
default-jre equivs sun-java6-fonts ttf-dejavu-extra fonts-ipafont-gothic
fonts-ipafont-mincho ttf-telugu-fonts ttf-oriya-fonts ttf-kannada-fonts
ttf-bengali-fonts
The following NEW packages will be installed:
ca-certificates-java icedtea-7-jre-jamvm java-common openjdk-7-jre-headless
openjdk-7-jre-lib tzdata-java
0 upgraded, 6 newly installed, 0 to remove and 24 not upgraded.
Need to get 44.1 MB of archives.
After this operation, 63.5 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
WARNING: The following packages cannot be authenticated!
openjdk-7-jre-lib ca-certificates-java tzdata-java java-common openjdk-7-jre- headless
icedtea-7-jre-jamvm
Install these packages without verification [y/N]? y
0% [Connecting to lb.archive.ubuntu.com (91.189.91.13)]
而且它只是卡在 0%
編輯:是的,互聯網在我的系統上運作良好。
我嘗試過的一件事是更改鏡像伺服器,據說它從中檢索套件從/etc/apt/sources.list 中的lb.archives.ubuntu.com 到archives.ubuntu.com 但它說該文件是只讀的,我無法對其進行任何更改。
我嘗試更新 apt-get through
apt-get update
但每當我嘗試這樣做時我都會得到這個:
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
編輯:問題已解決,我沒有使用 sudo apt-get update 而只使用 apt-get update
答案1
該apt-get
命令需要 root 權限,因此需要使用sudo
.例如:
sudo apt-get update
然後你可以安裝你的套件:
sudo apt-get install openjdk-7-jre-headless