Tuesday, May 28, 2013

Setup your own PPTP VPN server for Android


A. PPTP VPN server setup


1. Install the VPN server

#> apt-get install pptpd


2. Assign IP address for VPN client
#> vi /etc/pptpd.conf

localip 10.0.0.1
remoteip 10.0.0.100-200


3. Create VPN User &Password
#> vi /etc/ppp/chap-secrets

# client        server  secret                  IP addresses
user1 pptpd password1 *
user2 pptpd password2 *


4. Define DNS for VPN client
#> vi /etc/ppp/pptpd-options

ms-dns 8.8.8.8
ms-dns 8.8.4.4


5. PPTP setup completed, Restart the service.
#> service pptpd restart


6. Enable IP Forwarding, and apply changes.
#> vi /etc/sysctl.conf

net.ipv4.ip_forward = 1

#> sysctl -p


7. Create NAT for iptables (most important!!!)
#> iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE && iptables-save


8. Optional, enable communication between VPN clients
#> iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE
#> iptables -I INPUT -s 10.0.0.0/8 -i ppp0 -j ACCEPT
#> iptables --append FORWARD --in-interface eth0 -j ACCEPT



  • Steps above assume you have basic Linux Knowledge
  • Steps are based on Ubuntu 11.04
  • PPTP log was in "/var/log/syslog".
  • use "last |grep ppp" to show users logged in

B. Android VPN setup


1. In Android, go to "Setting" > "More" > "VPN", and type in Info as below.


2. Click on the connection your just created and type in username & password as defined in A.3.


3. After successful login, you will see a Key icon in Notification bar, plus a "VPN Activiated" message.




Ref : https://www.digitalocean.com/community/articles/how-to-setup-your-own-vpn-with-pptp


Friday, May 10, 2013

Subscribe Facebook / Facebook Page by RSS Feed

1. Prepare you Facebook page URL
i.e. (https://www.facebook.com/3thdev)

2. Get Facebook ID

Visit the page http://findmyfacebookid.com/ . It will translate your Facebook URL into Facebook ID
3. Prepare the RSS URL
Append your desired Facebook ID into the following link

http://www.facebook.com/feeds/page.php?format=atom10&id=<FACEBOOK-ID>
http://www.facebook.com/feeds/page.php?format=rss20&id=<FACEBOOK-ID>

4. Subscribe your Feed
Use you link to subscribe the feed from your favored RSS Reader. If you don't have one, try these.
http://www.feedly.com
https://play.google.com/store/apps/details?id=com.noinnion.android.greader.reader

Monday, April 01, 2013

Setup MySQL & PHP in Ubuntu

Setup MySQL & PHP in Ubuntu

Please make sure if your Apache & PHP was properly installed

Install the following packages.
apt-get install mysql-server
apt-get install libapache2-mod-auth-mysql
apt-get install php5-mysql

Restart Apache afterwards.
 

/etc/init.d/apache2 restart



Edit the MySQL config file, and make change as below. This example assumed you take IP as below.have
Apache/PHP/MySQL Server IP = 192.168.11.57
Workstation IP = 192.168.11.4

vi /etc/mysql/my.cnf

#bind-address           = 127.0.0.1
bind-address            = 192.168.11.57




Creat a Database & Grant privileges for user access. MySQL default password is blank.

$ mysql -u root -p
Enter password:
mysql> CREATE DATABASE mydb;

mysql> use mydb;

mysql> CREATE TABLE PHONES(
pid int(11) primary key auto_increment,
name varchar(100) not null,
price decimal(10,2) not null,
description text,
created_at timestamp default now(),
updated_at timestamp
);

mysql> use mysql

mysql> GRANT ALL ON *.* to root@'192.168.11.4' IDENTIFIED BY 'your-root-password';
mysql> GRANT ALL ON *.* to root@'192.168.11.57' IDENTIFIED BY 'your-root-password';

mysql> FLUSH PRIVILEGES;




Update MySQL user password

 
# mysqladmin -u root -p'your-old-password' password 'your-old-password''

 

Saturday, March 30, 2013

a Really Simple Android ListView Example

http://windrealm.org/tutorials/android/android-listview.php

Tuesday, March 26, 2013

Check if Apache & PHP was properly installed on Ubuntu Linux

Once your have installed Ubuntu server, depends on your setup option, Apache & PHP may not be installed. You can then issue the following command to install then.

sudo apt-get install apache2 

sudo apt-get install php5 

sudo apt-get install libapache2-mod-php5 

sudo /etc/init.d/apache2 restart 

Afterwards, issue vi a php file (phpinfo.php) in dir /var/www , with content below

<?php

print_r (phpinfo());

?>

If a PHP verion page showup, it means you Apache & PHP setup is completed.