Detect Sparse Files

To create one sparse file

truncate --size 10MB sparse_file

To detect

ls -lks sparse_file

To view the stat

stat sparse_file

Reference: http://en.wikipedia.org/wiki/Sparse_file

Posted in linux, misc, opensource | Tagged , , , | Comments Off

Install Ubuntu Font on Fedora 16

 

wget http://font.ubuntu.com/download/ubuntu-font-family-0.80.zip
unzip ubuntu-font-family-0.80.zip
mv ubuntu-font-family-0.80 ubuntu-font-family
sudo cp -rv ubuntu-font-family /usr/share/fonts/
sudo chmod 755 /usr/share/fonts/ubuntu-font-family
cd /usr/share/fonts; su -c ‘fc-cache ubuntu-font-family’
Posted in linux, opensource | Comments Off

Install Skype on Fedora 16 64bit

 

 

 

 

 

Install the 32bit package

yum install skype-2.2.0.35-fedora.i586.rpm

[jeff@fedora16 ~]$ skype
skype: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory

yum install glibc.i686 qt.i686 qt-x11.i686 libXv.i686 alsa-lib.i686 libXScrnSaver.i686

That’s it.

Posted in linux | Comments Off

Install Microsoft TrueType Font on Fedora 16 64bit

wget "http://blog.andreas-haerter.com/_export/code/2011/07/01/install-msttcorefonts-fedora.sh?codeblock=1" -O "/tmp/install-msttcorefonts-fedora.sh"
chmod a+rx "/tmp/install-msttcorefonts-fedora.sh"
su -c "/tmp/install-msttcorefonts-fedora.sh"
Posted in linux, opensource, script, shell | Tagged , , | Comments Off

How to Remove “Recent Item” @ Gnome-Shell?

Option 1

rm -fr ~/.local/share/recently-used.xbel
touch ~/.local/share/recently-used.xbel
chmod ugo-wr ~/.local/share/recently-used.xbel
sudo chattr +i ~/.local/share/recently-used.xbel

Option 2

rm -fr ~/.local/share/recently-used.xbel
mkdir ~/.local/share/recently-used.xbel
Posted in linux, opensource, shell | Tagged , , , , , | Comments Off

Enable L2TP/IPSec VPN on Ubuntu

I use China Unicom 3G on my Android phone in China. To get rid of #GFW in China, with Richard guidance, I set up L2TP/IPSec VPN on Ubuntu, hosted @ http://Linode.com. Simply document the steps.

IPSec

sudo apt-get install openswan

Use Pre- Shared Key. Change /etc/ipsec.conf

version 2.0
config setup
     nat_traversal=yes
     virtual_private=%v4:10.0.0.0/8,%v4:192.168.0.0/16,%v4:172.16.0.0/12
     oe=off
     protostack=netkey
conn L2TP-PSK-NAT
     rightsubnet=vhost:%priv
     also=L2TP-PSK-noNAT
conn L2TP-PSK-noNAT
     authby=secret
     pfs=no
     auto=add
     keyingtries=3
     rekey=no
     ikelifetime=8h
     keylife=1h
     type=transport
     left=YOUR.SERVER.IP.ADDRESS
     leftprotoport=17/1701
     right=%any
     rightprotoport=17/%any

and change /etc/ipsec.secrets to

YOUR.SERVER.IP.ADDRESS %any: PSK "YourSharedSecret"

Apply the following change

for each in /proc/sys/net/ipv4/conf/*
 do
     echo 0 > $each/accept_redirects
     echo 0 > $each/send_redirects
 done

Verify IPSec configuration, then restart the daemon

sudo ipsec verify
sudo /etc/init.d/ipsec restart

L2TP

Install xl2tpd

sudo apt-get install xl2tpd

Change /etc/xl2tpd/xl2tpd.conf

[global]
 ipsec saref = yes
[lns default]
 ip range = 10.1.2.2-10.1.2.255
 local ip = 10.1.2.1
 refuse chap = yes
 refuse pap = yes
 require authentication = yes
 ppp debug = yes
 pppoptfile = /etc/ppp/options.xl2tpd
 length bit = yes

PPP

sudo apt-get install ppp

Change /etc/ppp/options.xl2tpd

require-mschap-v2
 ms-dns 8.8.8.8
 ms-dns 8.8.4.4
 asyncmap 0
 auth
 crtscts
 lock
 hide-password
 modem
 debug
 name l2tpd
 proxyarp
 lcp-echo-interval 30
 lcp-echo-failure 4

Add a test user in /etc/ppp/chap-secrets

# user      server      password            ip
 test        l2tpd       testpassword        *

Restart xl2tpd

sudo /etc/init.d/xl2tpd restart

Apply iptables firewall rules

iptables --table nat --append POSTROUTING --jump MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

Permanently enable ip_forward, edit /etc/sysctl.conf

net.ipv4.ip_forward=1

Then run

sysctl -p /etc/sysctl.conf

And add the following into /etc/rc.local

iptables --table nat --append POSTROUTING --jump MASQUERADE
for each in /proc/sys/net/ipv4/conf/*
do
echo 0 > $each/accept_redirects
echo 0 > $each/send_redirects
done
/etc/init.d/ipsec restart
Posted in android, cloud, linux | Tagged , , , , , , , , , , | Comments Off

Install Gnome3 on Ubuntu Natty 11.04

Install repository

sudo add-apt-repository ppa:gnome3-team/gnome3
sudo apt-get update; sudo apt-get dist-upgrade
sudo apt-get install gnome-shell

Uninstall repository

sudo apt-get install ppa-purge
sudo ppa-purge ppa:gnome3-team/gnome3
Posted in linux, opensource | Tagged , , , , | Comments Off