How to use selinux on Centos 6.5

How to use selinux on your Redhat/CentOS server.

Check if selinux is enabled/disabled

sestatus

Disable on the fly selinux

setenforce 0

Enable on-the-fly selinux

setenforce 1

Install utilities to be able to change selinux policies

yum install policycoreutils policycoreutils-python
yum install -y setroubleshoot

Check for selinux errors

cat /var/log/audit/audit.* /var/log/messages* | audit2allow

Create selinux rules based on what was found on logs

cat /var/log/audit/audit.* /var/log/messages* | audit2allow -M mysemanage

Apply the rules on the system

sudo semodule -i mysemanage.pp

In case you run in to trouble and even after applying the pp file your app will still be blocked use the following commands

Mount Amazon S3 to Centos 6.5/Redhat6.5 EC2 paravirtualized only

The below solution works only with a paravirtualized VM.

On git hub can be found a very nice puppet module which does exactly the same installation.

https://github.com/MSMFG/puppet-s3fs

First remove the fuse installed:

yum remove fuse fuse* fuse-devel

Install all the required packages:

 yum install gcc libstdc++-devel gcc-c++ curl curl* curl-devel libxml2 libxml2* libxml2-devel openssl-devel mailcap vim wget -y

Navigate to the installation folder:

cd /usr/local/src

Download fuse and install:

wget http://downloads.sourceforge.net/project/fuse/fuse-2.X/2.9.3/fuse-2.9.3.tar.gz

tar -xvf fuse-2.9.3.tar.gz

mv fuse-2.9.3 fuse

cd fuse

./configure --prefix=/usr

make

make install

export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib64/pkgconfig/

ldconfig

modprobe fuse

pkg-config --modversion fuse

Install s3fs: