个人工具
登录
查看“UbuntuHelp:Drupal”的源代码 - Ubuntu中文
UbuntuHelp
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“UbuntuHelp:Drupal”的源代码
来自Ubuntu中文
←
UbuntuHelp:Drupal
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{From|https://help.ubuntu.com/community/Drupal}} {{Languages|UbuntuHelp:Drupal}} {|border="1" cellspacing="0" |This documentation needs to be updated for installing Drupal using Postgresql-8.2 on Feisty. |} === Drupal === [http://drupal.org/node/260 Drupal] is a robust Content Management System that runs on LAMP. Without any of its aditional modules, it can host blogs, forums, and a variety of other content. It has an astounding number of [http://drupal.org/project/Modules modules] which bring added functionality to your site, including advertising, chatbox, e-commerce, various multimedia tools, instant messenger, light customer relationship management, printer friendly pages, webcam, etc... Follow these instructions to install Drupal 6.4 on Ubuntu 6.06 (Dapper Drake), Ubuntu 6.10 (Edgy Eft), Ubuntu 7.04 (Feisty Fawn) and Ubuntu 8.04 (Hardy Heron). This page also explains the steps used to install the 5.1 branch of Drupal on Ubuntu. To install Drupal-5.1 with php5 and Postgresql-8.1, follow instructions at bottom of page. === Quick shortcut === If you would rather not setup Drupal by hand, then one of the easiest ways to get up and running with Drupal is the [[UbuntuHelp: http://www.turnkeylinux.org/appliances/drupal | TurnKey Drupal ]] live CD appliance, which is based on Ubuntu 8.04.1 (Hardy). === Installing === An older Drupal version 5.7 is present in the repositories, but it is no longer supported upstream. A more recent version has more modules and themes. Also, none of the Drupal modules are packaged and present in the repositores. Therefore, it is advisable to install the latest version from drupal.org. ==== Install the LAMP stack ==== Use [[UbuntuHelp:InstallingSoftware| any method]] to install the LAMP stack packages. <pre><nowiki> apache2 php5-mysql php5-gd libapache2-mod-php5 mysql-server </nowiki></pre> Set a mysql-root password (not the same as a root password, but a password for mysql) <pre><nowiki> mysql -u root mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword'); </nowiki></pre> A successful mysql command will show: '''Query OK, 0 rows affected (0.00 sec)''' Quit the mysql prompt: <pre><nowiki> mysql> \q </nowiki></pre> You should now have a functional LAMP stack and a password for the mysql root user. Visit [[UbuntuHelp:ApacheMySQLPHP|Apache PHP MySQL]] for more information on LAMP. ==== Get the most recent version of Drupal ==== There are two stable banches of Drupal. Currently 5.11 and 6.5. Both versions can be installed more or less the same way. The following instructions are for version 6.5. <pre><nowiki> wget http://ftp.drupal.org/files/projects/drupal-6.5.tar.gz tar xvzf drupal-6.5.tar.gz sudo mkdir /var/www/drupal sudo mv drupal-6.5/* drupal-6.5/.htaccess /var/www/drupal </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> sudo mkdir /var/www/drupal/sites/default/files sudo chown www-data:www-data /var/www/drupal/sites/default/files </nowiki></pre> It is also required to create the initial configuration file for the default site. <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> ==== Drupal needs a database, user and password ==== You need to create a drupal database and then load the database schema into it. You can do this with PhpMyAdmin or via the command line: <pre><nowiki> mysqladmin -u root -p create drupal </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> 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> 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> mysql> FLUSH PRIVILEGES; </nowiki></pre> Quit the mysql prompt: <pre><nowiki> mysql> \q </nowiki></pre> ==== PHP memory limit ==== Prior to 7.04, you may need to increase the amount of memory PHP can use to run scripts, Edit the /etc/php5/apache2/php.ini file and increase the memory_limit value to 32 megs or another value of your choice (8 megs is not enough for Drupal) ==== Reload Apache2 ==== You probably need to force-reload apache2 if you have not done so since you installed LAMP. <pre><nowiki> sudo /etc/init.d/apache2 restart </nowiki></pre> === Final Installation Settings === Point your browser to ''localhost/drupal'', create an account, login, and follow the installation instructions to finish loading the database and configuring the site. 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. === POSTGRESQL-8.1 with PHP5 and DRUPAL5.1 === Mysql is ideal for database-driven sites since it has better performance than Postgresql. Furthermore, some drupal modules are not tested using postgresql. However, if you want to run your drupal site using postgresql, follow these instructions. These instructions work on Ubuntu 6.06 and 6.10. ==== Install Postgresql 8.1 ==== <pre><nowiki> $ sudo aptitude install postgresql-8.1 $ sudo su postgres </nowiki></pre> Create a database and user for drupal on Postgresql <pre><nowiki> $ createuser -D -A -P drupaluser $ createdb -O drupaluser drupaldb </nowiki></pre> Modify the pg_hba.conf file of the postgresql DBMS <pre><nowiki> $ sudo nano /etc/postgresql/8.1/main/pg_hba.conf </nowiki></pre> comment out this line after # "local" is for Unix domain socket connections only <pre><nowiki> # local all all ident sameuser </nowiki></pre> Add the following lines <pre><nowiki> # TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD host drupaldb drupaluser 127.0.0.1 255.255.255.255 password </nowiki></pre> Save the file (Ctrl + x, y) Restart the postgresql database server engine <pre><nowiki> $ sudo /etc/init.d/postgresql* restart </nowiki></pre> Check your database connection: <pre><nowiki> $ psql -h 127.0.0.1 -p 5432 -U drupaluser -W drupaldb Enter the password for user drupaluser: </nowiki></pre> ==== Install Drupal ==== Install drupal dependencies <pre><nowiki> # sudo aptitude install libapache2-mod-php5 php5-imagick php5-ldap php5-pgsql php5 zlib1g-dev </nowiki></pre> Download the drupal core files <pre><nowiki> $ sudo wget http://ftp.osuosl.org/pub/drupal/files/projects/drupal-5.1.tar.gz </nowiki></pre> Unpack the tarball <pre><nowiki> tar xvzf drupal-5.1.tar.gz </nowiki></pre> You can read the install file on creating postgresql database and user (already done above) <pre><nowiki> # sudo nano drupal-5.1/INSTALL.pgsql.txt </nowiki></pre> Make a folder for your drupal installation. <pre><nowiki> $ sudo mkdir /var/www/drupal </nowiki></pre> Move your drupal files into the drupal folder <pre><nowiki> $ sudo mv drupal-5.1/* drupal-5.1/.htaccess /var/www/drupal </nowiki></pre> Create a /files storage folder for things like files, images, etc <pre><nowiki> $ sudo mkdir /var/www/drupal/files </nowiki></pre> Make the data storage writeable <pre><nowiki> $ sudo chown -R www-data:www-data /var/www/drupal/files </nowiki></pre> Edit the settings.php file so that drupal can know what user, password and database to use. <pre><nowiki> $ 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 </nowiki></pre> Save the file (Ctrl + x, y) Edit the amount of memory PHP can use to run scripts. The default 8mb is not enough for drupal, set to 32mb or more <pre><nowiki> $ sudo nano /etc/php5/apache2/php.ini file ; Resource Limits ; memory_limit = 160M You may also edit the example lines to accommodate Postgresql options ; Example lines: ;extensions=pgsql.so </nowiki></pre> Save the changes to the php.ini file (Ctrl + x, y) Restart apache <pre><nowiki> sudo /etc/init.d/apache2 restart </nowiki></pre> ==== Finish Installation ==== In a browser, enter: http://localhost/drupal/install.php ==== Configuration ==== File System Change the Download Method from public to private Select 'save configuration' Cron Click on 'You can run manually' For further configuration, please refer to:http://drupal.org/node/260 === Install Script === usage: install_drupal user pass domain dbpass dbname This is a work in progress. it creates a user with password, installs drupal-6.4 from drupal.org, sets up apache2 and bind9 for the domain, creates the database dbname using the root password dbpass for user with pass. If it breaks please advise tarvid@ls.net. If it works enter http://domain/ in your browser. <pre><nowiki> #!/bin/bash echo user=$1 echo password=$2 echo domain=$3 echo dbpass=$4 echo dbname=$5 useradd $1 -p `mkpasswd $2` mkdir /home/$1 mkdir /home/$1/public_html cd /home/$1/public_html wget http://ftp.drupal.org/files/projects/drupal-6.4.tar.gz tar xzvf drupal-6.4.tar.gz mv drupal-6.4 $3 mkdir /home/$1/public_html/$3/sites/all/modules mkdir /home/$1/public_html/$3/sites/all/themes mkdir /home/$1/public_html/$3/sites/default/files chmod -R 777 /home/$1/public_html/$3/sites/default/files cp /home/$1/public_html/$3/sites/default/default.settings.php /home/$1/public_html/$3/sitesdefault/settings.php chmod 777 /home/$1/public_html/$3/sites/default/settings.php chown -R $1.$1 /home/$1 mysql -uroot -p$4 -e "DROP USER '$1'@'localhost';" mysql -uroot -p$4 -e "DROP DATABASE IF EXISTS $5;" mysql -uroot -p$4 -e "CREATE USER '$1'@'localhost' IDENTIFIED BY '$2';" mysql -uroot -p$4 -e "CREATE DATABASE IF NOT EXISTS $5;" mysql -uroot -p$4 -e "GRANT USAGE ON $5.* TO '$1'@'localhost' IDENTIFIED BY '$2';" mysql -uroot -p$4 -e "GRANT ALL PRIVILEGES ON $5.* TO '$1'@'localhost';" mysql -uroot -p$4 -e "flush privileges;" echo "<VirtualHost *>" >/etc/apache2/sites-available/$3 echo " DocumentRoot /home/$1/public_html/$3" >>/etc/apache2/sites-available/$3 echo " ServerName $3" >>/etc/apache2/sites-available/$3 echo " <Directory /home/$1/public_html/$3>" >>/etc/apache2/sites-available/$3 echo " allow from all" >>/etc/apache2/sites-available/$3 echo " AllowOverride AuthConfig FileInfo Indexes Limit Options" >>/etc/apache2/sites-available $3 echo " Options FollowSymLinks SymLinksIfOwnerMatch +Indexes" >>/etc/apache2/sites-available/$3 echo " </Directory>" >>/etc/apache2/sites-available/$3 echo " ServerAlias www.$3" >>/etc/apache2/sites-available/$3 echo "</VirtualHost>" >>/etc/apache2/sites-available/$3 a2ensite $3 echo "\$TTL 86400" >/etc/bind/$3 echo "$3. IN SOA www.$3. root.$3. (" >>/etc/bind/$3 echo " `date +%Y%m%d`00" >>/etc/bind/$3 echo " 8H" >>/etc/bind/$3 echo " 2H" >>/etc/bind/$3 echo " 4W" >>/etc/bind/$3 echo " 1D)" >>/etc/bind/$3 echo " IN NS `hostname`" >>/etc/bind/$3 echo "$3 A `ifconfig|awk '/Bcast:/ {print $2}'|cut -d":" -f2`" >>/etc/bind/$3 echo "www.$3 A `ifconfig|awk '/Bcast:/ {print $2}'|cut -d":" -f2`" >>/etc/bind/$3 echo "zone \"$3\" {" >>/etc/bind/named.conf.local echo " type master;" >>/etc/bind/named.conf.local echo " file \"/etc/bind/$3\";" >>/etc/bind/named.conf.local echo " };" >>/etc/bind/named.conf.local echo "127.0.0.1 $3" >>/etc/hosts /etc/init.d/bind9 reload /etc/init.d/apache2 force-reload </nowiki></pre> [[category:UbuntuHelp]]
该页面使用的模板:
模板:From
(
查看源代码
)
模板:Languages
(
查看源代码
)(受保护)
模板:Languages/Lang
(
查看源代码
)(受保护)
返回至
UbuntuHelp:Drupal
。