Finishing up Environment Clean Up

All three of my environments now match completely. The Module Filter module helped me get them on the same page. So did the terminal command for listing the Centos patch level,

rpm -q centos-release

I also gave my VMs static addresses. and made host references so i can browse them by name. I have such a small network in my VO that I don’t need a dedicated DNS server. Ole Hosts is fine.

Procedure – Upgrade Drupal Core from 7.18 to 7.19

Please note that this procedure has been written for my specific situation. I believe that it is applicable to others and may provide insight to your situation but it will most likely not match what you have exactly so please be cautious. Back things up and test in a dev/qual environment first! I have just finished it in Quality and it works fine.

  1. Back up everything
  2. Download the new core file
  3. Put site into maintenance mode
  4. Place it on the server and extract all the contents to /var/www/719/drupal-7.19
  5. In the newly extracted files delete the sites directory and all its subs.This is done because the upgrade is not going to replace anything in this directory
  6. Rrom a terminal window type:          yes | cp -r /var/www/719/drupal-7.19/* /var/www/html
  7. Note that the destination folder of html is my doc root and all the drupal folders/files are located right underneath this. the yes | cp…. prefix is to let the system know to overwrite everything in the destination. since sites is the only directory that we want to keep and we have removed it from the source, this will be fine.
  8. Run update.php by navigating to http://…yourdrupalsitename/update.php
  9. Follow the instructions for this closely
  10. navigate to reports, available updates and check the version of your core
  11. take the site off of maintenance mode
  12. check different things on the site to ensure a smooth upgrade has occurred.
  13. that should just about do it.

Drupal core upgrade to 7.19

Today I’m going to upgrade core. qual first then prod. i don’t really think there is a compelling reason but i haven’t done a core update yet and i want to have it documented. plus, i want to get rid of the notice about a security update being available. it’s persistent. which is good.

here is a good link: http://drupal.org/node/1494290

since i have a great quality env (VMware) I am using sync toy to back up all the vmdk and related files from the windows host where the centos qual files live. i’ll then follow the instructions on how to upgrade core. should be fine but this way i don’t have to install in sand first. plus, i need to back up the vm files for qual; it hasn’t been done in 8 days.

i have two machines at home. a new windows 7 laptop which i like a lot and an old dell running xp which i honestly love. i have 2.5 gb of mem in the 3.0 ghz cpu and it runs everything i need. i have an external usb connected to that and i keep everything of value in the my docs folder. i use synctoy to sync the desk and laptop my docs and then backup the desk my docs to the external 1tb drive. the only hole in this approach is fire. i’m not worried about theft (for other reasons). i should think about some sort of off site storage. but if this place burns down i’ll have much bigger troubles.

my prod host is with Blackmesh.com hosting. a very excellent hosting company.

the laptop runs the VMs. i have them all on the same network so it is pretty easy to access files from the desk to a vm host. layer 1 is wireless. all in all a nice setup.

so sync toy is moving my vm to the desk from the laptop right now. will be about 30 more minutes.

SSL on Production

I was able to install the SSL cert on prod in less than 5 minutes. that is the advantage of setting up a quality environment that truly matches prod; you can make the prod changes so easily and help keep your prod environment pristine.

now back to the multilingual stuff. i hate to get distracted but i really hate creds in clear text. ssl had to be done.

Getting all the environments ready.

So, I have all three environments up and running. I have the prod site out of DC hosted by blackmesh.com, the best drupal hosting company there is. The quality site, which mimics the prod site perfectly past the virtualization level, from the drupal core level, the OS and patch installs and even the modules and themes installed on drupal. file structure. user accounts. access methods (although prod uses sftp and qual uses ftp) and os components like apache and mysql. very nice.

i had to reenable clean urls on the q and d boxes. which was OK. i used most of the proc that i uploaded earlier today with a few differences that are not in the instructions. but google and drupal.org were very helpful and I really didn’t have much trouble. just be aware that linux permissions seem to be trickier than perms on a windows server.

getting late, and write more tomorrow. but i am excited because i am finally going to be able to get to work on the site itself and not have to worry so much about all the infrastructure crap. i did  get a few issues with file transfer worked out too. but i have a question: is there any other way to use drupals install module gui to use a protocol other than ftp? that’s the only choice in the drop down. i can ssh files to the server and i’m sure that i could install/enable the modules via the command line, but from the web admin gui running remotely, i don’t see how you could. i’ll pcik that back up more tomorrow maybe.

Enabling Clean URLs

I though that i had posted this proc months ago until i went looking for it and couldn’t find it. so here is the proc that i used to enable clean urls on drupal 7.17 on ubuntu desktop 12.04

Procedure – Enable clean URLs for Drupal 7 on Ubuntu Desktop 12_04 rev_1.doc

Date: 11/13/2012

Author: PJ McGhee

Email: PJMcGhee@hotmail.com

Procedure: New

Replace Existing

Intended Audience: Drupal admins

Purpose: To explain the steps needed to enable clean URLs in Drupal by enabling the rewrite_module component and changing the httpd.conf file of Apache2 to

Web References:

http://drupal.org/getting-started/clean-urls

http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

Procedure:

  1. Navigate to the Configuration, Search and Metadata section of Drupal.
  2. Click Clean URLs.
  3. In Drupal 7 the test will be run automatically and will give the result right away.
  4. When the test fails take a good look at the links above for background on the issue.
  5. Then, on this particular install, since you are running a dedicated server, you can do this first.
  6. At the command line, type apache2ctl –M and hit enter.
  7. Look for rewrite_module (shared) you should not see it (that’s to be expected)
  8. Type a2enmod rewrite and hit enter.
  9. Type apachectl –M again, hit enter. Now you should see the module listed there.
  10. Go to etcapache2 and edit the httpd.conf file which should be empty.
  11. Add the lines:

<Directory /var/www/drupal/>
   RewriteEngine on
   RewriteBase /drupal
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>

  1. In this scenario, the directory structure shown is correct, but it should reflect where you actually have Drupal installed.
  2. Then type sudo /etc/init.d/force-reload and hit enter.
  3. Then type sudo /etc/init.d/apache2 restart and hit enter.
  4. Then test clean URLs in Drupal.
  5. You should now see a check box that will allow you to enable this feature.

Prod and Dev

I have everything set up the way that I want it. i set up ftp on my dev server and  did a little configuring to get the permissions setup so that I could get to the /var/… dir tree. that wasn’t too much of a stretch. since it is dev, i just opened it up. plus, it is on a vm on my laptop so it isn’t a big deal.

so i can open the dev site with ftp, the prod site from ssh and open the same file from each side. the have the same name and the same dir location. so, i test the code on dev and then copy and paste it to the prod server. works pretty well.

Centos Dev Server up and running

Well, I have finally gotten my dev server up and running. now my dev matches prod. CentOS 6.3 is the choice by my provider, Blackmesh.com and now it is my choice as well.

there were some challenges getting centos to work with drupal but nothing too bad and it ended up taking about half a day.

CentOS 6.3, VMWare Player, Drupal

well, i am making progress and moving forward. I am now getting ready to start on my prod site. i still have a lot of learning left to do but i need to move forward with the real deal.

i have the best hosting provider there is – Blackmesh. they are based out of the DC area and they are really a top class act.

they run all their drupal stuff on centos. i have been using ubuntu desktop 12.04 for all my dev work so far but the time has come to go back to the command line and use the same OS for the sandbox that i will be using in prod.

so i’m learing linux commands again. no desktop to fall back on. i was an AIX admin years ago so this isn’t too bad. but it is new and therefore will warrant some space on this site.

centos has networking turned off by default. here is a good link about that.

http://www.cyberciti.biz/faq/setting-up-a-linux-for-dhcp/

make sure the the onboot option is set to yes. learn vi editor if you don’t know it. BTW, it sucks. but here is a link for its commands

http://www.washington.edu/computing/unix/vi.html

then you can install the packages that you need. i also had some trouble getting centos installed on vmware player but i was able to work around them with some google searches. you need to get the centos iso minimal install file AND, when you create the vm, don’t install the os with the initial wizard, just choose don’t install os, then go back and do it. do specifiy in vmware that you will be using centos though.

LAMP and VMWare player

so i’m running drupal 7.16 on my windows 7 laptop. well, it’s on a vm on the laptop. i’m running vwware player. it’s free. and works well. running ubuntu 12.06. i wrote a good doc on how to do this. i’m an IT pro, 15 years but i have been almost completely focused on MS solutions. so this doc is good for someone who knows MS but wants to move towards open source. the doc is in ms word. here is the stuff from the docs. if you want the doc itself, send me a message and I can get it to you.

Procedure – Installing Drupal 7.16 on Ubuntu Desktop 12.04 LTS on VMWare Player hosted on Windows 7 Home 64 bit

Date: 10/22/2012

Author: PJ McGhee

Email: PJMcGhee@hotmail.com

 

Procedure:            New                                                              

                                Replace Existing                    

 

Intended Audience:

IT Pros who have been traditionally Microsoft based but are moving towards open source/linux based applications

Purpose:

This document explains the steps to install Drupal 7.16 on a VMWare Player hosted Ubuntu Desktop12.04 to create a development environment on a Windows 7 64 bit laptop. There are ways to do a “one click” install for this purpose. This procedure is intended to describe how to install all the separate components manually, giving the user a better understanding of the underlying technologies that support Drupal.

This may be of particular value for those (like me) who have traditionally been Microsoft oriented who now embrace open source. The document assumes then, a high level of familiarity with install procedures and other broad IT concepts like virtualization, web services, databases and systems administration regardless of the platform that it is being implemented on.

The overall objective for the first section is to successfully install what is known as a LAMP server. This is just an acronym for Linux, Apache, MySQL and PHP. Together, these elements form a platform, both scalable and powerful (free too), that can be used to implement many different open source applications. They form the backbone of the Drupal server, providing OS (Linux), Web Services (Apache), Database (MySQL) and Programming Language (PHP). There are many smaller packages that need to be installed as prerequisites and they are all detailed in the procedures.

Since familiarity with Linux and its components is assumed to be limited, this document describes in a fair amount of detail, how to achieve a dev/test environment on a Linux Ubuntu Desktop install running on a VMWare Player hosted on a Windows 7 laptop. This is what I am running. Ubuntu Desktop provides a familiar interface with the desktop feel. VMWare Player allows Linux to be run in a way that doesn’t impact your laptop much while still allowing internet access.

Drupal.org is an awesome site. Do yourself a favor right away and register with the site. Take some time to check out the different areas that are available. Get to learn where the resources are located. This will help you as you start to develop sites with Drupal. There are several newsletters that you can join as well that will aid you in learning this great product.

Open source is awesome and the community behind it is superb. But open source requires more time and work to achieve a clean install. The readme files in the packages you will be installing are very important for the procedures; always make sure to reference them! If you encounter errors along the way, remember that Google is your friend. The first time that I went through this install I had to work my way through errors at almost every single turn, usually because a prerequisite was missing, which is my fault for not reading enough beforehand which is arguably difficult because there is simply so much information out there. But, I was able to work through every single issue by Googling the message and following the tips offered. It takes time but in the end it is worth it because you gain a better understanding of the underlying systems. That’s why I eschew the “one-click” packages available for Drupal. And why I am not running Drupal on Windows. There are no Install Shield wizards for these installs but there really isn’t anything too onerous either: it’s just a lot of steps. And this is a great way to start learning Linux.

 

Caveats and Disclaimers

I’m not a Linux guy. I have spent my 15 professional years in IT mostly designing/implementing/supporting systems based on Microsoft products. There are sure to be much better ways to do many (most) of the things in this procedure. I won’t be the one to argue that. Please email me any suggestions. I simply want to help people who have traditionally focused on Microsoft products move into open source. Especially Drupal, which is a great product. That being said, I make no guarantees about the procedures in this document or their impact on your systems.

 

Common Linux commands/tips – http://www.pixelbeat.org/cmdline.html

 

  • Ctrl-Alt-T                                                  opens command prompt on Ubuntu
  • Dir                                                            shows list of directories
  • Ls                                                            shows list of files
  • ls –l                                                          show files with perms, owner, etc
  • cd ..                                                        moves up one dir level
  • cd /                                                          takes you up to the top level
  • chmod                                                     command to change permissions – see docs for syntax
  • apache2 –v                                             tells you the version of apache you have installed
  • mysqladmin -u root -p version                show version of MySQL installed

 

Responsibilities:

YOU

 

Requirements:

  • Admin access to a Windows 7 64bit Host OS
  • VMWare Player 4.0.4 Build 744019
  • Linux – Ubuntu Desktop ver. 12.04 LTS 64 bit
  • Autotools
  • Apache 2.2.22 Web Server
  • MYSQL 5.5.24
  • PHP 5.3.10
  • APR 1.4.6 APR-Util 1.5.1 – Apache components
  • PCRE 8.31
  • G++ via Build-essential

 

Estimated Time to Complete Procedure:

240 Minutes

Contact Information:

pjmcghee@hotmail.com – Feel free to email me if you have questions about this procedure.

Objective 1: Install LAMP server

Procedure:

               

Build the Ubuntu Server

  1. Install the free VMWare Player ver. 4.0.4.
  2. Start VMWare upon completion.
  3. Click File, New Virtual Machine.
  4. Browse to the Ubuntu .ISO file.
  5. Enter your name
  6. Give the new virtual server a name relevant to your purpose – Drupal-Dev in this case
  7. The install will prompt you for a user to be created. Make the user drupal-dev and the password password.
  8. VMWare tools for Ubuntu Linux will be installed automatically after the first reboot.
  9. Login to the new virtual Ubuntu Linux machine when prompted.
  10. Click the Cog icon in the top right corner of the desktop and choose “available updates”. There will be approximately 433 (274 MB at the time of writing) updates that will need to be downloaded and installed. Make sure to check for updates regularly as the components are installed. The VM must be able to browse the internet.

Enable the root account [i]  – http://www.liberiangeek.net/2012/05/login-as-root-in-ubuntu-12-04-precise-pangolin/ – this is a good reference for this part

  1. 11.     Hit Ctrl-Alt-T to open a terminal window. Remember this; it will be used a lot
  2. Type sudo passwd root and hit enter – set a password for the root account
  3. Type su root and supply the password for root – you are now using root privileges
  4. Type sh –c ‘echo “greeter-show-manual-login=true” >>/etc/lightdm/lightdm.conf’
  5. Reboot the server. You will now be able to choose the user name with which to login.
  6. Login as root with the password of password

 

 

 

Download Components

Open the Firefox web browser from within Drupal-dev. Some of these packages will be downloaded and installed manually and some will be installed via apt-get (https://help.ubuntu.com/8.04/serverguide/apt-get.html) but it is a good idea to look at the web site of each individual component.

  1. Autotools for Ubuntu –  http://www.sourceware.org/autobook/autobook/autobook.html
  2. Apache 2.2.22 – http://httpd.apache.org/docs/current/install.html – reference this link
  3. APR 1.4.6 – Apache component – http://apr.apache.org/download.cgi
  4. APR-Util 1.5.1 – Apache component – “
  5. PCRE 8.31 – ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.gz
  6. Build Essential – https://launchpad.net/ubuntu/+source/build-essential
  7. MySQL Server Installed via apt-get but reference https://help.ubuntu.com/12.04/serverguide/mysql.html
  8. PHP 5.4.8 – installed via apt-get reference  http://php.net/downloads.php
  9. Drupal Core 7.16 – recommended release, not development – http://drupal.org/drupal-7.16
  10. Open http://drupal.org/documentation/install – This is an excellent resource for the overall procedure to install Drupal.

 

Install Autotools  for Ubuntu – http://www.sourceware.org/autobook/autobook/autobook.html

  1. Go to http://pkgs.org/download/libtool and download the libtool (all you really need) package or, skip to step 5 to use apt-get to get the whole Autotools package.
  2. Double click the downloaded package.
  3. The UbuntuSoftwareCenter will open.
  4. Click install. This feels more like a Windows installer process which is why I included it.
  5. Or, you can use apt-get to download and install the package.
  6. Hit Ctrl-Alt-T to open a terminal session window
  7. From the terminal session type apt-get install libtool automake autoconf and hit enter.
  8. Click Y to confirm the needed space.

Install Yum

  1. Yum and apt-get do the same things but you may end up liking Yum more than apt-get and it is good to know about some of the install options available.
  2. http://packages.ubuntu.com/hardy/yum
  3. Hit Ctrl-Alt-T to open a terminal session window.
  4. Type apt-get install yum.
  5. Confirm the space needed for the install.

Install Build Essential

  1. This will give you G++ which will be needed, plus others. https://launchpad.net/ubuntu/+source/build-essential
  2. From the command prompt type apt-get install build-essential and hit enter.
  3. Confirm disk space.

 

Install APR

  1. Click the Home Folder icon in the top left of the desktop and go to downloads.
  2. Double click (DC) the APR-1.4.6  folder. Right click the contents of Archive Manager and choose Extract.
  3. Extract files to the downloads folder. You’ll now have a folder called apr-1.4.6 along with the tar packages.
  4. Open a terminal window.
  5. Linux can be a little confusing in regards to directory structure. A simple way to ensure you are at the root level is to type simply type cd / and hit enter.
  6. Once you’re at the root level you need to get to the APR-1.4.6 directory.
  7. Type dir to ensure that you’re at the top. You’ll see directories like boot, bin, home, root, var.
  8. Type cd root and hit enter – your prompt should go from

root@ubuntu:/# to root@ubuntu:~#

  1. Type cd Downloads – this is case sensitive – hit enter.
  2. Type cd apr-1 and hit the tab key – this will complete the command – hit enter.
  3. Type ./configure and hit enter. Many scripted commands will now run. At the end you will see an error about libtoolsT cannot be removed. This can be ignored.
  4. Type make and hit enter – more scripted commands.
  5. Type make test and hit enter – this will take a couple of minutes.
  6. Type make install and hit enter – this will be fast.
  7. There will now be an APR-1.4.6 folder in the /usr/local/src directory.

Install APR-Util

  1. Extract the APR-Util folder to downloads.
  2. Go back to the terminal window and make your way to the APR-Util-1.5.1.
  3. Type ./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr/ and hit enter.
  4. The prefix part specifies where the apr-util files will go and also specifies where the apr files are located.
    1. Type make and hit enter.
    2. Type make install and hit enter.

 

Install PCRE 8.31

  1. Extract the files to the download directory.
  2. From the terminal session go to the PCRE-8.31 directory.
  3. Type ./configure and hit enter.
  4. Type make and hit enter.
  5. Type make install and hit enter.

 

Install Apache

  1. At the command line type  apt-get install apache2 apache2-mpm-prefork and hit enter.
  2. Confirm that it is OK to use the additional space.

 

Install MySQL Server

  1. From the terminal session type apt-get install mysql-server and hit enter.
  2. Confirm Y to use the additional 97.1 MB of space.
  3. Enter a password for the root account (user name  =  root) when prompted. You’ll be prompted twice.

Install PHP

  1. Install mcrypt first.
  2. From a terminal session type apt-get install php5-mcrypt and hit enter.
  3. Choose Y to confirm the disk usage.
  4. Install Libxml2 dev files.
  5. Type apt-get install libxml2-dev and hit enter.
  6. Type apt-get install libapache2-mod-php5 and hit enter.
  7. Type Y to use the needed space.
  8. Type apt-get install php5-gd hit enter.
  9. Type Y to use the needed space.
  10. Type apt-get install php5-common php5-mysql and hit enter.

 

Test the installed components

 

Test Apache

  1. Open the Firefox browser and navigate to http://localhost.
  2. The default directory is in /var/www the page is index.html.
  3. If you see a plain page that says, “It works!…” the install is working.

 

Test MySQL

  1. From a terminal session type netstat -tap | grep mysql hit enter and you should see:
  2. tcp                   0              0 localhost:mysql    *:*            LISTEN931/mysqld
  3. This indicates the server is running.

 

Test PHP

  1. Open /var/www and create a new test php page called test.php using the test editor.
  2. Enter the following PHP code:

<?php phpinfo(); ?>

  1. Save the file.
  2. Browse to the url http://localhost/test.php.
  3. You should see a web page with quite a bit of PHP information.
  4. If you are asked to download the file PHP is not being parsed by Firefox.
  5. Reboot the server.

That concludes the installation of the LAMP server. Hopefully, it wasn’t too bad. Thanks for your patience and I hope that you might have learned a thing or two about the Linux world. I know that I did! Now it is time to move on to Object 2 – the install of Drupal Core itself

 

Objective 2: Install Drupal Core

Procedure:

Prepare the Drupal install files and create needed directories

 

  1. Extract the Drupal 7.16 to the download directory.
  2. Move the Drupal files via the next line’s command.
  3. Type mkdir /var/www/drupal and hit enter.
  4. Type mv drupal-7.16/* drupal-7.16/.htaccess /var/www/drupal and hit enter.
  5. Go to the extracted files and open the install.txt file for install procedures.

Create the MySQL Drupal DB

  1. Open the INSTALL.mysql.txt file in the ./Drupal-7.16 directory.
  2. Open a terminal session.
  3. Type mysqladmin –u root –p create drupal     where root is the user name and drupal is the name of the database that we are creating for the install.
  4. You will be prompted for the password that you supplied for the root account during the mysql server install.
  5. Login to mysql and set access rights by typing mysql –u root –p and hitting enter.
  6. Supply the password again.
  7. Now type this query to provide rights:
  8. GRANT ALL PRIVILEGES ON drupal.* TO ‘root’@’localhost’ IDENTIFIED BY ‘password’;
  9. Be very careful with the syntax here. Notepad may add characters that will interfere with a copy and paste method. The single quotes can also be different from Windows to Ubuntu. The syntax here is correct; you need to make sure that it is being transferred properly.
  10. Note that password is the same as supplied before.
  11. Successful assignment of perms will show as:
  12. Query OK, zero rows affected.
  13. Type exit and hit enter to leave mysqladmin.

Run the Drupal installation script and prepare files

 

  1. From a terminal session type mkdir /var/www/drupal/sites/default/files and hit enter.
  2. Type cp /var/www/drupal/sites/default/default.settings.php /var/www/drupal/sites/default/settings.php and hit enter.
  3. Type chmod 777 /var/www/drupal/sites/default/files and hit enter.
  4. Type root and hit enter.
  5. Open Firefox.
  6. Browse to http://localhost/drupal/install.php.
  7. Leave the radio button at “Standard” and Save and Continue.
  8. Leave at “English” and click Save and Continue.
  9. Verify Requirements will now appear.
  10. Correct any missing requirements and click Proceed
  11. You will now be at the Database configuration screen.

Supply the name of the database, user and password that you specified in step 3 of Create the MySQL Drupal DB. In this case, the db name is drupal, the user is root and the password is password.

  1. You should not need to change advanced options.
  2. Click Save and continue.
  3. The Install profile steps will be run.
  4. You will now be at Configure site and you’ll need to supply some SITE INFORMATION.
  5. localhost is fine for this dev environment.
  6. Any email address will be fine for now.
  7. Now for SITE MAINTENANCE ACCOUNT – This is important because this Drupal specific account will have rights to do everything in your Drupal install.
  8. User name is root, email address is root@root.com and the pass word will be password.
  9. Under SERVER SETTINGS choose the country settings and time zone appropriate for you.
  10. Leave UPDATE NOTIFICATIONS the way they are.
  11. Click Save and Continue.
  12. You should now be at Finished.
  13. One last step – VERY IMPORTANT!
  14. From the terminal session type:
  15. chmod 640 settings.php and hit enter.
  16. chmod 755 ../default and hit enter.
  17. Click the link to visit your site.
  18. CONGRADULATIONS! You have now implemented an excellent Drupal dev environment.

[i] Linux gurus will probably tell me that there is a better way to do this and I am sure that there is but I’m just an MCSE trying to make it in an open source world! Please send me your recommendations.