-
Notifications
You must be signed in to change notification settings - Fork 5
For those that would like to run MEDUSA locally on CentOS 7.x with SELinux enforcing
-
Install PHP 7.4 (https://computingforgeeks.com/how-to-install-php-7-4-on-centos-7/)
-
Install the EPEL and REMI repositories
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
-
Enable the PHP 7.4 repository
yum -y install yum-utils yum-config-manager --enable remi-php74
-
Install PHP 7.4 and related PHP components
yum update yum install -y php php-cli php-devel php-fpm php-pear composer
-
-
Install the following packages with yum (nominal versions in parenthesis).
- git (1.8.3)
- indent (2.2.11)
- ImageMagick (6.9.10)
- ImageMagick-devel (6.9.10)
- sassc (3.4.5)
yum install -y git indent ImageMagick ImageMagick-devel sassc
-
Install nginx (https://www.nginx.com/resources/wiki/start/topics/tutorials/install/)
-
Create the repo file (/etc/yum.repos.d/nginx.repo) with the following:
cat > /etc/yum.repos.d/nginx.repo <<'EOD' [nginx] name=nginx repo baseurl=https://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1 EOD
-
Install nginx
yum install nginx
-
Enable and start the nginx server
systemctl enable --now nginx
-
-
Install node.js 14.x (from https://github.com/nodesource/distributions)
curl -sL https://rpm.nodesource.com/setup_14.x | bash - yum install -y nodejs
-
Install Mongodb 4.4 (https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-centos-7)
-
Create the repo file (/etc/yum.repos.d/mongodb-org.repo) with the following:
cat > /etc/yum.repos.d/mongodb-org.repo <<'EOD' [mongodb-org-4.4] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc EOD
-
Install mongodb
yum install -y mongodb-org
-
Enable and start the mongodb server
systemctl enable --now mongod
-
-
Install Redis 6.0 (https://computingforgeeks.com/how-to-install-latest-redis-on-centos-7/)
yum --enablerepo=remi install redis systemctl enable --now redis
-
Enable PHP-FPM.
systemctl enable --now php-fpm
-
Install required PHP modules. Accept the default option for any prompts. Make sure you do this in either the same terminal window where you executed
source ~/.bash_profile
or a new terminal window created after you added the php path to the front of the search path, so pecl will find the correct php.ini file.pecl install mongodb pecl install imagick pecl install redis
After the all the modules have been installed, verify that you have the following lines in files in
/etc/php.d
with a numeric prefix greater than that for json (e.g.20-json.ini
but40-redis.ini
) (https://ystatit.medium.com/cannot-find-redio-so-on-centos7-with-php7-bfffdece5ead)cat > /etc/php.d/40-imagick.ini <<EOD ; Enable imagick extension module extension="imagick.so" EOD cat > /etc/php.d/40-redis.ini <<EOD ; Enable redis extension module extension="redis.so" EOD cat > /etc/php.d/40-mongodb.ini <<EOD ; Enable mongodb extension module extension="mongodb.so" EOD
-
Configure php-fpm. Edit
/etc/opt/remi/php74/php-fpm.d/www.conf
and change the listen line tolisten = /var/run/php-fpm.sock
and make sure these three lines are also included:
listen.owner = nginx listen.group = nginx listen.mode = 0660
Now, as a regular user...
-
Clone the MEDUSA repo in the directory of your choice (~/sites is good choice)
git clone https://github.com/TRMN/medusa.git
-
Copy .env.example to .env
cd ~/sites/medusa cp .env.example .env
-
Create the required framework directories under the application directory
mkdir -p storage/framework/cache storage/framework/sessions storage/framework/views
-
Edit the .env file and configure the database
-
Install the required PHP dependencies.
cd ~/sites/medusa composer install
-
Generate the application key
php artisan key:generate
-
Install the required node dependencies to generate css from scss files and to minify javascript.
cd ~sites/medusa npm install npm audit fix
Again as root...
-
Copy
server_configurations/nginx/medusa.dev
from your clone to/etc/nginx/conf.d/medusa.dev.conf
. Edit/etc/nginx/conf.d/medusa.dev.conf
and adjust the paths (which use/path/to
as a hint) as needed. -
Check to see that your chosen port is open with the firewall.
firewall-cmd --list-all
If the port is not open, use a command such as:
firewall-cmd --permanent --add-port=8080/tcp firewall-cmd --reload
If in doubt of what ports are a part of a service, you can consult the files under
/usr/lib/firewalld/services
, or use a command such asgrep 8080 /usr/lib/firewalld/services/*
to see if there is any pre-existing service which makes sense to use instead of the direct port number. (In this case, none do.)
-
Set the SELinux file context for the source directory if not cloned into
/var/www/html
. Here,~/sites
is taken to mean/home/medusa/sites
.semanage fcontext -a -e /var/www/html '/home/medusa/sites(/.*)?'
Regardless of directory, the following will also doubtless be needed, with the path adjusted accordingly:
semanage fcontext -a -t httpd_sys_rw_content_t '/home/medusa/sites/medusa/storage/(.*)?'
Once this is done, restore the file contexts with the command:
restorecon -Rv /home/medusa/sites/medusa
-
Edit /etc/hosts and add medusa.local (I’ve had better luck using the .local extension instead of .dev)
127.0.0.1 localhost medusa.local
-
Expand the archive of the database you’ve been given and cd into the trmn directory created to load the database into your local mongodb server.
$ cd trmn/ $ mongorestore --db=trmn --drop .
-
Verify that everything is working by going to http://medusa.local:8080/ in your browser. Use your current medusa login.
-
Finally, give yourself ALL_PERMS, USER_MASQ and CONFIG in your local sandbox. Replace “RMN-XXXX-YY” with your RMN number.
$ php artisan user:addperm RMN-XXXX-YY ALL_PERMS $ php artisan user:addperm RMN-XXXX-YY USER_MASQ $ php artisan user:addperm RMN-XXXX-YY CONFIG