Sunday, 25 November 2012

Linux Tips :How to build SVN server, Step by step


How to build SVN server, Step by step

There are many configurations for svn, here a some short instuctions to get a basic svn repository available over http.
  1. Install required packages:
    apt-get install subversion apache2 libapache2-svn
  2. Create an Directory-Structure:
    mkdir -p /var/svn/repos/
    
  3. Create a Repository:
    cd /var/svn/repos/
    svnadmin create --fs-type fsfs <your-repository>
    
  4. Now Create your Project-Struckture to import in the repository:
    mkdir -p /tmp/myproject/trunk /tmp/myproject/tags /tmp/myproject/branches
    
  5. Import the Project to the Repository:
    svn import /tmp/myproject file:///var/svn/repos/<your-repository> -m "initial import"
    
  6. Make it accesseable over http:
    cd /etc/apache2/sites-available
    touch subversion.conf
    vim subversion.conf
    
  7. Now edit the empty file with this configuration:
    NameVirtualHost *:80
    
    <VirtualHost *:80>   
      <Location /svn>
          ErrorDocument 404 default
          DAV svn
          SVNParentPath /var/svn/repos
          SVNListParentPath off
          Require valid-user
          AuthType Basic
          AuthName "subversion access"
          AuthUserFile /var/svn/.htpasswd
          AuthzSVNAccessFile /var/svn/authz 
      </Location>
    </VirtualHost>
    
  8. enable dav_svn module for apache:
    a2enmod dav_svn
    enable VHost configuration: 
    a2ensite subversion.conf
    
  9. now restart the webserver:
    /etc/init.d/apache2 restart
    
  10. Create an htpasswd:
    htpasswd -c /var/svn/.htpasswd user
    
  11. Create the access control file for the repository:
    touch /var/svn/authz
    
  12. edit the empty authz file:
    vim /var/svn/authz
    
  13. Give read/write rights to for user:
    [your-repository:/]
    user = rw
    Let's try to checkout the the repo over http: 
    svn checkout http://your-server/svn/your-repository
    

MySql Tips: How to track the source of IP-Addresses that cause aborted connect in mysql?


How to track the source of IP-Addresses that cause aborted connect in mysql?

mysql> show global status like 'aborted_connects';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| Aborted_connects | 161   |
+------------------+-------+
or in the terminal if you run
admin@DBServer$ mysqladmin ext -uroot -p | grep Aborted_connects
Enter password: 
| Aborted_connects                  | 161     |
this number means that you have 161 failed trials to connect to your mysql server for some reason. maybe somebody trying to hack you.
now to trace who is causing such connections, let us go ahead with tcpdump in a screen as below:
admin@DBServer$ screen -S TCPDUMP
#this will open a screen for you
admin@DBServer$  tcpdump -s 1500 -w tcp.out port 3306
#now to detach your screen click "CTRL + A + D"
#and to reattach it (enter it again) run screen -x TCPDUMP
Now when you get more aborted connections, stop the tcpdump and stringily your tcp.out as shown below
admin@DBServer$ strings tcp.out
Host 'XXX.XX.XX.XXX' is not allowed to connect to this MySQL server

Wednesday, 14 November 2012

Firefox Tips:Firefox Browser running but not open

Firefox Troubleshooting:


The fix was to uninstall Firefox and then manually delete in the registry (using the program regedit.exe provided by Microsoft) most entries for Firefox (especially those in HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE), then reinstalling Firefox. It now opens normally.


Chrome Troubleshooting:



I right click on the Chrome shortcut, get the Properties and click on the Open File Location button. This takes me to folder
 
C:\Users\myuserid\AppData\Local\Google\Chrome\Application
 
Sure enough, there is a file in that folder called debug.log and it's just what I was looking for, an error log in plain text. In Notepad, it looks like gibberish, but displayed in a better text editor, such as Notepad++, the errors are easy to read. 
 
