Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Sunday, April 14, 2013

PostgreSQL DB benchmarking

Creating DB benchmarking ---> pgbench -i -s 10 pgbench1

1. Benchmarking with pgbench

root@devel:/etc/pgbouncer# /usr/lib/postgresql/9.0/bin/pgbench -c 10 -C -T 60 -p 9999 -U postgres pgbench
starting vacuum...end.
transaction type: TPC-B (sort of)
scaling factor: 10
query mode: simple
number of clients: 10
number of threads: 1
duration: 60 s
number of transactions actually processed: 19034
tps = 317.123852 (including connections establishing)
tps = 387.216036 (excluding connections establishing)

Fixing :sudo:must be setuid root" problem

Use this command:

 chmod u+s /usr/bin/sudo

Wine rebuild

This method if we failed and wanna rebuild wine from beginning,

  1. Run winetricks
  2. Choice "Select the default wineprefix"
  3. Choice "Delete ALL DATA AND APPLICATIONS INSIDE THIS WINEPREFIX"
  4. When it finish. Run winecfg
  5. You can choice Windows Version you like. Such as XP or 7
  6. Then run winetricks again
  7. Choice "Select the default wineprefix"
  8. Choice "Install a Windows DLL or component"
  9. You can install necessary windows component, such as dotnet, jet40, mdac28, and others 

Saturday, April 13, 2013

postfixadmin on ubuntu

1. download postfix admin from http://postfixadmin.sourceforge.net/


2. install all necessary packages,


sudo apt-get install postfix postfix-mysql dovecot-postfix mysql-server apache2 php5 php5-mysql php5-imap


3. on "Postfix Configuration" wizard, please choice "Internet Site"


4. put your system mail name on next "Postfix Configuration" wizard


Tuesday, March 19, 2013

Fixing locale on Ubuntu



Do you have such this problem?

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

Well,  l don't know why that always happen after installed Ubuntu.  :(

And here's how to fix it.

1. Edit /etc/default/locale and put this line,


LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LANGUAGE="en_US:en"

2. If you don't have that file (I have that situation on ubuntu lxc container), just create new one for you.

3. Logout and login again. Sorry, I still don't know another way to active it. Hehe...

Tuesday, February 26, 2013

Install and configure bind9 as primary server on Ubuntu 12.10 (quick and dirty)


  • Install bind9 packages,
    • apt-get install bind9 dnsutils
  • Edit bind9 configuration file (/etc/bind/named.conf.local) with your fav editor into like this example. Please replace domain name and IP reverse with your requirement. 
# This is the zone definition. replace frozenhell.net with your domain name
zone "frozenhell.net" IN {
        type master;
        file "/etc/bind/zones/pri.frozenhell.net";
        };
# This is the zone definition for reverse DNS. replace 56.168.192 with your network address in reverse notation
zone "56.168.192.in-addr.arpa" IN {
     type master;
     file "/etc/bind/zones/pri.56.168.192.in-addr.arpa";
     allow-query { any; };
};

Thursday, December 13, 2012

Top 25 Best Linux Performance Monitoring and Debugging Tools


source: http://www.thegeekstuff.com/2011/12/linux-performance-monitoring-tools/


1. SAR
Using sar utility you can do two things: 1) Monitor system real time performance (CPU, Memory, I/O, etc) 2) Collect performance data in the background on an on-going basis and do analysis on the historical data to identify bottlenecks.


25 Most Frequently Used Linux IPTables Rules Examples


source: http://www.thegeekstuff.com/2011/06/iptables-rules-examples/


1. Delete Existing Rules

Before you start building new set of rules, you might want to clean-up all the default rules, and existing rules. Use the iptables flush command as shown below to do this.
iptables -F
(or)
iptables --flush

LVS+PGBouncer+RubyRep

We gonna build 3 server with different services. LVS (for load balancing), PGBouncer (connection pooling) and RubyRep (master-master replication).

Here's our simple topology,






And now, here steps


Chroot Bind9 on Debian (Quick and dirty)

This is very short, quick and dirty tutorial about chrooting Bind9 on Debian. This method already tested on Debian Squeeze, but i think suppose to be also run on other Debian variant.

