2012年2月28日 星期二

2012年2月9日 星期四

Howto install python easy_install on ubuntu 11.10

easy_install will help installing python modules and here is how we can install it on Ubuntu 11.10

root@ubuntu:~# apt-get install python-setuptools
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following extra packages will be installed:
  python-pkg-resources
Suggested packages:
  python-distribute python-distribute-doc
The following NEW packages will be installed:
  python-setuptools
The following packages will be upgraded:
  python-pkg-resources
1 upgraded, 1 newly installed, 0 to remove and 61 not upgraded.
Need to get 274 kB of archives.
After this operation, 1,061 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ oneiric-updates/main python-pkg-resources all 0.6.16-1ubuntu0.1 [62.7 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ oneiric-updates/main python-setuptools all 0.6.16-1ubuntu0.1 [212 kB]
Fetched 274 kB in 0s (393 kB/s)       
(Reading database ... 52429 files and directories currently installed.)
Preparing to replace python-pkg-resources 0.6.16-1 (using .../python-pkg-resources_0.6.16-1ubuntu0.1_all.deb) ...
Unpacking replacement python-pkg-resources ...
Selecting previously deselected package python-setuptools.
Unpacking python-setuptools (from .../python-setuptools_0.6.16-1ubuntu0.1_all.deb) ...
Setting up python-pkg-resources (0.6.16-1ubuntu0.1) ...
Setting up python-setuptools (0.6.16-1ubuntu0.1) ...


So how to use easy_install? We are going to install python module paste to illustrate the idea.


root@ubuntu:~# easy_install -U paste
Searching for paste
Reading http://pypi.python.org/simple/paste/
Reading http://pythonpaste.org
Best match: Paste 1.7.5.1
Downloading http://pypi.python.org/packages/source/P/Paste/Paste-1.7.5.1.tar.gz#md5=7ea5fabed7dca48eb46dc613c4b6c4ed
Processing Paste-1.7.5.1.tar.gz
Running Paste-1.7.5.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-I0cKPn/Paste-1.7.5.1/egg-dist-tmp-cdqwYD
warning: no previously-included files matching '*' found under directory 'docs/_build/_sources'
Adding Paste 1.7.5.1 to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/Paste-1.7.5.1-py2.7.egg
Processing dependencies for paste
Finished processing dependencies for paste

2012年2月5日 星期日

Reset root password for Ubuntu 10.04 LTS

Oops, I am trying to reset root password for a server with Ubuntu 10.04 LTS but the grub menu just doesn't come up. So it turns out the interactive grub menu is  disabled since GRUB2. And what we need to do to get into the GRUB menu is to hold the shift key during boot. According official documentation, pressing the ESC key may also display the menu sometime too (Reference here)

So once you get into the menu, move your text cursor to the end of the line starting with "LINUX", append "init=/bin/bash panic=3" and press with CTRL+X to start booting to single user mode.

Once you are booted to single user mode, you will be shown wilt login prompt 

root@(none)~# 

You could now type "mount -o remount,rw /" to remount / directory to change the root mount from read-only to read-writable. Now you could issue "password" command to update the password on this server.