Skip to content

Instantly share code, notes, and snippets.

@jbowles
Created June 12, 2012 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jbowles/2918808 to your computer and use it in GitHub Desktop.
Save jbowles/2918808 to your computer and use it in GitHub Desktop.
Install Node.js on CentOS
# this is a work in progress!!
######################################################
# I'm on a CentOS dev VM provided by my company #
######################################################
#uname -a
#Linux ------- 2.6.18-128.el5 ----- x86_64 x86_64 x86_64 GNU/Linux
# OR
#cat /proc/version
#Linux version 2.6.18-128.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)) ----
######################################################
# Upgrade all package and Install/Upgrade Python 2.7 #
######################################################
## The version of CentOS I have only upgrades python to
#python -V => Python 2.4.3
# and node.js needs at least 2.6
####see: http://wiki.mediatemple.net/w/CentOS_5.5_(VE)_Server_Build_-_Django_1.3,_Python_2.7
#####BUT also see this for a more RPM dependent way of installing 2.7: http://www.chrisabernethy.com/installing-node-js-on-centos-redhat/
#sudo yum upgrade
# You may want to also see this post about setting up a more flexible python environment using
# virtualenv (similar to Ruby Version Manager that lets you install and switch between python versions)
# http://jbowles.github.com/blog/2012/04/22/python/
#wget http://www.python.org/ftp/python/2.7/Python-2.7.tar.bz2
#tar -xvjf Python-2.7.tar.bz2
#cd Python-2.7
## NOTICE, I'M NOT PASSING ANY PARTICULAR OPTIONS, YOU MIGHT WANT TO SEE WHAT OPTIONS YOU MAY WANT/NEED
## I'M ONLY SETTING A INSTALL DIRECTORY SO THAT I CAN ALIAS MY PATHS LATER ON
#./configure --prefix=/usr/local/python2.7
#Because of a mod_wsgi error that you will run into later, you should install the following dependencies before installing python:
# cd
# sudo yum install readline-devel #you should already have this
# sudo yum install gdbm-devel
# sudo yum install sqlite-devel
###TODO; find the right yum libraries for:
#Python build finished, but the necessary bits to build these modules were not found:
#_bsddb _curses _curses_panel
#_tkinter bsddb185 bz2
#dl imageop sunaudiodev
## RESULT:
# python build was successful but you wont be able to use the python modules that require external libraries mentioned in this message. Since we really just need Python-2.7 for install node.js I'll leave this for now.
# Doubly ensure that you makefile is clean and up to date (though this isn't really necessary)
# cd Python-2.7
# make clean
# ./configure --prefix=/usr/local/python2.7
#Assuming everything went well, build and install python 2.7
# sudo make
# sudo make install
#vim ~/.bashrc
#alias python='/usr/local/python2.7/bin/python'
#You might need to source your bashrc
# source ~/.bashrc
##Then you should be able to do this
#python
#Python 2.7 (r27:82500, Jun 12 2012, 05:02:59)
#[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
#Type "help", "copyright", "credits" or "license" for more information.
# weeeeeeeeeeee!
######################################################
# Install/Upgrade Node.js #
######################################################
###see: http://www.chrisabernethy.com/installing-node-js-on-centos-redhat/
# OR
###see: https://github.com/joyent/node/wiki/Installation
##Make sure you have a g++ compiler
#sudo yum install gcc-c++
###### GET THE NODE VERSION YOU WANT #######
#wget http://nodejs.org/dist/v0.6.19/node-v0.6.19.tar.gz
#tar -zxf node-v0.6.19.tar.gz #Download this from nodejs.org
#cd node-v0.6.19
#./configure
#sudo make
#sudo make install
#check it
#node -v => v0.6.19
####### YAY!! #####
######################################################
# Install Redis #
######################################################
## Since I like using Redis I'll add this here too.
#wget http://redis.googlecode.com/files/redis-2.4.14.tar.gz
#tar xzf redis-2.4.14.tar.gz
#cd redis-2.4.14
#make
#Then just
#src/redis-server
#And you'll see something like
#[25157] 12 Jun 06:39:52 - 0 clients connected (0 slaves), 717496 bytes in use
#Now move the binaries so we have access to them:
#sudo mkdir /etc/redis /var/lib/redis
#sudo cp src/redis-server src/redis-cli /usr/local/bin/
#Copy config file to etc
#sudo cp redis.conf /etc/redis/
#See redis.io for configuration settings, but these should be sane enough updates to existing config:
#sudo vim /etc/redis.cinf
#daemonize yes
#logfile /var/log/redis.log
#dir /var/lib/redis
#wget https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
#Open the file we just downloaded
#vim redis-server
#redis="/usr/local/bin/redis-server" ## or wherever you put redis-server
#sudo mv redis-server /etc/init.d/
#chmod 755 /etc/init.d/redis-server
#as root
#service redis-server start
##check http://www.saltwebsites.com/2012/install-redis-245-service-centos-6
## for some more complicated setup options with
#Go ahead and test that Redis really working
#redis-cli
#redis 127.0.0.1:6379> set test yes
#OK
#redis 127.0.0.1:6379> get test
#"yes"
#redis 127.0.0.1:6379> exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment