Skip to content

Instantly share code, notes, and snippets.

@0x006E
Last active October 1, 2024 05:14
Show Gist options
  • Save 0x006E/96db09d8fdddd4fdc46345d515b46a3d to your computer and use it in GitHub Desktop.
Save 0x006E/96db09d8fdddd4fdc46345d515b46a3d to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
dnf install epel-release dnf-utils -y
dnf install http://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
dnf module reset php -y
dnf module install php:remi-8.2 -y
dnf install wget git gcc-c++ make php php-{fpm,bcmath,ctype,fileinfo,json,mbstring,pdo,tokenizer,xml,curl,zip,gmp,gd,mysqli} mariadb-server -y
dnf install vim policycoreutils-python-utils nodejs nginx libXcomposite libXcursor libXdamage libXext libXi libXtst libmng libXScrnSaver libXrandr libXv alsa-lib cairo pango atk at-spi2-atk gtk3 -y
systemctl enable --now mariadb
< /dev/tty mysql_secure_installation
curl -sL https://rpm.nodesource.com/setup_18.x | bash
wget "https://gist.github.com/0x006E/96db09d8fdddd4fdc46345d515b46a3d/raw/invoiceninja.conf" -O /etc/nginx/conf.d/invoiceninja.conf
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload
< /dev/tty vim /etc/nginx/conf.d/php-fpm.conf
< /dev/tty vim /etc/php-fpm.d/www.conf
mkdir -p /var/lib/php/session
mkdir -p /var/run/php/
chown -R nginx:nginx /var/lib/php/session/
chown -R nginx:nginx /var/run/php/
setfacl -dm u:nginx:rwx /var/lib/php/session
setfacl -dm u:nginx:rwx /var/lib/php
systemctl enable --now php-fpm
mkdir -p /usr/share/nginx/invoiceninja
cd /usr/share/nginx/invoiceninja
git clone -b v5-stable --depth 1 --single-branch https://github.com/invoiceninja/invoiceninja .
cp .env.example .env
< /dev/tty vim -o .env
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/bin --filename=composer
chown -R nginx:nginx ./
sudo -u nginx php -d memory_limit=-1 `which composer` i --no-dev
sudo -u nginx npm install --no-optional
< /dev/tty sudo -u nginx php artisan key:generate
< /dev/tty sudo -u nginx php artisan optimize
setenforce 0
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/public(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/storage(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/app(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/bootstrap(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/config(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/database(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/resources(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/vendor(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/tests(/.*)?'
restorecon -Rv '/usr/share/nginx/invoiceninja/'
setsebool -P httpd_unified 1
setsebool -P httpd_execmem 1
setsebool -P httpd_can_network_connect 1
setsebool -P use_virtualbox 1
systemctl restart nginx
setenforce 1
server {
listen 80;
# Here, enter the path to your invoiceninja directory, in the public dir.
root /usr/share/nginx/invoiceninja/public;
client_max_body_size 20M;
gzip on;
gzip_types application/javascript application/x-javascript text/javascript text/plain application/xml application/json;
gzip_proxied no-cache no-store private expired auth;
gzip_min_length 1000;
index index.php index.html index.htm;
charset utf-8;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# Here we pass to php-fpm listen socket. For configuration see /etc/php-fpm.d/*.conf.
fastcgi_pass unix:/var/run/php/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log /var/log/nginx/ininja.access.log;
error_log /var/log/nginx/ininja.error.log;
sendfile off;
}
#!/usr/bin/env bash
yum install wget git gcc-c++ make php php-{fpm,bcmath,ctype,fileinfo,json,mbstring,pdo,tokenizer,xml,curl,zip,gmp,gd,mysqli} mariadb-server -y
yum install vim libXcomposite libXcursor libXdamage libXext libXi libXtst libmng libXScrnSaver libXrandr libXv alsa-lib cairo pango atk at-spi2-atk gtk3 -y
systemctl enable --now mariadb
< /dev/tty mysql_secure_installation
curl -sL https://rpm.nodesource.com/setup_18.x | bash
yum install nodejs nginx -y
wget "https://gist.github.com/0x006E/96db09d8fdddd4fdc46345d515b46a3d/raw/invoiceninja.conf" -O /etc/nginx/conf.d/invoiceninja.conf
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload
< /dev/tty vim /etc/nginx/conf.d/php-fpm.conf
< /dev/tty vim /etc/php-fpm.d/www.conf
mkdir -p /var/lib/php/session
mkdir -p /var/run/php/
chown -R nginx:nginx /var/lib/php/session/
chown -R nginx:nginx /var/run/php/
setfacl -dm u:nginx:rwx /var/lib/php/session
setfacl -dm u:nginx:rwx /var/lib/php
systemctl enable --now php-fpm
mkdir -p /usr/share/nginx/invoiceninja
cd /usr/share/nginx/invoiceninja
git clone -b v5.2.2-release --depth 1 --single-branch https://github.com/invoiceninja/invoiceninja .
cp .env.example .env
< /dev/tty vim -o .env
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/bin --filename=composer
chown -R nginx:nginx ./
sudo -u nginx php -d memory_limit=-1 `which composer` i --no-dev
sudo -u nginx npm install --no-optional
< /dev/tty sudo -u nginx php artisan key:generate
< /dev/tty sudo -u nginx php artisan optimize
setenforce 0
yum install policycoreutils-python-utils -y
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/public(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/storage(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/app(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/bootstrap(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/config(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/database(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/resources(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/vendor(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/invoiceninja/tests(/.*)?'
restorecon -Rv '/usr/share/nginx/invoiceninja/'
setsebool -P httpd_unified 1
setsebool -P httpd_execmem 1
setsebool -P httpd_can_network_connect 1
setsebool -P use_virtualbox 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment