Skip to content

Instantly share code, notes, and snippets.

@eimg
Created October 29, 2013 14:15
Show Gist options
  • Save eimg/7215472 to your computer and use it in GitHub Desktop.
Save eimg/7215472 to your computer and use it in GitHub Desktop.
Download and install latest version of Wordpress. Only for XAMPP linux on Ubuntu.
#!/bin/bash
echo "Project/DB Name: "; read -e dbname
echo "Database User: "; read -e dbuser
echo "Database Password: "; read -s dbpass
echo "Run the install? (y/n)"; read -e run
if [ "$run" == n ] ; then
exit
else
wget http://wordpress.org/latest.tar.gz
tar -zxvf latest.tar.gz
mv wordpress /opt/lampp/htdocs/$dbname
cd /opt/lampp/htdocs/$dbname
cp wp-config-sample.php wp-config.php
sed -i -e "s/database_name_here/$dbname/g" wp-config.php
sed -i -e "s/username_here/$dbuser/g" wp-config.php
sed -i -e "s/password_here/$dbpass/g" wp-config.php
mkdir wp-content/uploads
chmod 777 wp-content/uploads
if [ $dbpass ] ; then
/opt/lampp/bin/mysql -u $dbuser -p $dbpass -e "create database if not exists $dbname"
else
/opt/lampp/bin/mysql -u $dbuser -e "create database if not exists $dbname"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment