Skip to content

Instantly share code, notes, and snippets.

@terrylinooo
Created September 17, 2023 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save terrylinooo/23f2eff93c9f5984a757ccfcb9e3ca5f to your computer and use it in GitHub Desktop.
Save terrylinooo/23f2eff93c9f5984a757ccfcb9e3ca5f to your computer and use it in GitHub Desktop.
Vagrant WordPress Up!
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