I created a basic vagrant box based on ubuntu/trusty64.

When i "vagrant up" the machine and next "vagrant ssh" into it, everything is fine.

Next step would be to install latest mysql 5.7, so thats what i did:

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

So it downloads configures etc... next an "interactive" shell appears, where are i am requested to type password and repeat.

MySql 5.7 is installed successfully in my machine...BUT:

I would like it to be installed during "vagrant up", thats why i modified Vagrantfile with:

config.vm.provision :shell, path: "bootstrap.sh"

In bootstrap.sh i added content:

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

This fails completely... in console i can read it tries to configure mysql 5.5 and its dependencies.

But why?

If anybody could help with this issue, i would be really thankful.

Thanks and Greetings!

UPDATE error message

==> 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.
share|improve this question
    
Can you provide vagrant box ubuntu version please? – Button Monkey Jul 29 '16 at 16:53
    
is is ubuntu/trusty64 (virtualbox, 20160714.0.0) – Creative crypter Jul 29 '16 at 16:55

The reason why vagrant is installing 5.5 instead of 5.7 is because ubuntu/trusty version might be ubuntu 14.04, default mysql version for ubuntu 14.04 is mysql 5.5.

Below is a vagrant file which automatically installs mysql 5.7, but I have configured centos6 here. Feel free to change the os and set that to ubuntu/trusty. Just do

mysql57_config.vm.box = 'ubuntu/trusty64'

Instructions:

mkdir mysql-5-7

cd mysql-5-7

Once you are in mysql-5-7 directory add these two files, Vagrantfile and bootstrap.sh file

Vagrantfile

    # -*- 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

bootstrap.sh

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

Now please run below commands: vagrant up vagrant ssh

Ones you are in the machine connected to mysql: connect to mysql and provide below credentials~~ user: root password: Passw0rd!

Somewhere in /etc/sudoers (or /etc/sudoers.d if it's included) you have to have

vagrant ALL=(ALL) NOPASSWD:ALL
Defaults:vagrant !requiretty

without that, the vagrant ssh (without tty) fails mysteriously.

If you are using MacOS, turn Off firewall and see it this works?

share|improve this answer
1  
ok thanks for answering but where exactly is mysql 5.7 installed? can u share ur provision.sh ? – Creative crypter Jul 29 '16 at 17:18
1  
@Creativecrypter sorry for that, updated, thanks :) – Button Monkey Jul 29 '16 at 17:20
    
hey there i updated my question with error code, could u refer to it? – Creative crypter Jul 29 '16 at 17:34
    
did you run this file using sudo? If you didn't please do it. – Button Monkey Jul 29 '16 at 17:36
    
i prefixed every line with sudo, but err msg remains, mhm, maybe because i use ubuntu/trusty64 ? – Creative crypter Jul 29 '16 at 17:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.