|
#Installs Remi Collet Repository |
|
sudo yum -y install epel-release |
|
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm |
|
sudo yum -y install yum-utils |
|
sudo yum-config-manager --enable remi remi-php56 |
|
############################### |
|
|
|
#Installs apache, php, and necessary php modules |
|
sudo yum -y install httpd |
|
sudo yum -y install gcc php php-common php-cli php-pear php-devel php-mysqlnd php-pecl-mongo php-gd php-mbstring php-mcrypt php-xml php-bcmath openssl-devel.x86_64 |
|
############################### |
|
|
|
#install MongoDB |
|
sudo yum -y install mongodb mongodb-server |
|
|
|
#install nodejs, npm, and bower |
|
sudo yum -y install nodejs |
|
sudo yum -y install npm |
|
sudo npm install -g bower |
|
############################### |
|
|
|
#install git, deltarpm, and update packages |
|
sudo yum -y install git |
|
sudo yum -y install deltarpm |
|
sudo yum -y update |
|
############################### |
|
|
|
#install to get semanage command for SELinux config |
|
sudo yum -y install policycoreutils-python |
|
|
|
#start and configure firewall, apache, and mongodb |
|
sudo systemctl start firewalld.service |
|
sudo systemctl enable firewalld.service |
|
sudo firewall-cmd --permanent --zone=public --add-service=http |
|
sudo firewall-cmd --permanent --zone=public --add-service=https |
|
sudo systemctl restart firewalld.service |
|
sudo systemctl start httpd.service |
|
sudo systemctl enable httpd.service |
|
sudo systemctl start mongod |
|
sudo systemctl enable mongod |
|
################################ |
|
|
|
#install composer and self-update with sudo -H flag to (possibly?) fix a permissions error |
|
curl -sS https://getcomposer.org/installer | php |
|
sudo mv composer.phar /usr/local/bin/composer |
|
sudo -H /usr/local/bin/composer self-update |
|
|
|
#add current user to apache group and chown www directory recursively to fix permissions (probably) |
|
sudo usermod -a -G apache $USER |
|
sudo chown $USER:apache -R /var/www/ |
|
################################ |
|
|
|
#clone learninglocker and chown the directory, then install with composer |
|
cd /var/www |
|
git clone https://github.com/LearningLocker/learninglocker.git learninglocker |
|
sudo chown $USER:apache -R /var/www/learninglocker |
|
cd learninglocker |
|
composer install |
|
################################ |
|
|
|
#this allows php to talk to mongodb |
|
sudo setsebool -P httpd_can_network_connect 1 |
|
|
|
cd /var/www/learninglocker |
|
|
|
#collect database credentials and create database and configuration using them |
|
echo "Please enter desired credentials for database." |
|
echo "Username: " |
|
read username |
|
echo "Password: " |
|
read -s password |
|
echo -e "use learninglocker\ndb.createUser({user:\"$username\",pwd:\"$password\",roles:[\"readWrite\"]})" | mongo |
|
rm app/config/database.php |
|
touch app/config/database.php |
|
echo "<?php" >> app/config/database.php |
|
echo "" >> app/config/database.php |
|
echo "return [" >> app/config/database.php |
|
echo "'fetch' => PDO::FETCH_CLASS," >> app/config/database.php |
|
echo "'default' => 'mongodb'," >> app/config/database.php |
|
echo "'connections' => [" >> app/config/database.php |
|
echo "'mongodb' => [" >> app/config/database.php |
|
echo "'driver' => 'mongodb'," >> app/config/database.php |
|
echo "'host' => 'localhost'," >> app/config/database.php |
|
echo "'port' => '27017'," >> app/config/database.php |
|
echo "'username' => '$username'," >> app/config/database.php |
|
echo "'password' => '$password'," >> app/config/database.php |
|
echo "'database' => 'learninglocker'" >> app/config/database.php |
|
echo "]," >> app/config/database.php |
|
echo "]," >> app/config/database.php |
|
echo "'migrations' => 'migrations'," >> app/config/database.php |
|
echo "];" >> app/config/database.php |
|
php artisan migrate |
|
################################ |
|
|
|
#set up SELinux permissons for server (these might be wrong) |
|
sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/learninglocker(/.*)?" |
|
sudo restorecon -Rv /var/www/learninglocker |
|
################################ |
|
|
|
php artisan key:generate |
|
|
|
sudo chown -R apache.apache /var/www/learninglocker |
|
|
|
echo "Copy the text below, then hit enter, vi will be launched editing httpd.conf. press i to enter insert mode, navigate to the relevant section (look for DocumentRoot), and replace both pieces with the one section below (it will look the same, it just has a comment between the two sections)" |
|
echo "DocumentRoot \"/var/www/learninglocker/public\"" |
|
echo "Alias /learninglocker \"/var/www/learninglocker/public/\"" |
|
echo "<Directory \"/var/www/learninglocker/public\">" |
|
echo " Options Indexes FollowSymLinks MultiViews" |
|
echo " AllowOverride All" |
|
echo " Order allow,deny" |
|
echo " Allow from all" |
|
echo " Require all granted" |
|
echo "</Directory>" |
|
echo "" |
|
echo "Press ento to begin editing, hit escape and type :wq and hit enter when done, the script will then resume." |
|
read junk |
|
|
|
sudo vi /etc/httpd/conf/httpd.conf |
|
sudo systemctl restart httpd.service |
|
|
|
echo "LearningLocker is now *mostly* set up. Make sure to adjust timezone settings in app/config/app.php and email settings in app/config/mail.php" |
|
|