Of course before start, you must have bind packages installed. You can use the magic of "apt-get install bind9" command for installing Bind9 packages.




    Wednesday, December 12, 2012

    Free fast Public DNS servers list

    Need free fast public DNS for your computer or servers? Here's my recommended free public DNS servers list,



    => Service provider: Google
    Google public dns server IP address:
    • 8.8.8.8
    • 8.8.4.4
    => Service provider:Dnsadvantage
    Dnsadvantage free dns server list:
    • 156.154.70.1
    • 156.154.71.1
    => Service provider:OpenDNS
    OpenDNS free dns server list / IP address:
    • 208.67.222.222
    • 208.67.220.220
    => Service provider:Norton
    Norton free dns server list / IP address:
    • 198.153.192.1
    • 198.153.194.1
    => Service provider: GTEI DNS (now Verizon)
    Public Name server IP address:
    • 4.2.2.1
    • 4.2.2.2
    • 4.2.2.3
    • 4.2.2.4
    • 4.2.2.5
    • 4.2.2.6
    => Service provider: ScrubIt
    Public dns server address:
    • 67.138.54.100
    • 207.225.209.66

    Port forwarding for iptables (DMZ)


    If you have a network gateway which is running Linux you might sometimes want to allow access to machines behind it from the internet.
    This is simple enough to do with iptables, which you will probably be using for the gateway's normal operation anyway.
    Normally you'd deny all incoming connections to a gateway machine as opening up services and ports could be a security risk.


    execute sudo command by remote (via SSH)

    I was lazy.... Yeah, that's true. Sometimes i feel so lazy to remote to other servers only execute one command. That's why usually i used this way to execute "sudo" command from my laptop to server.

    ssh -t username@remote-server 'sudo your_command'

    Just remote like usually, but using "-t" as SSH option. If you have custom SSH port, you can modify command above like this,

    ssh -p your_custom_port -t username@remote-server 'sudo your_command'

    Example,


    ssh -t test@testserver.com 'sudo init 0'

    Or,



    ssh -p 2222 -t test@testserver.com 'sudo init 0'



    Container already locked - OpenVZ Linux Containers Wiki


    If you received this message when you try and stop the VE...
    [root@server ~]# vzctl stop 104
    Container already locked
    
    Here's how to fix it:
    • Delete the lock file
    [root@server ~]# rm /vz/lock/104.lck
    rm: remove regular file `/vz/lock/104.lck'? y
    
    • Kill the checkpoint
    [root@server ~]# vzctl chkpnt 104 --kill
    Killing...

    Domain level blocking of users (Zimbra)


    Below mentioned are the steps to "REJECT" an external email address from sending mail to the users of the Zimbra Domain.
    The same results can also be achieved using Amavis via blacklisting.

    1. Edit zmmta.cf
     vi /opt/zimbra/conf/zmmta.cf
    
    Add this line below (smtpd_recipient_restrictions):
     POSTCONF smtpd_sender_restrictions FILE postfix_sender_restrictions.cf
    
    2. Create file /opt/zimbra/conf/postfix_sender_restrictions.cf with the below line:
      hash:/opt/zimbra/postfix/conf/reject
    
    or:
     echo "hash:/opt/zimbra/postfix/conf/reject" > /opt/zimbra/conf/postfix_sender_restrictions.cf
    
    3. Create file /opt/zimbra/postfix/conf/reject with the list of email address to be rejected in the below format:
      user@domain.com     REJECT
    
    4. postmap it and restart postfix
     postmap /opt/zimbra/postfix/conf/reject
     zmmtactl stop && zmmtactl start
    
    You'll be able to see the changes show up in /opt/zimbra/log/zmmtaconfig.log .
    Please note that this change will not survive an upgrade and you will have to redo these after the upgrade.
    Reject messages will be logged in /var/log/zimbra.log ; format looks like this:
    [date / hostname] postfix/smtpd[####] NOQUEUE: reject: RCPT from [remote mta]: 554 5.7.1 <senders-email@DOMAIN>: 
    Sender address rejected: Access denied: from=<senders-email@DOMAIN> to=<local-zimbra-user@domain> proto=ESMTP helo=<remote mta>
    
    The sender will receive a returned email declaring the rejection.

    Compile kernel on Ubuntu 12.04 LTS

    This tutorial is about how-to compile kernel Linux on Ubuntu 12.04 LTS with old school way. It's necessary to do recompile your Linux with latest kernel? Well... Depends. If you need new driver/modules to support your hardware, if you're kernel developer or interest with Linux kernel, or want to tuning your system, or maybe just interest Linux kernel, maybe recompiling latest kernel is good for you.




    VIM shorcut

    I love VIM...!!!  For me, this is the best text editor ever. No matter what OS i use now (Linux, Mac even windows) must have this app.

    A lot of reason of why i love this app. Simplicity is main reason. A lot of 'hidden' shortcut make you geek-alike. Hehe...

    Here's most useful VIM shortcut. Yeah, i know sometimes is little bit difficult to remember it all. My advice is just remember what most you need and use frequently.  ;)

    Ubuntu 12.10 Repo problem (for Mongolian users)


    Actually this is 'old' issue. I found repository problem on Ubuntu 12.10 (latest version). 

    The problem is when you install Ubuntu 12.10, by default you will use nearest Ubuntu repo, in this case it will use mongolia repo. You can check it from /etc/apt/sources.list and you can found this line,


    right? it's mean now you using mn.archive.ubuntu.com as your nearest Ubuntu repo. 

    There's the problem. Ubuntu repo in Mongolia is at http://ubuntu-archive.adsolux.com/ but... somehow they have problem on their Ubuntu 12.10 repo now. That's why sometimes you cannot install some packages.