Installing Drupal on Fedora can be challenging because of the different way in which Fedora installs Drupal and PostgreSQL, so the standard ways that you will find in the generic README files and even on the official websites won't work. Artificially trying to make your installs like you see on the sites is fraught with problems.
At least parts of this tutorial can be found elsewhere, but this page represents one single place for all your needs for Fedora 9 and PostgreSQL.
PostgreSQL on Fedora
- PostgreSQL installs to /var/lib/pgsql
- the superuser postgres is created automatically, without a password. Once you
su root, you can then
su postgres(or another other user) without a password.
- although root cannot use PostgreSQL, root initializes the database and starts PostgreSQL
- If you already have PostgreSQL running, skip to step 5.
- As root, in a command line, enter
service postgresql initdb. (Depending on how you have paths set up, you may have to use
/sbin/servicefor the command.) You should get an OK as feedback when it's done.
- Still as root, enter
service postgresql start. Once again, wait for the OK.
- To have PostgreSQL start up on boot, as root enter
chkconfig --level 345 postgresql on. There is also a GUI way of starting/stopping services, but I prefer the command line.
- Now you can
createuser– we'll call it drupal:
createuser --pwprompt --encrypted --no-adduser --no-createdb drupal
which leads to a prompt for the password
- Create the database (as postgres) – which we'll call drupaldb:
createdb --encoding=UNICODE --owner=drupal drupaldb
It used to be that you would get some feedback on the command line after createuser and createdb, but that doesn't seem to happen anymore.
Now Edit pg_hba.conf
You will need to do this to allow Drupal to access your database.
As root, use your favorite editor to edit the file /var/lib/pgsql/data/pg_hba.conf
Go down to this section:
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all ident sameuser
After this above line enter:
host drupaldb all 127.0.0.1/32 md5
Save the file, then, as root,
service postgresql restart
Drupal on Fedora
- Drupal installs to /usr/share/drupal
- Inside Drupal, the sites links to /etc/drupal, files links to /var/lib/drupal
- You use httpd to control access to Drupal. This is what keeps visitors from getting access to your system, since httpd forbids going up above allowed directories by default.
- The base setup of httpd and Drupal is set in /etc/httpd/conf.d/drupal.conf, where you find
Alias /drupal /usr/share/drupal
#Comment the following line and uncomment the next for public use
Deny from all
#Allow from all
#Uncomment the following line for setup
#Allow from 127.0.0.1
The first line is the link. On your machine, go to a browser, enter http://localhost/drupal, you will access Drupal, but not with a file like this one – instead you get the 403 Forbidden page. Remove the '#' from the
Allow from 127.0.0.1 (this is what uncomment means, add the '#' to comment the line.) Needless to say perhaps, but you need to do this as root, and when you edit this file you have to stop and start httpd again, the quickest way being
service httpd restart.
You will get permissions error messages from Drupal as it tries to establish your site, unless and until you do the following:
- As root, go to /etc/drupal and
chmod 777 default.
- Enter the default directory, and
cp default.settings.php settings.php.
chmod 666 settings.php default.settings.php
It's not quite clear whether you also need to make default.settings.php writable, perhaps 644 is Ok for default.settings.php.
- You do not need to restart httpd after these steps.
At this point, you should be able to enter http://localhost/drupal in your browser, and bring up the forms for starting up your Drupal site, then entering your basic administrator information, after which you're off and running!
The last step, as you will read when you're all done, is to go back to /etc/drupal/ and
chmod 755 default
and inside the default directory,
chmod 644 settings.php default.settings.php
A Final Note about SELinux
It's possible there will not always be problems with SELinux, but for many tasks in Fedora 9, it simply helps to change the enforcing mode of SELinux to Permissive. Ideally, some day there may be some helpful documentation about SELinux to create some targeted policies that work, but for now, this seems to be what many are doing, and not specifically just about Drupal.