无法在 ubuntu 上安装 mysql 服务器

无法在 ubuntu 上安装 mysql 服务器

我在 ubuntu 11.10 中更新时遇到的错误。由于我发现 ubuntu 11.10 对 matlab 的支持比 12.04 好得多,所以我将操作系统重新启动到 ubuntu 11.10。即使在这里,我也遇到了同样的问题。我觉得这一定是 oneiric 的问题

sudo apt-get update    
Err http://in.archive.ubuntu.com oneiric InRelease
Err http://in.archive.ubuntu.com oneiric-updates InRelease                     
Err http://in.archive.ubuntu.com oneiric-backports InRelease                   
Err http://in.archive.ubuntu.com oneiric-proposed InRelease                    
Err http://in.archive.ubuntu.com oneiric Release.gpg                           
Unable to connect to in.archive.ubuntu.com:http: [IP: 91.189.92.156 80]
Err http://in.archive.ubuntu.com oneiric-updates Release.gpg                   
Unable to connect to in.archive.ubuntu.com:http: [IP: 91.189.92.156 80]
Err http://in.archive.ubuntu.com oneiric-backports Release.gpg                 
Unable to connect to in.archive.ubuntu.com:http: [IP: 91.189.92.156 80]
Err http://extras.ubuntu.com oneiric InRelease                                 
Err http://in.archive.ubuntu.com oneiric-proposed Release.gpg                  
Unable to connect to in.archive.ubuntu.com:http: [IP: 91.189.92.156 80]
Err http://extras.ubuntu.com oneiric Release.gpg                               
Unable to connect to extras.ubuntu.com:http:
Err http://security.ubuntu.com oneiric-security InRelease                      
Err http://security.ubuntu.com oneiric-security Release.gpg                    
Unable to connect to security.ubuntu.com:http: [IP: 91.189.91.14 80]
Err http://archive.ubuntu.com oneiric InRelease
Err http://archive.ubuntu.com oneiric Release.gpg
Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.177 80]
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/oneiric/InRelease  
W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/oneiric/InRelease  
W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/oneiric-updates/InRelease  
W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/oneiric-backports/InRelease  
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/oneiric-security/InRelease  
W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/oneiric/InRelease  
W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/oneiric-proposed/InRelease  
W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/oneiric/Release.gpg  Unable to connect to in.archive.ubuntu.com:http: [IP: 91.189.92.156 80]
W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/oneiric-updates/Release.gpg  Unable to connect to in.archive.ubuntu.com:http: [IP: 91.189.92.156 80]
W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/oneiric-backports/Release.gpg  Unable to connect to in.archive.ubuntu.com:http: [IP: 91.189.92.156 80]
W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/oneiric-proposed/Release.gpg     Unable to connect to in.archive.ubuntu.com:http: [IP: 91.189.92.156 80]
W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/oneiric/Release.gpg         Unable to connect to extras.ubuntu.com:http:
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/oneiric-security/Release.gpg           Unable to connect to security.ubuntu.com:http: [IP: 91.189.91.14 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/oneiric/Release.gpg         Unable to connect to archive.ubuntu.com:http: [IP: 91.189.92.177 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.

/etc/apt/sources.list

# deb cdrom:[Ubuntu 11.10 _Oneiric Ocelot_ - Release amd64 (20111012)]/ dists/oneiric/main/binary-i386/
# deb cdrom:[Ubuntu 11.10 _Oneiric Ocelot_ - Release amd64 (20111012)]/ oneiric main restricted
deb-src http://archive.ubuntu.com/ubuntu oneiric main restricted #Added by software-properties

deb http://in.archive.ubuntu.com/ubuntu/ oneiric main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ oneiric restricted main multiverse #Added by software-properties

deb http://in.archive.ubuntu.com/ubuntu/ oneiric-updates main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ oneiric-updates restricted main multiverse           #Added by software-properties

deb http:// in.archive.ubuntu.com/ubuntu/ oneiric multiverse
deb http://in.archive.ubuntu.com/ubuntu/ oneiric-updates multiverse

deb http://in.archive.ubuntu.com/ubuntu/ oneiric-backports main restricted multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ oneiric-backports main restricted multiverse #Added by software-properties

deb http://security.ubuntu.com/ubuntu oneiric-security main restricted
deb-src http://security.ubuntu.com/ubuntu oneiric-security restricted main multiverse #Added by software-properties
deb http://security.ubuntu.com/ubuntu oneiric-security multiverse

# deb http://archive.canonical.com/ubuntu oneiric partner
# deb-src http://archive.canonical.com/ubuntu oneiric partner

deb http://extras.ubuntu.com/ubuntu oneiric main
deb http://in.archive.ubuntu.com/ubuntu/ oneiric-proposed restricted main multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ oneiric-proposed restricted    main multiverse #Added by software-properties
deb-src http://extras.ubuntu.com/ubuntu oneiric main

答案1

SQL Server 需要 Microsoft Windows 操作系统才能运行。无法在 Ubuntu 上安装 SQL Server。只能使用某种形式的 VM 来实现。

确保您已检查重要安全更新。

在此处输入图片描述

要在 Ubuntu 12.04 上安装 MySQL,只需按键盘上的Ctrl+ Alt+T打开终端。打开后,运行以下命令:

sudo apt-get update && sudo apt-get upgrade   
sudo apt-get install mysql-server

这将仅安装 MySQL 5.5

在此处输入图片描述 在此处输入图片描述

在 Ubuntu 12.04 LTS 上安装支持 PHP5 和 MySQL 的 Apache2

sudo apt-get install mysql-server mysql-client
sudo apt-get install apache2
sudo apt-get install php5 libapache2-mod-php5

资料来源:感谢 Shankar Raman

答案2

Ubuntu Oneric (11.10) 已经停产很长时间了,并且它的存储库也不再存在http://in.archive.ubuntu.com/ubuntu/

12.04 是最早的版本,还有相当长的支持期限。10.04 仍然对服务器版本提供几个月的支持,但如果您可以使用其中任何一个,我建议您使用 12.04 或 14.04。

答案3

正如已经指出的那样,Ubuntu Oneric 已停产,因此其官方存储库不再维护。但是,如果您希望继续使用不再更新的官方存储库,您可以将当前(不再可用,这是错误的原因)存储库更改为托管在旧版本通过运行以下命令;它将更新您当前的/etc/apt/sources.list存储库以使用不再更新的存储库:

sudo mv /etc/apt/sources.list /etc/apt/sources.list.backup && sed 's/http:\/\/.*\.ubuntu\.com/http:\/\/old-releases\.ubuntu\.com/' /etc/apt/sources.list.backup | sudo tee /etc/apt/sources.list

之后您可以运行sudo apt-get update更新apt缓存,然后sudo apt-get install mysql-server进行安装mysql-server


命令分解:

  • sudo mv /etc/apt/sources.list /etc/apt/sources.list.backup: 重命名/etc/apt/sources.list/etc/apt/sources.list.backup
  • sed 's/http:\/\/.*\.ubuntu\.com/http:\/\/old-releases\.ubuntu\.com/' /etc/apt/sources.list.backup:替换以开头http://和结尾的任何字符串.ubuntu.comhttp://old-releases.ubuntu.com/etc/apt/sources.list.backup
  • sudo tee /etc/apt/sources.list:输出所有内容至/etc/apt/sources.list

相关内容