Category Archives: Debian

python-virtenv + django


tatico@asgard:~$ mkdir virtenv
tatico@asgard:~$ virtualenv --no-site-packages -p /usr/bin/python2.6 ~/virtenv/
Running virtualenv with interpreter /usr/bin/python2.6
New python executable in /home/tatico/virtenv/bin/python2.6
Also creating executable in /home/tatico/virtenv/bin/python
Installing distribute..................................................................................................................................................................................done.
tatico@asgard:~$ cd virtenv/
tatico@asgard:~/virtenv$ ls
bin include lib
tatico@asgard:~/virtenv$ cd bin/
tatico@asgard:~/virtenv/bin$ ls
activate activate_this.py easy_install easy_install-2.6 pip python python2.6
tatico@asgard:~/virtenv/bin$ cd ..
tatico@asgard:~/virtenv$ source bin/activate
(virtenv)tatico@asgard:~/virtenv$
(virtenv)tatico@asgard:~/virtenv$ python --version
Python 2.6.5+
(virtenv)tatico@asgard:~/virtenv$ python
Python 2.6.5+ (release26-maint, Jul 30 2010, 23:04:10)
[GCC 4.4.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
(virtenv)tatico@asgard:~/virtenv$ pip install django
Downloading/unpacking django
Downloading Django-1.2.3.tar.gz (6.3Mb): 6.3Mb downloaded
Running setup.py egg_info for package django
warning: no files found matching 'django/dispatch/LICENSE.txt'
warning: no files found matching '*' under directory 'examples'
Installing collected packages: django
Running setup.py install for django
changing mode of build/scripts-2.6/django-admin.py from 644 to 755
warning: no files found matching 'django/dispatch/LICENSE.txt'
warning: no files found matching '*' under directory 'examples'
changing mode of /home/tatico/virtenv/bin/django-admin.py to 755
Successfully installed django
Cleaning up...
(virtenv)tatico@asgard:~/virtenv$ deactivate
tatico@asgard:~/virtenv$ ls
bin include lib
tatico@asgard:~/virtenv$ source bin/activate
(virtenv)tatico@asgard:~/virtenv$ django-admin.py
Usage: django-admin.py subcommand [options] [args]

Options:
-v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=all output
--settings=SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
used.
--pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
--traceback Print traceback on exception
--version show program's version number and exit
-h, --help show this help message and exit

Type 'django-admin.py help ' for help on a specific subcommand.

Available subcommands:
cleanup
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
reset
runfcgi
runserver
shell
sql
sqlall
sqlclear
sqlcustom
sqlflush
sqlindexes
sqlinitialdata
sqlreset
sqlsequencereset
startapp
startproject
syncdb
test
testserver
validate
(virtenv)tatico@asgard:~/virtenv$ deactivate
tatico@asgard:~/virtenv$ django-admin.py
tatico@asgard:~/virtenv$ source bin/activate
(virtenv)tatico@asgard:~/virtenv$ django-admin.py testserver
Error: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.
(virtenv)tatico@asgard:~/virtenv$ deactivate

PulseAudio + Gnome in Debian

From the pulseaudio wiki + some googling:

$ apt-get install pulseaudio libao-common paprefs libpulse-mainloop-glib0 pulseaudio-module-jack pavucontrol alsaplayer-alsa pulseaudio-module-hal pulseaudio-module-x11 libgstreamer-plugins-base0.10-0 pulseaudio-module-lirc pulseaudio-utils pulseaudio-module-zeroconf libasound2-plugins padevchooser paman pulseaudio-module-gconf libgconfmm-2.6-1c2 libpulse-browse0 pavumeter libglademm-2.4-1c2a pulseaudio-esound-compat libpulse0 libpulse-dev

$ ln -sf /usr/local/bin/esdcompat /usr/bin/esd

Then, you launch gnome and everything works!

links:
http://forums.debian.net/viewtopic.php?t=12497
http://pulseaudio.org/wiki/PerfectSetup#GNOME

Installing a VPN

Here I will explain how i’ve manageed to have a functional VPN with running Debian as server.
I have Linux and Mac OS X clients(Tunnelblick).
What you will need

  • A public IP
  • debian
  • an editor (vi or vim)
  • this howto
  • frustration proof patienece


- to launch the server:
openvpn --config /etc/openvpn/server.conf --script-security 2 --daemon

- to launch a Linux client:
openvpn --config /etc/openvpn/client.conf --script-security 2 --daemon (Debian, Ubuntu)

– to launch a Mac OS X:
Download and install Tunnelblick

– How to generate client certificates:
one installed, to generate a VPN

#cd /etc/openvpn/easy-rsa/2.0/
#./build-key <client_name>
#cd /etc/openvpn/easy-rsa/2.0/keys/
you will find 3 files named:
- <client_name>.crt
- <client_name>.csr
- <client_name>.key (chmod 500 if not )

make a tarball with those files + ca.crt

This post is not complete. By now, you can follow the open VPN howto.

twisted web file server for ignorant cowboys

To serve files over http, you can install Twisted

apt-get install python-twisted-core python-twisted-web

To launch the web server:

twistd web --path /var/www/ --port 80

To stop the web server:
kill `cat twistd.pid` (on the same directory you launched it)

You will find complete doc at:
http://twistedmatrix.com/documents/current/web/howto/using-twistedweb.html

squirrelmail with postfix – debian

apt-get install courier-imap
http://www.debian-administration.org/articles/243

Thing 1:

http://www.squirrelmail.org/docs/admin/admin-3.html

Thing 2:
/usr/share/squirrelmail/config/conf.pl

posfix with debian

apt-get install postfix
http://wiki.debian.org/Postfix
http://www.debian-administration.org/articles/243

With an edited sample of my /etc/aliases
# /etc/aliases
root: user1@dragon-tortuga.net #all mail sento to root@dragon-tortuga.net will end in my mailbox
mailer-daemon: postmaster #all mail sent to mail-daemon will go to postmaster, wich is root which is user1 (me)
postmaster: root
hostmaster: root
webmaster: root
www: root
ftp: root
abuse: root
user1: user1@dragon-tortuga.net
my.name: user1 #an alias to have more a more formal mail address
user2: user2@sutercnologico.net
user2.realname: user2
user3: user3@dragon-tortuga.net
—————
once you have finished editting this file, run
newaliases
invoke-rc.d postfix reload

This is a very basic set up that uses system accounts with all pros and cons.

the OSes

why pay for something that is too complicated and will finally not work?
why buying French cars?
why buying Chinese tools? (In previous both cases I’m talking ’bout the cheap ones)
why hiring Chilean workers?
None of this will work, and it is usually a little bit more expensive that it was calculated.

Then, that’s when you decide to go for the big American expensive, energy eager, top hardware, obsolete technology muscle car that will run flawlessly for 30 years unless you forgot fueling it (every Wednesday).
Why buying an American OS that is crap? And expensive! and that will run flawless until you turn on your computer.
For almost the same money you can by a true OS that is as sexy as an OS can be, and it works, and it’s American too.
If all of this is too expensive, instead installing pirate Windows copies, tell you geek friends to install Linux (there is an aberration called Ubuntu (Ooh-boohn- tooh) that works out of the box, you can even choose you desktop environment painlessly.
so, why?
because everybody else does?