Configure LAMP Server for Drupal 7 and Migrate Development Site - No GUI, command line only

  • strict warning: Non-static method view::load() should not be called statically in /home1/nate01/public_html/sites/all/modules/views/views.module on line 1113.
  • strict warning: Declaration of views_handler_field::query() should be compatible with views_handler::query($group_by = false) in /home1/nate01/public_html/sites/all/modules/views/handlers/views_handler_field.inc on line 1147.
  • strict warning: Declaration of views_handler_argument::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home1/nate01/public_html/sites/all/modules/views/handlers/views_handler_argument.inc on line 917.
  • strict warning: Declaration of views_handler_argument::query() should be compatible with views_handler::query($group_by = false) in /home1/nate01/public_html/sites/all/modules/views/handlers/views_handler_argument.inc on line 917.
  • strict warning: Declaration of views_handler_sort::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home1/nate01/public_html/sites/all/modules/views/handlers/views_handler_sort.inc on line 165.
  • strict warning: Declaration of views_handler_sort::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /home1/nate01/public_html/sites/all/modules/views/handlers/views_handler_sort.inc on line 165.
  • strict warning: Declaration of views_handler_sort::query() should be compatible with views_handler::query($group_by = false) in /home1/nate01/public_html/sites/all/modules/views/handlers/views_handler_sort.inc on line 165.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home1/nate01/public_html/sites/all/modules/views/handlers/views_handler_filter.inc on line 587.
  • strict warning: Declaration of views_handler_filter::query() should be compatible with views_handler::query($group_by = false) in /home1/nate01/public_html/sites/all/modules/views/handlers/views_handler_filter.inc on line 587.
  • strict warning: Declaration of views_plugin_query::options_submit() should be compatible with views_plugin::options_submit($form, &$form_state) in /home1/nate01/public_html/sites/all/modules/views/plugins/views_plugin_query.inc on line 169.
  • strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /home1/nate01/public_html/sites/all/modules/views/plugins/views_plugin_row.inc on line 136.
  • strict warning: Non-static method view::load() should not be called statically in /home1/nate01/public_html/sites/all/modules/views/views.module on line 1113.
  • strict warning: Declaration of views_plugin_pager_none::post_execute() should be compatible with views_plugin_pager::post_execute(&$result) in /home1/nate01/public_html/sites/all/modules/views/plugins/views_plugin_pager_none.inc on line 69.

To start with, I created a tarball with bz2 compression of the dev site. Make sure to explicitly include .htaccess because the tar command, like the ls command does not include filenames with "." as the first character. Navigate to the root of your site and execute the following (-c create | -v verbose (lists files as it goes) | -j bz2 compression | -f file):

tar -cvjf nameofsite_date_of_copy.tar.bz2 * .htaccess

Also, you will need the mysqldump

mysqldump -u user -p db-name > db-name.out

more about mysqldump

Next I connected to the dev site via FTP and pulled down the tarball and the sql dump. With that on hand, I can now connect to the VPN and get the files and database setup. FTP the files up and get started extracting the tarball.

tar -xvjf nameofsite_date_of_copy.tar.bz2

Then, we must first create the database:
Login to mysql as root.

mysql -u root -p -h localhost

Most of the time, this will suffice:

mysql -u root -p

At the mysql prompt "mysql >" create the database

mysql> create database yourdbname;

At the mysql prompt "mysql >" create the user

mysql> GRANT ALL ON yourdbname.* TO new-user-name@localhost IDENTIFIED BY 'TheNewPasswordHere';

You can additionally supply remote access permission:
( the following would allow access from 192.168.1.5 )

mysql> GRANT ALL ON yourdbname.* TO new-user-name@192.168.1.5 IDENTIFIED BY 'TheNewPasswordHere';
mysql> quit;

Now with the database created and user in place, import the db from the sql dump

mysql -u username -p -h localhost DATA-BASE-NAME < db-name-out.sql

more about mysqldump import


At this point, the files and database are good to go. When I tried to view the index page, I saw nothing. After simple hello world index.php and phpinfo(), I figured out that Drupal 7 requires PHP 5.2+ and 5.3 is even better. The phpinfo() showed PHP 5.1 so it was time to upgrade the PHP version. With CentOS this wasn't too hard.

The article here explains upgrading to php 5.3 very well.

Once PHP was updated and httpd restarted, I saw the homepage. Seemed great until I clicked any link and Clean URLs were not working. Having a little experience in fixing this problem, I knew to look in the .htaccess file. Evertyhing looked good so now I wanted to check if mod_rewrite was installed.

In /etc/httpd/conf/httpd.conf , check that it is being loaded by verifying this line in the file:
If you are unfamiliar with viewing/editing files within SSH, look here or just google "vi editor commands".

LoadModule rewrite_module modules/mod_rewrite.so

If commented out (#), remove the # and then restart httpd

service httpd restart

To list all of the services which are running, checking to see if the rewrite_module is included in the list of modules:

apachectl -M
On some systems, it may be
apache2ctl -M

more about mod_rewrite isntallation

The module was listed for me, so I headed to Drupal to run the Clean URL test (/?q=admin/config/search/clean-urls) and it failed. It ended up that AllowOverride was set to None for the /var/www/html directory in httpd.conf so I changed it to AllowOverride All and voila, the clean url test passed and the Drupal 7 site has been migrated to a fresh LAMP server.