This commit is contained in:
2022-05-11 17:43:53 +02:00
parent bf5ef33f07
commit 828fa6940d
7 changed files with 374 additions and 0 deletions

37
multivm/Vagrantfile vendored Normal file
View File

@ -0,0 +1,37 @@
# -*- 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|
config.vm.box = "ubuntu/focal64"
config.vm.box_check_update = false
config.vm.provision "shell",
path: "standard.sh"
config.vm.define "web" do |web|
web.vm.hostname = "websrv"
web.vm.network "forwarded_port", guest: 80, host: 8080
web.vm.network "private_network", ip: "10.10.0.2"
web.vm.provision "shell",
path: "apachephp.sh"
end
config.vm.define "db" do |db|
db.vm.hostname = "websrv"
db.vm.network "private_network", ip: "10.10.0.3"
db.vm.provision "shell",
path: "mariadb.sh"
end
end

9
multivm/apachephp.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/bash
#Instalacja Apache i MC
sudo apt -y install apache2
#Instalacja PHP
sudo apt -y install php php-{cli,mysql,json,opcache,xml,mbstring,gd,curl}
sudo systemctl restart apache2

19
multivm/mariadb.sh Normal file
View File

@ -0,0 +1,19 @@
#!/bin/bash
#Instalacja serwera baz danych
sudo apt -y install mariadb-server mariadb-client
#Konfiguracja serwera baz danych (wykonanie m.in. "mysql_secure_installation")
sudo mysql -e "UPDATE mysql.user SET Password = PASSWORD('Zaq12wsx') WHERE User = 'root'"
sudo mysql -e "DELETE FROM mysql.user WHERE User='';"
sudo mysql -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
sudo mysql -e "DROP DATABASE IF EXISTS test;"
sudo mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';"
sudo mysql -e "use mysql; update user set plugin='' where User='root';"
sudo mysql -u root -e "CREATE DATABASE IF NOT EXISTS baza_test;"
sudo mysql -u root -e "SHOW DATABASES;"
sudo mysql -e "flush privileges;"

8
multivm/standard.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/bash
#Aktualizacja systemu
sudo apt update && sudo apt upgrade -y
#Instalacja Apache i podstawowego oprogramowania
sudo apt -y install mc unzip tree bzip2 htop