特殊:Badtitle/NS100:Drupal:修订间差异
小无编辑摘要 |
小无编辑摘要 |
||
第1行: | 第1行: | ||
{{From|https://help.ubuntu.com/community/Drupal}} | {{From|https://help.ubuntu.com/community/Drupal}} | ||
{{Languages|UbuntuHelp:Drupal}} | {{Languages|UbuntuHelp:Drupal}} | ||
=== Introduction === | |||
[http://drupal.org Drupal] is a robust Content Management System that runs on a LAMP server. The LAMP server uses MySQL by default, but [[UbuntuHelp:PostgreSQL|PostgreSQL]] can also be used with Drupal. | |||
It can host blogs, forums, and a variety of other content, and has a huge selection of add-on [http://drupal.org/project/Modules modules] for other functionality, such as advertising, chatbox, e-commerce, various multimedia tools, instant messenger, customer relationship management, printer friendly pages, and webcams. | |||
=== | There are currently two stable branches of Drupal, Drupal5 and Drupal6 (Drupal7 is in development). Versions from either branch can be installed in more or less the same way. | ||
[http://drupal.org Drupal] is a robust Content Management System that runs on LAMP. | Both Drupal5 and Drupal6 versions are found in the repositories. | ||
Accessory Drupal add-on [http://drupal.org/project/Modules modules] are not included in the Ubuntu packages, however, and must be installed manually after initial installation. | |||
=== LAMP server installation === | |||
Use [[UbuntuHelp:InstallingSoftware| any method]] to install the LAMP stack packages. Visit [[UbuntuHelp:ApacheMySQLPHP|Apache PHP MySQL]] for more information on LAMP. | |||
==== Easy LAMP server installation ==== | |||
The easiest method is to use a single command from the command-line terminal, which installs the entire LAMP stack in an integrated package: | |||
=== | |||
Use [[UbuntuHelp:InstallingSoftware| any method]] to install the LAMP stack packages. | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo tasksel install lamp-server | |||
</nowiki></pre> | </nowiki></pre> | ||
I also recommend (optionally) enabling the rewrite functions of Apache2, which helps with many modules in Drupal and with the correct redirection of webpages on your Apache server: | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo a2enmod rewrite | |||
sudo /etc/init.d/apache2 restart | |||
</nowiki></pre> | </nowiki></pre> | ||
If you are using Ubuntu 9.10 Server, after enabling the rewrite you still cannot select enable clean url's in your Drupal install then edit this file "/ect/apache2/sites-available/default" with command: | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo gedit /etc/apache2/sites-available/default | |||
</nowiki></pre> | </nowiki></pre> | ||
Find every occurrence of "AllowOverride none" and replace with "AllowOverride All" then save and restart your server. | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo /etc/init.d/apache2 restart | |||
or | |||
sudo | sudo service apache2 restart | ||
</nowiki></pre> | </nowiki></pre> | ||
Also, you need to change the RewriteBase line in the htaccess file in your drupal folder in order to get clean urls working (Ubuntu 10.04). | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo | sudo gedit /etc/drupal/6/htaccess | ||
</nowiki></pre> | </nowiki></pre> | ||
==== Individual LAMP component installation ==== | |||
A more difficult method is to install all the LAMP components (Apache2, MySQL, PHP) individually, configure them separately, and hope they all work together well. Note that if you intend to use [[UbuntuHelp:PostgreSQL|PostgreSQL]], you do not need to install the MySQL components. | |||
<pre><nowiki> | <pre><nowiki> | ||
apache2 php5-mysql php5-gd libapache2-mod-php5 mysql-server | |||
</nowiki></pre> | </nowiki></pre> | ||
==== Drupal | ==== Using Drupal with MySQL ==== | ||
===== Manually configure MySQL database ===== | |||
Note: This step is not necessary with the current repository packages of MySQL, which complete this step automatically during installation. | |||
Set a mysql-root password (not the same as a root password, but a password for mysql) | |||
<pre><nowiki> | <pre><nowiki> | ||
mysql -u root -p | mysql -u root -p | ||
mysql> | mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword'); | ||
</nowiki></pre> | </nowiki></pre> | ||
A successful mysql command will show: | |||
'''Query OK, 0 rows affected (0.00 sec)''' | |||
Quit the mysql prompt: | Quit the mysql prompt: | ||
<pre><nowiki> | <pre><nowiki> | ||
mysql> \q | mysql> \q | ||
</nowiki></pre> | </nowiki></pre> | ||
You should now have a functional LAMP stack and a password for the mysql root user. | |||
==== Using Drupal with PostgreSQL ==== | |||
You can use Drupal6 with [[UbuntuHelp:PostgreSQL|PostgreSQL]] instead of MySQL (but not every Drupal module will work well with [[UbuntuHelp:PostgreSQL|PostgreSQL]]). Install [[UbuntuHelp:PostgreSQL|PostgreSQL]]: | |||
==== | |||
You | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo | sudo apt-get install postgresql php5-pgsql | ||
</nowiki></pre> | </nowiki></pre> | ||
===== Manually configure PostgreSQL database ===== | |||
=== | Note: These steps are not necessary if you are using a repository package installation of Drupal. (The repository package installations automatically prompt the user for [[UbuntuHelp:PostgreSQL|PostgreSQL]] options during installation.) This method is needed only for manual installations of Drupal. | ||
<pre><nowiki> | <pre><nowiki> | ||
sudo su postgres | |||
</nowiki></pre> | </nowiki></pre> | ||
Create a database and user for drupal on Postgresql | Create a database and user for drupal on Postgresql | ||
第129行: | 第93行: | ||
Enter the password for user drupaluser: | Enter the password for user drupaluser: | ||
</nowiki></pre> | </nowiki></pre> | ||
==== Install Drupal ==== | === Drupal Installation === | ||
Note: The two methods listed below are not compatible. The Ubuntu package (from the repositories) installs Drupal6 in different directories from the manual method. Choose one method or the other, but do not attempt to use both. You cannot switch back and forth between the two methods. | |||
==== Install Drupal package from the Ubuntu repositories ==== | |||
You can choose whether to install Drupal5 or Drupal6 from the repositories. As always, repository version are not the most current versions, but they can be updated easily. | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo apt-get install drupal6 | |||
</nowiki></pre> | </nowiki></pre> | ||
or | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo apt-get install drupal5 | |||
</nowiki></pre> | </nowiki></pre> | ||
==== Manual installation of Drupal ==== | |||
The following instructions are for version 6.15 of the Drupal6 branch, which was the most current version at the time of writing. (A similar method can be used for the most current version of Drupal5). This installation does not install Drupal in directories that are compatible with the respository packages. | |||
<pre><nowiki> | <pre><nowiki> | ||
tar xvzf drupal- | wget http://ftp.drupal.org/files/projects/drupal-6.15.tar.gz | ||
tar xvzf drupal-6.15.tar.gz | |||
sudo mkdir /var/www/drupal | |||
sudo mv drupal-6.15/* drupal-6.15/.htaccess /var/www/drupal | |||
</nowiki></pre> | </nowiki></pre> | ||
It is required to create a ''files'' subdirectory in your drupal default site installation directory. It will be used for files such as custom logos, user avatars, and other media associated with your new site. | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo mkdir /var/www/drupal/sites/default/files | |||
sudo chown www-data:www-data /var/www/drupal/sites/default/files | |||
</nowiki></pre> | </nowiki></pre> | ||
It is also required to create the initial configuration file for the default site. | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo cp /var/www/drupal/sites/default/default.settings.php /var/www/drupal/sites/default/settings.php | |||
sudo chown www-data:www-data /var/www/drupal/sites/default/settings.php | |||
</nowiki></pre> | </nowiki></pre> | ||
===== Manually configure MySQL database ===== | |||
You need to create a MySQL drupal database and then load the database schema into it. You can do this with [[UbuntuHelp:PhpMyAdmin|PhpMyAdmin]] or via the command line: | |||
<pre><nowiki> | <pre><nowiki> | ||
mysqladmin -u root -p create drupal | |||
</nowiki></pre> | </nowiki></pre> | ||
Where ''drupal'' is the name you picked for the mysql database that Drupal will use. You can call it anything you want. | |||
<pre><nowiki> | <pre><nowiki> | ||
mysql -u root -p | |||
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON drupal.* TO 'drupaluser'@'localhost' IDENTIFIED BY 'drupalpass'; | |||
</nowiki></pre> | </nowiki></pre> | ||
You do not want to have Drupal use the mysql root user to access the database. The above command creates a mysql user (other than the mysql root user) with some priviledges to use the ''drupal'' database. You should pick something different than ''drupaluser'' and ''drupalpass''. If the command was successful, activate the new permissions: | |||
<pre><nowiki> | <pre><nowiki> | ||
mysql> FLUSH PRIVILEGES; | |||
</nowiki></pre> | </nowiki></pre> | ||
Quit the mysql prompt: | |||
<pre><nowiki> | |||
mysql> \q | |||
</nowiki></pre> | |||
==== Miscellaneous adjustments for manual installation ==== | |||
(Mike_B_sixosix 02.05.09) Comment: | |||
When I used the manual installation method I had to go back and edit the settings.php page with the drupal db username, password, and db name in order for the database portion of the install.php page to recognize that I had made the changes. After manually updating the file and saving, I refreshed the page and it automatically recognized the changes and moved to the next step. | |||
(Mike_B_sixosix 02.05.09) Comment: | |||
I also had to | |||
<pre><nowiki> | |||
sudo chown www-data:www-data /var/www/drupal/sites/default/files | |||
</nowiki></pre> | |||
directory in order for the install.php page to make file changes. | |||
==== Manually configure postgreSQL for Drupal ==== | |||
Edit the settings.php file so that drupal can know what user, password and database to use. | Edit the settings.php file so that drupal can know what user, password and database to use. | ||
<pre><nowiki> | <pre><nowiki> | ||
第170行: | 第159行: | ||
</nowiki></pre> | </nowiki></pre> | ||
Save the file (Ctrl + x, y) | Save the file (Ctrl + x, y) | ||
=== Adjust PHP memory limit === | |||
You should increase the default PHP memory limit value (the amount of memory dedicated to running scripts), since the default 8 Mb is not sufficient. Use 96 Mb (or even 160M) if you intend to use graphics (although for simple uses 32 Mb may be sufficient). | |||
In newer versions of Drupal6, you can simply edit the settings.php file and add the line: | |||
<pre><nowiki> | <pre><nowiki> | ||
ini_set('memory_limit', '96M'); | |||
</nowiki></pre> | </nowiki></pre> | ||
In older versions of Drupal5, or if using PHP for many different uses, it is best to increase the amount of PHP memory using this method: | |||
Edit the /etc/php5/apache2/php.ini file and increase the memory_limit value to 96M (or another value of your choice). | |||
If using [[UbuntuHelp:PostgreSQL|PostgreSQL]], you can also edit the /etc/php5/apache2/php.ini file to accommodate [[UbuntuHelp:PostgreSQL|PostgreSQL]] options by adding the line: | |||
<pre><nowiki> | <pre><nowiki> | ||
extensions=pgsql.so; | |||
</nowiki></pre> | </nowiki></pre> | ||
=== | === Adjust PHP Error Reporting === | ||
An adjustment to the error reporting is required for the install.php page to come up properly. Edit your settings.php file (e.g., /etc/drupal/6/sites/default/settings.php) and add the following ini_set line after the existing ini_set lines: | |||
<pre><nowiki> | <pre><nowiki> | ||
ini_set('error_reporting', 4096); | |||
</nowiki></pre> | </nowiki></pre> | ||
=== | This is based upon the recommendations from the drupal.org forms: http://drupal.org/node/514334#comment-1912924 | ||
=== Reload Apache2 === | |||
=== | Reload Apache2. | ||
<pre><nowiki> | |||
sudo /etc/init.d/apache2 restart | |||
</nowiki></pre> | |||
=== Complete Drupal Installation through a Browser === | |||
Point your browser to ''localhost/drupal/install.php'', create an account, login, and follow the installation instructions to finish loading the database and configuring the site. | |||
EDIT: (Michael: k3lt01, April 23rd 2010) | |||
For a repository install of Drupal6 I had to point my browser to "localhost/drupal6/install.php" | |||
https://help.ubuntu.com/community/Drupal?action=AttachFile&do=get&target=drupal.jpg | |||
If you got a page full of warnings, follow the prompts to resolve the issues (and add the fixes to this wiki page if appropriate). | |||
The first account will automatically become the main administrator account with total control. | |||
https://help.ubuntu.com/community/Drupal?action=AttachFile&do=get&target=drupal1.jpg | |||
Please refer to the [http://drupal.org/node/260 drupal installation manual] for more advanced hosting features. | |||
=== Other Resources === | |||
* [http://ubuntuguide.org/wiki/Drupal6_tips Ubuntuguide.org] -- simplified instructions for installing Drupal6 in Ubuntu. Includes advanced configuration options. | |||
* [http://kubuntuguide.org//Drupal6_tips Kubuntuguide.org] -- simplified instructions for installing Drupal6 in Kubuntu. Includes advanced configuration options. | |||
=== TurnKey Drupal Appliance === | |||
Some users may prefer to skip manual installation by using the unofficial pre-integrated [http://www.turnkeylinux.org/drupal6 TurnKey Drupal Appliance] based on Ubuntu LTS. | |||
[[category:UbuntuHelp]] | [[category:UbuntuHelp]] |
2010年5月19日 (三) 22:07的最新版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/Drupal }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/af | • {{#if: UbuntuHelp:Drupal|Afrikaans| [[::Drupal/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/ar | • {{#if: UbuntuHelp:Drupal|العربية| [[::Drupal/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/az | • {{#if: UbuntuHelp:Drupal|azərbaycanca| [[::Drupal/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/bcc | • {{#if: UbuntuHelp:Drupal|جهلسری بلوچی| [[::Drupal/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/bg | • {{#if: UbuntuHelp:Drupal|български| [[::Drupal/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/br | • {{#if: UbuntuHelp:Drupal|brezhoneg| [[::Drupal/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/ca | • {{#if: UbuntuHelp:Drupal|català| [[::Drupal/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/cs | • {{#if: UbuntuHelp:Drupal|čeština| [[::Drupal/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/de | • {{#if: UbuntuHelp:Drupal|Deutsch| [[::Drupal/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/el | • {{#if: UbuntuHelp:Drupal|Ελληνικά| [[::Drupal/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/es | • {{#if: UbuntuHelp:Drupal|español| [[::Drupal/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/fa | • {{#if: UbuntuHelp:Drupal|فارسی| [[::Drupal/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/fi | • {{#if: UbuntuHelp:Drupal|suomi| [[::Drupal/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/fr | • {{#if: UbuntuHelp:Drupal|français| [[::Drupal/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/gu | • {{#if: UbuntuHelp:Drupal|ગુજરાતી| [[::Drupal/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/he | • {{#if: UbuntuHelp:Drupal|עברית| [[::Drupal/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/hu | • {{#if: UbuntuHelp:Drupal|magyar| [[::Drupal/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/id | • {{#if: UbuntuHelp:Drupal|Bahasa Indonesia| [[::Drupal/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/it | • {{#if: UbuntuHelp:Drupal|italiano| [[::Drupal/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/ja | • {{#if: UbuntuHelp:Drupal|日本語| [[::Drupal/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/ko | • {{#if: UbuntuHelp:Drupal|한국어| [[::Drupal/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/ksh | • {{#if: UbuntuHelp:Drupal|Ripoarisch| [[::Drupal/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/mr | • {{#if: UbuntuHelp:Drupal|मराठी| [[::Drupal/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/ms | • {{#if: UbuntuHelp:Drupal|Bahasa Melayu| [[::Drupal/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/nl | • {{#if: UbuntuHelp:Drupal|Nederlands| [[::Drupal/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/no | • {{#if: UbuntuHelp:Drupal|norsk| [[::Drupal/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/oc | • {{#if: UbuntuHelp:Drupal|occitan| [[::Drupal/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/pl | • {{#if: UbuntuHelp:Drupal|polski| [[::Drupal/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/pt | • {{#if: UbuntuHelp:Drupal|português| [[::Drupal/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/ro | • {{#if: UbuntuHelp:Drupal|română| [[::Drupal/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/ru | • {{#if: UbuntuHelp:Drupal|русский| [[::Drupal/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/si | • {{#if: UbuntuHelp:Drupal|සිංහල| [[::Drupal/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/sq | • {{#if: UbuntuHelp:Drupal|shqip| [[::Drupal/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/sr | • {{#if: UbuntuHelp:Drupal|српски / srpski| [[::Drupal/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/sv | • {{#if: UbuntuHelp:Drupal|svenska| [[::Drupal/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/th | • {{#if: UbuntuHelp:Drupal|ไทย| [[::Drupal/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/tr | • {{#if: UbuntuHelp:Drupal|Türkçe| [[::Drupal/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/vi | • {{#if: UbuntuHelp:Drupal|Tiếng Việt| [[::Drupal/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/yue | • {{#if: UbuntuHelp:Drupal|粵語| [[::Drupal/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/zh | • {{#if: UbuntuHelp:Drupal|中文| [[::Drupal/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/zh-hans | • {{#if: UbuntuHelp:Drupal|中文(简体)| [[::Drupal/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Drupal | UbuntuHelp:Drupal | {{#if: | :}}Drupal}}/zh-hant | • {{#if: UbuntuHelp:Drupal|中文(繁體)| [[::Drupal/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:Drupal|:Drupal|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :Drupal/zh | | {{#ifexist: Drupal/zh | | {{#ifeq: {{#titleparts:Drupal|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Drupal|1|-1|}} | zh | | }}
Introduction
Drupal is a robust Content Management System that runs on a LAMP server. The LAMP server uses MySQL by default, but PostgreSQL can also be used with Drupal. It can host blogs, forums, and a variety of other content, and has a huge selection of add-on modules for other functionality, such as advertising, chatbox, e-commerce, various multimedia tools, instant messenger, customer relationship management, printer friendly pages, and webcams. There are currently two stable branches of Drupal, Drupal5 and Drupal6 (Drupal7 is in development). Versions from either branch can be installed in more or less the same way. Both Drupal5 and Drupal6 versions are found in the repositories. Accessory Drupal add-on modules are not included in the Ubuntu packages, however, and must be installed manually after initial installation.
LAMP server installation
Use any method to install the LAMP stack packages. Visit Apache PHP MySQL for more information on LAMP.
Easy LAMP server installation
The easiest method is to use a single command from the command-line terminal, which installs the entire LAMP stack in an integrated package:
sudo tasksel install lamp-server
I also recommend (optionally) enabling the rewrite functions of Apache2, which helps with many modules in Drupal and with the correct redirection of webpages on your Apache server:
sudo a2enmod rewrite sudo /etc/init.d/apache2 restart
If you are using Ubuntu 9.10 Server, after enabling the rewrite you still cannot select enable clean url's in your Drupal install then edit this file "/ect/apache2/sites-available/default" with command:
sudo gedit /etc/apache2/sites-available/default
Find every occurrence of "AllowOverride none" and replace with "AllowOverride All" then save and restart your server.
sudo /etc/init.d/apache2 restart or sudo service apache2 restart
Also, you need to change the RewriteBase line in the htaccess file in your drupal folder in order to get clean urls working (Ubuntu 10.04).
sudo gedit /etc/drupal/6/htaccess
Individual LAMP component installation
A more difficult method is to install all the LAMP components (Apache2, MySQL, PHP) individually, configure them separately, and hope they all work together well. Note that if you intend to use PostgreSQL, you do not need to install the MySQL components.
apache2 php5-mysql php5-gd libapache2-mod-php5 mysql-server
Using Drupal with MySQL
Manually configure MySQL database
Note: This step is not necessary with the current repository packages of MySQL, which complete this step automatically during installation. Set a mysql-root password (not the same as a root password, but a password for mysql)
mysql -u root -p mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
A successful mysql command will show: Query OK, 0 rows affected (0.00 sec) Quit the mysql prompt:
mysql> \q
You should now have a functional LAMP stack and a password for the mysql root user.
Using Drupal with PostgreSQL
You can use Drupal6 with PostgreSQL instead of MySQL (but not every Drupal module will work well with PostgreSQL). Install PostgreSQL:
sudo apt-get install postgresql php5-pgsql
Manually configure PostgreSQL database
Note: These steps are not necessary if you are using a repository package installation of Drupal. (The repository package installations automatically prompt the user for PostgreSQL options during installation.) This method is needed only for manual installations of Drupal.
sudo su postgres
Create a database and user for drupal on Postgresql
$ createuser -D -A -P drupaluser $ createdb -O drupaluser drupaldb
Modify the pg_hba.conf file of the postgresql DBMS
$ sudo nano /etc/postgresql/8.1/main/pg_hba.conf
comment out this line after
- "local" is for Unix domain socket connections only
# local all all ident sameuser
Add the following lines
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD host drupaldb drupaluser 127.0.0.1 255.255.255.255 password
Save the file (Ctrl + x, y) Restart the postgresql database server engine
$ sudo /etc/init.d/postgresql* restart
Check your database connection:
$ psql -h 127.0.0.1 -p 5432 -U drupaluser -W drupaldb Enter the password for user drupaluser:
Drupal Installation
Note: The two methods listed below are not compatible. The Ubuntu package (from the repositories) installs Drupal6 in different directories from the manual method. Choose one method or the other, but do not attempt to use both. You cannot switch back and forth between the two methods.
Install Drupal package from the Ubuntu repositories
You can choose whether to install Drupal5 or Drupal6 from the repositories. As always, repository version are not the most current versions, but they can be updated easily.
sudo apt-get install drupal6
or
sudo apt-get install drupal5
Manual installation of Drupal
The following instructions are for version 6.15 of the Drupal6 branch, which was the most current version at the time of writing. (A similar method can be used for the most current version of Drupal5). This installation does not install Drupal in directories that are compatible with the respository packages.
wget http://ftp.drupal.org/files/projects/drupal-6.15.tar.gz tar xvzf drupal-6.15.tar.gz sudo mkdir /var/www/drupal sudo mv drupal-6.15/* drupal-6.15/.htaccess /var/www/drupal
It is required to create a files subdirectory in your drupal default site installation directory. It will be used for files such as custom logos, user avatars, and other media associated with your new site.
sudo mkdir /var/www/drupal/sites/default/files sudo chown www-data:www-data /var/www/drupal/sites/default/files
It is also required to create the initial configuration file for the default site.
sudo cp /var/www/drupal/sites/default/default.settings.php /var/www/drupal/sites/default/settings.php sudo chown www-data:www-data /var/www/drupal/sites/default/settings.php
Manually configure MySQL database
You need to create a MySQL drupal database and then load the database schema into it. You can do this with PhpMyAdmin or via the command line:
mysqladmin -u root -p create drupal
Where drupal is the name you picked for the mysql database that Drupal will use. You can call it anything you want.
mysql -u root -p mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON drupal.* TO 'drupaluser'@'localhost' IDENTIFIED BY 'drupalpass';
You do not want to have Drupal use the mysql root user to access the database. The above command creates a mysql user (other than the mysql root user) with some priviledges to use the drupal database. You should pick something different than drupaluser and drupalpass. If the command was successful, activate the new permissions:
mysql> FLUSH PRIVILEGES;
Quit the mysql prompt:
mysql> \q
Miscellaneous adjustments for manual installation
(Mike_B_sixosix 02.05.09) Comment: When I used the manual installation method I had to go back and edit the settings.php page with the drupal db username, password, and db name in order for the database portion of the install.php page to recognize that I had made the changes. After manually updating the file and saving, I refreshed the page and it automatically recognized the changes and moved to the next step. (Mike_B_sixosix 02.05.09) Comment: I also had to
sudo chown www-data:www-data /var/www/drupal/sites/default/files
directory in order for the install.php page to make file changes.
Manually configure postgreSQL for Drupal
Edit the settings.php file so that drupal can know what user, password and database to use.
$ sudo nano /var/www/drupal/sites/default/settings.php * Database URL format: $db_url = 'pgsql://username:password@localhost/databasename'; where username = drupaluser password = drupaluserpass databasename = drupaldb
Save the file (Ctrl + x, y)
Adjust PHP memory limit
You should increase the default PHP memory limit value (the amount of memory dedicated to running scripts), since the default 8 Mb is not sufficient. Use 96 Mb (or even 160M) if you intend to use graphics (although for simple uses 32 Mb may be sufficient). In newer versions of Drupal6, you can simply edit the settings.php file and add the line:
ini_set('memory_limit', '96M');
In older versions of Drupal5, or if using PHP for many different uses, it is best to increase the amount of PHP memory using this method: Edit the /etc/php5/apache2/php.ini file and increase the memory_limit value to 96M (or another value of your choice). If using PostgreSQL, you can also edit the /etc/php5/apache2/php.ini file to accommodate PostgreSQL options by adding the line:
extensions=pgsql.so;
Adjust PHP Error Reporting
An adjustment to the error reporting is required for the install.php page to come up properly. Edit your settings.php file (e.g., /etc/drupal/6/sites/default/settings.php) and add the following ini_set line after the existing ini_set lines:
ini_set('error_reporting', 4096);
This is based upon the recommendations from the drupal.org forms: http://drupal.org/node/514334#comment-1912924
Reload Apache2
Reload Apache2.
sudo /etc/init.d/apache2 restart
Complete Drupal Installation through a Browser
Point your browser to localhost/drupal/install.php, create an account, login, and follow the installation instructions to finish loading the database and configuring the site. EDIT: (Michael: k3lt01, April 23rd 2010) For a repository install of Drupal6 I had to point my browser to "localhost/drupal6/install.php" If you got a page full of warnings, follow the prompts to resolve the issues (and add the fixes to this wiki page if appropriate). The first account will automatically become the main administrator account with total control. Please refer to the drupal installation manual for more advanced hosting features.
Other Resources
- Ubuntuguide.org -- simplified instructions for installing Drupal6 in Ubuntu. Includes advanced configuration options.
- Kubuntuguide.org -- simplified instructions for installing Drupal6 in Kubuntu. Includes advanced configuration options.
TurnKey Drupal Appliance
Some users may prefer to skip manual installation by using the unofficial pre-integrated TurnKey Drupal Appliance based on Ubuntu LTS.