|
1 | 1 | # -*- mode: ruby -*-
|
2 | 2 | # vi: set ft=ruby :
|
3 | 3 |
|
4 |
| -# All Vagrant configuration is done below. The "2" in Vagrant.configure |
5 |
| -# configures the configuration version (we support older styles for |
6 |
| -# backwards compatibility). Please don't change it unless you know what |
7 |
| -# you're doing. |
8 |
| -Vagrant.configure(2) do |config| |
9 |
| - # The most common configuration options are documented and commented below. |
10 |
| - # For a complete reference, please see the online documentation at |
11 |
| - # https://docs.vagrantup.com. |
| 4 | +Vagrant.configure("2") do |config| |
| 5 | + config.vm.box = "generic/fedora30" |
| 6 | + config.vm.network "private_network", ip: "192.168.50.10", virtualbox__intnet: false |
12 | 7 |
|
13 |
| - # Every Vagrant development environment requires a box. You can search for |
14 |
| - # boxes at https://atlas.hashicorp.com/search. |
15 |
| - |
16 |
| - config.vm.box = "centos/7" |
17 |
| - # Disable automatic box update checking. If you disable this, then |
18 |
| - # boxes will only be checked for updates when the user runs |
19 |
| - # `vagrant box outdated`. This is not recommended. |
20 |
| - # config.vm.box_check_update = false |
21 |
| - #config.vbguest.auto_update = true |
22 |
| - # Create a forwarded port mapping which allows access to a specific port |
23 |
| - # within the machine from a port on the host machine. In the example below, |
24 |
| - # accessing "localhost:8080" will access port 80 on the guest machine. |
25 |
| - # config.vm.network "forwarded_port", guest: 80, host: 8080 |
26 |
| - |
27 |
| - # Create a private network, which allows host-only access to the machine |
28 |
| - # using a specific IP. |
29 |
| - # config.vm.network "private_network", ip: "192.168.0.115" |
| 8 | + if Vagrant.has_plugin? "vagrant-vbguest" |
| 9 | + config.vbguest.no_install = true |
| 10 | + config.vbguest.auto_update = false |
| 11 | + config.vbguest.no_remote = true |
| 12 | +end |
30 | 13 | config.hostmanager.enabled = true
|
31 |
| - config.hostmanager.manage_host = true |
| 14 | + config.hostmanager.manage_host = false |
| 15 | + config.hostmanager.manage_guest = true |
32 | 16 | config.hostmanager.ignore_private_ip = false
|
33 | 17 | config.hostmanager.include_offline = true
|
34 |
| - |
35 |
| - # Create a public network, which generally matched to bridged network. |
36 |
| - # Bridged networks make the machine appear as another physical device on |
37 |
| - # your network. |
| 18 | + |
38 | 19 | config.vm.network "public_network"
|
39 |
| - config.vm.hostname = 'mysql57' |
40 |
| - config.hostmanager.aliases = %w(mysql57.localdomain mysql57.local) |
41 |
| - # Share an additional folder to the guest VM. The first argument is |
42 |
| - # the path on the host to the actual folder. The second argument is |
43 |
| - # the path on the guest to mount the folder. And the optional third |
44 |
| - # argument is a set of non-required options. |
45 |
| - # config.vm.synced_folder '.', '/vagrant', disabled: true |
46 |
| - config.vm.synced_folder "./data", "/data" |
| 20 | + config.vm.hostname = 'fedora-generic' |
| 21 | + config.hostmanager.aliases = %w(fedora-generic.localdomain fedora-generic.local fcg.local) |
| 22 | + |
| 23 | + config.vm.synced_folder "/home/jmren/VagrantMachines/VagrantData", "/data" |
47 | 24 |
|
48 |
| - # Provider-specific configuration so you can fine-tune various |
49 |
| - # backing providers for Vagrant. These expose provider-specific options. |
50 |
| - # Example for VirtualBox: |
51 |
| - # |
52 | 25 | config.vm.provider "virtualbox" do |vb|
|
53 |
| - vb.name = "mysql57" |
54 |
| - vb.memory = "2048" |
55 |
| - vb.cpus = 2 |
| 26 | + vb.name="fedora-generic" |
| 27 | + vb.gui = false |
| 28 | + vb.memory = "3036" |
| 29 | + vb.cpus = 4 |
56 | 30 | end
|
57 |
| - # |
58 |
| - # View the documentation for the provider you are using for more |
59 |
| - # information on available options. |
60 |
| - |
61 |
| - # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies |
62 |
| - # such as FTP and Heroku are also available. See the documentation at |
63 |
| - # https://docs.vagrantup.com/v2/push/atlas.html for more information. |
64 |
| - # config.push.define "atlas" do |push| |
65 |
| - # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME" |
66 |
| - # end |
67 | 31 |
|
68 |
| - # Enable provisioning with a shell script. Additional provisioners such as |
69 |
| - # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the |
70 |
| - # documentation for more information about their specific syntax and use. |
71 | 32 | config.vm.provision "shell", inline: <<-SHELL
|
72 |
| - sudo yum -y update |
73 | 33 | echo "secret" | sudo passwd --stdin root
|
| 34 | + echo "secret" | sudo passwd --stdin vagrant |
74 | 35 | sudo cp -pr ~vagrant/.ssh /root
|
75 | 36 | sudo chown -R root.root /root/.ssh
|
76 |
| - sudo yum -y install git python |
77 |
| - sudo pip install --upgrade pip |
78 |
| - if [ ! -d "/data/MySQLTuner-perl" ]; then |
79 |
| - cd /data |
80 |
| - sudo git clone https://github.com/major/MySQLTuner-perl.git |
81 |
| - fi |
82 |
| - |
83 |
| - sudo rpm -ivh https://dev.mysql.com/get/mysql57-community-release-fc23-7.noarch.rpm |
84 |
| - sudo yum -y install perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils |
85 |
| - sudo cpanm install File::Util |
86 | 37 |
|
87 |
| - sudo yum -y install mysql-community-server mysql-community-client wget |
88 |
| - sudo systemctl start mysqld.service |
89 |
| - PASSWORD=$(sudo grep -i "temporary password" /var/log/mysqld.log | cut -d':' -f4 | xargs -n 1 echo) |
90 |
| - echo "PASSWORD: $PASSWORD" |
91 |
| - mysql -uroot -p$PASSWORD --connect-expired-password -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'MySqlSecr3t#'" |
92 |
| - mysql -uroot -psecret -e 'select version();' |
93 |
| - cd /data |
94 |
| - [ -f "employees_db-full-1.0.6.tar.bz2" ] || sudo wget "https://launchpad.net/test-db/employees-db-1/1.0.6/+download/employees_db-full-1.0.6.tar.bz2" |
95 |
| - sudo tar xvjf employees_db-full-1.0.6.tar.bz2 |
96 |
| - cd employees_db |
97 |
| - cat employees.sql | mysql -uroot -pMySqlSecr3t# |
| 38 | + sudo dnf -y update |
| 39 | + sudo dnf -y install telnet vim-enhanced net-tools git python python2-pip python34-PyYAML moreutils net-tools python-psutil perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils vim-enhanced unzip zip jq youtube-dl ffmpeg make mariadb psmisc PyYAML tofrodos python3 chromedriver wget |
| 40 | + sudo dnf -y install python34-pip moreutils net-tools python-psutil perl-WWW-Mechanize-GZip perl-App-cpanminus perl-List-MoreUtils vim-enhanced unzip zip jq youtube-dl ffmpeg make mariadb psmisc PyYAML tofrodos python3 wget python-beautifulsoup4 npm rclone golang yum-utils device-mapper-persistent-data lvm2 docker |
98 | 41 |
|
99 |
| - cd .. |
100 |
| - cd MySQLTuner-perl |
| 42 | + echo "alias h='function hdi(){ howdoi \$* -c -n 5; }; hdi'" >> /tmp/util.sh |
| 43 | + echo "alias s=sudo" >> /tmp/util.sh |
| 44 | + echo "alias h=history" >> /tmp/util.sh |
| 45 | + echo "alias hserver='python -m http.server 8000'" >> /tmp/util.sh |
| 46 | + sudo cp /tmp/util.sh /etc/profile.d |
| 47 | + cat /tmp/util.sh |
101 | 48 |
|
102 |
| - perl mysqltuner.pl --user root --pass MySqlSecr3t# --idxstat --dbstat |
103 |
| - SHELL |
104 |
| - config.vm.provision :hostmanager |
| 49 | + sudo dnf install -y yum-utils device-mapper-persistent-data lvm2 |
| 50 | + sudo dnf -y install dnf-plugins-core |
| 51 | + sudo dnf config-manager \ |
| 52 | + --add-repo \ |
| 53 | + https://download.docker.com/linux/fedora/docker-ce.repo |
| 54 | +
|
| 55 | + sudo dnf -y install docker-ce docker-ce-cli containerd.io |
| 56 | + dnf list docker-ce --showduplicates | sort -r |
| 57 | +
|
| 58 | + sudo systemctl start docker |
| 59 | + sudo systemctl enable docker |
| 60 | + sudo usermod -aG docker vagrant |
| 61 | + sudo systemctl daemon-reload |
| 62 | +
|
| 63 | + true |
| 64 | +
|
| 65 | +########################################## |
| 66 | +# Install container |
| 67 | + sudo systemctl restart docker |
| 68 | +SHELL |
| 69 | + config.vm.provision :hostmanager |
105 | 70 | end
|
| 71 | + |
0 commit comments