Last updated April 8, 2009. Created on October 29, 2008.
Edited by bekasu, lhtown. Log in to edit this page.

This is a general description of how to install Drupal on a Linux CentOS/RedHat/Fedora server with root access. Your mileage might vary somewhat depending on your particular environment.

Comments on various CentOS/RedHat/Fedora combinations and set ups are most welcome in this section. This is based on a CentOS 5/RedHat installation. Comments that only concern Fedora should be added to and not displace CentOS/RedHat information.

  1. Upgrade the operating system
    yum update
  2. Install common programs
    yum install php mysql-server php-mysql php-mbstring php-gd
  3. Download and install Webmin (optional)
    wget http://prdownloads.sourceforge.net/webadmin/webmin-1.440-1.noarch.rpm
    wget http://webmin.com/jcameron-key.asc
    rpm --import jcameron-key.asc
    yum install webmin-1.440-1.noarch.rpm
  4. Reboot
  5. Login to webmin through your browser. On a virtual host, how to do so may be non-obvious, but your host should provide details somewhere in the documentation of how to access your host through a url.
  6. In webmin, go to "Bootup and Shutdown" and enable the httpd and mysqld daemons.
  7. Create a new user. I made the home directory "/var/www/html" and the shell "/bin/bash".
  8. Edit the httpd.conf file. I did this through webmin in the "Apache Webserver" section by clicking on the "Global configuration" tab and then going to "Edit config files". Change the line "Options Indexes FollowSymLinks" to "Options Includes FollowSymLinks" or even something more liberal.

    While you are there, go to the following section:

    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None"

    Change "AllowOverride None" to "AllowOverride All" if you want clean urls.

  9. In webmin, go to "Apache Webserver" and create a virtual host if you want to host multiple hosts on the same server instance.
  10. Create a new empty database in mysql. I did this through webmin. You should also add passwords for the root mysql user as well as a regular user for security reasons.
  11. In my case, I changed the permissions of /var/www/html to my user and the apache group.
    chown -R myuser /var/www/html
    chgrp -R apache /var/www/html
  12. Get Drupal and unpack it in the /var/www/html/ directory or if you are using virtual hosts in /var/www/html/example.com
    wget http://ftp.drupal.org/files/projects/drupal-6.6.tar.gz
    tar -xzvpf drupal-* --strip-components=1
    cp ./sites/default/default.settings.php ./sites/default/settings.php
  13. If you want a "files" directory for file uploads, do the following in your Drupal root directory
    mkdir ./sites/default/files
  14. The following permissions should allow you complete access to Drupal though your regular user account except for the ./sites/default folder which should be set to a Drupal's default upon install.
    chgrp -R apache .
    chown -R apache ./sites/default
    chgrp -R myuser ./sites/default
    chmod -R g+w sites/default
  15. Reboot
  16. Install Drupal as normal by going to the url of your home page

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

anilo’s picture

You didn't include instructions to setup Apache.

yum install httpd mod_ssl

Cheers!!!

-Anil

willy2eagles’s picture

"Create a new user. I made the home directory "/var/www/html" and the shell "/bin/bash"."

Hello,
I am quite new to Linux.
I don't understand step #7.
What kind of user am I supposed to create and how? Do I do this in Webmin? Command line?

Please advise...

Thanks very much.

willy2eagles’s picture

I am going to answer my own question, please correct me if I am wrong.
In Webmin...
Click "System" on the left column.
Click "Users and Groups"
Click "Create New User"

bishopolis’s picture

consider this instead:
adduser -d /var/www/html -s /bin/bash someuser

[sorry if replying to stale posts isgauche. I'm a usenet kid]

michael630angelo’s picture

I had already done every step here at this node 327731 but I am having this kind of problem: You don't have permission to access /drupal-6.14/ on this server. By the way, I am using Fedora 12, Apache 2.2.13, PHP 5.3.1 and MySQL 5.1

Please help. Thank you very much.

Michael Angelo Samson

MCP ID 6607942

"Because knowledge has no horizons."

http://masamsonpc.farvista.net

oakleyarts’s picture

First timers may want to be particularly careful when reading and executing these instructions. I made a few mistakes during my initial installation and had to start all over again, failing to find where I had gone wrong before.

I suggest that once you have downloaded the Drupal package, read the file 'install.txt' to cross-reference it with this tutorial. This method was what worked for me (using Fedora 12).

This is otherwise a very useful walk-through for both Drupal and Webmin newcomers.

Thanks.

N00B today... N00B tomorrow.

philosophically’s picture

If you get a 403 Forbidden page error after following these instructions... check out http://drupal.org/node/557910

Best Regards,

Mark Rozencwajg

SangersDrupalDude’s picture

Because of php 5.3, we need to fix a few things:

If back up and migrate fails, need date.timezone = "Europe/London" in php.ini.

You will need to update to the dev module versions of admin_menu calendar date, lots of thread on these 3 issues so won't elaborate.

S:)

Senior Drupal Web Developer
Wellcome Trust Sanger Institute

rfay’s picture

RHEL/CentOS is fairly notorious for coming with older versions of PHP. Since we mostly want PHP 5.2 (or possibly 5.3) for Drupal 6, and 5.3 for Drupal 7, there are a couple of repositories that can be used to get a reasonable PHP version.

To get PHP 5.2, use the jasonlitka.com repository. Follow the instructions listed, but you will probably want to add a line to the bottom of the suggested .repo file that says includepkgs=php* so that only the PHP packages are affected.

For PHP 5.3, the Remi repository is highly thought off. Again, you may want to add includepkgs=php*.

After installing the .repo files, you can

yum update
jwatson3d’s picture

I just stumbled on this article from the RedHat/CentOS group and would like to offer a couple of succinct blog posts I wrote in Nov. 2009 when I was getting into Drupal and setting up a server...

http://pragmatic-software.blogspot.com/2009/11/preparing-centos-53-lamp-...

http://pragmatic-software.blogspot.com/2009/11/preparing-centos-53-lamp-...

zxq9’s picture

I spent the last several days doing Fedora 14 installs of Drupal 7 on PostgreSQL. I banged out the basic instructions starting from a minimal system with an SELinux Enforcing policy active and iptables blocking everything not necessary for Drupal to run. I didn't provide much explanation (sorry, just no time yet), but researching the details on the net should be easy:

http://zxq9.com/archives/442

I am pretty sure these instructions will work (almost?) unmodified on CentOS 5/6 and RHEL 5/6 as well as Fedora 15, though I've been too lazy to test it there as well. This is a bit more strict server-side oriented, so it assumes absolutely nothing is installed on the system (make and gcc aren't even installed yet, but they will be when you're done).

If I kajiggered anything or put something out of order, please let me know -- I tried to streamline it just short of turning it into a script (which at this point would be relatively effortless...).

djgregor’s picture

I really can't imagine why all of this rebooting is taking place. Maybe the first one if 'yum update' installed a new kernel and a reboot is absolutely necessary (it usually isn't actually).

The second reboot is entirely unnecessary.