Saturday, 17 August 2013

Setting up a drupal enviroment dev, live and production so it all works...

Setting up a drupal development environment on Ubuntu.

1. Virgin ubuntu install.

  • sudo apt-get update
  • sudo apt-get dist-upgrade #make ubuntu the latest and greatest.
  • sudo apt-get install tasksel# fantastic install tool (tasksel on cmd line)
  • sudo tasksel install lamp-server (reference)#(Will set up apache php etc)
Enter your root password
  • mysql -u root -p (Log in and ensure name/password combo work)
  • sudo apt-get install build-essential php5-dev php5-gd php-pear 
  • phpmyadmin php5-curl
(FYI: This loaded 82.5 MB on my server)
I ran apt-get autoremove afterwards; YMMV
  1. sudo a2enmod rewrite
  2. sudo pecl install uploadprogress
  • sudo vim /etc/php5/apache2/php.ini (Add extension=uploadprogress.so as instructed)
  • sudo vim /etc/apache2/sites-available/default
  1. Change the "AllowOverride None" line to "AllowOverride All"
  2. (Ensure that default site settings are what you expect and are on valid paths)
  • sudo service apache2 restart
  1. You may see the inconsequential warning about "Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName" If that bugs you, you can always add "ServerName localhost" to the bottom of /etc/apache2/apache2.conf
  • sudo apt-get install drush # better to wget the latest version from drupal.org as ubuntu is always out of date. 
  • cd /var
  • sudo drush dl drupal --drupal-project-rename=www
  1. Install location /var/www already exists. Do you want to overwrite it? (y/n): y FYI: This will overwrite the apache default www directory
  • sudo chown -Rv www-data:www-data /var/www
  1. cd www
  2. sudo drush site-install standard --db-url="mysql://root:s73jd76sj3wu1@localhost/drupaltest" --site-name=drupaltest
  • Go to http://localhost/admin/reports/status and enjoy the report -

    Full credit to : http://www.skrinakcreative.com/2012/12/23/making-ubuntu-server-1210-drupal-ready#sthash.NvEShlGR.dpuf for all this.

  • I did not place my www in var - i stuck it on my desktop.
    I will add the following to this guide. All this is from my working setup - obviously you will have to replace all the paths yourself for your setup.
    You will want to set up drush bashrc for your shell in your home directory. See the Drush examples folder - you can find this using locate or whereis to find where drush lives and setup the bash shell.#
    sudo nano ~/.bashrc
    and add this at bottom of file
# 20130810 - Add path to .drush_bashrc to bash command line
if [ -f ~/.drush_bashrc ] ; then
        . ~/.drush_bashrc
fi
     
    I edited /Etc/hosts and added; 
127.0.0.1       ukipliverpool.org
127.0.0.1       www.ukipliverpool.org
127.0.0.1       dev.ukipliverpool.org
127.0.0.1       www.dev.ukipliverpool.org

    You will also need to setup drush aliases for www/yoursite.org/dev live and production. 
    I placed mine in - here is a working file and its location. 
/home/tony/Desktop/www/ukipliverpool/live/aliases.drushrc.php
    sites/all/drush/
    <?php
      // File: ukipliverpool.aliases.drushrc.php
       $aliases['dev'] = array(
         'root' => '/home/tony/Desktop/www/ukipliverpool/dev',
         'uri' => 'dev.ukipliverpool.org',
       );
    /*
       $aliases['live'] = array(
         'root' => '/home/tony/Desktop/www/ukipliverpool/live',
         'uri' => 'ukipliverpool.org',
       );
    */
    ?>
 The next thing to know is that in ubuntu's install of apache2 you have
sites-available and sites-enabled

locate sites-enabled

sudo nano ..xxx/sites-available/dev.ukipliverpool.org
<VirtualHost *:80>

    ##ServerAdmin webmaster@dummy-host.example.com

    DocumentRoot "/home/tony/Desktop/www/ukipliverpool/dev"

    ServerName dev.ukipliverpool.org

    ServerAlias www.dev.ukipliverpool.org

    ##ErrorLog "logs/dummy-host.example.com-error.log"

    ##CustomLog "logs/dummy-host.example.com-access.log" common

        <Directory "/home/tony/Desktop/htdocs/www/ukipliverpool/dev">

                Options Indexes FollowSymLinks

                AllowOverride All

                Order allow,deny

                allow from all

        </Directory>

</VirtualHost>

