Linux

Download youtube videos with youtube-dl

While reading an article by Makeuseof.com: http://www.makeuseof.com/tag/14-youtube-playlists-watch-learn-computer-p...
I decide to take a quick python training since I never learn python seriously before.
It's a bit troublesome to watch the video from China through the firewall, so I downloaded it from the server with a command line utility called youtube-dl
youtube-dl -q -t  http://www.youtube.com/user/thenewboston#grid/user/EA1FEF17E1E5C0DA

Configure ftp task for ant on Debian/Ubuntu

  1. apt-get install ant ant-optional
  2. apt-get install libcommons-net-java liboro-java
  3. cd /usr/share/ant/lib
  4. ln -s /usr/share/java/commons-net.jar .
  5. ln -s /usr/share/java/oro.jar .

Ant has a ftp task which requires some libraries, that's the way to setup on Debian/Ubuntu. Have fun!

remotely shutdown virtualbox vm

I'm out of office in a hurry and forget to close the virtual box vm on my Ubuntu desktop, which is running Windows XP and I'd rather close it for security reason. Here's the way to do it remotely. 

Opera can't switch input method on Linux (Ubuntu)

On linux, Opera can't switch the input method by ctrl-space, here's the steps to solve the issue
1. remove the keyboard shortcut:
Open opera preferences-> Advanced->Shortcuts->Keyboard setup, click Edit, search for Space ctrl, and then delete it
2. open /usr/bin/opera: you need root permission to edit the file, otherwise, you can create your own version of opera script to start

Setup Postfix with SMTP Auth

  1. Install Postfix and SASL 
    apt-get install postfix sasl2-bin
  2. edit /etc/default/saslauthd, change the following:
    START=yes
     
  3. Start saslauthd:
    /etc/init.d/saslauthd start
  4. test if saslauthd is working:
    testsaslauthd -u username -p password
  5. Stop saslauthd:
    /etc/init.d/saslauthd stop
  6. Create file /etc/postfix/sasl/smtpd.conf:
    pwcheck_method: saslauthd
     
  7. edit /etc/postfix/main.cf :

perl: warning: Setting locale failed

This error message happens after I did an upgrade to Debian 5.0 (lenny)

perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C").
dpkg-reconfigure locales

Then choose en_US.UTF-8 and it's fixed.

Replacing text in multiple files

I need to replace an IP address for a sever switch, here's the command for it: find . -name "*.php" -print | xargs sed -i 's/192.168.0.10/192.168.0.11/'

Configure OpenVPN on Debian Lenny

This is the original artiche

In my configuration, my server's network is 10.1.1.0 and my VPN is 10.1.10.0, in order to access the server side networks, you need to enable the forwarding and masquerading, here's the steps:

$echo 1 > /proc/sys/net/ipv4/ip_forward

$iptables -t nat -A POSTROUTING -s 10.1.10.0/24 -o eth0 -j MASQUERADE
*Assuming your nic is eth0 and your vpn network is 10.1.10.0

Ubuntu upgrade to 9.04 Jaunty Jackalope

Finally upgraded to 9.04 Jaunty, here's some times might help:

Upgrade Debian Etch to Debian Lenny in 4 steps

  1. change /etc/apt/sources.list , replace etch to lenny. here's my example:
    deb http://http.us.debian.org/debian/ lenny main contrib non-free
    deb http://security.debian.org/ lenny/updates main contrib
  2. apt-get install apt dpkg aptitude
  3. apt-get update ; apt-get upgrade
  4. apt-get dist-upgrade

Somebody skipped step 3 and also works fine. Now your server is running Lenny. In my case, I don't even have to reboot the machine.

 

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer