Installing Larvel and MongoDB On Digital Ocean CentOS

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

29 January 2014

Install MongoDB and Laravel


Ive been playing around with Laravel and MongoDB. I cut my teeth
on Codeigniter and MySQL, but both seem to be losing popularity,
so I gured it was worthwhile staying on the cutting edge (i know, I
know, nothing written in PHP is on the cutting edge, but cut me
some slack).
To get everything up and running, I red up a Digital Ocean Droplet
(cant beat $5 a month!), and built this script to get everything up
and running.
#!/bin/bash
#su
#Install SSH
#yum -y install openssh
#chkconfig sshd on
#Disable IPtables - can reenable later
/etc/init.d/iptables save
/etc/init.d/iptables stop
chkconfig iptables off
#Install LAMP
yum -y install httpd php-devel mysql-server php-mysql
chkconfig httpd on
chkconfig mysqld on
#Set up Mongo Repository
#nano /etc/yum.repos.d/10gen-mongodb.repo
#[10gen]
#name=10gen Repository
#baseurl=http://downloads-distro.mongodb.org/repo/
redhat/os/x86_64
#gpgcheck=0
#enabled=1
##printf [mongodb] \n name=MongoDB Repository \n
baseurl=http://downloads-distro.mongodb.org/repo/
redhat/os/x86_64/ \n gpgcheck=0 \n enabled=1" | cat > /
etc/yum.repos.d/10gen-mongodb.repo
cat mongorepo.txt > /etc/yum.repos.d/10gen-
mongodb.repo
#Install MongoDB
yum -y install mongo-10gen mongo-10gen-server
#Make any necessary config changes
#nano /etc/mongod.conf
#Start MongoDB
service mongod start
#Set to restart on reboot
chkconfig mongod on
#Check that the client works
#mongo
#Install Unzip
yum -y install unzip
yum -y install gcc
#Install Mongo PHP Driver
cd
mkdir mongo-php-driver
cd mongo-php-driver
curl https://codeload.github.com/mongodb/mongo-php-
driver/zip/master > mongo-php-driver-master.zip
unzip mongo-php-driver-master.zip
cd mongo-php-driver-master
phpize
./configure
make all
sudo make install
#Include PHP Extension
#nano /etc/php.d/mongo.ini
#; Enable mongo extension
#extension=mongo.so
#printf ; Enable mongo extension \n
extension=mongo.so | cat > /etc/php.d/mongo.ini

echo "extension=mongo.so" | cat > /etc/php.d/mongo.ini
#Start Apache
service httpd start
##Install EPEL Repo
yum -y install wget
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/
epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-
release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
#Install Mcrypt
yum -y install php-mcrypt
#Install Composer
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
#Install Laravel
cd /var/www/html/
composer create-project laravel/laravel
chmod -R 777 /var/www/html/laravel
setsebool httpd_can_network_connect_db 1
setsebool httpd_can_network_connect 1
service httpd restart
service mongod restart

You might also like