180 likes | 293 Views
Authors: John Studdard @johnstuddard Hector Iribarne @hectoriribarne Mark Stahlbaum @markeytoe. I have been trying to get away from hosting Drupal on shared hosting, so I have been investigating the best way to setup Drupal on a VPS.
E N D
Authors: John Studdard @johnstuddard Hector Iribarne @hectoriribarne Mark Stahlbaum @markeytoe
I have been trying to get away from hosting Drupal on shared hosting, so I have been investigating the best way to setup Drupal on a VPS. • Two months ago, I attended the Palm Beach Drupal meetup (http://PalmBeachDrupal.org) and I put this question to John Studdard of http://BigCouchMedia.com and he recommended using Aegir. • John was even nice enough to get us started by sharing the scripts he uses to set up his server. I have now been using those base scripts to set up Aegir 1.2 on a Ubuntu 10.04 LTS 64-bit VPS server. I am using Linode and Mark Stahlbaum has been using the scripts and giving me feedback on his Rackspace server. • I also used the blog posts from Victor Kane http://awebfactory.com.ar • I got help from mig5 on IRC: #drupal-aegir irc://irc.freenode.net/aegir • The slides in this presentation are ‘A’ way to install Aegir 1.2. ‘The’ way is documented in detail at http://community.aegirproject.org/ • Also, I want to thank fellow Broward Drupal members Chris Parsons (http://www.chris-parsons.com/) for reviewing the slides and giving feedback, and Jay Epstein (http://www.jay-epstein.com/) for creating the great logo for Broward Drupal, which is on every slide in this presentation. @hectoriribarne
Italics means that you will have to use your information in place of the italics • servername = the name of your server (e.g. linode12345, or whatever you name it) • IPaddress = the public IP of your server • example.com = your domain name • DomainHost.com = your domain name host (e.g. godaddy.com, etc.) • VPShost.com = the domain of your VPS host (e.g. linode.com, rackspace.com, etc.) Linux commands are in blue. Text inside files is in green. Pay extra attention to text in red. @hectoriribarne
Go to your domain name host (i.e. DomainHost.com) and point your main domain name (i.e. example.com) to the name servers of your host (e.g. ns1.linode.com, ns2.linode.com or dns1.stabletransit.com, dns2.stabletransit.com, etc.) Wait about 2 hours for the change to take effect, although sometimes it can be a little longer. • Add A records for aegir and servername. You may also want to add one for mail and www, if you don't already have one • After waiting the appropriate time. Do a whois on your domain name to make sure it is pointing to the name servers you set up. You should not process with installing aegir unless your name servers are set up for your domain • Login as root to your server so we can begin typing in the commands in the continuing slides @hectoriribarne
Update your linux distribution apt-get updateapt-get upgrade • Update your FQDN (fully qualified domain name) /bin/hostname servername.example.comecho servername.example.com > /etc/hostname • REBOOT YOUR SERVER • Install LAMP server (You will be asked to enter a mysql database password) sudo apt-get install lamp-server^ • Edit your hosts file sudo nano /etc/hosts • While editing your hosts file, add the following line: IPaddressservername.example.comservername @hectoriribarne
Enable ssl (Don't restart apache at this time. Wait until later when you will be told to do so in the slides) a2enmod ssl • Enable rewrite, headers and expires modules a2enmod rewritea2enmod headersa2enmod expires • Enable mod_status sudo nano /etc/apache2/httpd.conf • While editing your httpd.conf file, add the following lines: ExtendedStatus On<Location /server-status>SetHandler server-statusOrder Deny,AllowDeny from allAllow from 127.0.0.1 </Location> @hectoriribarne
Install Apachetop to monitor Apache (More information can be found at http://packages.ubuntu.com/lucid/apachetop) sudo apt-get install apachetop • Update the apache2.conf file (don’t forget to change servername below) sudo nano /etc/apache2/apache2.conf • While editing your httpd.conf file, add the following lines at the end: # Caching & cache headers<IfModule mod_headers.c>ExpiresActive OnExpiresDefault "access plus 300 seconds"ExpiresByType text/html "access plus 1 day"ExpiresByType text/css "access plus 1 day"ExpiresByType text/javascript "access plus 1 day"ExpiresByType image/gif "access plus 1 month"ExpiresByType image/jpg "access plus 1 month"ExpiresByType image/png "access plus 1 month"ExpiresByType application/x-shockwave-flash "access plus 1 day"</IfModule># 6 HOURS<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4)$"> Header set Cache-Control "public" Header set Cache-Control "max-age=21600" Header unset Last-Modified</FilesMatch># 2 HOURS<FilesMatch "\.(html|htm|xml|txt|xsl|js|css)$"> Header set Cache-Control "max-age=7200, must-revalidate"</FilesMatch> ServerName servername @hectoriribarne
Finally! : Restart Apache /etc/init.d/apache2 restart • Install mytop for monitoring MySQL databases (More information can be found at http://packages.ubuntu.com/lucid/mytop) aptitude install mytop • Install phpmyadmin to administer MySQL databases (1) Choose apache2 webserver, 2) Configure database for phpmyadmin with dbconfig-common = yes, 3) Enter password for database) sudo apt-get install phpmyadmin • Install PHP command line interface sudo apt-get install php5-cli • Remove deprecated hash and change it to a semicolon sudo nano /etc/php5/cli/conf.d/mcrypt.ini • Edit mcrypt.ini file and change # to ; ; configuration for php MCrypt module @hectoriribarne
Install PHP libraries and scripting capabilities sudo aptitude updatesudo aptitude install libssh2-1-dev libssh2-phpsudo apt-get install php-pear php5-dev php5-gd • Install PECL PHP Extension Community Library (at the cursor, hit enter) pecl install -f ssh2 • Some more PHP configs echo 'extension=ssh2.so' > /etc/php5/conf.d/ssh2.inisudo apt-get updatesudo apt-get install php-apcecho 'extension=apc.so' > /etc/php5/conf.d/apc.inisudo apt-get install rsyncsudo pecl install uploadprogressecho 'extension=uploadprogress.so' > /etc/php5/conf.d/uploadprogress.ini @hectoriribarne
Again: Restart Apache /etc/init.d/apache2 restart • Install Postfix mail transfer agent that routes and delivers mail ( 1) General type of mail configuration = Internet Site, 2) servername.example.com ). sudo apt-get install postfix • Configure Postfix ( 1) General type of mail configuration = Internet Site, 2)servername.example.com , 3) left blank, 4) leave list of defaults, 5) No forced synchronous updates, 6) network blocks leave default, 7) mailbox file limit left at 0, 8) left + default value, 9) ipv4). For more details on configuring Postfix, see https://help.ubuntu.com/community/Postfix sudo dpkg-reconfigure postfix • Install build-essential for building debian packages. (More info can be found at http://packages.ubuntu.com/lucid/build-essential) sudo aptitude install build-essential @hectoriribarne
Edit Apache PHP Resource Limits sudo nano /etc/php5/apache2/php.ini • Update to the following (keep in mind that the memory limit can be set higher depending on the amount of memory on your server) max_execution_time = 300 max_input_time = 300 memory_limit = 128M • Edit PHP command line interface Resource Limits sudo nano /etc/php5/cli/php.ini • Update to the following (keep in mind that the memory limit can be set higher depending on the amount of memory on your server) max_execution_time = 300 max_input_time = 300 memory_limit = 192M @hectoriribarne
Install Git apt-get updatesudo apt-get install git-core • Create and configure Aegir user ln -s /var/aegir/config/apache.conf /etc/apache2/conf.d/aegir.confuseradd -r -U -d /var/aegir -m -G www-data aegirecho 'aegir ALL=NOPASSWD: /usr/sbin/apache2ctl' >> /etc/sudoers • Obtain Key for installing Aegir (some text is smaller so it fits on the line) echo "deb http://debian.koumbit.net/debian stable main" > /etc/apt/sources.list.d/koumbit-stable.list wget http://debian.koumbit.net/debian/key.ascapt-key add key.ascapt-get update Install latest stable version of Drush wget http://mirror.pnl.gov/ubuntu//pool/universe/d/drush/drush_4.4-1_all.debdpkg -i drush_4.4-1_all.deb @hectoriribarne
Execute automatic Aegir install (1) domain for aegir - aegir.example.com, 2) enter a database password. After Aegir installs, it will provide you with a one time login where you will have to change your password for aegir.example.com . Also, when creating the admin user after you go to the one time login, type in a valid email address.) apt-get install aegir • Login as the Aegir user su -s /bin/sh aegir • Change to the Aegir directory cd /var/aegirls –al • Download the latest version of Drupal drush dl @hectoriribarne
Community Aegir site: http://community.aegirproject.org/ http://community.aegirproject.org/installing/debian • Videos from mig5 on installing Aegir http://vimeo.com/17131725 http://vimeo.com/groups/webdesigntuts/videos/9127281 • Blog posts from Victor Kane: http://awebfactory.com.ar/node/427 http://awebfactory.com.ar/node/444 @hectoriribarne
Questions? @hectoriribarne
http://BrowardDrupal.org/ Twitter: @BrowardDrupal http://www.meetup.com/broward-drupal/ http://groups.drupal.org/broward-drupal Also, checkout other user groups in Florida: http://groups.drupal.org/florida The slides for this presentation are posted on the July 2011 Broward Drupal meetup