无法在ubuntu上安装mysql服务器

我在ubuntu 11.10中更新时遇到的错误。 因为我发现ubuntu 11.10支持比12.04更好的matlab,我已经将我的操作系统重新启动到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 

SQL Server需要Microsoft Windows操作系统才能运行。 你无法在Ubuntu上安装SQL Server。 它只能使用某种forms的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

Ubuntu Oneric(11.10)在很长一段时间内已经停产,并且http://in.archive.ubuntu.com/ubuntu/上的存储库不再存在。

12.04是最早留下良好支持生命的版本。 10.04仍然有几个月的服务器版本支持,但如果您可以使用其中任何一个,我建议12.04或14.04。

正如已经说明的那样,Ubuntu Oneric是EOL,因此它的官方存储库不再被保留。 但是,如果您希望继续使用不再更新的官方存储库,则可以通过运行以下命令将当前(不再可用,这是错误的原因)存储库更改为old-releases.ubuntu.com上托管的存储库; 它将更新您当前的/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.com结尾,并在/etc/apt/sources.list.backuphttp://old-releases.ubuntu.com结尾
  • sudo tee /etc/apt/sources.list :将所有内容输出到/etc/apt/sources.list