Skip to content

Instantly share code, notes, and snippets.

@trolzen
Last active February 1, 2023 18:08
Embed
What would you like to do?
Домашняя работа №2 к интенсиву Skillbox "Linux+Vagrant"
<VirtualHost *:81>
ServerAdmin webmaster@wordpress
DocumentRoot /var/www/wordpress
ErrorLog ${APACHE_LOG_DIR}/wordpress-error.log
CustomLog ${APACHE_LOG_DIR}/wordpress-access.log combined
</VirtualHost>
<VirtualHost *:82>
ServerAdmin webmaster@drupal
DocumentRoot /var/www/drupal-9.5.1
ErrorLog ${APACHE_LOG_DIR}/drupal-error.log
CustomLog ${APACHE_LOG_DIR}/drupal-access.log combined
</VirtualHost>
# установка неоходимых пакетов
sudo apt update
sudo apt install -y apache2 libapache2-mod-php php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip php-mysql mysql-server
# база для Wordpress
sudo mysql -e "create database wp_db;"
sudo mysql -e "create user wp_user@localhost identified by 'wp_pass';"
sudo mysql -e "grant all on wp_db.* to wp_user@localhost;"
mysql -u wp_user -pwp_pass wp_db -e "show tables;"
# установка самого Wordpress
wget --no-show-progress https://wordpress.org/wordpress-6.1.1.tar.gz
echo "80f0f829645dec07c68bcfe0a0a1e1d563992fcb *wordpress-6.1.1.tar.gz" | shasum -c
sudo tar xf wordpress-6.1.1.tar.gz -C /var/www/
sudo chown -R root:root /var/www/wordpress/
### отредактировать /etc/apache2/ports.conf
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/001-wordpress.conf
### отредактировать /etc/apache2/sites-available/001-wordpress.conf
sudo rm /etc/apache2/sites-enabled/000-default.conf
sudo ln -s /etc/apache2/sites-available/001-wordpress.conf /etc/apache2/sites-enabled/
sudo service apache2 reload
sudo cp /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php
### отредактировать /var/www/wordpress/wp-config.php
# база для Drupal
sudo mysql -e "create database drupal_db;"
sudo mysql -e "create user drupal_user@localhost identified by 'drupal_pass';"
sudo mysql -e "grant all on drupal_db.* to drupal_user@localhost;"
mysql -u drupal_user -pdrupal_pass drupal_db -e "show tables;"
# установка самого Drupal
wget --no-show-progress https://ftp.drupal.org/files/projects/drupal-9.5.1.tar.gz
echo "299e173f89f97ce333cf7fa21c4b1f254fb92d813b7170c047b1c6f27649cd6b *drupal-9.5.1.tar.gz" | shasum -c
sudo tar xf drupal-9.5.1.tar.gz -C /var/www/
sudo chown -R root:root /var/www/drupal-9.5.1/
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/002-drupal.conf
### отредактировать /etc/apache2/sites-available/002-drupal.conf
sudo ln -s /etc/apache2/sites-available/002-drupal.conf /etc/apache2/sites-enabled/
sudo service apache2 reload
### TODO не закончено!
Listen 81
Listen 82
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/focal64"
config.vm.network "forwarded_port", guest: 81, host: 8081
config.vm.network "forwarded_port", guest: 82, host: 8082
config.vm.boot_timeout = 650
config.vm.provision "shell", inline: <<-'SHELL'
# установка неоходимых пакетов
sudo apt update
sudo apt install -y apache2 libapache2-mod-php php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip php-mysql mysql-server
# база для Wordpress
sudo mysql -e "create database wp_db;"
sudo mysql -e "create user wp_user@localhost identified by 'wp_pass';"
sudo mysql -e "grant all on wp_db.* to wp_user@localhost;"
# установка самого Wordpress
wget https://wordpress.org/wordpress-6.1.1.tar.gz
echo "80f0f829645dec07c68bcfe0a0a1e1d563992fcb *wordpress-6.1.1.tar.gz" | shasum -c
sudo tar xf wordpress-6.1.1.tar.gz -C /var/www/
sudo chown -R root:root /var/www/wordpress/
### отредактировать /etc/apache2/ports.conf
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/001-wordpress.conf
### отредактировать /etc/apache2/sites-available/001-wordpress.conf
sudo rm /etc/apache2/sites-enabled/000-default.conf
sudo ln -s /etc/apache2/sites-available/001-wordpress.conf /etc/apache2/sites-enabled/
sudo cp /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php
### отредактировать /var/www/wordpress/wp-config.php
# база для Drupal
sudo mysql -e "create database drupal_db;"
sudo mysql -e "create user drupal_user@localhost identified by 'drupal_pass';"
sudo mysql -e "grant all on drupal_db.* to drupal_user@localhost;"
# установка самого Drupal
wget https://ftp.drupal.org/files/projects/drupal-9.5.1.tar.gz
echo "299e173f89f97ce333cf7fa21c4b1f254fb92d813b7170c047b1c6f27649cd6b *drupal-9.5.1.tar.gz" | shasum -c
sudo tar xf drupal-9.5.1.tar.gz -C /var/www/
sudo chown -R root:root /var/www/drupal-9.5.1/
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/002-drupal.conf
### отредактировать /etc/apache2/sites-available/002-drupal.conf
sudo ln -s /etc/apache2/sites-available/002-drupal.conf /etc/apache2/sites-enabled/
### TODO не закончено!
sudo cp /vagrant/ports.conf /etc/apache2/
sudo cp /vagrant/001-wordpress.conf /etc/apache2/sites-available/
sudo cp /vagrant/002-drupal.conf /etc/apache2/sites-available/
sudo cp /vagrant/wp-config.php /var/www/wordpress/
sudo service apache2 reload
SHELL
end
<?php
define( 'DB_NAME', 'wp_db' );
define( 'DB_USER', 'wp_user' );
define( 'DB_PASSWORD', 'wp_pass' );
define( 'DB_HOST', 'localhost' );
define( 'DB_CHARSET', 'utf8' );
define( 'DB_COLLATE', '' );
define('AUTH_KEY', 'Z+Oq]&7L+Jd_H+E[7I NwZ@;U!|.TH|*-&+SA1*-m0-[WWvLby)9as$7-jjFE>_&');
define('SECURE_AUTH_KEY', 'ZWsoP?df_qA+97*F!2.V.;PqE772{_ua5JW3$PemF9}z^% {V,-F~PA])*OZp {w');
define('LOGGED_IN_KEY', '<,l@Wv:`HND/uF-r]9)jm1UcNE{=Pt%}=K3w}?T=rQhF<!VOkV Dv6)&aT@xe`P1');
define('NONCE_KEY', 'Xx5$87K_FOkTjq7/H.NZXsH9%F2gkNf~N(E926Fh)|&ol!~DugU6oKq6n8>~#WHb');
define('AUTH_SALT', '+u+,|!qkH.v_w&fyO&mNk[@2lXLJLrtvkbqT:MCxRb1+FEe+;0R0Q{-|WI`o#|Xv');
define('SECURE_AUTH_SALT', 'pHh44.A[o|v$8}?2P*uEK>sQ`odA`,bJM|HU(=/I;[Nwzl4%G1Uuy}0ZUa{Cpi)Q');
define('LOGGED_IN_SALT', 'NMDU&+^?zB!4n)b+!5R@30F7LJ,,:H@%,-v;@`vX,&hsN|~V|V=_n(O2MoM_@DF@');
define('NONCE_SALT', 'DA*vIK+nWnK0hTE+]14P_qD?b_~l1s<2lud)+FR`5&9B;39Jwt`Z;)lGW--l+?R@');
$table_prefix = 'wp_';
define( 'WP_DEBUG', false );
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment