Created
September 9, 2011 22:06
-
-
Save matiskay/1207457 to your computer and use it in GitHub Desktop.
Wordpress Install
This file contains hidden or 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
#!/bin/bash | |
if [[ ! -n $1 ]]; then | |
echo "Please insert a project name" | |
exit 1 | |
fi | |
# Mysql Config | |
MYSQL_USER="" | |
MYSQL_PASSWORD="" | |
# Variables | |
WORDPRESS="http://wordpress.org/latest.tar.gz" | |
LOCAL_PATH="$HOME/projects" | |
PROJECT_NAME=$1 | |
PROJECT_PATH=$LOCAL_PATH/$PROJECT_NAME/web | |
WORDPRESS_PATH=$PROJECT_PATH/wordpress | |
SERVER_PATH="/var/www/wordpress/$PROJECT_NAME" | |
TEMP_FILE="/tmp/wordpress$RANDOM" | |
if [[ -d $PROJECT_NAME ]]; then | |
exit 1 | |
fi | |
# Download the last version of wordpress | |
mkdir -p $PROJECT_PATH | |
cd $PROJECT_PATH | |
wget $WORDPRESS | |
tar xvfz latest.tar.gz | |
cd $WORDPRESS_PATH | |
# mv wordpress $PROJECT_NAME | |
# Wordpress Policy | |
cp wp-config-sample.php wp-config.php | |
# Create Database | |
echo "CREATE DATABASE $PROJECT_NAME" | mysql -u $MYSQL_USER -p | |
# Setting up the configuration file | |
sed -e "s/database_name_here/$PROJECT_NAME/" \ | |
-e "s/username_here/$MYSQL_USER/" \ | |
-e "s/password_here/$MYSQL_PASSWORD/" \ | |
wp-config.php > $TEMP_FILE | |
mv $TEMP_FILE wp-config.php | |
cd wp-content | |
mkdir uploads | |
chmod 777 -R uploads | |
# Link it to localhost | |
# Check this magic string | |
sudo ln -s $WORDPRESS_PATH $SERVER_PATH | |
# Housekeeping | |
# Remove tar.gz file | |
# Remove temp file |
You can save it in a file and then use as wp-install.sh
$ bash wp-install.sh myawesomeprojectname
And the the script will create a the project in $HOME/projects/myawesomeprojectname and create a link to /var/www/wordpress/myawsomeprojectname. I will add a Readme file.
Thanks for being interested in this script.
Thanks brother.
On Sun, Oct 30, 2011 at 8:00 PM, Edgar Marca < ***@***.***>wrote:
You can save it in a file and then use as wp-install.sh
`$ bash wp-install.sh myawesomeprojectname`
And the the script will create a the project in
$HOME/projects/myawesomeprojectname and create a link to
/var/www/wordpress/myawsomeprojectname. I will add a Readme file.
Thanks for being interested in this script.
##
Reply to this email directly or view it on GitHub:
https://gist.github.com/1207457
##
_Jerry Lee_
Webmasters In Texas http://www.webmastersintexas.com/
Web Developer | Search Engine\* _Optimization | Social Media Marketing_
*
Hey, I don't know if I mentioned that I am running Windows. Can I run this
through Putty?
On Sun, Oct 30, 2011 at 8:02 PM, Texas Webmaster <[email protected]
wrote:
Thanks brother.
On Sun, Oct 30, 2011 at 8:00 PM, Edgar Marca <
***@***.***>wrote:
> You can save it in a file and then use as wp-install.sh
>
> `$ bash wp-install.sh myawesomeprojectname`
>
> And the the script will create a the project in
> $HOME/projects/myawesomeprojectname and create a link to
> /var/www/wordpress/myawsomeprojectname. I will add a Readme file.
>
> Thanks for being interested in this script.
> ##
>
> Reply to this email directly or view it on GitHub:
> https://gist.github.com/1207457
##
_Jerry Lee_
Webmasters In Texas http://www.webmastersintexas.com/
Web Developer | Search Engine\* _Optimization | Social Media Marketing_
*
##
_Jerry Lee_
Webmasters In Texas http://www.webmastersintexas.com/
Web Developer | Search Engine\* _Optimization | Social Media Marketing_
*
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So, do I type this into my command line, or can I save it as a file, and call it from command line?