Created
September 17, 2023 10:24
-
-
Save terrylinooo/23f2eff93c9f5984a757ccfcb9e3ca5f to your computer and use it in GitHub Desktop.
Vagrant WordPress Up!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant.configure("2") do |config| | |
config.vm.box = "ubuntu/jammy64" | |
config.vm.network "private_network", ip: "192.168.33.10" | |
config.vm.synced_folder "./wordpress", "/var/www/html" | |
config.vm.provider "virtualbox" do |vb| | |
vb.memory = "1024" | |
vb.gui = true | |
end | |
config.vm.provision "shell", inline: <<-SHELL | |
apt update | |
apt install -y apache2 php php-mysql mysql-server | |
wget -c https://wordpress.org/latest.tar.gz | |
tar -xvf latest.tar.gz | |
cp -r wordpress/* /var/www/html/ | |
chown -R www-data:www-data /var/www/html/ | |
rm /var/www/html/index.html | |
a2enmod rewrite | |
sudo mysql -u root <<-EOF | |
CREATE DATABASE wordpress; | |
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password'; | |
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost'; | |
FLUSH PRIVILEGES; | |
EOF | |
service apache2 restart | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment