Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Fedora 29 local LAMP Selinux issues

I setup many VPS etc so I can install LAMP on Fedora. ItÅ› very easy and simple. I already did that earlier on 27 but now I have issues with Selinux.

I want the local LAMP (so no outside access) for developing websites. However, no mather what I try I have not full access rights. I need 'sudo' to write files inside VSCODE and when I f.e. install Joomla I can remove installation folder by Joomla, I need to do that with terminal. Also in Joomla I can't write configuration file.

If I completkly shutdown selinux I have no issues anymore.

Anybody have a real good working guide how to solve this?

Here my notes, with some of the things I have tried. Working on this for days now.

yum list installed | grep -i php

ALWAYS UPDATE FIRST !!!! sudo dnf update & sudo dnf upgrade -y reboot

set hostname hostnamectl set-hostname HOSTNAME

Install lamp + phpmyadmin su -

dnf install httpd mariadb mariadb-server php php-cli php-php-gettext php-mbstring php-mcrypt php-mysqlnd php-pear php-curl php-gd php-xml php-bcmath php-zip phpmyadmin

systemctl start httpd.service systemctl start mariadb.service

activate/install Mysql mysql_secure_installation

mysql -u root

follow form mysql> quit

VirtualHosts & hosts file

sudo nano /etc/hosts

add the domainnames (test1 test of test.dev test2.dev etc)

ADDING SITES (always in /var/www/SITENAME (eerste keer met

terminal)

sudo mkdir -p /var/www/site1

change permission

sudo chcon -R -t httpd_sys_content_t /var/www !!!!

sudo usermod -a -G apache xfce

sudo chown -R $USER:$USER /var/www/site1 sudo chmod -R 755 /var/www

semanage permissive -a httpd_t
!!!!!!!!!!!!!!!!

Making symlink ln -s /var/www /home/xfce/DevelopmentSites chcon -R

unconfined_u:object_r:httpd_sys_rw_content_t:s0 /home/xfce/DevelopmentSites sudo sed -i "s/User apache/User $USERNAME/g" /etc/httpd/conf/httpd.conf

semanage fcontext -a -t httpd_sys_rw_content_t

add sites virtualhost sudo nano /etc/httpd/conf/httpd.conf

at end of file add sites <virtualhost *:80=""> DocumentRoot

/var/www/site1 ServerName site1

Other Apache config directives, logs etc. </virtualhost>

COMMANDS

systemctl start httpd.service ## use restart after update systemctl enable httpd.service

systemctl start mariadb.service ## use restart after update systemctl enable mariadb.service

sudo systemctl reload httpd !!!!!

sudo chcon -R -t httpd_sys_content_t /var/www !!!!

https://fedoramagazine.org/troubleshooting-selinux/

https://blog.lysender.com/2015/07/centos-7-selinux-php-apache-cannot-writeaccess-file-no-matter-what/ https://unix.stackexchange.com/questions/116575/selinux-httpd-write-access-to-a-directory/179616 https://ask.fedoraproject.org/en/question/81784/how-do-i-enable-non-root-read-and-write-access-to-varwww-on-fedora23/

https://ask.fedoraproject.org/en/question/50063/location-varwww-is-not-writable/ https://askubuntu.com/questions/178231/permissions-issue-when-trying-to-save-file-to-var-www https://ask.fedoraproject.org/en/question/106773/how-to-set-permissions-for-apache/