12 June 2010

How To Backup Your Ubuntu System With Remastersys

remastersys-logoAfter countless hours of configuring, tweaking, installing new applications onto your Ubuntu system, the last thing that you want to do is to reformat and start everything all over again. Remastersys is here to save you all this trouble. Remastersys is a simple and easy to use application that allows you to easily clone and backup your Ubuntu system so that you can quickly restore your computer to its previous state in the event that it crashes.
There are two thing that Remastersys can do:
  1. To do a full system backup, including all installed applications, their settings and your personal data, to a live CD or DVD. You can use this live CD or DVD to restore your system or to install it in another computer. You can also bring it around and use it everywhere as a Live CD.
  2. To create a custom distributable copy of your current Ubuntu system and share it with your friends.
Remastersys comes with a GUI to guide you through the process. There is little or no configuration to do. In as little as one step, you will be backing up your Ubuntu (or creating custom distributable iso) in no time. Remastersys works only in Ubuntu and its derivative such as Linux Mint.

Installing Remastersys

In your terminal,
gksu gedit /etc/apt/sources.list
Add the following line to the end of the file.
For Gutsy and Earlier
# Remastersys
deb http://www.geekconnection.org/remastersys/repository remastersys/
For Hardy and Newer with original grub
# Remastersys
deb http://www.geekconnection.org/remastersys/repository ubuntu/
For Karmic and Newer with grub2
# Remastersys
deb http://www.geekconnection.org/remastersys/repository karmic/
Save and exit.
Update the repositories and install Remastersys
sudo apt-get update
sudo apt-get install remastersys
Once the installation has finished, go to System -> Administration -> Remastersys Backup
If you have any other windows or applications running, close them all. Click OK to continue.
remastersys-screenshot1
Select the action that you want to do. If you want to create a backup of your system, including all the personal data, highlight Backup and click OK. If you want to create a distributable copy of your current system, select Dist and click OK.
remastersys-selection
Remastersys will proceed to do the task that you have specified. This will take a long time, depending on the number of applications and files in your system.
remastersys-in-process
You will receive a prompt when the backup process is done. The backup cd filesystem and iso can be found at /home/remastersys/remastersys folder.
remastersys-finish
If you have Virtualbox or VMware installed, you can test the iso file by loading it in a virtual machine.
remastersys-bootup

Conclusion

Remastersys is a powerful, yet simple to use application. There is no technical knowledge involved. You simply load it up, select the option and off it goes. It is ideal for backing up your system so that you can restore it in the event your system crashes. I like the feature where it allows you to create a custom distribution of Ubuntu. Over the time, I have received many queries from friends on how to install the various applications. With Remastersys, I can now create my own distro with all the applications pre-installed and distribute them to my friends.
For alternative way to create your custom distro, check out Reconstructor.

18 April 2010

Linux route add command


Q. How do I add new / default gateway using route command under Linux?
A. You can use any one of the following tool to add route:
=> route command : show / manipulate the IP routing table
=> ip command : show / manipulate routing, devices, policy routing and tunnels

Linux route add using route command

Route all traffic via 192.168.1.254 gateway connected via eth0 network interface:
# route add default gw 192.168.1.254 eth0

Linux route add using ip command

Just like above but with ip command:
# ip route add 192.168.1.0/24 dev eth0

Restart Networking

/etc/init.d/networking {stop|start|restart}

11 April 2010

HOWTO: configure MySQL’s my.cnf file

