Category: Linux


Install Python2.7.2, apache, wsgi on Ubuntu 10.04 LTS

September 27th, 2011 — 7:30pm

My initial attept failed miserably as you can see my post from here

After bunch of help from many intelligent people I successfully setup Python2.7.2, apache, wsgi for Ubunut 10.04 LTS

++++++++++++++++++++++++++++++
+ References:
+ 1. How to install 2.7 comment made by Alen here
+ 2. How to install wsgi
++++

# ==== Setup Ubuntu 10.04 on VMWare # on server:
# install basic stuff…
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install openssh-server # only if you want to use ssh
sudo apt-get install vim # only if you like vim….
sudo apt-get install libpq-dev
sudo apt-get install curl # only if you like over wget.. I am just so used to curl over wget since os-x (my dev machine) doesn’t have wget
sudo apt-get install build-essential

##### # Install Python 2.7.2 #####

sudo vim /etc/apt/sources.list

# add the following 2 lines at the bottom of the file:

deb http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu lucid main
deb-src http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu lucid main

# issue the following command:

sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys DB82666C
sudo apt-get update
sudo apt-get install python2.7 python2.7-dev

# verify instllation

which python >>/usr/local/bin/python
python -V >> Python 2.7.2

# verify the linkage

ldd /usr/local/bin/python2.7

##### # Install Apache #####
# you need to install apache2-dev for wsgi installation

sudo apt-get install apache2 apache2-dev

# then add domain.

sudo vim /etc/apache2/conf.d/fqdn
# add: “ServerName localhost” without quotes

################################
# install wsgi
################################
# if wsgi is installed via apt-get then purge it:

sudo apt-get purge libapache2-mod-wsgi

mkdir tmp # or wherever you want to compile
cd tmp
curl -O http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz tar xzf mod_wsgi-3.3.tar.gz
rm mod_wsgi-3.3.tar.gz
cd mod_wsgi-3.3 ./configure –with-python=/usr/local/bin/python make sudo make install
# the load declaration for the module needs to go wsgi.load
sudo vim /etc/apache2/mods-available/wsgi.load
# then add the following line: “LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so” without quotes
# Then you have to activate the wsgi module with:
sudo a2enmod wsgi

# That’s it!

Comment » | apache, Bash Shell, Django, Linux, mod_wsgi, Python, Ubuntu

Open SSH (Port 22) on Fedora 15

August 31st, 2011 — 6:13pm

So Fedora 15 with GNOME 3 is very beautiful. I really like it. Mac’s spotlight like search is +1.

I had a bit hard time accessing my macbook to Fedora 15 via SSH so I thought I should share this with you.

1. Modify sshd_conf file (/etc/ssh/sshd_config): Find Line “Port 22″ and uncomment the line

2. Restart sshd service by issuing 

$ service sshd stop$ service sshd restart

3. Let’s check to see if sshd is running

$ service sshd status# or you could$ ps aux|grep sshd

3. Okay, let’s test it. Go to client (my case is my macbook) and issued $ ssh username@ip_address Connect then I got “Connection Refused” Error. So looks like I need to mess with firewall (iptables).

3.1 Edit file /etc/sysconfig/iptables and add the following line. Note that this should go above the first instance of -A INPUT otherwise other rule might block you as rule will will be read from top down and stops as soon as it meets the rule.

# to open ssh
-A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
3.2. Save and close the file and restart iptables as follows:
$ service iptables restart
4. Then try this again: $ ssh username@ip_address Hopefully you are connected….

 

Comment » | Fedora, Linux, System Admin

Back to top