Main Menu

search

You are here

obs - Drupal: Local Server Installation

as of 2024-01-04 this page may be obsolete...
---------------------------
[last updated: 2020-01-04]
Drupal home page
obs - local server setup
https://www.drupal.org/docs/official_docs/local-development-guide
-----

  • from: (link to:) dummies.com
  • Drupal needs MySQL, Apache, and PHP.
    You have to install these first (in that order). Installing them involves downloading the software, extracting it in the correct location, making any file configuration changes, and testing it.
    • OR: Installation packages are available that install all 3 programs:
      DAMP also installs Drupal
      XAMPP also installs Perl
      WAMP is for Windows
      MAMP is for Mac
    • MySQL and Apache were installed previously (see Dell tower blog - 2019/11/05)
      (see Dell tower blog - 2019/12/30 for PHP installation)

  • Decide on Directory Structure:
    • Best guess is that the directory structure on both my hosts (BlueHost & HostGator) is wrong or at least not optimum.
    • search drupal.org for "standard structure" for a Drupal 7 installation.
    • I've created a drupal769 directory under /var/www/html to allow a mirror to online sites.
      This will be equivalent to or in place of public_html on both HostGator and BlueHost
      This will be my root Drupal installation directory:
          /var/www/html/drupal769
    • Under my root folder drupal769, under ../sites, I created subfolders for each of my domains, starting with jayrabe.net
  • Download Drupal software:
    • drupal-7.69.zip downloaded into my .../Tech/drupal/drupal7.69 folder, then unzipped there,
      which created a drupal-7.69 directory with all the extracted installation files
    • Copied all files and directories from drupal-7.69 into the drupal769 directory:
      $ cd moved to drupal-7.69 directory, and executed:
      $ sudo cp -avr [dir or fileName] /var/www/html/drupal769
      and repeated for all files and folders in drupal-7.69
      [There surely is a quicker way to do this, but this worked for now...]
    • $ cd moved into drupal769/sites and created folders for all my sites:
      jayrabe.net, arduinoetal.net, allthingsgmcmh.net, and tangomoments.com

  • Create a database for Drupal to use:
    • open phpMyAdmin (with what user with what privileges?):
      Locate the Create a New Database text box on the right side of the phpMyAdmin screen.
      • However: 'Create database' was not clickable, with "X - No privileges" warning underneath.
        I did not record convolutions needed to restore privileges, but after much forum-surfing and hacking around, eventually was successful and proceeded...
        [Repeated the process later and worked around it by logging into mysql with root, then creating a root2 user with root2 pw with all privileges. I could then use root2 to get into localhost/phpmyadmin with privileges to create databases.
    • Type drupal as the name of your new database, left Collation at default, and clicked the Create button.
      But now it wants me to create a table, so I made one named tmpx
      But then it needed something filled out, so I put an "x" in the first field,
      But then it wanted something about partitioning...
      closed browser [perhaps could have done so before creating the tmpx table...]
      [later went into mysql and deleted the tmpx table]
    • OR:
      $ sudo mysql -u root2 -p
      mysql> create database drupal;
      [perhaps should have named it drupal769 ?]
    • (from: O'Reilly) "When it's time to transfer the database from your local server to a production server: you’ll create a new database (with a stronger username and password), and sync the data from the local development database to the new remote, online database.

  • Configure Drupal site:
    • opened browser to: localhost/drupal769
      went through prompts to configure, then...
        "... create a settings file: copy the ./sites/default/default.settings.php file to ./sites/default/settings.php. ..."
        did so with: $ cd ../sites/default ... then
        $ sudo cp default.settings.php settings.php
        Back to drupal config page: error says that settings.php is not writable
        $ sudo chmod 777 settings.php
        confirmed permissions changed with: $ ls -l
        'not writable' error gone
    • then got error: must enable php extension gd
      • Found Php-gd in Software Manager. Installed.
        No change in localhost/drupal769 config page
        Stopped and restarted mysql:
          $ sudo service mysql stop
          $ sudo service mysql start

        No change in localhost/drupal769

      • Per phpinfo(), my "extensions-directory" is: /usr/lib/php/20170718
        which contains a bunch of .so files, including gd.so
      • Next step is to edit php.ini and add directive to load gd.so
        • Some doubt as to which php.ini file to edit, since there are several,
          including versions in: /etc/php/7.2/apache2, /etc/php/7.2/cli.
          Best guess is that appropriate one is the cli/php.ini
      • Made a trial run editing php.ini to include gd module.
        Added line:
              ;extensions=gd ... unsure about synax, esp the " ; " at start of line
        Instructions say to restart php after editing. forum says restart php by restarting apache2 web server. Did so (see Apache page).

      -----------------------

    • Continue Drupal Configuration:
      • Now going in to localhost/drupal769 re-starts the drupal configuration process,
        and on Database Configuration page, here's what worked:
          database name: drupaI
          database username: phpmyadmin
          database password: tripT

        Eventually things worked on database configuration, and message:

        • "All necessary changes to sites/default and sites/default/settings.php have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, consult the online handbook."
      • in Configure Site:
              Site Information:
                    Site Name: default was localhost; changed to jayrabe.net
                    Site email address: entered jay@jayrabe.net

              Site maintenance account:
                    Username: phpmyadmin
                    email address: jay@jayrabe.net
                    password: tripT
                    confirm password:
                    Save and Continue

      • Uncertain about implications of the email addresses I've entered:
        First, not sure if my local drupal769 installation would even be able to send an email.
        Second, notes on forums say something about how emails paired to users must be unique,
        that is you can't have two users with the same email, but not sure how that affects like site and maintenance emails.

  • "Congratulations. You installed Drupal."
    Proceed to: local server setup
  • -----------------------------------------------

  • from O'Reilly: If you are using a remote staging server (ie. online), you can prevent your dev/staging environments from being seen is to edit the .htaccess file (included in Drupal) to require all visitors to use a password just to view the site.
  • ----------------------------------------------------------------------

  • Links to install a local server to test drupal things.

.

.

.

eof