UPDATE: I recently used this MySQL tuner script, I basically went with what it told me, but I’m using a higher query_cache_size than it recommends, basically because I don’t see anything online saying it will hurt things.  So I’m now using the following values on my server:
[mysqld]
user=mysql
bind-address=127.0.0.1
datadir=/var/lib/mysql
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysql/mysql.sock
port=3306
tmpdir=/tmp
language=/usr/share/mysql/english
skip-external-locking
query_cache_limit=64M
query_cache_size=32M
query_cache_type=1
max_connections=15
max_user_connections=300
interactive_timeout=100
wait_timeout=100
connect_timeout=10
thread_stack=128K
thread_cache_size=128
myisam-recover=BACKUP
key_buffer=64M
join_buffer=1M
max_allowed_packet=32M
table_cache=512M
sort_buffer_size=1M
read_buffer_size=1M
read_rnd_buffer_size=768K
max_connect_errors=10
thread_concurrency=4
myisam_sort_buffer_size=32M
skip-locking
skip-bdb
expire_logs_days=10
max_binlog_size=100M
server-id=1
[mysql.server]
user=mysql
basedir=/usr
[safe_mysqld]
bind-address=127.0.0.1
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
open_files_limit=8192
SAFE_MYSQLD_OPTIONS=”–defaults-file=/etc/my.cnf –log-slow-queries=/var/log/slow-queries.log”
[mysql]
[isamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M
[myisamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M
[mysqlhotcopy]
interactive-timeout
max_heap_table_size = 64 M
tmp_table_size = 64 M
!includedir /etc/mysql/conf.d/
I’ve gone back and forth over the years configuring MySQL for optimal performance, and while I know I’m not there, I now have a new baseline to build from. From a post called Standard MYSQL my.cnf configuration, you can see all the base information, but also things like:
key_buffer=256M # 64M for 1GB, 128M for 2GB, 256 for 4GB
Which defines the value (256M) but then spells out ideal base values for you to start with if you have more RAM on your system. This is very helpful, I’m tried to go a step further by combining it with Debian’s default my.cnf that comes on 5.0 (lenny) for MySQL 5. As I’m always open for suggestions for improvements, please comment if you have a different view on these choices, thanks. Here it is:
[client]
socket=/var/run/mysqld/mysqld.sock
port=3306

[mysqld_safe]
socket=/var/run/mysqld/mysqld.sock
nice=0

[mysqld]
user=mysql
bind-address=127.0.0.1
datadir=/var/lib/mysql
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysql/mysql.sock
port=3306
tmpdir=/tmp
language=/usr/share/mysql/english
skip-external-locking
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
max_connections=3000
max_user_connections=600
interactive_timeout=100
wait_timeout=100
connect_timeout=10
thread_stack=128K
thread_cache_size=128
myisam-recover=BACKUP
#key_buffer - 64M for 1GB, 128M for 2GB, 256 for 4GB
key_buffer=64M
#join_buffer_size - 1M for 1GB, 2M for 2GB, 4M for 4GB
join_buffer=1M
max_allowed_packet=32M
table_cache=1024
#sort_buffer_size - 1M for 1GB, 2M for 2GB, 4M for 4GB
sort_buffer_size=1M
#read_buffer_size - 1M for 1GB, 2M for 2GB, 4M for 4GB
read_buffer_size=1M
#read_rnd_buffer_size - 768K for 1GB, 1536K for 2GB, 3072K for 4GB
read_rnd_buffer_size=768K
max_connect_errors=10
thread_concurrency=4
#myisam_sort_buffer_size - 32M for 1GB, 64M for 2GB, 128 for 4GB
myisam_sort_buffer_size=32M
skip-locking
skip-bdb
expire_logs_days=10
max_binlog_size=100M
server-id=1

[mysql.server]
user=mysql
basedir=/usr

[safe_mysqld]
bind-address=127.0.0.1
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
open_files_limit=8192
SAFE_MYSQLD_OPTIONS=”–defaults-file=/etc/my.cnf –log-slow-queries=/var/log/slow-queries.log”

#[mysqldump]
#quick
#quote-names
#max_allowed_packet=16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
#key_buffer - 64M for 1GB, 128M for 2GB, 256M for 4GB
key_buffer=64M
#sort_buffer - 64M for 1GB, 128M for 2GB, 256M for 4GB
sort_buffer=64M
#read_buffer - 16M for 1GB, 32M for 2GB, 64M for 4GB
read_buffer=16M
#write_buffer - 16M for 1GB, 32M for 2GB, 64M for 4GB
write_buffer=16M

[myisamchk]
#key_buffer - 64M for 1GB, 128M for 2GB, 256M for 4GB
key_buffer=64M
#sort_buffer - 64M for 1GB, 128M for 2GB, 256M for 4GB
sort_buffer=64M
#read_buffer - 16M for 1GB, 32M for 2GB, 64M for 4GB
read_buffer=16M
#write_buffer - 16M for 1GB, 32M for 2GB, 64M for 4GB
write_buffer=16M

[mysqlhotcopy]
interactive-timeout

!includedir /etc/mysql/conf.d/

21 March 2010

New Ubuntu 10.04 Change is Coming

Ubuntu as one of the most popular linux distros start make over herself with a new look and design to strengthen brandingnya. From the logo, theme and splash screen when booting all changed



The following splash screen display when booting :



And the following new theme GTK view :



Get it while it's hot. ISOs and torrents are available at:


http://cdimage.ubuntu.com/releases/lucid/alpha-1/ (Ubuntu Desktop and Server)
http://uec-images.ubuntu.com/releases/lucid/alpha-1/ (Ubuntu Server for UEC and EC2)
http://cdimage.ubuntu.com/ports/releases/lucid/alpha-1/ (Ubuntu ARM)
http://cdimage.ubuntu.com/kubuntu/releases/lucid/alpha-1/ (Kubuntu Desktop and Netbook Remix)
http://cdimage.ubuntu.com/xubuntu/releases/lucid/alpha-1/ (Xubuntu)

meebo widget on wordpress or your web & plugin for pidgin

Display your chat meebo widget from your wordpress or site .

I created this Pidgin plugin for use with the meebo me widget. When people visit the web page on which your widget is placed, a buddy will automatically be added to your Pidgin buddy list in a group titled Meebo Guests. When they leave the site, the buddy will automatically be removed from your list. This removes the headache of having to authorize and add the buddy every time someone visits your web site.



Step 1 -- Register meebo account & get script


first register in  meebo for get a script to be placed on the site .


follow step by step ...

if it is done , get & adding script in your widget or site place ..

Step 2 -- Setting Up Pidgin


An account must be created in Pidgin to communicate with the meebo widget. The settings below should be used to create the account:

Basic tab
Protocol: XMPP
Domain: meebo.org
Resource: Home

Advanced tab
Connect port: 5222
Connect server: meebo.org

Download


The plugin file should be placed in the Pidgin plugins folder. On Windows this is usually located at C:\Program Files\Pidgin\plugins. On Linux this might be something like /usr/lib/purple-2. For the 64 bit version, one user found that it should be placed at /usr/lib64/pidgin. Of course this may be different depending on your installation. It can then be enabled from the Plugins option in the Tools menu.

Windows (2.0.2): download
Linux (2.0.2): download
Linux 64 bit (2.4.3): download

Source (2.0.2): download

finished .. please try on your site .. keep work ... !! :D

Build a Lava-Lamp Style Navigation Menu

[caption id="" align="aligncenter" width="600" caption="lavalamp"][/caption]

A couple weeks ago, I created a screencast that demonstrated how to build a three-level navigation menu. In a response email, one of our readers requested a tutorial on how to build a lava-lamp style menu. Luckily, it’s quite a simple task, especially when using a JavaScript library. We’ll build one from scratch today.

Step 1 Create the Mark-up


Before we can create this neat functionality, we need a base from which to work from. In your favorite code editor, create an unordered list for your navigation, and import both jQuery and jQuery UI, via Google.

read more ...

Change System from DHCP to a Static IP Address in Ubuntu

If Your Ubuntu System has set to use DHCP, you will want to change it to a static IP address here is simple tip

open the /etc/network/interfaces file.

sudo vi /etc/network/interfaces

If you are using DHCP for your primary network card which is usually eth0, you will see the following lines

auto eth0
iface eth0 inet dhcp

As you can see, it’s using DHCP right now. We are going to change dhcp to static, and then there are a number of options that should add and here is the example and you can change these settings according to your network settings.

auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1


Restart the neworking service using the following command

sudo /etc/init.d/networking restart

apt-get ufw - UFW (Uncomplicated firewall) For Ubuntu

Create a tool for host-based iptables firewall configuration. This tool should provide an easy to use interface to the user, as well as support package integration and dynamic-detection of open ports.

Install UFW in Ubuntu

Currently this firewall package is available in Ubuntu

sudo apt-get install ufw

This will complete the installation

Turn firewall on and off (‘disable’ is default ACCEPT)

# ufw enable|disable

Toggle logging

# ufw logging on|off

Set the default policy (ie “mostly open” vs “mostly closed”)

# ufw default allow|deny

Accept or drop incoming packets to (can see what services are available with ’status’ (see below)). can be specified via service name in /etc/services, ‘protocol:port’, or via package meta-data. ‘allow’ adds service entry to /etc/ufw/maps and ‘deny’ removes service entry from /etc/ufw/maps. Basic syntax:

# ufw allow|deny [service]

Display status of firewall and ports in the listening state, referencing /var/lib/ufw/maps. Numbers in parenthesis are not displayed to user

# ufw status

UFW Examples

Allow port 53

$ sudo ufw allow 53

Delete Allow port 53

$ sudo ufw delete allow 53

Allow port 80

$ sudo ufw allow 80/tcp

Delete Allow port 80

$ sudo ufw delete allow 80/tcp

Allow port smtp

$ sudo ufw allow smtp

Delete Allow port smtp

$ sudo ufw delete allow smtp

Allow fro Particular IP

$ sudo ufw allow from 192.168.254.254

Delete the above rule

$ sudo ufw delete allow from 192.168.254.254

GUI Tool for UFW

If you want GUI for UFW check this guide

Hello world!

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

20 March 2010

Setup Transparent Squid Proxy Server in Ubuntu

Squid is a fully-featured HTTP/1.0 proxy which is almost (but not quite - we’re getting there!) HTTP/1.1 compliant. Squid offers a rich access control, authorization and logging environment to develop web proxy and content serving applications.

This is a short guide on how to set up a transparent squid proxy server. Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes a great server accelerator.

Install Squid

Install squid and squid-common

sudo aptitude install squid squid-common

Edit the squid config file.

sudo vi /etc/squid/squid.conf

Set the allowed hosts.

acl internal_network src 192.168.0.0/24 (
Where 192.168.0.0/24 is your IP range.)
http_access allow internal_network

Set the correct permissions.

sudo chown -R proxy:proxy /var/log/squid/
sudo chown proxy:proxy /etc/squid/squid.conf

You will need to restart squid for the changes to take affect.

sudo /etc/init.d/squid restart

Now open up your browser and set your proxy to point to your new squid server on port 3128

Authentication

If you wish to use authentication with your proxy you will need to install apache2 utilities

sudo aptitude install squid squid-common apache2-utils

To add your first user you will need to specify -c

sudo htpasswd -c /etc/squid.passwd first_user

Thereafter you add new users with

sudo htpasswd /etc/squid.passwd another_user

Edit the squid config file

sudo vi /etc/squid/squid.conf

Set the the authentication parameters and the acl

auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid.passwd
auth_param basic children 5
auth_param basic realm NFYE Squid proxy-caching web server
auth_param basic credentialsttl 3 hours
auth_param basic casesensitive off

acl users proxy_auth REQUIRED

acl sectionx proxy_auth REQUIRED

http_access allow users

So this is what your squid.conf should look like.

acl all src 0.0.0.0/0.0.0.0
acl
internal_network src 192.168.0.0/24
acl users proxy_auth REQUIRED
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 563 # https, snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 563 # https, snews
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl sectionx proxy_auth REQUIRED
acl purge method PURGE
acl CONNECT method CONNECT

http_access allow manager localhost
http_access allow users
http_access allow internal_network
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
http_reply_access allow all
icp_access allow all

Redirect the all HTTP traffic.

If you would like to redirect the all HTTP traffic through the proxy without needing to set up a proxy manually in all your applications you will need to add some rules

iptables -t nat -A PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.0.1:3128
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128

Where eth1,eth0 are the LAN, WAN devices and 192.168.0.1 is the IP address of your LAN device.

If you wish to monitor the performance of your proxy you can look as some log parser’s (sarg, calamaris, ect.)

Source from here

Change from DHCP to a Static IP Address in Ubuntu

If Your Ubuntu System has set to use DHCP, you will want to change it to a static IP address here is simple tip

open the /etc/network/interfaces file.

sudo vi /etc/network/interfaces

If you are using DHCP for your primary network card which is usually eth0, you will see the following lines

auto eth0
iface eth0 inet dhcp

As you can see, it’s using DHCP right now. We are going to change dhcp to static, and then there are a number of options that should add and here is the example and you can change these settings according to your network settings.

auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

Restart the neworking service using the following command

sudo /etc/init.d/networking restart

UFW For Ubuntu ( Debian )

Create a tool for host-based iptables firewall configuration. This tool should provide an easy to use interface to the user, as well as support package integration and dynamic-detection of open ports.

Install UFW in Ubuntu

Currently this firewall package is available in Ubuntu 8.04

sudo apt-get install ufw

This will complete the installation

Turn firewall on and off (‘disable’ is default ACCEPT)

# ufw enable|disable

Toggle logging

# ufw logging on|off

Set the default policy (ie “mostly open” vs “mostly closed”)

# ufw default allow|deny

Accept or drop incoming packets to (can see what services are available with ’status’ (see below)). can be specified via service name in /etc/services, ‘protocol:port’, or via package meta-data. ‘allow’ adds service entry to /etc/ufw/maps and ‘deny’ removes service entry from /etc/ufw/maps. Basic syntax:

# ufw allow|deny [service]

Display status of firewall and ports in the listening state, referencing /var/lib/ufw/maps. Numbers in parenthesis are not displayed to user

# ufw status

UFW Examples

Allow port 53

$ sudo ufw allow 53

Delete Allow port 53

$ sudo ufw delete allow 53

Allow port 80

$ sudo ufw allow 80/tcp

Delete Allow port 80

$ sudo ufw delete allow 80/tcp

Allow port smtp

$ sudo ufw allow smtp

Delete Allow port smtp

$ sudo ufw delete allow smtp

Allow fro Particular IP

$ sudo ufw allow from 192.168.254.254

Delete the above rule

$ sudo ufw delete allow from 192.168.254.254

GUI Tool for UFW

If you want GUI for UFW check this guide