Quick install on Fedora - SentryXSI/Codiad GitHub Wiki

How to setup Codiad on a Fedora linux operating system.

Depending on your installation, some steps might not be required.

HTTPD + PHP setup

sudo dnf install httpd
sudo dnf install php php-mbstring 

sudo systemctl start httpd
sudo systemctl enable httpd

Firewalld

Add a Firewalld rule to allow access to httpd on port 80/http.

Check for your active firewall zones :

sudo firewall-cmd --get-active-zones 

You may need to run reload first if you have added temp rules etc.

sudo firewall-cmd --reload  

If your default zone is public :

sudo firewall-cmd --zone=public --add-service=http --permanent  
sudo firewall-cmd --reload  

My zone is FedoraWorkstation :

sudo firewall-cmd --zone=FedoraWorkstation --add-service=http --permanent  
sudo firewall-cmd --reload  

GIT setup

sudo dnf install git  

Install Codiad

Place Codiad in the /var/www/html/ directory,
change the username to your user account name :

sudo mkdir /var/www/html/codiad
sudo chown username:apache codiad
sudo chmod 2775 codiad

sudo git clone https://github.com/SentryXSI/Codiad /var/www/html/codiad  

You can either copy the config.example.php file to config.php or create a new file :

sudo touch /var/www/html/codiad/config.php  

You could also reset the permissions back to apache, or the server you use :

sudo chown -R apache:apache /var/www/html/codiad

I use ninja:apache as owner:group permissions, instead of apache:apache
because having my own account as owner allows me to edit files remotely using WinSCP, FileZilla etc

SELinux Policy

Update the SELinux security contexts for files and directories :

sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/codiad/data(/.*)?'  
sudo restorecon -rv '/var/www/html/codiad/data'  

sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/codiad/plugins(/.*)?'  
sudo restorecon -rv '/var/www/html/codiad/plugins'  

sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/codiad/themes(/.*)?'   
sudo restorecon -rv '/var/www/html/codiad/themes'  

sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/codiad/workspace(/.*)?'   
sudo restorecon -rv '/var/www/html/codiad/workspace'  

sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/codiad/config.php'  
sudo restorecon -rv '/var/www/html/codiad/workspace'  

restorecon - set file security contexts :

https://fedoraproject.org/wiki/Security_context
https://fedoraproject.org/wiki/SELinux/restorecon

chcon

Previous install guides advised to use chcon, which is only temporary.

"The chcon command changes the SELinux context for files. 
However, changes made with the chcon command do not survive a file system relabel, 
or the execution of the restorecon command."

ref : https://docs.fedoraproject.org/en-US/Fedora/25/html/SELinux_Users_and_Administrators_Guide/sect-Security-Enhanced_Linux-Working_with_SELinux-SELinux_Contexts_Labeling_Files.html

View Security Contexts

Use ls -Z to view the context labels of your file system :

ls -alZ

Setup Virtual Host

Create a new virtual host .conf file in /etc/httpd/conf.d/

cd /etc/httpd/conf.d
sudo vim codiad.local.conf  

Add your config details ( minimal example ) :

<VirtualHost *:80>
    DocumentRoot "/var/www/html/codiad/"
    ServerName codiad.local
    ServerAlias www.codiad.local
    <Directory "/var/www/html/codiad/">
        AllowOverride all
        Require all granted
    </Directory>
</VirtualHost>

Add to Hosts FIle

Add your local Codiad hostname to your hosts file.

127.0.0.1  codiad.local www.codiad.local codiad

Or if you prefer, you can map your codiad host to a local network ip address :

192.168.198.30  codiad.local www.codiad.local codiad

Install

Open up your 'http://codiad.local/' to start the installation.

⚠️ **GitHub.com Fallback** ⚠️