type a2 and then tab (twice) on the command line from sites-available - you can see the apache2 commands.

To enter your site into the sites-enabled sites (which are enabled by apache2) you type sudo a2ensite www.yoursite.org
(then it shows you how to restart apache2)
Ok - some other things to do before you really get going.

You will likely want to  locate apache2/php.ini and increase the size of
the following
memory_limit = 256M
max_execution_limit =-1
post_max_size = 50M

so your dev enviroment doesn't resemble the tiny resources of a shared server and you can operate properly and run scripts properly;

phpmyadmin

http://localhost/phpmyadmin/
If this doesn't work you must follow the troubleshooting guide. It didn't work for me initially, but I got it going on a 2nd attempt by following the guide
http://wiki.phpmyadmin.net/pma/Welcome_to_phpMyAdmin_Wiki










  • sudo apt-get update
  • sudo apt-get dist-upgrade
  • sudo apt-get install tasksel
  • sudo tasksel install lamp-server (reference)
    1. Enter your root password
  • mysql -u root -p (Log in and ensure name/password combo work)
  • sudo apt-get install build-essential php5-dev php5-gd php-pear
    1. (FYI: This loaded 82.5 MB on my server)
    2. I ran apt-get autoremove afterwards; YMMV
  • sudo a2enmod rewrite
  • sudo pecl install uploadprogress
  • sudo vim /etc/php5/apache2/php.ini (Add extension=uploadprogress.so as instructed)
  • sudo vim /etc/apache2/sites-available/default
    1. Change the "AllowOverride None" line to "AllowOverride All"
    2. (Ensure that default site settings are what you expect and are on valid paths)
  • sudo service apache2 restart
    1. You may see the inconsequential warning about "Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName" If that bugs you, you can always add "ServerName localhost" to the bottom of /etc/apache2/apache2.conf
  • sudo apt-get install drush (I love that I can do this)
  • cd /var
  • sudo drush dl drupal --drupal-project-rename=www
    1. Install location /var/www already exists. Do you want to overwrite it? (y/n): y FYI: This will overwrite the apache default www directory
  • sudo chown -R www-data:www-data /var/www
    1. I'm finding sudo chown -R username:www-data /var/www works better
  • cd www
  • sudo drush site-install standard --db-url="mysql://root:s73jd76sj3wu1@localhost/drupaltest" --site-name=drupaltest
  • Go to http://localhost/admin/reports/status and enjoy the report
  • - See more at: http://www.skrinakcreative.com/2012/12/23/making-ubuntu-server-1210-drupal-ready#sthash.NvEShlGR.dpuf







  • sudo apt-get dist-upgrade
  • sudo apt-get install tasksel
  • sudo tasksel install lamp-server (reference)
    1. Enter your root password
  • mysql -u root -p (Log in and ensure name/password combo work)
  • sudo apt-get install build-essential php5-dev php5-gd php-pear
    1. (FYI: This loaded 82.5 MB on my server)
    2. I ran apt-get autoremove afterwards; YMMV
  • - See more at: http://www.skrinakcreative.com/2012/12/23/making-ubuntu-server-1210-drupal-ready#sthash.NvEShlGR.dpuf






  • sudo apt-get update
  • sudo apt-get dist-upgrade
  • sudo apt-get install tasksel
  • sudo tasksel install lamp-server (reference)
    1. Enter your root password
  • mysql -u root -p (Log in and ensure name/password combo work)
  • sudo apt-get install build-essential php5-dev php5-gd php-pear
    1. (FYI: This loaded 82.5 MB on my server)
    2. I ran apt-get autoremove afterwards; YMMV
  • - See more at: http://www.skrinakcreative.com/2012/12/23/making-ubuntu-server-1210-drupal-ready#sthash.NvEShlGR.dpuf






  • sudo apt-get update
  • sudo apt-get dist-upgrade
  • sudo apt-get install tasksel
  • sudo tasksel install lamp-server (reference)
    1. Enter your root password
  • mysql -u root -p (Log in and ensure name/password combo work)
  • sudo apt-get install build-essential php5-dev php5-gd php-pear
    1. (FYI: This loaded 82.5 MB on my server)
    2. I ran apt-get autoremove afterwards; YMMV
  • - See more at: http://www.skrinakcreative.com/2012/12/23/making-ubuntu-server-1210-drupal-ready#sthash.NvEShlGR.dpuf






  • sudo apt-get update
  • sudo apt-get dist-upgrade
  • sudo apt-get install tasksel
  • sudo tasksel install lamp-server (reference)
    1. Enter your root password
  • mysql -u root -p (Log in and ensure name/password combo work)
  • sudo apt-get install build-essential php5-dev php5-gd php-pear
    1. (FYI: This loaded 82.5 MB on my server)
    2. I ran apt-get autoremove afterwards; YMMV
  • sudo a2enmod rewrite
  • sudo pecl install uploadprogress
  • sudo vim /etc/php5/apache2/php.ini (Add extension=uploadprogress.so as instructed)
  • sudo vim /etc/apache2/sites-available/default
    1. Change the "AllowOverride None" line to "AllowOverride All"
    2. (Ensure that default site settings are what you expect and are on valid paths)
  • sudo service apache2 restart
    1. You may see the inconsequential warning about "Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName" If that bugs you, you can always add "ServerName localhost" to the bottom of /etc/apache2/apache2.conf
  • sudo apt-get install drush (I love that I can do this)
  • cd /var
  • sudo drush dl drupal --drupal-project-rename=www
    1. Install location /var/www already exists. Do you want to overwrite it? (y/n): y FYI: This will overwrite the apache default www directory
  • sudo chown -R www-data:www-data /var/www
    1. I'm finding sudo chown -R username:www-data /var/www works better
  • cd www
  • sudo drush site-install standard --db-url="mysql://root:s73jd76sj3wu1@localhost/drupaltest" --site-name=drupaltest
  • Go to http://localhost/admin/reports/status and enjoy the report
  • - See more at: http://www.skrinakcreative.com/2012/12/23/making-ubuntu-server-1210-drupal-ready#sthash.NvEShlGR.dpuf






  • sudo apt-get update
  • sudo apt-get dist-upgrade
  • sudo apt-get install tasksel
  • sudo tasksel install lamp-server (reference)
    1. Enter your root password
  • mysql -u root -p (Log in and ensure name/password combo work)
  • sudo apt-get install build-essential php5-dev php5-gd php-pear
    1. (FYI: This loaded 82.5 MB on my server)
    2. I ran apt-get autoremove afterwards; YMMV
  • sudo a2enmod rewrite
  • sudo pecl install uploadprogress
  • sudo vim /etc/php5/apache2/php.ini (Add extension=uploadprogress.so as instructed)
  • sudo vim /etc/apache2/sites-available/default
    1. Change the "AllowOverride None" line to "AllowOverride All"
    2. (Ensure that default site settings are what you expect and are on valid paths)
  • sudo service apache2 restart
    1. You may see the inconsequential warning about "Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName" If that bugs you, you can always add "ServerName localhost" to the bottom of /etc/apache2/apache2.conf
  • sudo apt-get install drush (I love that I can do this)
  • cd /var
  • sudo drush dl drupal --drupal-project-rename=www
    1. Install location /var/www already exists. Do you want to overwrite it? (y/n): y FYI: This will overwrite the apache default www directory
  • sudo chown -R www-data:www-data /var/www
    1. I'm finding sudo chown -R username:www-data /var/www works better
  • cd www
  • sudo drush site-install standard --db-url="mysql://root:s73jd76sj3wu1@localhost/drupaltest" --site-name=drupaltest
  • Go to http://localhost/admin/reports/status and enjoy the report
  • - See more at: http://www.skrinakcreative.com/2012/12/23/making-ubuntu-server-1210-drupal-ready#sthash.NvEShlGR.dpuf






  • sudo apt-get update
  • sudo apt-get dist-upgrade
  • sudo apt-get install tasksel
  • sudo tasksel install lamp-server (reference)
    1. Enter your root password
  • mysql -u root -p (Log in and ensure name/password combo work)
  • sudo apt-get install build-essential php5-dev php5-gd php-pear
    1. (FYI: This loaded 82.5 MB on my server)
    2. I ran apt-get autoremove afterwards; YMMV
  • sudo a2enmod rewrite
  • sudo pecl install uploadprogress
  • sudo vim /etc/php5/apache2/php.ini (Add extension=uploadprogress.so as instructed)
  • sudo vim /etc/apache2/sites-available/default
    1. Change the "AllowOverride None" line to "AllowOverride All"
    2. (Ensure that default site settings are what you expect and are on valid paths)
  • sudo service apache2 restart
    1. You may see the inconsequential warning about "Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName" If that bugs you, you can always add "ServerName localhost" to the bottom of /etc/apache2/apache2.conf
  • sudo apt-get install drush (I love that I can do this)
  • cd /var
  • sudo drush dl drupal --drupal-project-rename=www
    1. Install location /var/www already exists. Do you want to overwrite it? (y/n): y FYI: This will overwrite the apache default www directory
  • sudo chown -R www-data:www-data /var/www
    1. I'm finding sudo chown -R username:www-data /var/www works better
  • cd www
  • sudo drush site-install standard --db-url="mysql://root:s73jd76sj3wu1@localhost/drupaltest" --site-name=drupaltest
  • Go to http://localhost/admin/reports/status and enjoy the report
  • - See more at: http://www.skrinakcreative.com/2012/12/23/making-ubuntu-server-1210-drupal-ready#sthash.NvEShlGR.dpuf






  • sudo apt-get update
  • sudo apt-get dist-upgrade
  • sudo apt-get install tasksel
  • sudo tasksel install lamp-server (reference)
    1. Enter your root password
  • mysql -u root -p (Log in and ensure name/password combo work)
  • sudo apt-get install build-essential php5-dev php5-gd php-pear
    1. (FYI: This loaded 82.5 MB on my server)
    2. I ran apt-get autoremove afterwards; YMMV
  • sudo a2enmod rewrite
  • sudo pecl install uploadprogress
  • sudo vim /etc/php5/apache2/php.ini (Add extension=uploadprogress.so as instructed)
  • sudo vim /etc/apache2/sites-available/default
    1. Change the "AllowOverride None" line to "AllowOverride All"
    2. (Ensure that default site settings are what you expect and are on valid paths)
  • sudo service apache2 restart
    1. You may see the inconsequential warning about "Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName" If that bugs you, you can always add "ServerName localhost" to the bottom of /etc/apache2/apache2.conf
  • sudo apt-get install drush (I love that I can do this)
  • cd /var
  • sudo drush dl drupal --drupal-project-rename=www
    1. Install location /var/www already exists. Do you want to overwrite it? (y/n): y FYI: This will overwrite the apache default www directory
  • sudo chown -R www-data:www-data /var/www
    1. I'm finding sudo chown -R username:www-data /var/www works better
  • cd www
  • sudo drush site-install standard --db-url="mysql://root:s73jd76sj3wu1@localhost/drupaltest" --site-name=drupaltest
  • Go to http://localhost/admin/reports/status and enjoy the report
  • - See more at: http://www.skrinakcreative.com/2012/12/23/making-ubuntu-server-1210-drupal-ready#sthash.NvEShlGR.dpuf






  • sudo apt-get update
  • sudo apt-get dist-upgrade
  • sudo apt-get install tasksel
  • sudo tasksel install lamp-server (reference)
    1. Enter your root password
  • mysql -u root -p (Log in and ensure name/password combo work)
  • sudo apt-get install build-essential php5-dev php5-gd php-pear
    1. (FYI: This loaded 82.5 MB on my server)
    2. I ran apt-get autoremove afterwards; YMMV
  • sudo a2enmod rewrite
  • sudo pecl install uploadprogress
  • sudo vim /etc/php5/apache2/php.ini (Add extension=uploadprogress.so as instructed)
  • sudo vim /etc/apache2/sites-available/default
    1. Change the "AllowOverride None" line to "AllowOverride All"
    2. (Ensure that default site settings are what you expect and are on valid paths)
  • sudo service apache2 restart
    1. You may see the inconsequential warning about "Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName" If that bugs you, you can always add "ServerName localhost" to the bottom of /etc/apache2/apache2.conf
  • sudo apt-get install drush (I love that I can do this)
  • cd /var
  • sudo drush dl drupal --drupal-project-rename=www
    1. Install location /var/www already exists. Do you want to overwrite it? (y/n): y FYI: This will overwrite the apache default www directory
  • sudo chown -R www-data:www-data /var/www
    1. I'm finding sudo chown -R username:www-data /var/www works better
  • cd www
  • sudo drush site-install standard --db-url="mysql://root:s73jd76sj3wu1@localhost/drupaltest" --site-name=drupaltest
  • Go to http://localhost/admin/reports/status and enjoy the report
  • - See more at: http://www.skrinakcreative.com/2012/12/23/making-ubuntu-server-1210-drupal-ready#sthash.NvEShlGR.dpuf

    No comments:

    Post a Comment