I wrote this shell script for Dreamhost users to automate the

  • Installation of a custom PHP.ini configuration
  • Installation of Drupal
  • Installation of Drush (the command-line tool for Drupal), and the
  • Installation of the Upload Progress module that Drupal is always bugging you about

You should be able to use it by doing the following:

  • Copy the code below and save it to a file called installthemall.sh
  • Log in to your FTP account (I prefer using WinSCP on Windows, because it will log you in with PuTTY as well regular FTP)
  • Upload installthemall.sh to your server
  • Open PuTTY and type sh installthemall.sh

Note: this assumes you want to install Drupal 7.7 (which is currently the latest version). To change that, find/replace drupal-7.7 with whichever version you wish to install.

#!/bin/sh
export PATH=/usr/local/php53/bin:$PATH
wget http://pecl.php.net/get/uploadprogress -O uploadprogress-1.0.2.tgz &
wait
tar -zxvf uploadprogress-1.0.2.tgz &
wait
cd uploadprogress-1.0.2
phpize &
wait
./configure --with-php-config=/usr/local/php53/bin/php-config &
wait
make &
wait
mkdir $HOME/.php &
wait
mkdir $HOME/.php/5.3 &
wait
cp ./modules/uploadprogress.so $HOME/.php/5.3/
echo "extension = $HOME/.php/5.3/uploadprogress.so" > $HOME/.php/5.3/phprc &
wait
killall php53.cgi &
wait
mkdir $HOME/cgi-bin &
wait
cp /etc/php53/php.ini $HOME/cgi-bin/php.ini &
wait
chmod 755 $HOME/cgi-bin
cat << EOF > $HOME/cgi-bin/php-wrapper.fcgi
#!/bin/sh
exec /dh/cgi-system/php53.cgi $*
EOF
wait
chmod 755 $HOME/cgi-bin/php-wrapper.fcgi
chmod 640 $HOME/cgi-bin/php.ini
export PHP_CONFIG_FILE_PATH=$HOME/cgi-bin
cd $HOME/
wget http://ftp.drupal.org/files/projects/drupal-7.7.tar.gz &
wait
tar -xz --directory="." -f "drupal-7.7.tar.gz" &
wait
wget http://ftp.drupal.org/files/projects/drush-7.x-4.4.tar.gz &
wait
tar -xz --directory="." -f "drush-7.x-4.4.tar.gz" &
wait
ln -s $HOME/cgi-bin $HOME/drupal-7.7/cgi-bin &
wait
echo "alias drush="$HOME"/drush/drush" >> $HOME/.bashrc &
wait
rm drupal-7.7.tar.gz
rm drush-7.x-4.4.tar.gz
rm uploadprogress-1.0.2.tgz
echo '

=========================== ALMOST DONE... ====================================

One more thing to do though: add the following 4 lines to the VERY TOP 
of the file called ".htaccess":

Options +ExecCGI
AddHandler php5-cgi .php
Action php-cgi /cgi-bin/php-wrapper.fcgi
Action php5-cgi /cgi-bin/php-wrapper.fcgi

Good luck!'

Comments

laryn’s picture

I appreciate it... will be testing this out. (That upload progress notification has been a bother to me for some time but I haven't taken the time to figure out whether I could install it myself... apparently I can!)

greg.1.anderson’s picture

Nice script; looks very useful. FYI, we are moving towards using PEAR to distribute drush. See #1215346: Distributing drush via PEAR (was drush debian packaging usage instructions. You might want to experiment with using the instructions there instead of wget to pull down drush, as doing it that way would make upgrades easier.

jerdiggity’s picture

Something I forgot to mention is that in order for this setup to work properly, you'll have to login to your hosting control panel and make sure that the domain for which you're installing everything is configured to use PHP version 5.3 (instead of the default version, 5.2):

  • Login (panel.dreamhost.com)
  • Click Domains -> Manage Domains on the left
  • Click Edit next to the domain you wish to change (Edit is found in the column labeled Web Hosting)
  • Scroll about 1/4 of the way down the page, and under Web Options make sure that PHP Mode is set to PHP 5.3 CGI

@Greg: Thanks! I'll be sure to check that out.

---
Yo that's shizzle.

rbrownell’s picture

I am using Dreamhost VPS and this script worked fine (had to update the script to include the most recent version number of uploadprogress bar though). But the uploadprogress bar is not working at all! Can any one else confirm they are having this problem? Did you have this problem and overcome it?

Thanks;

-R

mbopp’s picture

Something to note that I had trouble with.

You NEED to do the above as the user you are running the site under. So if you have a special admin account on your Dreamhost PS, you need to switch to your regular hosting user before retrieving, building, and installing the uploadprogress.so or any other module.