Fedora and Drupal, part1

Ok all, so you ‘ve decided to test Drupal on a Fedora Core system. Meaning, you chose the hard way, testing Drupal on an OS that runs SELinux, which inevitably will cause you trouble with permissions, other than the casual file permissions having to do with files ownership and access rights. So did I. I ve tested the following commands in FC17, so I can’t guarantee for possible failures in FC16 or previous, although SELinux policies should be the same.

For starters, these are the packages i had to install through yum, so everything would run properly:

yum -y install gcc httpd php phpMyAdmin php-domxml-php4-php5 php-gd php-mysql mysql mysql-server git policycoreutils-python php-pecl-apc php-mbstring php-pecl-memcache memcached php-xml php-devel


I added php-devel, cause pecl will need it and it will also need a C compiler. You might already have installed it, but if you re not sure, it won’t harm you to add. Anyway, you ‘re running Linux, you should have it installed, just for the tradition… If you don’t know what PECL is, just keep in mind, that Drupal will ask for it, if you intend to install modules or themes from within it, or even run an update. So speaking of PECL, lets install through it, the uploadprogress module:

pecl install uploadprogress


Here is where you ‘ll need the C compiler (gcc). However, PECL will do only half the job, installing the module, and will not alter the php.in file. This is something you ‘ll have to do manually, adding the line “extension=uploadprogress.so” to it. In FC17 and most RedHat machines, php.ini will be located in /etc/ folder. So add it manually, either through a text editor, or with the command:

echo "extension=uploadprogress.so" >> /etc/php.ini


having root privileges. Next, you ll have to start the services you installed above, and make them start at boot every time. If you come from Ubuntu.. yeah i know, but you chose the hard way. So you register memcached, apache and mysql for bootime start with the commands:

chkconfig memcached on
chkconfig httpd on
chkconfig mysqld on


and you start the above services, with the commands:

service memcached start
service mysqld start
service httpd start


and that’s about it.

Now, for SELinux. What you want is alter three booleans, if you use the targeted policy. That is which i tested, so if you use the MLS, well… if you re using the MLS, you ll know a lot more than me about SELinux, so this post, wont say much to you eitherway. More specifically, you want to let apache server, to contact databases in the network,  to talk to memcache and optionally if you re going to run more than one domain or sandboxes, to allow executables to have full access to all content labeled with a http file context. This will be done with the following three commands:

setsebool -P httpd_can_network_connect_db 1
setsebool -P httpd_can_network_memcache 1
setsebool -P httpd_unified 1


with the last command, being the optional one. Running these, will take some time, and will normally produce no output, so when you run them, just be patient. In my virtualbox, with only one core, all three take about 5mins.

And that’s all you need to do to a Fedora system, before you actually download and install Drupal core. Keep in mind, that if in later stages you suspect SELinux for some irregularity in your drupal code, you can always temporarily disable it with the command:

setenforce 0


and then re-enable it with:

setenforce 1


You can also disable permanently SELinux, but then again, you ll miss the advanced security that an NSA tool can give. I know i haven’t talked about altering file permissions, but this will come in the next chapter, when we will download and deploy Drupal Core. Have fun.

Tagged , , ,

One thought on “Fedora and Drupal, part1

  1. Simon says:

    Great stuff. Thanks.

    How did you enable the rewrite module for clean URLs? I’m using Fedora 18 and have tried various combinations of including the associated LoadModule line in httpd.conf and changing the AllowOverride None to AllowOverride All. Yet Drupal still shows “The clean URL test failed” and “Clean URLs cannot be enabled”.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: