Floating bits
Another IT/telecom dump corner
Tuesday, March 27, 2012
RHEL stop x-server
Wednesday, March 14, 2012
Simple VPN via SSH using SHUTTLE
What if your workplace doesnt offer VPN services? Or the remote is just your home, you won't install a VPN server. Or simply you wouldnt like to setup a vpn client!
Shuttle comes to help you:
"What's sshuttle? It's a Python app that makes use of SSH to create a on-the-fly VPN between your Linux, BSD, or Mac OS X machine and a remote system that has SSH access and Python."
https://github.com/apenwarr/sshuttle
This is how you use it:
If you would also like your DNS queries to be proxied through the DNS server of the server you are connect to:
./sshuttle --dns -vr username@sshserver 0/0
"Any TCP session you initiate to one of the proxied IP addresses will be captured by sshuttle and sent over an ssh session to the remote copy of sshuttle, which will then regenerate the connection on that end, and funnel the data back and forth through ssh. "
Thursday, October 6, 2011
Installing Django over Zend Server with mod_wsgi
We will guide you through the installation of a web server based RHEL 5 to run Django websites using Apache 2 (from Zend Server CE), Python 2.7 with virtualenv, linked by an WSGI interface.
The Tools
Zend Server CE
For our development environment, we are using the Zend Server CE, which besides coming with an administration interface out-of-the-box, it's a complete and stable web server stack, offering apache 2, php, lighttpd, etc.
The installer guides you throw a few installation steps and which, in the end, puts your new server up and running and tells you the address where the hosted pages and the administration page are available, tipically https://localhost:10088 and https://localhost:10082 respectively.
Apart from the functional point of view, when using the installer, Zend Server CE completely installs under the directory you've chosen. That means minimal system modification and better organization.
Python 2.7 and Virtualenv
We want to take advantage of the new features and performance improvements of Python 2.7. Unfortunately RHEL5 ships with Python 2.4 only. Python 2.7 was installed from source in it's own directory, leaving system Python untouched, while alias enable transparent access to the latest binaries.
Furthermore, in order to run out web page with it's dedicated python libraries, we used Virtualenv.
mod_wsgi
It implements a simple to use Apache module which can host any Python application which supports the Python WSGI interface, In our case DJango.
- Download it from http://www.zend.com/en/products/server-ce/downloads. Choose the tar.gz file.
- Extract it
$ tar -xzf - Install it
$ cd ZendServer...
$ ./install.sh
- Install pysqlite-devel
$yum install sqlite-devel - Installing Python 2.7 into alternate location since we don’t want to break Centos 5.6 (yum) that uses Python 2.4 $ cd /usr/src/python2.7/
- Creating symbolic link to the alternate Python version $ ln -s /opt/python2.7/bin/python /usr/bin/python2.7
- Let’s test if new Python version works/usr/bin/python2.7
- Now we need to install Python setup-tools cd /usr/src/python2.7/
- Installing virtualenv to our Python 2.7 cd /opt/python2.7/bin
- Create Python links and alias to newest version (optional but recommended)
$ ln -s /usr/local/python2.7/bin/easy_install-2.7 /usr/bin/easy_install-2.7
$ ln -s /usr/local/python2.7/bin/easy_install-2.7 /usr/bin/easy_install-2.7
$ ln -s /usr/local/python2.7/bin/virtualenv-2.7 /usr/bin/virtualenv-2.7
$ echo "alias python=python2.7
alias pip=pip-2.7
alias easy_install=easy_install-2.7
alias virtualenv=virtualenv-2.7" >> ~/.bashrc
$ source ~/.bashrc
$ wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
$ tar zxvf Python-2.7.2.tgz
$ cd Python-2.7.2
$ ./configure --prefix=/opt/python2.7 --with-threads --enable-shared
$ make
$ make install
$ echo '/opt/python2.7/lib'>> /etc/ld.so.conf.d/opt-python2.7.conf
$ ldconfig
If successful you will see something like this:
Python 2.7.2 (default, Sep 3 2011, 18:28:42)[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
press control+D to exit
wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
sh setuptools-0.6c11-py2.7.egg --prefix=/opt/python2.7
./easy_install virtualenv
- $ cd /opt/python2.7/lib/python2.7/config/
$ ln -s ../../libpython2.7.so
$ cd /usr/src/python2.7/
$ wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
$ tar zxvf mod_wsgi-3.3.tar.gz
$ cd mod_wsgi-3.3
$ ./configure --with-python=/opt/python2.7/bin/python
$ make
$ make install
- Create a directory structure for static/php pages, wsgi scripts and django sites
$ mkdir /var/www
$ mkdir /var/www/html
$ mkdir /var/www/wsgi-scripts
$ mkdir /var/www/sites - Create python virtual environment for django websites and activate it
$ mkdir /usr/local/python2.7/virtualenvs; cd /usr/local/python2.7/virtualenvs
$ virtualenv --no-site-packages --distribute websites
$ source websites/bin/activate - Install core Django and required site libraries
$ pip install django
$ wget http://bitbucket.org/jespern/django-piston/downloads/django-piston-0.2.2.tar.gz
$ tar -xzf django-piston-0.2.2.tar.gz
$ cd django-piston
$ python setup.py install
$ pip install django-grappelli
$ pip install django-filebrowser - Configure mod_wsgi.
Create file wsgi.conf under /usr/local/zend/apache2/conf.d/ with contents:
#The aim of mod_wsgi is to implement a simple to use Apache module
#which can host any Python application which supports the Python WSGI interface.
#
LoadModule wsgi_module modules/mod_wsgi.so
AddHandler wsgi-script .wsgi
WSGIPythonHome /usr/local/python2.7/virtualenvs/websites
######## Configuration entries ##############
Order allow,deny
Allow from all
# WSGI aliases
WSGIScriptAlias /radioclass /var/www/wsgi-scripts/radioclass.wsgi - Create the website wsgi script for the site
create file as specified before ( /var/www/wsgi-scripts/radioclass.wsgi ) with contents:
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
ys.path.insert(0, '/var/www/sites/radioclass/')
#Load WSGI Handler
from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler() - Create (or move) your django website for the specified directory (/var/www/sites/radioclass/)
$ cd /var/www/sites/
$ django-admin startproject radioclass - Apache settings and reload
check /usr/local/zend/apache2/conf/httpd.conf, and eventually change ListenPort to 80
restart zend
$ /usr/local/zend/bin/zendctl restart
Monday, January 17, 2011
IrDA/Infrared working on hp compaq nx7000 series with Ubuntu
4.10. IrDA
The nx7010 has a FIR (Fast IrDA) port that supports speeds up to 4 Mbps. The smsc-ircc2 module that supports it is experimental and not included in the default Fedora kernel, so you'll have to set the SMC_IRCC_FIR
kernel option, and recompile the kernel. The only problem is that the BIOS does not initialize this chip, so you'll need the SMCINIT utility to do this for you.
To get this to work you first need to download and compile tosh1800-smcinit according to the instructions given on the linked page.
- Install irda-utils and setserial packages.
The /etc/sysconfig/irda
file should look like this:
IRDA=yes DEVICE=irda0 DISCOVERY=yes
To /etc/modprobe.conf
add the following lines:
install smsc-ircc2 /usr/local/sbin/tosh1800-smcinit; /sbin/modprobe --ignore-install smsc-ircc2 alias irda0 smsc-ircc2
Now you can start IrDA as root via irattach irda0.
DEBUG: Try (re)start ir-util service and check the contents of dmesg
Thursday, December 9, 2010
Propel and Oracle - Installing from scratch on Ubuntu 10.04 / 10.10
Nevertheless putting everything up and running can be quite tricky: it depends on phing, php cli, oracle drivers, etc, which are not ready out of the box.
After many hours reading tutorials and source code, and many failed attempts, I was finally able to put it running, which I will explain below.
Rule #1: Don't reinvent the wheel!
There is a crucial element in this story: the database driver. Installing Oracle Call Interface (OCI) and insert all oci modules into php can be tricky. Therefore, if you are installing from scratch I'd HIGHLY recommend to use Zend Server CE, the successor of ZendCore. This is the procedure described in this guide.
If you're willing to do it by hand, I'd suggest you to visit the following resources:
https://help.ubuntu.com/community/PHPOracle
Step #1: Install ZendServer (apache+php+DB drivers)
Go to http://www.zend.com/en/products/server-ce/downloads and download the latest ZendServer CE. (it's free). You could also try setting up a deb source for apt-get, but in the case of Ubuntu 10.10 this didn't work.
Locate and extract the package:
tar -xzf ZendServer-CE-php-xxxx
Move in the newly created directory and begin installation:
cd ZendServerxxxx
sudo ./install.sh
Great! your Apache server should be up and running. Refer to the printed INSTALLATION SUMMARY message to know your Zend administration page address. By default: https://localhost:10082/ZendServer
In the Administration page go to Server Setup -> extensions and check whether oci8 and pdo_oci extensions are "ON". Otherwise your system is probably missing libaiol. In such case install it:
sudo apt-get install libaio1Back to the administration page hit "Restart PHP".
Finally we need to add php binaries and libraries to the path. In order to do that, append the following lines to the end of your /etc/profile file (check the path according to your installation).
PATH=$PATH:/usr/local/zend/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/zend/lib
and load the new settings:
source /etc/profile
Step 2: Installing and fixing propel
The easiest way to install propel is, without doubt, using php-pear
ZendServer will also provide this utility. If you are installing the system by hand make sure you have php-pear installed before proceeding.
In order to install the Propel packages, you must add new channels from where pear will fetch it and its dependencies:
pear channel-discover pear.propelorm.org
pear channel-discover pear.phing.info
Install propel
pear install -a propel/propel_generator
pear install -a propel/propel_runtime
After the installation is finished, there are two details which must not be forgotten.
In first place, add propel_generator library folder to php include path. The easiest way is to through the zend administration page, under Server Setup->Directives->Paths and directories. Add to the box the path of the libraries, separating with ":", typically:
Restart PHP
Further, the current version of phing doesnt support multiple classpaths, which makes Propel to raise the following error every-time it's executed:
Swallowing exception: Could not create task of type: propel-sql [wrapped: Could not instantiate class PropelSQLTask, even though a class was specified. (Make sure that the specified class file contains a class with the correct name.)]
To correct this, edit propel_gen config file:
vi /usr/local/zend/share/pear/data/propel_generator/build-propel.xml
Locate the block
pathelement dir="${propel.home}/lib/"/
pathelement dir="${propel.project.dir}/"/ --
/path
and transform it into
pathelement dir="${propel.home}/lib/"/
!-- pathelement dir="${propel.project.dir}/"/ --
/path
(note the commented second pathelement entry)
After this you should be able to run propel_gen
Step 3: Connecting to the database
The last step is to define the connection to the database. In this case I'll show an example considering a connection to a remote server. Just be sure all php oci modules are loaded and working.
Each propel project has its configurations in a build.properties file, including the connection to the database.
In case of oracle drivers, one must refer to the system OCI drivers, although we must generate Oracle like queries.
Please provide the following details, replacing
propel.project = {proj name}
# The Propel driver to use for generating SQL, etc.
propel.database = oracle
propel.database.driver = oci
#tnsnames entry
#propel.database.url = oci:dbname={user}@{DBNAME}/{SID}
#Full qualified conn string (no need for TNSNAMES)
propel.database.url = oci:dbname=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={db_server})(PORT={db_port})))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME={SID})))
propel.database.creole.url = ${propel.database.url}
propel.database.user = {user}
propel.database.password = {passwd}
Thursday, October 28, 2010
Unix File-Systems: why EXT4?
So, if you are or ever been in doubt, I assume you have good reasons to not think again in the same issue. EXT4 is there and is actually faster for most disk usage patterns.
Tuesday, September 28, 2010
The device mess!
Tuesday, June 22, 2010
Resume your remote SSH sessions
- Remote login (normally) to your server, from windows, linux, whatever client...
- run "screen" (make sure it's installed on the server)
There are screens on:
2477.pts-0.server1 (Detached)
2522.pts-0.server1 (Detached)
2 Sockets in /var/run/screen/S-root.
- Ctrl a c - Creates a new screen session so that you can use more than one screen session at once.
- Ctrl a n - Switches to the next screen session (if you use more than one).
- Ctrl a p - Switches to the previous screen session (if you use more than one).
- Ctrl a d - Detaches a screen session (without killing the processes in it - they continue).
To close a screen session where all tasks are finished you can type Ctrl-D
Wednesday, March 24, 2010
VirtualBox Raw partition - Windows Host Linux Guest
- VBoxManage.exe internalcommands listpartitions -rawdisk \\.\PhysicalDrive0
1 0x07 0 /32 /33 13 /163/19 100 2048
2 0x07 13 /163/20 1023/239/63 20480 206848
3 0x07 1023/239/63 1023/239/63 26410 42149888
4 0x83 1023/239/63 1023/239/63 10239 96238800
- VBoxManage.exe internalcommands createrawvmdk -filename e:\vm\ubunturaw.vmdk -rawdisk \\.\PhysicalDrive0 -register -partitions 4 -mbr c:\linux.bin
Tuesday, March 2, 2010
NIC Bonding/Teaming
This means both will have the same MAC address. Depending on the protocol, you might not even have to change router configuration, and several Linux distributions have good support on that.
Here I provide links to some how-to’s on enabing NIC bonding for some of the most popular Linux distributions. Windows users don’t have the same luck, unless the NIC manufacturer had provided some utility for this specific purpose.
In all the cases an additional kernel module has to be loaded (bonding). Debian systems make use of the ifenslave utility.
RedHat Linux Enterprise 4
http://www.cyberciti.biz/tips/linux-bond-or-team-multiple-network-interfaces-nic-into-single-interface.html
Debian
http://www.5dollarwhitebox.org/wiki/index.php/Howtos_NIC_Bonding_Debian
http://www.howtoforge.com/nic-bonding-on-debian-lenny
Thursday, January 14, 2010
HP zt3000 / Compaq nx7000 and Mobility Radeon 9200
It seems like many people are having a lot of problems getting their 9200 video drivers to work on their zt3000 and nx7000 laptops.
Starting around Catalyst 5.6, something changed in the original ATI driver code that stopped working with the laptop's LCD screen.
The newer drivers actually work but the laptop LCD either has a strange color behavior, or it just shows nothing (like in my case).
Solution? Just use a modded Catalyst 5.6 or earlier.
This should be sufficient for most zt3000/nx7000 users... if they're running on XP. If you're trying to run Vista, you can still install them by downloaded the modded drivers install package then enabling Windows XP SP2 compatibility mode.
You can also try Omega Catalyst drivers.
Read more: HP zt3000 / Compaq nx7000 and Mobility 9200
Tuesday, December 15, 2009
Home SVN Server - Authentication with mod_dav_svn
This tiny overview is not going under much detail about installing the system, instead it reminds you (and myself) some post-installation steps you should not forget in order everything to work smoothly, namely access via apache server (mod_dav_svn).
First: Install the svn package (in ubuntu the package “subversion” comes already with repository administration commands)
Second: Install the libapache2-svn package with apt-get.
Third: Config mod_dav_svn. Go to /etc/apache2/mods-available and find dav_svn.load. Check inside if both apache modules are being loaded (i.e. both lines are uncommented).
Then open dav_svn.conf and you have to configure certain parameters, like the hard disk location where your svn repository will actually reside. Luckily this file is already well documented, but the common settings are as follow:
<Location /svn> –> Tells apache the url it should reserve for SVN. In this case http://your_server/svn will point to our repository, which you use with your svn client.
SVNParentPath /var/svn –> Tells Apache/mod_dav where all svn repositories reside.
Create the repository location and give it permissions.
(remember, when you commit apache will WRITE information for you, so it must have permission to do so)
> mkdir /var/svn
> chown www-data /var/svn –R
No go and create your first repo!
>svnadmin create /var/svn/
The following steps are needed if you want apache to require authentication when users try to commit and or read.
Back to dav_svn.conf
First tell apache “Hey! I want some authentication, and I’ll store users information on … (the file path)”:
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
This will require authentication for every access. If you want to make it public readable add this trick:
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
Now just create your first user:
> htpasswd -c /etc/apache2/dav_svn.passwd your_first_svn_user
To add more users you just skip the –c (create) parameter.
Monday, December 7, 2009
Public DNS server from google
Google seems to be broadening their service provisioning with the introduction of a “Public DNS service”.
If it’s true DNS plays an essential role in the internet, it’s also true it introduces already a significant overhead. Google considers the service can be improved and therefore launches its approach, which they claim it’s faster, more secure and needs no redirection (less resolving jumps).
Details on performance are available at the google page: http://code.google.com/speed/public-dns/docs/performance.html
I’m temped to give it a try. Free, simple to try (and remember). Just point your dns server addresses to 8.8.8.8 and 8.8.4.4. Feedback is encouraged! :)
Public page: http://code.google.com/speed/public-dns/
Wednesday, November 25, 2009
Why store ISOs if you can Mount zip?
Have you ever stored CD images (usually .iso files) on a DVD or hard-drive, just to get rid of the old & slow media? Then you could, of course, mount the image to a virtual drive and you’re done!
Have you ever thought “damn, this ISO could be smaller…” or “this whole bunch of files were better in a single file. Do I have to create an ISO?”
Well, the actual question you’d like to ask is “Can I mount a standard format compressed archive file?” What about zip? Yes, mount zip would be great!
And you know what? It’s as straight-forward as downloading a small piece of software for that.
There’s winMount (commercial), but for free we can get Prismo File Mount: http://www.pismotechnic.com/download/
It supports ISO, ZIP, CISO, CFS, ISZ, DAA… etc. Probably enough for your daily tasks… :)
Monday, November 16, 2009
Linux monitor file updates
This is a very handy command, mostly if you are doing some system changes and you need to monitor a log file.
Like me, many people know it's possible but have forgotten how. Simply use tail!
tail –f <file>
For those who didn't know, it checks for new lines in the file and prints them to standard output.
Nice, isn't it?
Sunday, November 15, 2009
Deluge 1.2 on Ubuntu Hardy
Torrent clients are must-have applications nowadays. There are dozens of clients around, but the average user will look for a simple yet fast and intuitive one.
As a Window user I’m a fan of uTorrent, which is well known by its quality and simplicity. Unfortunately, when it comes to Linux, there’s no uTorrent. After following some discussions between torrent clients for Ubuntu1, I finally decided going to Deluge. It’s said to be fast, simple, good-looking and comes with a web interface.
Those who read previous articles may have noticed I’m building a minimal server system using Ubuntu Hardy (8.04) and Deluge characteristics were about the requirements I had in mind, principally the web-interface for controlling it remotely.
So I went straight to the shell and apt-get install deluge… What?? it doesn’t exist?
A little search through packages.ubuntu.com revealed it’s been only available from Ubuntu Jaunty afterwards.
Further looking into Deluge doc, I could find they provide it via a third party repository, at launchpad:
deb http://ppa.launchpad.net/deluge-team/ubuntu <distribution> main universe
working for distribution feisty, gutsy, hardy, intrepid or jaunty. Good! :)
The steps are:
- Add the line to /etc/apt/sources.list, replacing <distribution> with hardy or one of the other dists.
- apt-get update. An error will raise saying some “signatures couldn't be verified”. Please copy the key at the end of this line to be used in the next step2
- Add the key to apt with the command:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <key_here> - apt-get update. Now everything should go fine.
- Now the nice command. apt-get install deluge
You may prefer to install just the daemon and then the web interface. Go for the deluge-core and deluge-web packages.
It’s also a good idea to create a rc startup script so deluge starts automatically at system startup. Luckily someone already thought about that. Give a look at:http://dev.deluge-torrent.info/wiki/UserGuide/InitScript
And that’s it!
1- http://ubuntuforums.org/showthread.php?t=213713
2- https://help.launchpad.net/Packaging/PPA/InstallingSoftware
Tuesday, November 10, 2009
Dyndns in Ubuntu/Debian
sudo apt-get install ipcheck
ipcheck -r checkip.dyndns.org:8245 \
$USERNAME $PASSWORD $HOSTNAME
For details refer to the original article:
http://blog.patrick-morgan.net/2007/05/dyndns.html
Loads of Linux Info
Monday, November 9, 2009
VMWare 2.0 on Ubuntu 8.04 LTS (minimal)
This small How-to contains the steps to install a virtualization host with VMWare 2.0 on a minimal ubuntu installation.
Ubuntu version was Server Jeos. Yep, it’s intended for virtual machines, but it works perfectly on old standard hardware (like my PIII).
Run the following command to install some necessary packages:
sudo apt-get install linux-headers-`uname -r` build-essential xinetd
Then go to the location where you saved the VMware Server .tar.gz, unpack the file and run the installer:
tar xvfz VMware-server-*.tar.gz
cd vmware-server-distrib
sudo ./vmware-install.pl
The installer will ask you a lot of questions. You can always accept the default values simply by hitting
When the installer asks you
In which directory do you want to keep your virtual machine files?
[/var/lib/vmware/Virtual Machines]
you can either accept the default value or specify a location that has enough free space to store your virtual machines.
At the end of the installation, you will be asked to enter a serial number:
Please enter your 20-character serial number.
Type XXXXX-XXXXX-XXXXX-XXXXX or 'Enter' to cancel:
Fill in your serial number for VMware Server.
After the successful installation, you can delete the VMware Server download file and the installation directory:
cd /home/falko/Desktop
rm -f VMware-server*
rm -fr vmware-server-distrib/
If you have accepted all default values during the installation, root is now the VMware Server login name.
You can access the management interface over HTTPS (https://
The result was a charming VMServer running occupying 90MB of RAM. Impressive!
For the full step-by-step version (Ubuntu Desktop) check:
http://www.howtoforge.com/how-to-install-vmware-server-2-on-an-ubuntu-8.04-desktop
Friday, November 6, 2009
Minimal Ubuntu installation
- It's a fully rocking ubuntu
- You install it using a running system with debootstrap
- There's a good tutorial on http://www.howtoforge.com/minimal-ubuntu-8.04-server-install
- Download the Ubuntu Minimal and follow the steps. Get iso from https://help.ubuntu.com/community/Installation/MinimalCD
- Get the Alternate CD and choose "Install a command-line system.". Here's a good tutorial: https://help.ubuntu.com/community/Installation/LowMemorySystems
UPDATE: If you’re installing Ubuntu on a plain old machine, you might want to try Ubuntu JeOS. It’s ubuntu server version intended to run on a virtual machine. As so, it comes only with the absolutely essential drivers and applications.
After installation (very simple, GUI guided) it occupied some 300MB.