<p>Someone with more CentOS experience will probably want to chime in—like you I'm more familiar with Debian/Ubuntu—but I can't imagine it wouldn't work, assuming you configure SELinux correctly and you're <a href="https://community.webfaction.com/questions/15849/craft-cms-needs-mysql-510-or-higher-to-run" rel="nofollow noreferrer">using</a> at least CentOS 6, preferably the latest.</p>

<p>Basically, SELinux is an kernel level gatekeeper, preventing or allowing certain processes from reading/writing to parts of the file system. </p>

<p>In terms of how that affects Craft, you'll need to make sure it knows that Apache/PHP is allowed to write to <code>/craft/app</code>, <code>craft/config</code> and <code>craft/storage</code> and whatever upload directories you have setup.</p>

<p>Just perusing the SELinux docs and problems people have had with Yii and WordPress, assuming your Craft install is at <code>/var/www/craft/</code> running something like:</p>

<pre><code>cd /var/www/craft/
chcon -R -v -t public_content_rw_t app/ config/ storage/
</code></pre>

<p>... should open up the permissions. There's more to it than that obviously. </p>

<p>If you run PHP as an <a href="http://forums.fedoraforum.org/showthread.php?t=288728" rel="nofollow noreferrer">FPM pool/CGI</a>, as I do, that's <a href="https://serverfault.com/questions/596790/selinux-label-for-php-fpm-sockets">going to affect permissions</a> as well.</p>

<p><a href="http://edvoncken.net/2010/06/configuring-selinux-for-wordpress/" rel="nofollow noreferrer">This article</a> is based around setting up permissions for WordPress but it's still applicable for Craft.</p>

CC BY-SA 3.0
2015-07-14T17:05:01.000Z
We are running Craft on CentOS 6 and 7 without issues, you only have to get a newer version of PHP (than the one available from the default repos) from EPEL or Webtatic. I think CentOS 7 defaults to 5.4 which might be too old for Craft 3. No experience with SELinux though.
megatrond
CC BY-SA 3.0
2015-07-14T17:18:06.697Z
@megatrond: Thanks for that!  Craft 3 is going to require PHP 5.4 (http://buildwithcraft.com/3/docs/installing-and-updating) so you're right, if this is a new box, you might as well head straight to the latest version. Another hurdle there is it looks like CentOS 7 officially comes with MariaDB instead of MySQL unless you use another repo to get it.
RitterKnight
CC BY-SA 3.0
2015-07-14T17:20:52.127Z
We're using the default MariaDB without issues.
megatrond
CC BY-SA 3.0
2015-07-14T20:11:22.860Z
I have been doing a related project with CentOS and SELinux and I am starting to like the addition MAC along with the DAC, but, I just didn't want to jump into something that will cause me a problem.  I may run both systems for a bit and see if I can get Craft fully running in the more secure environment. Thanks!
Chip Shank
CC BY-SA 3.0
2015-09-16T19:17:57.180Z
Glad to hear it's working out!
RitterKnight
CC BY-SA 3.0
2015-07-14T16:19:42.837Z
2015-07-14T17:19:10.640Z
2017-04-13T12:14:55.733Z
RitterKnight
<p>Seriously considering installing Craft on CentOS w/SELinux.  I currently have it running on Ubuntu.  Anyone have any problems with that type of install?</p>

<p>thanks,</p>

<p>Chip</p>

<install>
Any problems installing Craft on CentOS with SELinux enabled?
# Any problems installing Craft on CentOS with SELinux enabled?

(Asked by: username_0 on 2015-07-13)

Seriously considering installing Craft on CentOS w/SELinux. I currently have it running on Ubuntu. Anyone have any problems with that type of install?

thanks,

Chip

**Tags:** install


---

## 1 answers

### Answer by username_1 on 2015-07-14. Score: 2 | Accepted answer

Someone with more CentOS experience will probably want to chime in—like you I'm more familiar with Debian/Ubuntu—but I can't imagine it wouldn't work, assuming you configure SELinux correctly and you're using at least CentOS 6, preferably the latest.
Basically, SELinux is an kernel level gatekeeper, preventing or allowing certain processes from reading/writing to parts of the file system. 
In terms of how that affects Craft, you'll need to make sure it knows that Apache/PHP is allowed to write to /craft/app, craft/config and craft/storage and whatever upload directories you have setup.
Just perusing the SELinux docs and problems people have had with Yii and WordPress, assuming your Craft install is at /var/www/craft/ running something like:
cd /var/www/craft/
chcon -R -v -t public_content_rw_t app/ config/ storage/

... should open up the permissions. There's more to it than that obviously. 
If you run PHP as an FPM pool/CGI, as I do, that's going to affect permissions as well.
This article is based around setting up permissions for WordPress but it's still applicable for Craft.

> **Comments:**
> **username_2**: We are running Craft on CentOS 6 and 7 without issues, you only have to get a newer version of PHP (than the one available from the default repos) from EPEL or Webtatic. I think CentOS 7 defaults to 5.4 which might be too old for Craft 3. No experience with SELinux though.  
> **username_1**: @username_2: Thanks for that!  Craft 3 is going to require PHP 5.4 (http://buildwithcraft.com/3/docs/installing-and-updating) so you're right, if this is a new box, you might as well head straight to the latest version. Another hurdle there is it looks like CentOS 7 officially comes with MariaDB instead of MySQL unless you use another repo to get it.  
> **username_2**: We're using the default MariaDB without issues.  
> **username_0**: I have been doing a related project with CentOS and SELinux and I am starting to like the addition MAC along with the DAC, but, I just didn't want to jump into something that will cause me a problem.  I may run both systems for a bit and see if I can get Craft fully running in the more secure environment. Thanks!  
> **username_1**: Glad to hear it's working out!  

---

