.
This commit is contained in:
parent
bf5ef33f07
commit
828fa6940d
37
multivm/Vagrantfile
vendored
Normal file
37
multivm/Vagrantfile
vendored
Normal 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
9
multivm/apachephp.sh
Normal 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
19
multivm/mariadb.sh
Normal 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
8
multivm/standard.sh
Normal 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
|
||||
|
75
ubuntu-lamp-phpmyadmin/Vagrantfile
vendored
Normal file
75
ubuntu-lamp-phpmyadmin/Vagrantfile
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
# -*- 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://vagrantcloud.com/search.
|
||||
config.vm.box = "ubuntu/focal64"
|
||||
|
||||
# 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.
|
||||
# NOTE: This will enable public access to the opened port
|
||||
config.vm.network "forwarded_port", guest: 80, host: 8080
|
||||
|
||||
# Create a forwarded port mapping which allows access to a specific port
|
||||
# within the machine from a port on the host machine and only allow access
|
||||
# via 127.0.0.1 to disable public access
|
||||
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
|
||||
|
||||
# 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"
|
||||
# config.vm.synced_folder "./html", "/var/www/html"
|
||||
|
||||
# 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.
|
||||
|
||||
# Enable provisioning with a shell script. Additional provisioners such as
|
||||
# Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
|
||||
# documentation for more information about their specific syntax and use.
|
||||
# config.vm.provision "shell", inline: <<-SHELL
|
||||
# apt-get update
|
||||
# apt-get install -y apache2
|
||||
# SHELL
|
||||
|
||||
config.vm.provision "shell",
|
||||
path: "ubuntulamp.sh"
|
||||
|
||||
end
|
113
ubuntu-lamp-phpmyadmin/ubuntulamp.sh
Normal file
113
ubuntu-lamp-phpmyadmin/ubuntulamp.sh
Normal file
@ -0,0 +1,113 @@
|
||||
#!/bin/bash
|
||||
|
||||
#Aktualizacja systemu
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
|
||||
#Instalacja Apache i MC
|
||||
sudo apt -y install apache2 mc
|
||||
|
||||
#Instalacja PHP
|
||||
sudo apt -y install php php-{cli,mysql,json,opcache,xml,mbstring,gd,curl}
|
||||
|
||||
#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 -e "flush privileges;"
|
||||
|
||||
|
||||
|
||||
#Instalacja phpmyadmin
|
||||
cd /tmp
|
||||
wget -P Downloads https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
|
||||
sudo mkdir -p /www/phpmyadmin
|
||||
sudo tar xvf /tmp/Downloads/phpMyAdmin-latest-all-languages.tar.gz --strip-components=1 -C /www/phpmyadmin
|
||||
sudo cp /www/phpmyadmin/config.sample.inc.php /www/phpmyadmin/config.inc.php
|
||||
|
||||
|
||||
sudo chmod 660 /www/phpmyadmin/config.inc.php
|
||||
sudo chown -R www-data:www-data /www/phpmyadmin
|
||||
|
||||
cat << 'EOF' > phpmyadmin.conf
|
||||
|
||||
# phpMyAdmin default Apache configuration
|
||||
|
||||
Alias /phpmyadmin /www/phpmyadmin
|
||||
|
||||
<Directory /www/phpmyadmin>
|
||||
Options SymLinksIfOwnerMatch
|
||||
DirectoryIndex index.php
|
||||
<IfModule mod_php5.c>
|
||||
<IfModule mod_mime.c>
|
||||
AddType application/x-httpd-php .php
|
||||
</IfModule>
|
||||
<FilesMatch ".+\.php$">
|
||||
SetHandler application/x-httpd-php
|
||||
</FilesMatch>
|
||||
php_value include_path .
|
||||
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
|
||||
php_admin_value open_basedir /www/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/www/php/php-gettext/:/www/php/php-php-gettext/:/www/javascript/:/www/php/tcpdf/:/www/doc/phpmyadmin/:/www/php/phpseclib/
|
||||
php_admin_value mbstring.func_overload 0
|
||||
</IfModule>
|
||||
<IfModule mod_php.c>
|
||||
<IfModule mod_mime.c>
|
||||
AddType application/x-httpd-php .php
|
||||
</IfModule>
|
||||
<FilesMatch ".+\.php$">
|
||||
SetHandler application/x-httpd-php
|
||||
</FilesMatch>
|
||||
php_value include_path .
|
||||
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
|
||||
php_admin_value open_basedir /www/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/www/php/php-gettext/:/www/php/php-php-gettext/:/www/javascript/:/www/php/tcpdf/:/www/doc/phpmyadmin/:/www/php/phpseclib/
|
||||
php_admin_value mbstring.func_overload 0
|
||||
</IfModule>
|
||||
</Directory>
|
||||
# Authorize for setup
|
||||
<Directory /www/phpmyadmin/setup>
|
||||
<IfModule mod_authz_core.c>
|
||||
<IfModule mod_authn_file.c>
|
||||
AuthType Basic
|
||||
AuthName "phpMyAdmin Setup"
|
||||
AuthUserFile /etc/phpmyadmin/htpasswd.setup
|
||||
</IfModule>
|
||||
Require valid-user
|
||||
</IfModule>
|
||||
</Directory>
|
||||
|
||||
# Disallow web access to directories that don't need it
|
||||
<Directory /www/phpmyadmin/templates>
|
||||
Require all denied
|
||||
</Directory>
|
||||
<Directory /www/phpmyadmin/libraries>
|
||||
Require all denied
|
||||
</Directory>
|
||||
<Directory /www/phpmyadmin/setup/lib>
|
||||
Require all denied
|
||||
</Directory>
|
||||
|
||||
EOF
|
||||
|
||||
sudo mv phpmyadmin.conf /etc/apache2/conf-available/phpmyadmin.conf
|
||||
|
||||
cp /etc/apache2/apache2.conf apache2.conf
|
||||
cat << 'EOF' >> apache2.conf
|
||||
|
||||
<Directory /www/>
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
EOF
|
||||
|
||||
sudo mv apache2.conf /etc/apache2/apache2.conf
|
||||
|
||||
sudo a2enconf phpmyadmin.conf
|
||||
sudo systemctl restart apache2
|
113
ubuntu-lamp2/ubuntulamp.sh
Normal file
113
ubuntu-lamp2/ubuntulamp.sh
Normal file
@ -0,0 +1,113 @@
|
||||
#!/bin/bash
|
||||
|
||||
#Aktualizacja systemu
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
|
||||
#Instalacja Apache i MC
|
||||
sudo apt -y install apache2 mc
|
||||
|
||||
#Instalacja PHP
|
||||
sudo apt -y install php php-{cli,mysql,json,opcache,xml,mbstring,gd,curl}
|
||||
|
||||
#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 -e "flush privileges;"
|
||||
|
||||
|
||||
|
||||
#Instalacja phpmyadmin
|
||||
cd /tmp
|
||||
wget -P Downloads https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
|
||||
sudo mkdir -p /www/phpmyadmin
|
||||
sudo tar xvf /tmp/Downloads/phpMyAdmin-latest-all-languages.tar.gz --strip-components=1 -C /www/phpmyadmin
|
||||
sudo cp /www/phpmyadmin/config.sample.inc.php /www/phpmyadmin/config.inc.php
|
||||
|
||||
|
||||
sudo chmod 660 /www/phpmyadmin/config.inc.php
|
||||
sudo chown -R www-data:www-data /www/phpmyadmin
|
||||
|
||||
cat << 'EOF' > phpmyadmin.conf
|
||||
|
||||
# phpMyAdmin default Apache configuration
|
||||
|
||||
Alias /phpmyadmin /www/phpmyadmin
|
||||
|
||||
<Directory /www/phpmyadmin>
|
||||
Options SymLinksIfOwnerMatch
|
||||
DirectoryIndex index.php
|
||||
<IfModule mod_php5.c>
|
||||
<IfModule mod_mime.c>
|
||||
AddType application/x-httpd-php .php
|
||||
</IfModule>
|
||||
<FilesMatch ".+\.php$">
|
||||
SetHandler application/x-httpd-php
|
||||
</FilesMatch>
|
||||
php_value include_path .
|
||||
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
|
||||
php_admin_value open_basedir /www/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/www/php/php-gettext/:/www/php/php-php-gettext/:/www/javascript/:/www/php/tcpdf/:/www/doc/phpmyadmin/:/www/php/phpseclib/
|
||||
php_admin_value mbstring.func_overload 0
|
||||
</IfModule>
|
||||
<IfModule mod_php.c>
|
||||
<IfModule mod_mime.c>
|
||||
AddType application/x-httpd-php .php
|
||||
</IfModule>
|
||||
<FilesMatch ".+\.php$">
|
||||
SetHandler application/x-httpd-php
|
||||
</FilesMatch>
|
||||
php_value include_path .
|
||||
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
|
||||
php_admin_value open_basedir /www/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/www/php/php-gettext/:/www/php/php-php-gettext/:/www/javascript/:/www/php/tcpdf/:/www/doc/phpmyadmin/:/www/php/phpseclib/
|
||||
php_admin_value mbstring.func_overload 0
|
||||
</IfModule>
|
||||
</Directory>
|
||||
# Authorize for setup
|
||||
<Directory /www/phpmyadmin/setup>
|
||||
<IfModule mod_authz_core.c>
|
||||
<IfModule mod_authn_file.c>
|
||||
AuthType Basic
|
||||
AuthName "phpMyAdmin Setup"
|
||||
AuthUserFile /etc/phpmyadmin/htpasswd.setup
|
||||
</IfModule>
|
||||
Require valid-user
|
||||
</IfModule>
|
||||
</Directory>
|
||||
|
||||
# Disallow web access to directories that don't need it
|
||||
<Directory /www/phpmyadmin/templates>
|
||||
Require all denied
|
||||
</Directory>
|
||||
<Directory /www/phpmyadmin/libraries>
|
||||
Require all denied
|
||||
</Directory>
|
||||
<Directory /www/phpmyadmin/setup/lib>
|
||||
Require all denied
|
||||
</Directory>
|
||||
|
||||
EOF
|
||||
|
||||
sudo mv phpmyadmin.conf /etc/apache2/conf-available/phpmyadmin.conf
|
||||
|
||||
cp /etc/apache2/apache2.conf apache2.conf
|
||||
cat << 'EOF' >> apache2.conf
|
||||
|
||||
<Directory /www/>
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
EOF
|
||||
|
||||
sudo mv apache2.conf /etc/apache2/apache2.conf
|
||||
|
||||
sudo a2enconf phpmyadmin.conf
|
||||
sudo systemctl restart apache2
|
Loading…
Reference in New Issue
Block a user