• Drupal Installation guide


    Installation guide for Drupal 6.x

     

    The following pages cover the installation of Drupal 6. For information about installing Drupal 5, see the Drupal 5 guide.

    Drupal provides an installation script that automatically populates database tables and configures the correct settings in the settings.php file. This section covers preparing for installation, running the installation script itself, and the steps that should be done after running the installation script has completed. It also explains how to do a "multi site" installation, where a number of different Drupal sites run off the same code base.

    Before proceeding with your first Drupal installation, you should also review the best practices section. For help with Drupal terms, see the terminology page.

    Other tools

    Some of the steps in the installation process can be performed with tools such as graphical applications for moving files and managing databases or tools that are provided by your hosting service. This documentation focuses on performing tasks at the command line. For information on using other tools, see the documentation that accompanies the application or is provided by your hosting service.

    Creating a test site on a local computer

    It is considered a good practice to do all development work on a separate test site before making changes to a production site. A test site allows you to evaluate the impact of upgrades, new modules, modifications to themes etc. without causing disruption to your live site. For information about setting up a web server on a local computer, see the Local Server Setup section of the Developing for Drupal guide.

    Alternative methods for installation

    Some web hosting companies offer "one-click" installations of Drupal, or specific Drupal support. You may be able to locate one on the Drupal hosting handbook page.

    There is also a handbook page listing Drupal distributions, which include installation profiles and pre-packaged distributions of Drupal and modules. These may be of help as well.

    System requirements

    Note: if you meet these requirements but still have problems with your site, be sure to read through the Webhosting Troubleshooting FAQ.

    Resources

    Drupal 7 installation has been tested with several operating systems. It is difficult to recommend an absolute memory or runtime amount. A Drupal installation may have none, few, or many contributed modules which drive an increase in memory requirements.

    Servers successfully installed Drupal 7 with no errors when memory was a minimum of 32M to 90M. Runtime was successful when the time parameter was at least 30 to 60 seconds.

    MAMP memory changes should be made in the main php.ini file usually located in: /Applications/MAMP/conf/php5/php.in

    Web Hosting Databases

    If your web hosting account is set up with a graphic control panel such as Plesk or CPanel, it is very likely that you do not need to worry about installing a driver for MySQL -- it is probably already installed on your server. You might wish to simply create your database and proceed with installing Drupal, and then refer back to Drupal documentation for specific troubleshooting help if you run into problems.

    Web server

    Drupal has been deployed successfully on both Apache and IIS.

    Apache (Recommended)

    • Drupal will work on Apache 1.3 or Apache 2.x hosted on UNIX/Linux, OS X, or Windows. The majority of Drupal development and deployment is done on Apache, so there is more community experience and testing performed on Apache than on other web servers.
    • You can use the Apache 'mod_rewrite' extension to allow for clean URLs.

    Microsoft IIS

    • Drupal core will work using IIS 5, IIS 6, or IIS 7 if PHP is configured correctly.
    • To achieve clean URLs you may need to use a third party product. For IIS7 you can use the Microsoft URL Rewrite Module or a third party solution.
    • When using Drupal on IIS 7 with fastcgi you must install Hotfix kb954946, or wait until the hotfix appears in a package update (recommended). KB954946 was included in Windows 2008 Server SP2

    Drupal is being developed to be web server independent, but we have limited or no reports of successful use on web servers not listed here.

    The total file size of your Drupal installation will depend on what you add to your site, but Drupal core files alone will take up approximately 2 to 3 MB uncompressed. The exact size depends on the version of Drupal you have installed.

    PHP

    Recommended: PHP 5.2.x
    Required: PHP version 4.3.5 or higher

    • PHP 5.3 is only supported by Drupal 6.14 and above.
    • PHP 5.2 or higher will be a requirement for Drupal 7.
    • PHP memory requirements can vary significantly depending on your use of modules. While 16 MB may be sufficient for a default Drupal 6 installation and 30 MB may be sufficient for a default Drupal 7 installation, a production site with a number of commonly used modules enabled (CCK, Views etc.) could require 64 MB or more. Some installations may require much more, especially with media-rich implementations. If you are using a hosting service it is important to verify that your host can provide sufficient memory for the set of modules you are deploying or may deploy in the future. (See the Increase PHP memory limit page in the Troubleshooting FAQ for additional information on modifying the PHP memory limit.)
    • The PHP extension for connecting to your chosen database must be installed and enabled. Drupal's currently supported database connectors are: mysql (the original MySQL extension), mysqli (an improved connector for newer MySQL installations), and pgsql (for PostgreSQL). Note: PHP 5.x no longer enables the mysql extension by default. Please read the links above for installing and enabling your chosen connector. Additionally, Drupal 6.x does not provide the option to select the mysql connector if mysqli is enabled in your PHP configuration.
    • PHP XML extension (for Blog Api, Drupal, and Ping modules). This extension is enabled by default in a standard PHP installation; the Windows version of PHP has built-in support for this extension.
    • An image library for PHP such as the GD library is needed for image manipulation (resizing user pictures, image and imagecache modules). GD is included with PHP 4.3 and higher and enabled by default. ImageMagick is also supported for basic image manipulations in Drupal core but there is much less support from contributed modules.
    • PHP needs the following configuration directives for Drupal to work (only directives that differ from the default php.ini-dist / php.ini-recommended):
      • register_globals: off; this is the default value, but some hosts have it enabled
      • session.save_handler: user
      • error_reporting set to E_ALL & ~E_NOTICE. Work is ongoing to change this to E_ALL for Drupal 6 and Drupal 7.
      • safe_mode: off. Safe mode may interfere with file and image uploads.
      • Php Data Objects (PDO) must be activated for Drupal 7 to install and run correctly. Look in your php.ini. Uncomment (remove the leading semicolin) at line extension=php_pdo.dll, extension=php_pdo_mysql.dll. If these lines are not there, you will need to add them. You can also use pecl install pdo to install pdo.
      • In addition, we recommend the following setting: session.cache_limiter: nocache
    • Some of these settings are contained in the default .htaccess file that ships with Drupal, so you shouldn't need to set them explicitly. Note, however, that setting PHP configuration options from .htaccess only works under the following conditions:
      • With Apache (or a compatible web server)
      • If the .htaccess file is actually read, i.e. AllowOverride is not None
      • If PHP is installed as an Apache module
    • See the PHP manual for how to change configuration settings for other interfaces to PHP.
    • In some shared hosting environments, access to these settings is restricted. If you cannot make these changes yourself, please ask your hosting provider to adjust them for you.

    Database server

    Recommended: MySQL 4.1 or MySQL 5.0

    • Drupal 5.x and earlier supports MySQL 3.23.17 or higher. MySQL 4.1 or higher is strongly recommended.
    • Drupal 6 supports MySQL 4.1 or higher.
    • Drupal 7 will only support MySQL 5.0 or higher.
    • NOTE: Drupal makes use of some features not available on some inexpensive hosting plans so please check that your host allows database accounts with the following rights:
      SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER.
      These rights are sufficient to run Drupal core 6.x.

      Some contributed modules, and also Drupal core 5.x (but not Drupal core 6.x), additionally require the following rights:
      CREATE TEMPORARY TABLES, LOCK TABLES.

    • Note: If your system/host is running MySQL 4.1 or newer and you receive the error "Client does not support authentication protocol requested by server", address the problem by following the instructions provided by MySQL AB. There is a minor OS issue with some MySQL 5+ installations primarily on Windows but affecting some versions of Unix/Linux as well.
    • Note: When using Drupal 5.x or later, particularly with contributed modules, it may be necessary to set the system variable max_allowed_packet to at least 16M. Some inexpensive hosting plans set this value too low (the MySQL default is only 1M). In that case, you may need to choose a better hosting plan. A value of 1M may be sufficient for 5.x.
    • Note: Drupal supports MyISAM and InnoDB table types. NDB tables (MySQL Cluster) are not supported.

    PostgreSQL 7.4 or higher

    • Note: Some contributed modules are not as abstracted from MySQL-specific code as everyone would like. If you are familiar with PostgreSQL please file issues with those contributed modules as you find them.
    • Drupal 7 will only support PostgreSQL 8.3 or higher
    • PHP 5.2.6 for Windows has a bug in its pgsql extension. You will need to replace it with the php_pgsql.dll from version 5.2.5.

    Currently Microsoft SQL Server and Oracle are not supported, but various efforts are underway to supply schema. Please see discussions in the Enterprise Group if you are interested in working on this.

    Browser requirements

    Websites built using just Drupal core (i.e. with no additional, contributed modules) are compatible with, and fully functional, in all modern browsers that support CSS and JavaScript. However, browsers have varying levels of compliance with Internet standards such as CSS 2, so there may be minor variations in appearance.

    Here is an incomplete list of browsers that are known to work well with Drupal core and support all of its features:

    • Internet Explorer 6.x and later
    • Firefox 2.x and later
    • Opera 7 and later
    • Safari 1.x and later
    • Camino 1.x and later
    • Google Chrome

    It is also possible to use a browser that does not support JavaScript with Drupal, although the functionality will of course be slightly different. For instance, in Drupal 6 running in a browser with JavaScript enabled, you can use a drag-and-drop interface to position blocks on the Blocks administration page (admin >> site building >> blocks). If you don't have JavaScript, you will still be able to position blocks, but you will use an interface more like Drupal 5, where you will assign numerical weights to the blocks.

    It is also possible to use a browser that does not support CSS with Drupal, but of course the site will not look very similar to how it looks in a browser that does support CSS.

    Some contributed modules and themes may not be compatible with all browsers. If you find a problem with browser compatibility in a contributed module or theme, or some functionality in a contributed module that does not work at all without JavaScript enabled, please submit an issue to report it to the module or theme maintainer.

    Download Drupal

    You can obtain the latest Drupal release from http://drupal.org/project/drupal.

    Drupal has been translated to many different languages. Check whether a released package of the language desired is available at http://drupal.org/project/translations.

    Drupal files, and associated modules, are compressed in the .tar.gz format and can be extracted using most compression tools.

    Downloading and extracting for Linux users
    If you would like to download version x.x of Drupal from the typical Unix command line, use the following commands (replacing x.x throughout the rest of these commands with the version you want to install, such as 5.7, 6.13, 7.2, etc.):
    wget http://drupal.org/files/projects/drupal-x.x.tar.gz
    tar -zxvpf drupal-x.x.tar.gz

    This will create a new directory drupal-x.x/ containing all Drupal files and directories and will preserve all of Drupal's file and directory permissions. Move the contents of that directory into a directory within your web server's document root or your public HTML directory.

    mv drupal-x.x/* drupal-x.x/.htaccess /var/www/html

    The base URL for your Drupal installation will be set in your Web server's configuration file. You will need to know this URL before proceeding to the next step of the installation. If you are installing Drupal on your local machine the base URL may be: http://localhost. If you are installing Drupal onto a Web server your base URL may be a specific domain name (such as http://example.com).

    Note for Mac users
    Mac users may also want review this handbook page during installation: http://drupal.org/node/22676
    Especially in cases where you don't understand where the "web server's document root or your public HTML directory" is on your local machine as referred to above.

    Note for Windows users
    A number of compression programs, such as 7-Zip, allow you to extract .tar.gz files. To use 7-Zip, right-click on the .tar.gz file and, in the menu that appears, select 7-Zip -> Extract Here. A .tar file will appear. Right-click on the .tar file and again select 7-Zip -> Extract Here. In a few moments, the final Drupal folder will appear.

    Note for SELinux users
    Users of Fedora or other distributions with SELinux (Security Enhanced Linux) should not move files unpacked into their home directory into the Web directory /var/www/html.

    As posted at http://drupal.org/node/50280 moving a file preserves the context with the directory in which it was created. In this case the files are incorrectly associated with the home directory (user_home_t) instead of the web directory (httpd_sys_content_t).

    Instead, copying the files to the directory /var/www/html will cause them to inherit the context of the correct directory:

    cp -R drupal-x.x/* drupal-x.x/.htaccess /var/www/html

    If you have already moved the files you may re-associate the files using the command chcon to change the security context for the files:

    chcon -R -t httpd_sys_content_t /var/www/html

    Grant write permissions on the configuration file

    Drupal uses a configuration file for database information and other special configurations.

    Your Drupal download comes with a default configuration file at sites/default/default.settings.php, within the Drupal directory that you downloaded the Drupal files to (following the downloading instructions from the previous page), which needs to be prepared so that the installer can edit it.

    1. Copy the default.settings.php to settings.php. You can do this from the command line using cp default.settings.php settings.php. NOTE: Do not simply rename the file. The Drupal installer will need both files.
    2. You should now have both a default.settings.php and settings.php file in your sites/default directory.
    3. Make the settings file writeable, so that the installer can edit it
      chmod a+w sites/default/settings.php
      or
      chmod 666 sites/default/settings.php
      Both commands have the same effect.
      Several FTP tools like Filezilla, Transmit, and Fetch allow you to change file permissions, using a 'file attribute' or 'get info' command. In this case the octal or numeric value file permission should be set to 666.
    4. Drupal should set the file permissions back to read-only once the installation is done. You should make sure this is the case and manually change it yourself if it didn't happen. You can use the same command, slightly modified, to remove write permission:
      chmod a-w sites/default/settings.php
      or
      chmod 444 sites/default/settings.php. If you are using a FTP tool the permission should be set to 444.

    Windows note
    On a Windows system this would be Change permission and make sure the file is not marked Read Only before running the installer and then set it back to Read Only after. For more information about modifying Windows file permissions, see the Troubleshooting FAQ.

    Create the database

    Drupal requires access to a database in order to be installed. Your database user will need sufficient privileges to run Drupal. Additional information about privileges, and instructions to create a database using the command line are available in INSTALL.mysql.txt (for MySQL) or INSTALL.pgsql.txt (for PostgreSQL).

    To create a database using PHPMyAdmin or a web-based control panel consult the documentation or ask your web host service provider.

    Take note of the username, password, database name and hostname as you create the database. You will enter these items in the install script.

    Create database with MySQL

    This step is only necessary if you don't already have a database set-up (e.g. By your host). In the following examples, 'username' is an example MySQL user which has the CREATE and GRANT privileges. Use the appropriate user name for your system.

    First, you must create a new database for your Drupal site here, 'databasename' is the name of the new database):

    mysqladmin -u username -p create databasename

    MySQL will prompt for the 'username' database password and then create the initial database files. Next you must login and set the access database rights:

    mysql -u username -p

    Again, you will be asked for the 'username' database password. At the MySQL prompt, enter following command:

    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON databasename.* TO 'username'@'localhost' IDENTIFIED BY 'password';

    where

    'databasename' is the name of your database
    'username@localhost' is the username of your MySQL account
    'password' is the password required for that username

    Note

    Unless your database user has all of the privileges listed above, you will not be able to run Drupal.

    If successful, MySQL will reply with:

    Query OK, 0 rows affected

    To activate the new permissions, enter the following command:

    FLUSH PRIVILEGES;

    the database should be created with UTF-8 (Unicode) encoding.

    Create database with PostgreSQL

    The database must be created with UTF-8 (Unicode) encoding.

    1. CREATE DATABASE USER

    This step is only necessary if you don't already have a user setup (e.g. by your host) or you want to create new user for use with Drupal only. The following command creates a new user named "username" and asks for a password for that user:

    createuser --pwprompt --encrypted --no-adduser
    --no-createdb username

    If everything works correctly, you'll see a
    "CREATE USER" notice.

    2. CREATE THE DRUPAL DATABASE

    This step is only necessary if you don't already have a database setup (e.g. By your host) or you want to create new database for use with Drupal only. The following command creates a new database named "databasename", which is owned by previously created "username":

    createdb --encoding=UNICODE --owner=username databasename

    If everything works correctly, you'll see a "CREATE DATABASE" notice.

    Run the install script

    To run the install script point your browser to the base URL of your website.

    The base URL is defined in your Web server configuration file and is specific to the document root where you placed your Drupal files. If you have installed Drupal on a Web server this will likely be a domain name such as http://example.com. If you have installed Drupal on your desktop machine this URL might be http://localhost.

    You will be guided through several screens to set up the database, create tables,

    add the first user account and provide basic web site settings.

    Note

    If your site is not configured for clean url's you can troubleshoot this later. The Update notifications box will check for later versions of Drupal and contributed modules. If you are without or have restricted Internet connectivity you may want to uncheck this for now and test and enable it later.

    On success, you will see the Drupal installation complete screen. If there are any error message, review and correct them now.

    The install script will attempt to create a files storage directory in the default location at sites/default/files (the location of the files directory may be changed after Drupal is installed). In some cases, you may need to create the directory and modify its permissions manually. Use the following commands (from the installation directory) to create the files directory and grant the web server write privileges to it:

    mkdir sites/default/files

    chmod o+w sites/default/files

    The install script will attempt to write-protect the sites/default directory after creating the settings.php file. If you make manual changes to that file later, be sure to protect it again after making your modifications. Failure to remove write permissions to that file is a security risk. Although the default location for the settings.php file is at sites/default/settings.php, it may be in another location if you use the multi-site setup, as explained below.

    If installing in subfolder

    crispy - July 7, 2009 - 23:05

    Instruction says to start web-based install go to http://example.com

    To run the install script point your browser to the base URL of your website.

    Perhaps that's accurate if you're installing in the root.

    But if installing in subfolder, for me I had to specifically point to the install.php file:

    http://example.com/subfolder/install.php

    in order to get the initial installation page to come up. Without pointing to install.php (http://example.com/subfolde) I got a host of errors and no installation page.

    Installing Drupal-6.13 on OS X

    aziff - July 22, 2009 - 04:43

    Thought I'd share what seems to have worked for me to install Drupal-6.13 on OS X (not server), Leopard (10.5.7), Apache2

    1) Install Drupal 6.13 as /Users/xxx/Sites/drupal, user xxx is in the "_www" group and make the entire installation is group writable. Create a soft link from /Library/WebServer/Documents/xxx -> /Users/xxx/Sites (This is purely a test installation so I didn't want this in my system document root.).

    2) Re-writing seems to be enabled by default in Apache2 on Leopard. Enable PHP5 and virtual hosts in Apache2, i.e. by uncommenting these lines in /etc/apache2/httpd.conf:

    #
    # Dynamic Shared Object (DSO) Support
    #
    ...
    LoadModule libexec/apache2/libphp5.so

    ...

    # Virtual hosts
    Include /private/etc/apache2/extra/httpd-vhosts.conf

    3) Add a virtual host stanza to the /private/etc/apache2/extra/httpd-vhosts.conf file that has at least this in it:

    <VirtualHost *:80>
        DocumentRoot /Library/WebServer/Documents
        ServerName localhost
       
        <Directory "/Library/WebServer/Documents">
            Options FollowSymLinks Indexes MultiViews
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>

    4) Add a variant of the RewriteBase /drupal line in the stock /Users/xxx/Sites/drupal/.htaccess file:

    <IfModule mod_rewrite.c>
    RewriteEngine on

    ...

    # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
    # VirtualDocumentRoot and the rewrite rules are not working properly.
    # For example if your site is at http://example.com/drupal uncomment and
    # modify the following line:
    # RewriteBase /drupal
    RewriteBase /xxx/drupal

    ...

    # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    </IfModule>

    5) Make a copy of the /Users/xxx/Sites/drupal/sites/default directory tree as /Users/xxx/Sites/drupal/sites/localhost. Make sure this directory is writable by the _www group.

    6) Manually create the database in MySQL. Make a copy of
    /Users/xxx/Sites/drupal/sites/localhost/default.settings.php file as /Users/xxx/Sites/drupal/sites/settings.php and make this file writable by the _www group. Configure the database in /Users/xxx/Sites/drupal/sites/settings.php

    /**
    * Database settings:
    *
    ...
    */
    #$db_url = 'mysql://username:password@localhost/databasename';

    7) Rebuild PHP5 to include the GD tools according to the instructions here.

    8) Point a browser manually at http://localhost/xxx/drupal/install.php. The pages came up as shown on the Run the install script.

    "files" has to be created first

    igorgrin - August 25, 2009 - 18:05

    sites/default/files directory has to be created PRIOR to running the install script. The install script checks for it and gives you an error if "files" is not there.

    http://drupal.org/node/394704

    Apache2 on Windows problem: Forbidden You don't have permission.

    myqyl4 - October 23, 2009 - 17:52

    If you installed on windows and are virtually serving you drupal install, you might get this error

    Forbidden You don't have permission.

    If You get this error,
    Edit Apache httpd.conf

    Find the following Entry

    #
    # DirectoryIndex: sets the file that Apache will serve if a directory
    # is requested.
    #

    <IfModule dir_module>
        DirectoryIndex index.html
    </IfModule>

    Update it and add index.php as a valid Directory index

    i.e. It should look something like this now:
    #
    # DirectoryIndex: sets the file that Apache will serve if a directory
    # is requested.
    #

    <IfModule dir_module>
        DirectoryIndex index.html index.php
    </IfModule>

    Save and restart Apache.

  • 相关阅读:
    英语46级CET外语大学词汇
    TOEFL词汇笔记英语托福英语
    19道常见的JS面试算法题
    Vue.js---指令与事件、语法糖
    Qt--多线程间的互斥
    const关键字总结
    Numpy和Pandas的使用入门
    python爬虫爬取天气数据并图形化显示
    JCEF-鼠标右键菜单
    JCEF-tab形式展示浏览器
  • 原文地址:https://www.cnblogs.com/cy163/p/1589331.html
Copyright © 2020-2023  润新知