There seem to be a pair of errors generated every time I try to run Chrome. The first pair is below.
 
0706/215116:ERROR:client_util.cc(394)
  Failed to load Chrome DLL from
  C:\Users\myuserid\AppData\Local\Google\Chrome\
  Application\20.0.1132.43\chrome.dll

0706/215116:ERROR:client_util.cc(442)
  Could not find exported function
  RelaunchChromeBrowserWithNewCommandLineIfNeeded

Wednesday, 7 November 2012

Linux Tips:Run Crontab / Cronjob every 10 Minutes or every 5 minutes


Linux Tips: Run Crontab / Cronjob every 10 Minutes or every 5 minutes



\
*/10 * * * * /path/to/command
*/05 * * * * /path/to/command


linux / unix find size of a folder


to find folder size easy way is to check with du command
du - sch 
or you want to see file size of each item inside folder
du -ach

Linux Tips # SOLVED - Pure FTP Connection Error : Error loading directory


1. How to SOLVED - Pure FTP Connection Error : Error loading directory


enable ftp pots
iptables -A INPUT -s 0/0 -p tcp --dport 20 -j ACCEPT
iptables -A INPUT -s 0/0 -p tcp --dport 21 -j ACCEPT

enable port for passive mode
iptables -A INPUT -s 0/0 -p tcp --dport 30000:50000  -j ACCEPT
save iptables for future
iptables-save

restart iptables
/etc/init.d/iptables restart

whala!   my client says IT WORKS !!

enjoy 
change configuration for passive mode
vi   /etc/pure-ftpd/pure-ftpd.conf
PassivePortRange 30000 50000
Restart  Pure-ftpd
/etc/init.d/pure-ftpd restart



2. Linux Tips # Pure FTP fix for “failed to retrieve directory listing”.


I was setting up pure-ftpd on a system that needed FTP access for users. The users were using FileZilla. For firewall on the server (running RHEL5), I was using iptables. Was having a difficult time getting FTP with TLS to connect and when I was able to get it to connect I would get the error: “failed to retrieve directory listing”.
Error: Connection timed out
Error: Failed to retrieve directory listing
Here is the fix:
# cat /proc/sys/net/ipv4/ip_local_port_range
32768      61000
Make sure ports used do not fall within that range (used by the system). So pick 10000 to 20000, for example.
# iptables -I INPUT 2 -p tcp –dport 10000:20000 -j ACCEPT
# iptables -I OUTPUT 2 -p tcp –sport 10000:20000 -j ACCEPT
Also need port 21 (port 20 was not needed):
# iptables -I INPUT 2 -p tcp –dport 21 -j ACCEPT
# iptables -I OUTPUT 2 -p tcp –sport 21 -j ACCEPT
Save your iptables of course and then restart:
iptables-save > /etc/sysconfig/iptables
service iptables restart
Then in pure-ftpd, go to conf file (/etc/pure-ftpd.conf and set the following line:
PassivePortRange          10000 20000
service pure-ftpd restart

Mac Tips:how to show hidden files in MAC Osx - mountain Lion


how to show hidden files in MAC Osx - mountain Lion


NOTE (July 28, 2012): In OS X Mountain Lion, you can no longer open hidden folders normally (by double-clicking). However, you can still open hidden folders by right-clicking on them, and clicking "Open".

You can force Finder to show hidden files by editing a Finder property through Terminal. Open Terminal (located in /Applications/Utilities) and enter the following line:
defaults write com.apple.Finder AppleShowAllFiles 1
To stop showing hidden files, enter:
defaults write com.apple.Finder AppleShowAllFiles 0
Entering these lines into Terminal will not have any immediate effects. You will have to relaunch Finder for any change to apply. You can relaunch Finder by logging off. Alternatively, you can relaunch Finder through the "Force Quit Applications" window, which you can open with the keyboard shortcut Command+Option+Esc (known as Alt+Windows+Esc on Windows keyboards).