Last active
April 14, 2019 16:14
-
-
Save bobby5892/4b0d0840f5fd652dd72461c44d0d7412 to your computer and use it in GitHub Desktop.
Install LL Env
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| #------------------------------------------------------------------------------ | |
| # Install Learning Locker Undocumented Dependencies | |
| #------------------------------------------------------------------------------ | |
| #Modified from Multiple Sources including https://gist.github.com/davidpesce/7d6e1b81594ecbc72311 | |
| #converted to bash install | |
| # - Last revision Robert Moore 4/14/2019 | |
| # -----Command to Run from any shell---- | |
| # yum -y update ; yum -y install wget ; wget -qO configure.sh https://gist.githubusercontent.com/bobby5892/4b0d0840f5fd652dd72461c44d0d7412/raw/dd9401438d77127146cbc00425475ca81bf5c1d0/configure.sh && bash configure.sh | |
| # | |
| # | |
| #prepare colors | |
| RED='\033[0;31m' | |
| WHITE='\033[1;37m' | |
| YELLOW='\033[1;33m' | |
| #must run as root | |
| if [ "$(whoami)" != "root" ]; then | |
| {echo -e "Script must be run as user: root"; } 2> /dev/null | |
| exit -1 | |
| fi | |
| cd ~/ | |
| {echo -e " "; } 2> /dev/null | |
| {echo -e " "; } 2> /dev/null | |
| {echo -e "${YELLOW} Install Learning Locker ${RED} Made for Centos 7 ${WHITE}"; } 2> /dev/null | |
| {echo -e " "; } 2> /dev/null | |
| {echo -e " "; } 2> /dev/null | |
| {echo -e "${RED}=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-${WHITE}"; } 2> /dev/null | |
| #Original Installation Documentation Assumptions: | |
| #CentOS 7.0 x64 is installed (default install from DigitalOcean Droplet Manager) | |
| #- This is not a minimal install - | |
| #our bash is assuming Centos 7.0 x64 - but minimal install.... This way we can account for all dependencies. | |
| #Logged in via ssh key with root privileges | |
| #Using MongoDB as database | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Install Remi Collet Repository:"; } 2> /dev/null | |
| yum install -y epel-release | |
| rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm | |
| yum install -y yum-utils | |
| yum-config-manager --enable remi remi-php56 | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Install MongoDB"; } 2> /dev/null | |
| #setup the mongo direct repository - this fixes alot of mongo problems | |
| #Note PM2 - Requires Mongo 3.0 or > as of 4/10/2019 | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Configuring Mongo Repo -3.4"; } 2> /dev/null | |
| cat > /etc/yum.repos.d/mongodb-org4.0.repo << EOF | |
| [mongodb-org-4.0] | |
| name=MongoDB Repository | |
| baseurl=https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/4.0/x86_64/ | |
| gpgcheck=1 | |
| enabled=1 | |
| gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc | |
| EOF | |
| #install Mongo Server | |
| # this is version 2.6.1 [ by centos repo] | |
| #yum install -y mongodb mongodb-server | |
| #this will be 4.0 | |
| yum install -y mongodb-org.x86_64 | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Installing PHP and necessary PHP modules:"; } 2> /dev/null | |
| yum install -y php php-common php-cli php-pear php-mysqlnd php-pecl-mongo php-gd php-mbstring php-mcrypt php-xml php-bcmath | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Installing Development Tools"; } 2> /dev/null | |
| yum install -y groupinstall "Development Tools" | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Open SSL Dependencies"; } 2> /dev/null | |
| yum install -y libtool perl-core zlib-devel | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Installing NodeJs:"; } 2> /dev/null | |
| yum install -y nodejs | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Installing Node Package Manager (NPM):"; } 2> /dev/null | |
| yum install -y npm | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Installing Bower:"; } 2> /dev/null | |
| npm install -gyv bower | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Installing GIT:"; } 2> /dev/null | |
| yum install -y git | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Installing wget:"; } 2> /dev/null | |
| yum install -y wget | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Installing DeltaRPM:"; } 2> /dev/null | |
| yum install -y deltarpm | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Update CentOS"; } 2> /dev/null | |
| yum update -y | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Starting the Firewall Daemon and enabling automatic startup"; } 2> /dev/null | |
| systemctl start firewalld.service | |
| systemctl enable firewalld.service | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Allow HTTP Access through Firewall"; } 2> /dev/null | |
| firewall-cmd --permanent --zone=public --add-service=http | |
| firewall-cmd --permanent --zone=public --add-service=https | |
| systemctl restart firewalld.service | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Attempting to start MongoDB and enabling automatic startup"; } 2> /dev/null | |
| systemctl start mongod | |
| systemctl enable mongod | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Installing Composer and setting global launch"; } 2> /dev/null | |
| curl -sS https://getcomposer.org/installer | php | |
| mv composer.phar /usr/local/bin/composer | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Installing Mlocate"; } 2> /dev/null | |
| yum install -y mlocate | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Installing net-tools"; } 2> /dev/null | |
| yum install -y net-tools | |
| ####################################### | |
| ### Start Setting up Learning Locker ## | |
| ####################################### | |
| #Check if directory exists | |
| if [ ! -d "/var/www" ]; then | |
| #if it does not create it | |
| mkdir /var/www | |
| fi | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Changing directory to /var/www"; } 2> /dev/null | |
| cd /var/www | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Creating a linux user learninglocker: "; } 2> /dev/null | |
| useradd learninglocker -d /home/learninglocker | |
| {echo -e "Please enter a password for [learninglocker] user and press [enter]:"; } 2> /dev/null | |
| passwd -f learninglocker --stdin | |
| #echo -e "${RED}[lladmin]${WHITE}Cloning LearningLocker via Git:" | |
| #sudo -H -u lladmin bash -c 'cd /home/lladmin && git clone https://github.com/LearningLocker/learninglocker.git learninglocker && cd learninglocker && curl -sS https://getcomposer.org/installer | php' | |
| {echo -e "Enter a Username for DB Mongo User and press [enter]"; } 2> /dev/null | |
| read mongoUser | |
| {echo -e "Enter a Password for DB Mongo User and press [enter]"; } 2> /dev/null | |
| read mongoPassword | |
| {echo -e "${YELLOW}[ROOT]${WHITE}Creating a new MongoDB database Creating MongoDB database user:"; } 2> /dev/null | |
| cat > ~/mongoUser.js << EOF | |
| use learninglocker | |
| db.createUser({user:"$mongoUser",pwd:"$mongoPassword",roles:["readWrite"]}) | |
| exit | |
| EOF | |
| mongo < ~/mongoUser.js | |
| {echo -e "Deleting Mongo User Create Script"; } 2> /dev/null | |
| rm -f ~/mongoUser.js | |
| #Modify app/config/database.php with database credentials: | |
| #vi app/config/database.php | |
| #Finalize LL MongoDB setup: | |
| #echo -e "${YELLOW}[ROOT]${WHITE}Set Apache DocumentRoot and Directory Settings:"" | |
| #Check if directory exists | |
| #if [ ! -d "/var/www/learninglocker/" ]; then | |
| #if it does not create it | |
| #mkdir /var/www/learninglocker/ | |
| #fi | |
| #Check if directory exists | |
| #if [ ! -d "/var/www/learninglocker/public" ]; then | |
| # #if it does not create it | |
| # mkdir /var/www/learninglocker/public | |
| #fi | |
| #vi /etc/httpd/conf/httpd.conf | |
| #cat > /etc/httpd/conf.d/learninglocker.conf << EOF | |
| #DocumentRoot "/var/www/learninglocker/public" | |
| #<Directory "/var/www/learninglocker/public"> | |
| #AllowOverride All | |
| #</Directory> | |
| #EOF | |
| #echo -e "${YELLOW}[ROOT]${WHITE}Restart Apache" | |
| #systemctl restart httpd.service | |
| #echo -e "${YELLOW}[ROOT]${WHITE}Set ownership of directories to Apache" | |
| #chown -R apache.apache /var/www/learninglocker | |
| { echo -e "\n\n\n\n\n${YELLOW}[ROOT]${WHITE}We are about to install learning locker - please press enter several times to accept defaults:"; } 2> /dev/null | |
| #This is LL ubuntu install which leads to problems | |
| #wget -qO deployll.sh http://lrnloc.kr/installv2 && bash deployll.sh | |
| #{echo -e "${YELLOW}[ROOT]${WHITE}Adjust url and timezone values:"; } 2> /dev/null | |
| #{echo -e "${YELLOW}[ROOT]${WHITE}Adjust Encryption Key in app/config/app.php:"; } 2> /dev/null | |
| # | |
| #php artisan key:generate | |
| #{echo -e "${YELLOW}[ROOT]${WHITE}Adjust email settings in app/config/mail.php:"; } 2> /dev/null | |
| #{echo -e "${YELLOW}[ROOT]${WHITE}Create your admin user at http://yoursite.com/register:"; } 2> /dev/null | |
| ######### Post Enviroment Setup ### | |
| #update mlocateDB | |
| updatedb | |
| #goto /webapp | |
| cd/usr/local/learninglocker/current/webapp | |
| npm install -g babel-plugin-transform-runtime babel-preset-es2015 babel-preset-stage-2 | |
| yarn build-all | |
| #note in the .env - need to uncomment FS_LOCAL_STORAGE_DIR and set MONGO_URL to mongodb://localhost:27017/xapiserver | |
| #found in two spots - gotta figure out where its supposed to go - these are cached | |
| #/usr/local/share/.cache/yarn/v4/npm-@learninglocker-persona-service-1.7.1-8a1136e0817b8e7089683a1efaaf7b8d83c351ce/node_modules/@learninglocker/persona-service/.env.example | |
| #/usr/local/share/.cache/yarn/v4/npm-@learninglocker-xapi-statements-7.5.0-dca948c07330c4ef0274d2d125712af9ba539c22/node_modules/@learninglocker/xapi-statements/.env.example | |
| {echo -e "${YELLOW}[ROOT]${WHITE}JOBS DONE"; } 2> /dev/null | |
| #thinking::: Swapping from building from their install script to clone from github... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment