Vagrant Box-使用apt安装MySql 5.7

Vagrant Box-使用apt安装MySql 5.7,mysql,ubuntu,vagrant,vagrantfile,mysql-5.7,Mysql,Ubuntu,Vagrant,Vagrantfile,Mysql 5.7,我基于ubuntu/trusty64创建了一个基本的漫游框 当我“游荡起来”机器,然后“游荡ssh”进入它时,一切都很好 下一步是安装最新的mysql 5.7,我就是这么做的: wget http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb sudo dpkg -i mysql-apt-config_0.7.3-1_all.deb sudo apt-get update sudo apt-get install -y mysql-se

我基于ubuntu/trusty64创建了一个基本的漫游框

当我“游荡起来”机器,然后“游荡ssh”进入它时,一切都很好

下一步是安装最新的mysql 5.7,我就是这么做的:

wget http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
sudo dpkg -i mysql-apt-config_0.7.3-1_all.deb
sudo apt-get update
sudo apt-get install -y mysql-server
所以它下载配置等。。。接下来会出现一个“交互式”shell,其中要求我键入密码并重复

MySql 5.7已成功安装在我的计算机中…但是:

我希望它在“vagrant up”期间安装,这就是为什么我用以下内容修改vagrant文件:

config.vm.provision :shell, path: "bootstrap.sh"
在bootstrap.sh中,我添加了以下内容:

wget http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
sudo dpkg -i mysql-apt-config_0.7.3-1_all.deb
sudo apt-get update
sudo apt-get install -y mysql-server
这完全失败了。。。在控制台中,我可以看到它试图配置mysql 5.5及其依赖项

但是为什么呢

如果有人能在这个问题上提供帮助,我将非常感激

谢谢和问候

更新 错误消息

==> default: There are no enabled repos.
==> default:  Run "yum repolist all" to see the repos you have.
==> default:  You can enable repos with yum-config-manager --enable <repo>
==> default: sudo: yum-config-manager: command not found
==> default: There are no enabled repos.
==> default:  Run "yum repolist all" to see the repos you have.
==> default:  You can enable repos with yum-config-manager --enable <repo>
==> default: mysqld: unrecognized service
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
==>默认值:没有启用的回购。
==>默认值:运行“yum repolist all”查看您拥有的repo。
==>默认值:可以使用yum config manager--enable启用repos
==>默认值:sudo:yum配置管理器:未找到命令
==>默认值:没有启用的回购。
==>默认值:运行“yum repolist all”查看您拥有的repo。
==>默认值:可以使用yum config manager--enable启用repos
==>默认值:mysqld:无法识别的服务
SSH命令以非零退出状态响应。流浪汉
假设这意味着命令失败。此命令的输出
应该在上面的日志中。请阅读输出以确定需要什么
出了问题。

vagrant之所以安装5.5而不是5.7,是因为
ubuntu/trusty
版本可能是ubuntu 14.04,ubuntu 14.04的默认mysql版本是mysql 5.5

下面是一个自动安装mysql 5.7的vagrant文件,但我在这里配置了centos6。请随意更改操作系统,并将其设置为ubuntu/trusty。照办

mysql57_config.vm.box='ubuntu/trusty64'

说明:

mkdir mysql-5-7

光盘mysql-5-7

进入mysql-5-7目录后,添加这两个文件,
Vagrantfile
bootstrap.sh
文件

流浪汉档案

没有这一点,流浪汉ssh(没有tty)就会神秘地失败


如果您正在使用MacOS,请关闭防火墙,看看它是否正常工作?

您能提供vagrant box ubuntu版本吗?ubuntu/trusty64(virtualbox,20160714.0.0)可以吗?谢谢您的回答,但mysql 5.7到底安装在哪里?你能分享你的provision.sh吗?嘿,我用错误代码更新了我的问题,你能参考一下吗?你用sudo运行了这个文件吗?如果你没有,请这样做。我在每一行前面都加上sudo,但err msg仍然存在,嗯,可能是因为我使用ubuntu/trusty64?我能知道你的操作系统名称和版本吗?
    # -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://atlas.hashicorp.com/search.
  config.vm.box = "centos/7"
  config.vm.hostname = "mysql57"
  config.vm.provision "shell", path: "bootstrap.sh"
  config.vm.define "mysql57" do |mysql57|
  end

  # Disable automatic box update checking. If you disable this, then
  # boxes will only be checked for updates when the user runs
  # `vagrant box outdated`. This is not recommended.
  # config.vm.box_check_update = false

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  # config.vm.network "forwarded_port", guest: 80, host: 8080

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  config.vm.network "private_network", ip: "192.168.33.10"

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  # config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
  #   vb.gui = true
  #
  #   # Customize the amount of memory on the VM:
  #   vb.memory = "1024"
  # end
  #
  # View the documentation for the provider you are using for more
  # information on available options.

  # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
  # such as FTP and Heroku are also available. See the documentation at
  # https://docs.vagrantup.com/v2/push/atlas.html for more information.
  # config.push.define "atlas" do |push|
  #   push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
  # end

  # Enable provisioning with a shell script. Additional provisioners such as
  # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
  # documentation for more information about their specific syntax and use.
  # config.vm.provision "shell", inline: <<-SHELL
  #   sudo apt-get update
  #   sudo apt-get install -y apache2
  # SHELL
end
sudo yum install -y wget
wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
sudo yum install -y mysql57-community-release-el7-8.noarch.rpm
sudo yum -y update
sudo yum -y install mysql-server
sudo systemctl start mysqld
sudo systemctl enable mysqld
MYSQL_TEMP_PWD=`sudo cat /var/log/mysqld.log | grep 'A temporary password is generated' | awk -F'root@localhost: ' '{print $2}'`
mysqladmin -u root -p`echo $MYSQL_TEMP_PWD` password 'Passw0rd!'
cat << EOF > .my.cnf
[client]
user=root
password=Passw0rd!
EOF
vagrant ALL=(ALL) NOPASSWD:ALL
Defaults:vagrant !requiretty