ipython setup on windows
Your life on windows platform will be much more convenient with ipython. Here is a short memo to setup ipython with enhanced console.
install python
Download current python installer. Python 3.3.1 seems to be one for now.
PATH environment variable
Append “C:Python33” to the end of PATH environment variable, so that one call python.
easy_install & pip
Obtain install script of easy_install and launch it for installation.
$ python ez_setup.py
Append script folder, “C:Python33Scripts” to PATH environment variable as well. Now you can call easy_install.
Then install pip by easy_install.
$ easy_install pip
pyreadline
ipython requires pyreadline package, so install pyreadline.
$ pip install pyreadline
ipython
Now it’s ready for ipython installation.
$ pip install ipython
console enhancement
Install console enhancement. You can obtain current binary from project page.
Put it under, say, C:Console2 folder. And add this path to PATH environment variable so that you can start by calling “console”.
public key authentication
Sometimes you would like to login remote system without password authentication. You can make use of public key authentication for this sake.
Here is a short memo to set up local & remote system.
Let us generate rsa key in case that you have none on localhost.
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (~/.ssh/id_rsa): <ENTER>
Enter passphrase (empty for no passphrase): <ENTER>
Enter same passphrase again: <ENTER>
Your identification has been saved in ~/.ssh/id_rsa.
Your public key has been saved in ~/.ssh/id_rsa.pub.
The key fingerprint is:
ab:6b:44:71:2f:48:22:09:85:d2:1b:18:a5:93:03:97 USER@HOST
As seen, private key (id_rsa) and public key (id_rsa.pub) is generated respectively.
$ file .ssh/*
.ssh/id_rsa: PEM RSA private key
.ssh/id_rsa.pub: OpenSSH RSA public key
.ssh/known_hosts: ASCII text
Now create .ssh directory on target host.
$ ssh USER@TARGET_HOST mkdir -p .ssh
Copy public key of localhost onto remote target host and save it as authorized_keys so that remote host shall recognize localhost as authorized one.
$ cat .ssh/id_rsa.pub |ssh USER@TARGET_HOST 'cat >> .ssh/authorized_keys'
Now you can connect target host without password. Here is an excerpt from debug message yielded by ssh command!
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: ~/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to TARGET_HOST ([TARGET_HOST]:22).
automatic upgrade
Sometimes you would like to configure your ubuntu host to upgrade automatically without any manual intervention.
You can achieve this by unattended-upgrades package. Here is a short memo to do so.
Install unattended-upgrades package (if not there).
$ sudo apt-get install unattended-upgrades
Enable automatic upgrade.
$ sudo dpkg-reconfigure unattended-upgrades
You will be prompted and see message like this.
Applying updates on a frequent basis is an important part of keeping systems secure. By default, updates need to be applied manually using package management tools. Alternatively, you can choose to have this system automatically download and install security updates.
Automatically download and install stable updates?
After enabling unattended-upgrades, you will have configuration like this.
$ more /etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
According to history records yielded in /var/log/apt/history.log, it seems that automatic update may take place around 08:00.
Start-Date: 2013-12-05 07:58:10
Install: linux-headers-3.11.0-14-generic:amd64 (3.11.0-14.21, automatic), linux-headers-3.11.0-14:amd64 (3.11.0-14.21, automatic), linux-image-extra-3.11.0-14-generic:amd64 (3.11.0-14.21, automatic), linux-image-3.11.0-14-generic:amd64 (3.11.0-14.21, automatic)
End-Date: 2013-12-05 08:00:54