-
-
Save robzolkos/1588623 to your computer and use it in GitHub Desktop.
Quick notes for 1.9.2 + postgres on Ubuntu 10.4
This file contains 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
sudo /usr/sbin/groupadd rvm | |
sudo /usr/sbin/usermod -G rvm ubuntu | |
sudo apt-get install git-core build-essential zlib1g-dev libssl-dev libreadline5-dev libxml2-dev libsqlite3-dev libxslt-dev libxml2-dev libcurl4-openssl-dev | |
sudo su - | |
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm) | |
rvm pkg install zlib | |
rvm remove 1.9.2 | |
rvm install 1.9.2 --with-zlib-dir=$rvm_path/usr | |
rvm use 1.9.2 --default | |
gem install bundler passenger | |
wget http://nginx.org/download/nginx-0.8.55.tar.gz | |
tar xf nginx-0.8.55.tar.gz | |
cd nginx-0.8.55 | |
git clone git://github.com/masterzen/nginx-upload-progress-module.git | |
wget http://www.grid.net.ru/nginx/download/nginx_upload_module-2.2.0.tar.gz | |
tar xf nginx_upload_module-2.2.0.tar.gz | |
rvmsudo passenger-install-nginx-module | |
/home/ubuntu/nginx-0.8.55 | |
--with-http_ssl_module --with-http_gzip_static_module --add-module=/home/ubuntu/nginx-0.8.55/nginx-upload-progress-module --add-module=/home/ubuntu/nginx-0.8.55/nginx_upload_module-2.2.0 | |
# Add nginx init file | |
sudo chmod +x /etc/init.d/nginx | |
sudo /usr/sbin/update-rc.d -f nginx defaults | |
sudo apt-get install python-software-properties | |
sudo add-apt-repository ppa:pitti/postgresql | |
sudo apt-get update | |
sudo apt-get install postgresql-9.0 libpq-dev | |
wget http://sphinxsearch.com/files/sphinx-0.9.9.tar.gz | |
tar xf sphinx-0.9.9.tar.gz | |
cd sphinx-0.9.9 | |
./configure --without-mysql --with-pgsql | |
make | |
sudo make install |
This file contains 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 | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: nginx init.d script for Ubuntu 8.10 and lesser versions. | |
# Description: nginx init.d script for Ubuntu 8.10 and lesser versions. | |
### END INIT INFO | |
#------------------------------------------------------------------------------ | |
# nginx - this script, which starts and stops the nginx daemon for ubuntu. | |
# | |
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ | |
# proxy and IMAP/POP3 proxy server. This \ | |
# script will manage the initiation of the \ | |
# server and it's process state. | |
# | |
# processname: nginx | |
# config: /opt/nginx/conf/nginx.conf | |
# pidfile: /acronymlabs/server/nginx.pid | |
# Provides: nginx | |
# | |
# Author: Jason Giedymin | |
# <jason.giedymin AT acronymlabs.com>. | |
# | |
# Version: 1.0 01-Apr-2009 jason.giedymin AT gmail.com | |
# Notes: nginx init.d script for Ubuntu 8.10 and lesser versions. | |
# | |
#------------------------------------------------------------------------------ | |
# MIT X11 License | |
#------------------------------------------------------------------------------ | |
# | |
# Copyright (c) 2009 Jason Giedymin, http://AcronymLabs.com | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining | |
# a copy of this software and associated documentation files (the | |
# "Software"), to deal in the Software without restriction, including | |
# without limitation the rights to use, copy, modify, merge, publish, | |
# distribute, sublicense, and/or sell copies of the Software, and to | |
# permit persons to whom the Software is furnished to do so, subject to | |
# the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be | |
# included in all copies or substantial portions of the Software. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
#------------------------------------------------------------------------------ | |
#------------------------------------------------------------------------------ | |
# Functions | |
#------------------------------------------------------------------------------ | |
. /lib/lsb/init-functions | |
#------------------------------------------------------------------------------ | |
# Consts | |
#------------------------------------------------------------------------------ | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
DAEMON=/opt/nginx/sbin/nginx | |
PS="nginx" | |
PIDNAME="nginx" #Lets you do $PS-Master or $PS-Slave | |
PIDFILE=$PIDNAME.pid #pid file | |
PIDSPATH=/opt/nginx/logs | |
DESCRIPTION="Nginx Server..." | |
RUNAS=root #user to run as | |
SCRIPT_OK=0 #ala error codes | |
SCRIPT_ERROR=1 #ala error codes | |
TRUE=1 #boolean | |
FALSE=0 #boolean | |
lockfile=/var/lock/subsys/nginx | |
NGINX_CONF_FILE="/opt/nginx/conf/nginx.conf" | |
#------------------------------------------------------------------------------ | |
# Simple Tests | |
#------------------------------------------------------------------------------ | |
#test if nginx is a file and executable | |
test -x $DAEMON || exit 0 | |
# Include nginx defaults if available | |
if [ -f /etc/default/nginx ] ; then | |
. /etc/default/nginx | |
fi | |
#set exit condition | |
#set -e | |
#------------------------------------------------------------------------------ | |
# Functions | |
#------------------------------------------------------------------------------ | |
setFilePerms(){ | |
if [ -f $PIDSPATH/$PIDFILE ]; then | |
chmod -f 400 $PIDSPATH/$PIDFILE | |
fi | |
} | |
configtest() { | |
$DAEMON -t -c $NGINX_CONF_FILE | |
} | |
getPSCount() { | |
return `pgrep -f $PS | wc -l` | |
} | |
isRunning(){ | |
pidof_daemon | |
PID=$? | |
if [ $PID -gt 0 ]; then | |
return 1 | |
else | |
return 0 | |
fi | |
} | |
status(){ | |
isRunning | |
isAlive=$? | |
if [ "${isAlive}" -eq $TRUE ]; then | |
echo "$PIDNAME found running with processes: `pidof $PS`" | |
else | |
echo "$PIDNAME is NOT running." | |
fi | |
} | |
removePIDFile(){ | |
if [ -f $PIDSPATH/PIDFILE ]; then | |
rm -f $PIDSPATH/$PIDFILE | |
fi | |
} | |
start() { | |
log_daemon_msg "Starting $DESCRIPTION" | |
isRunning | |
isAlive=$? | |
if [ "${isAlive}" -eq $TRUE ]; then | |
log_end_msg $SCRIPT_ERROR | |
else | |
start-stop-daemon --start --quiet --chuid $RUNAS --pidfile $PIDSPATH/$PIDFILE --exec $DAEMON | |
setFilePerms | |
log_end_msg $SCRIPT_OK | |
fi | |
} | |
stop() { | |
log_daemon_msg "Stopping $DESCRIPTION" | |
isRunning | |
isAlive=$? | |
if [ "${isAlive}" -eq $TRUE ]; then | |
start-stop-daemon --stop --quiet --pidfile $PIDSPATH/$PIDFILE | |
removePIDFile | |
log_end_msg $SCRIPT_OK | |
else | |
log_end_msg $SCRIPT_ERROR | |
fi | |
} | |
reload() { | |
configtest || return $? | |
log_daemon_msg "Reloading (via HUP) $DESCRIPTION" | |
isRunning | |
if [ $? -eq $TRUE ]; then | |
`killall -HUP $PS` #to be safe | |
log_end_msg $SCRIPT_OK | |
else | |
log_end_msg $SCRIPT_ERROR | |
fi | |
} | |
terminate() { | |
log_daemon_msg "Force terminating (via KILL) $DESCRIPTION" | |
PIDS=`pidof $PS` || true | |
[ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` | |
for i in $PIDS; do | |
if [ "$i" = "$PIDS2" ]; then | |
kill $i | |
removePIDFile | |
fi | |
done | |
log_end_msg $SCRIPT_OK | |
} | |
pidof_daemon() { | |
PIDS=`pidof $PS` || true | |
[ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` | |
for i in $PIDS; do | |
if [ "$i" = "$PIDS2" ]; then | |
return 1 | |
fi | |
done | |
return 0 | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart|force-reload) | |
stop | |
start | |
;; | |
reload) | |
$1 | |
;; | |
status) | |
status | |
;; | |
configtest) | |
$1 | |
;; | |
terminate) | |
$1 | |
;; | |
*) | |
FULLPATH=/etc/init.d/$PIDNAME | |
echo "Usage: $FULLPATH {start|stop|restart|force-reload|status|configtest|terminate}" | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment