Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save davidpesce/7d6e1b81594ecbc72311 to your computer and use it in GitHub Desktop.
Save davidpesce/7d6e1b81594ecbc72311 to your computer and use it in GitHub Desktop.
Installing LearningLocker (v1) on CentOS 7.0

Prepare CentOS 7.0 Server for LearningLocker (v1) LRS

Assumptions:

  • CentOS 7.0 x64 is installed (default install from DigitalOcean Droplet Manager)
  • Logged in via ssh key with root privileges
  • Using MongoDB as database

Install Remi Collet Repository:

yum install epel-release
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum install yum-utils
yum-config-manager --enable remi remi-php56

Install Apache:

yum install httpd

Install PHP and necessary PHP modules:

yum install php php-common php-cli php-pear php-mysqlnd php-pecl-mongo php-gd php-mbstring php-mcrypt php-xml php-bcmath

Install MongoDB

yum install mongodb mongodb-server

Install NodeJs:

yum install nodejs

Install Node Package Manager (NPM):

yum install npm

Install Bower:

npm install -g bower

Install GIT:

yum install git

Install DeltaRPM:

yum install deltarpm

Update CentOS

yum update

Start the Firewall Daemon and enable automatic startup

systemctl start firewalld.service
systemctl enable firewalld.service

Allow HTTP Access through Firewall

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
systemctl restart firewalld.service

Start Apache HTTP Daemon and enable automatic startup

systemctl start httpd.service
systemctl enable httpd.service

Start MongoDB and enable automatic startup

systemctl start mongod
systemctl enable mongod

Install Composer and set global launch

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

Install and Configure LearningLocker(v1)

Assumptions:

  • Commands are issued from LL installation directory
  • Using MongoDB as database

Clone LearningLocker via Git:

cd /var/www
git clone https://github.com/LearningLocker/learninglocker.git learninglocker

Install LearningLocker

cd learninglocker
composer install

Create a new MongoDB database:

mongo
use learninglocker

Create MongoDB database user:

db.createUser({user:"username",pwd:"password",roles:["readWrite"]})
exit

Modify app/config/database.php with database credentials:

vi app/config/database.php

Finalize LL MongoDB setup:

php artisan migrate

Set Apache DocumentRoot and Directory Settings:

vi /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/learninglocker/public"
<Directory "/var/www/learninglocker/public">
  AllowOverride All
</Directory>

Restart Apache

systemctl restart httpd.service

Set ownership of directories to Apache

chown -R apache.apache /var/www/learninglocker

Adjust url and timezone values in app/config/app.php

Adjust Encryption Key in app/config/app.php

php artisan key:generate

Adjust email settings in app/config/mail.php

Create your admin user at http://yoursite.com/register

@hamishdewe
Copy link

Thanks for this guide - it's been very useful.

One thing to add, for those who have selinux enabled - you may need to enable rw access to app/storage, or get a permission denied error when attempting to register:
Error in exception handler: The stream or file "/var/www/learninglocker/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/learninglocker/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:95.

The following worked for me:

yum install policycoreutils-python (if semanage not already installed)
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/learninglocker/app/storage(/.*)?"
restorecon -Rv /var/www/learninglocker

@btopro
Copy link

btopro commented Oct 21, 2015

last part definitely needed on CentOS 7-esk installs at least

@kwtask
Copy link

kwtask commented Jan 18, 2016

Thanks for the info on CentOS 7. Pardon the noobie question/comment, but have attempted to install on CentOS release 5.11 (Final) and with exception of installing nodejs,deltarpm,and npm and thus cannot install bower. Not in any repos I can find and am un-aware of any alternatives to install. Bottom line ... will learninglocker run? Thanks for sharing!

@yeeking
Copy link

yeeking commented Aug 12, 2016

Running on RHEL 7.0

The stage
php artisan migrate
failed for me. I went back into mongo and ran:

mongo
use ll_staging
db.createUser({user:"username",pwd:"password",roles:["readWrite"]})

Then when running the main app, got a permission denied error on connecting to mongo, fixed with this:

/usr/sbin/setsebool -P httpd_can_network_connect 1

(http://php.net/manual/en/class.mongoconnectionexception.php)

@gmram
Copy link

gmram commented Mar 22, 2017

Thank you so much for this guide. Worked like a charm, especially with the changes suggested by JKK.

Perhaps, in the last section, where you direct users to use the key generator, they could instead use:

php artisan key:generate

since this auto-generates & inserts the key on its own.

Also, a server reboot may help before users try the site-registration.

Once again, thank you! :)

@gamahachaa
Copy link

gamahachaa commented Aug 14, 2017

With CENTOS 7.3.1611 (Core) on step Install NodeJs: yum install nodejs
an error pops :
Error: Package: 1:nodejs-6.11.1-1.el7.x86_64 (epel) Requires: libhttp_parser.so.2()(64bit) Error: Package: 1:nodejs-6.11.1-1.el7.x86_64 (epel) Requires: http-parser >= 2.7.0 You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest
The non-synchro (between EPEL and Centos 7.3) is detailed here:
https://bugs.centos.org/view.php?id=13669

so downloading the http-parser on a temp folder
wget -O MY_LOCAL_TEMP_PATH/http-parser-2.7.1-3.el7.x86_64.rpm https://kojipkgs.fedoraproject.org//packages/http-parser/2.7.1/3.el7/x86_64/http-parser-2.7.1-3.el7.x86_64.rpm

then
yum localinstall MY_LOCAL_TEMP_PATH/http-parser-2.7.1-3.el7.x86_64.rpm

did the trick to insatll nodejs

BR

@nepomuc
Copy link

nepomuc commented Aug 23, 2017

@gamahachaa Thanks a lot for the instructions on installing a newer version of httpd. Also I had problems with the versions of nodejs and mongodb which get installed by yum. So I followed the installation instructions on https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/ for mongodb and https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora for nodejs. Otherwise I was able to setup the webserver and also get the user-interface to show up in my browser but the ajax requests would not work because of the mongodb v2.6 which gets installed by yum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment