0. sudo su 1. apt-get install build-essential xutils-dev 2. apt-get remove xserver-xorg-input-evtouch xserver-xorg-input-tslib (it tells me that i've not xserver-xorg-input installed, so nothing to remove) 3. apt-get install xserver-xorg-dev 4. apt-get install autoconf 5. apt-get install libtool 6. wget http://cgit.freedesktop.org/xorg/driver/xf86-input-evdev/snapshot/xf86-input-evdev-2.5.0.tar.gz 7. tar xvfz xf86-input-evdev-2.5.0.tar.gz 8. cd xf86-input-evdev-2.5.0/ 9. ./autogen.sh -prefix=/usr 10. make 11. make install 12. reboot
Friday, January 21, 2011
keypad
Thursday, January 20, 2011
blutooth
In Ubuntu Karmic you can add blueman repositories by issuing this command:
sudo add-apt-repository ppa:blueman/ppa
And to install it run:
sudo apt-get update
sudo apt-get install blueman
To add daily-builds repository in karmic run:
sudo add-apt-repository ppa:blueman/blueman-dailies
sudo add-apt-repository ppa:blueman/ppa
And to install it run:
sudo apt-get update
sudo apt-get install blueman
To add daily-builds repository in karmic run:
sudo add-apt-repository ppa:blueman/blueman-dailies
Monday, January 17, 2011
Public and Private Keys
Ref :https://help.ubuntu.com/community/SSH/OpenSSH/Keys
Public and Private Keys
Public and Private Keys
If your SSH server is visible over the Internet, you should use public key authentication instead of passwords if at all possible. If you don't think it's important, try logging all of the malicious login attempts you get for the next week. My computer - a perfectly ordinary desktop PC - had over 4,000 attempts to guess my password and almost 2,500 break-in attempts in the last week alone. How many thousand random guesses do you think it will take before an attacker stumbles across your password?
With public key authentication, every computer has a public and a private "key" (a large number with particular mathematical properties). The private key is kept on the computer you log in from, while the public key is stored on the .ssh/authorized_keys file on all the computers you want to log in to. When you log in to a computer, the SSH server uses the public key to "lock" messages in a way that can only be "unlocked" by your private key - this means that even the most resourceful attacker can't snoop on, or interfere with, your session. As an extra security measure, most SSH programs store the private key in a passphrase-protected format, so that if your computer is stolen or broken in to, you should have enough time to disable your old public key before they break the passphrase and start using your key. Wikipedia has a more detailed explanation of how keys work.
Public key authentication is a much better solution than passwords for most people. In fact, if you don't mind leaving a private key unprotected on your hard disk, you can even use keys to do secure automatic log-ins - as part of a network backup, for example. Different SSH programs generate public keys in different ways, but they all generate public keys in a similar format:
<ssh-rsa or ssh-dss> <really long string of nonsense> <username>@<host>
Key-Based SSH Logins
Key-based authentication is the most secure of several modes of authentication usable with OpenSSH, such as plain password (the default with Ubuntu) and Kerberos tickets. Key-based authentication has several advantages over password authentication, for example the key values are significantly more difficult to brute-force, or guess than plain passwords, provided an ample key length. Other authentication methods are only used in very specific situations.
SSH can use either "RSA" (Rivest-Shamir-Adleman) or "DSA" ("Digital Signature Algorithm") keys. Both of these were considered state-of-the-art algorithms when SSH was invented, but DSA has come to be seen as less secure in recent years. RSA is the only recommended choice for new keys, so this guide uses "RSA key" and "SSH key" interchangeably.
Key-based authentication uses two keys, one "public" key that anyone is allowed to see, and another "private" key that only the owner is allowed to see. To securely communicate using key-based authentication, you need to create a public key for the computer you're logging in from, and securely transmit it to the computer you're logging in to. Wikipedia has a good explanation of the theory
Using key based logins with ssh is generally considered more secure than using plain password logins. This section of the guide will explain the process of generating a set of public/private RSA keys, and using them for logging into your Ubuntu computer(s) via OpenSSH.
Generating RSA Keys
The first step involves creating a set of RSA keys for use in authentication.
This should be done on the client.
To create your public and private SSH keys on the command-line:
mkdir ~/.ssh chmod 700 ~/.ssh ssh-keygen -t rsa
You will be prompted for a location to save the keys, and a passphrase for the keys. This passphrase will protect your private key while it's stored on the hard drive and be required to use the keys every time you need to login to a key-based system:
Generating public/private rsa key pair. Enter file in which to save the key (/home/b/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/b/.ssh/id_rsa. Your public key has been saved in /home/b/.ssh/id_rsa.pub.
Your public key is now available as .ssh/id_rsa.pub in your home folder.
Congratulations! You now have a set of keys. Now it's time to make your systems allow you to login with them
Choosing a good passphrase
Just like with physical keys, you need to change all your locks if your RSA key is stolen. Otherwise, your thief will be able to get access to all your stuff.
An SSH key passphrase is a secondary form of security that gives you a little time when your keys are stolen. If your RSA key has a strong passphrase, it might take your attacker a few hours to guess by brute force. That extra time should be enough to log in to any computers you have an account on, delete your old key from the .ssh/authorized_keys file, and add a new key.
Your SSH key passphrase is only used to protect your private key from thieves. It's never transmitted over the Internet, and the strength of your key has nothing to do with the strength of your passphrase.
You have to choose for yourself whether to use a passphrase with your RSA key. Ultimately, it's a choice between cursing the difficulty every time you have to type it in, or cursing your glibness when someone logs in to all your accounts and changes your password so you can't get in any more.
If you choose to use a passphrase, pick something strong and write it down on a piece of paper that you keep in a safe place. If you choose not to use a password, just press the return key without typing a password - you'll never be asked for one again.
Key Encryption Level
Note: The default is a 2048 bit key. You can increase this to 4096 bits with the -b flag (Increasing the bits makes it harder to crack the key by brute force methods).
ssh-keygen -t rsa -b 4096
Password Authentication
The main problem with public key authentication is that you need a secure way of getting the public key onto a computer before you can log in with it. If you will only ever use an SSH key to log in to your own computer from a few other computers (such as logging in to your PC from your laptop), you should copy your SSH keys over on a memory stick, and disable password authentication altogether. If you would like to log in from other computers from time to time (such as a friend's PC), make sure you have a strong password.
Transfer Client Key to Host
The key you need to transfer to the host is the public one. If you can log in to a computer over SSH using a password, you can transfer your RSA key by doing the following from your own computer:
ssh-copy-id <username>@<host>
Where <username> and <host> should be replaced by your username and the name of the computer you're transferring your key to.
You can make sure this worked by doing:
ssh <username>@<host>
You should be prompted for the passphrase for your key:
Enter passphrase for key '/home/<user>/.ssh/id_rsa': |
Enter your passphrase, and provided host is configured to allow key-based logins, you should then be logged in as usual.
Troubleshooting
Encrypted Home Directory
If you have an encrypted home directory, SSH cannot access your authorized_keys file because it is your encrypted home directory and won't be available until after you are authenticated. Therefore, SSH will default to password authentication.
To solve, create a folder outside your home. For example, /etc/<username> and move the authorized_keys file to it. Then change the line in your /etc/ssh/sshd_config to:
AuthorizedKeysFile /etc/<username>/authorized_keys
Then
sudo /etc/init.d/ssh restart
The next time you connect with SSH you should not have to enter your password.
username@host's password:
If you are not prompted for the passphrase, and instead get just the
username@host's password: |
prompt as usual with password logins, then read on. There are a few things which could prevent this from working as easily as demonstrated above. On default Ubuntu installs however, the above examples should work. If not, then check the following condition, as it is the most frequent cause:
On the host computer, ensure that the /etc/ssh/sshd_config contains the following lines, and that they are uncommented;
PubkeyAuthentication yes RSAAuthentication yes
If not, add them, or uncomment them, restart OpenSSH, and try logging in again. If you get the passphrase prompt now, then congratulations, you're logging in with a key!
Permission denied (publickey)
If you're sure you've correctly configured sshd_config, copied your ID, and have your private key in the .ssh directory, and still getting this error:
Permission denied (publickey). |
Chances are, your /home/<user> or ~/.ssh/authorized_keys permissions are too open by OpenSSH standards. You can get rid of this problem by issuing the following commands:
chmod go-w ~/ chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys
Debugging and sorting out further problems
The permissions of files and folders is crucial to this working. You can get debugging information from both the client and server.
if you think you have set it up correctly , yet still get asked for the password, try starting the server with debugging output to the terminal.
sudo /usr/sbin/sshd -d
To connect and send information to the client terminal
ssh -v ( or -vv) username@host's
Where to From Here?
No matter how your public key was generated, you can add it to your Ubuntu system by opening the file .ssh/authorized_keys in your favourite text editor and adding the key to the bottom of the file. You can also limit the SSH features that the key can use, such as disallowing port-forwarding or only allowing a specific command to be run. This is done by adding "options" before the SSH key, on the same line in the authorized_keys file. For example, if you maintain a CVS repository, you could add a line like this:
command="/usr/bin/cvs server",no-agent-forwarding,no-port-forwarding,no-X11-forwarding,no-user-rc ssh-dss <string of nonsense>...When the user with the specified key logged in, the server would automatically run /usr/bin/cvs server, ignoring any requests from the client to run another command such as a shell. For more information, see the sshd man page.
Manage the entire Operating System using terminal
Ref: http://ubuntulinux.co.in/blog/linux-commands/
One of the great style of Linux OS is commands. We can manage the entire Operating System using terminal. Commands and its description give here. Given commands have been tested both on Fedora and Ubuntu.
| Command | Description | |
| • | apropos whatis | Show commands pertinent to string. |
| • | man -t man | ps2pdf – > man.pdf | make a pdf of a manual page |
| which command | Show full path name of command | |
| time command | See how long a command takes | |
| • | time cat | Start stopwatch. Ctrl-d to stop. |
| • | nice | Run a low priority command (The “info” reader in this case) |
| • | renice 19 -p $$ | Make shell (script) low priority. Use for non interactive tasks |
| dir navigation | ||
| • | cd - | Go to previous directory |
| • | cd | Go to $HOME directory |
| (cd dir && command) | Go to dir, execute command and return to current dir | |
| • | pushd . | Put current dir on stack so you can popd back to it |
| file searching | ||
| • | alias l=’ls -l –color=auto’ | quick dir listing |
| • | ls -lrt | List files by date. |
| • | ls /usr/bin | pr -T9 -W$COLUMNS | Print in 9 columns to width of terminal |
| find -name ‘*.[ch]‘ | xargs grep -E ‘expr’ | Search ‘expr’ in this dir and below. | |
| find -type f -print0 | xargs -r0 grep -F ‘example’ | Search all regular files for ‘example’ in this dir and below | |
| find -maxdepth 1 -type f | xargs grep -F ‘example’ | Search all regular files for ‘example’ in this dir | |
| find -maxdepth 1 -type d | while read dir; do echo $dir; echo cmd2; done | Process each item with multiple commands (in while loop) | |
| • | find -type f ! -perm -444 | Find files not readable by all (useful for web site) |
| • | find -type d ! -perm -111 | Find dirs not accessible by all (useful for web site) |
| • | locate -r ‘file[^/]*.txt’ | Search cached index for names. This re is like glob *file*.txt |
| • | look reference | Quickly search (sorted) dictionary for prefix |
| • | grep – color reference /usr/share/dict/words | Highlight occurances of regular expression in dictionary |
| archives and compression | ||
| gpg -c file | Encrypt file | |
| gpg file.gpg | Decrypt file | |
| tar -c dir/ | bzip2 > dir.tar.bz2 | Make compressed archive of dir/ | |
| bzip2 -dc dir.tar.bz2 | tar -x | Extract archive (use gzip instead of bzip2 for tar.gz files) | |
| tar -c dir/ | gzip | gpg -c | ssh user@remote ‘dd of=dir.tar.gz.gpg’ | Make encrypted archive of dir/ on remote machine | |
| find dir/ -name ‘*.txt’ | tar -c –files-from=- | bzip2 > dir_txt.tar.bz2 | Make archive of subset of dir/ and below | |
| find dir/ -name ‘*.txt’ | xargs cp -a –target-directory=dir_txt/ –parents | Make copy of subset of dir/ and below | |
| ( tar -c /dir/to/copy ) | ( cd /where/to/ && tar -x -p ) | Copy (with permissions) copy/ dir to /where/to/ dir | |
| ( cd /dir/to/copy && tar -c . ) | ( cd /where/to/ && tar -x -p ) | Copy (with permissions) contents of copy/ dir to /where/to/ | |
| ( tar -c /dir/to/copy ) | ssh -C user@remote ‘cd /where/to/ && tar -x -p’ | Copy (with permissions) copy/ dir to remote:/where/to/ dir | |
| dd bs=1M if=/dev/sda | gzip | ssh user@remote ‘dd of=sda.gz’ | Backup harddisk to remote machine | |
| rsync (Network efficient file copier: Use the –dry-run option for testing) | ||
| rsync -P rsync://rsync.server.com/path/to/file file | Only get diffs. Do multiple times for troublesome downloads | |
| rsync –bwlimit=1000 fromfile tofile | Locally copy with rate limit. It’s like nice for I/O | |
| rsync -az -e ssh –delete ~/public_html/ remote.com:’~/public_html’ | Mirror web site (using compression and encryption) | |
| rsync -auz -e ssh remote:/dir/ . && rsync -auz -e ssh . remote:/dir/ | Synchronize current directory with remote one | |
| ssh (Secure SHell) | ||
| ssh $USER@$HOST command | Run command on $HOST as $USER (default command=shell) | |
| • | ssh -f -Y $USER@$HOSTNAME xeyes | Run GUI command on $HOSTNAME as $USER |
| scp -p -r $USER@$HOST: file dir/ | Copy with permissions to $USER’s home directory on $HOST | |
| ssh -g -L 8080:localhost:80 root@$HOST | Forward connections to $HOSTNAME:8080 out to $HOST:80 | |
| ssh -R 1434:imap:143 root@$HOST | Forward connections from $HOST:1434 in to imap:143 | |
| wget (multi purpose download tool) | ||
| • | (cd dir/ && wget -nd -pHEKk http://www.pixelbeat.org/cmdline.html) | Store local browsable version of a page to the current dir |
| wget -c http://www.example.com/large.file | Continue downloading a partially downloaded file | |
| wget -r -nd -np -l1 -A ‘*.jpg’ http://www.example.com/dir/ | Download a set of files to the current directory | |
| wget ftp://remote/file[1-9].iso/ | FTP supports globbing directly | |
| • | wget -q -O- http://www.pixelbeat.org/timeline.html | grep ‘a href’ | head | Process output directly |
| echo ‘wget url’ | at 01:00 | Download url at 1AM to current dir | |
| wget –limit-rate=20k url | Do a low priority download (limit to 20 KB/s in this case) | |
| wget -nv –spider –force-html -i bookmarks.html | Check links in a file | |
| wget –mirror http://www.example.com/ | Efficiently update a local copy of a site (handy from cron) | |
| networking (Note ifconfig, route, mii-tool, nslookup commands are obsolete) | ||
| ethtool eth0 | Show status of ethernet interface eth0 | |
| ethtool –change eth0 autoneg off speed 100 duplex full | Manually set ethernet interface speed | |
| iwconfig eth1 | Show status of wireless interface eth1 | |
| iwconfig eth1 rate 1Mb/s fixed | Manually set wireless interface speed | |
| • | iwlist scan | List wireless networks in range |
| • | ip link show | List network interfaces |
| ip link set dev eth0 name wan | Rename interface eth0 to wan | |
| ip link set dev eth0 up | Bring interface eth0 up (or down) | |
| • | ip addr show | List addresses for interfaces |
| ip addr add 1.2.3.4/24 brd + dev eth0 | Add (or del) ip and mask (255.255.255.0) | |
| • | ip route show | List routing table |
| ip route add default via 1.2.3.254 | Set default gateway to 1.2.3.254 | |
| • | tc qdisc add dev lo root handle 1:0 netem delay 20msec | Add 20ms latency to loopback device (for testing) |
| • | tc qdisc del dev lo root | Remove latency added above |
| • | host pixelbeat.org | Lookup DNS ip address for name or vice versa |
| • | hostname -i | Lookup local ip address (equivalent to host `hostname`) |
| • | whois pixelbeat.org | Lookup whois info for hostname or ip address |
| • | netstat -tupl | List internet services on a system |
| • | netstat -tup | List active connections to/from system |
| windows networking (Note samba is the package that provides all this windows specific networking support) | ||
| • | smbtree | Find windows machines. See also findsmb |
| nmblookup -A 1.2.3.4 | Find the windows (netbios) name associated with ip address | |
| smbclient -L windows_box | List shares on windows machine or samba server | |
| mount -t smbfs -o fmask=666,guest //windows_box/share /mnt/share | Mount a windows share | |
| echo ‘message’ | smbclient -M windows_box | Send popup to windows machine (off by default in XP sp2) | |
| text manipulation (Note sed uses stdin and stdout. Newer versions support inplace editing with the -i option) | ||
| sed ’s/string1/string2/g’ | Replace string1 with string2 | |
| sed ’s/(.*)1/12/g’ | Modify anystring1 to anystring2 | |
| sed ‘/ *#/d; /^ *$/d’ | Remove comments and blank lines | |
| sed ‘:a; /$/N; s/n//; ta’ | Concatenate lines with trailing | |
| sed ’s/[ t]*$//’ | Remove trailing spaces from lines | |
| sed ’s/([`"$])/1/g’ | Escape shell metacharacters active within double quotes | |
| • | seq 10 | sed “s/^/ /; s/ *(.{7,})/1/” | Right align numbers |
| sed -n ‘1000p;1000q‘ | Print 1000th line | |
| sed -n ‘10,20p;20q‘ | Print lines 10 to 20 | |
| sed -n ’s/.*<title>(.*)</title>.*/1/ip;T;q‘ | Extract title from HTML web page | |
| sed -i 42d ~/.ssh/known_hosts | Delete a particular line | |
| sort -t. -k1,1n -k2,2n -k3,3n -k4,4n | Sort IPV4 ip addresses | |
| • | echo ‘Test’ | tr ‘[:lower:]‘ ‘[:upper:]‘ | Case conversion |
| • | tr -dc ‘[:print:]‘ < /dev/urandom | Filter non printable characters |
| • | history | wc -l | Count lines |
| set operations (Note you can export LANG=C for speed. Also these assume no duplicate lines within a file) | ||
| sort file1 file2 | uniq | Union of unsorted files | |
| sort file1 file2 | uniq -d | Intersection of unsorted files | |
| sort file1 file1 file2 | uniq -u | Difference of unsorted files | |
| sort file1 file2 | uniq -u | Symmetric Difference of unsorted files | |
| join -a1 -a2 file1 file2 | Union of sorted files | |
| join file1 file2 | Intersection of sorted files | |
| join -v2 file1 file2 | Difference of sorted files | |
| join -v1 -v2 file1 file2 | Symmetric Difference of sorted files | |
| math | ||
| • | echo ‘(1 + sqrt(5))/2′ | bc -l | Quick math (Calculate φ). |
| • | echo ‘pad=20; min=64; (100*10^6)/((pad+min)*8)’ | bc | More complex (int) e.g. This shows max FastE packet rate |
| • | echo ‘pad=20; min=64; print (100E6)/((pad+min)*8)’ | python | Python handles scientific notation |
| • | echo ‘pad=20; plot [64:1518] (100*10**6)/((pad+x)*8)’ | gnuplot -persist | Plot FastE packet rate vs packet size |
| • | echo ‘obase=16; ibase=10; 64206′ | bc | Base conversion (decimal to hexadecimal) |
| • | echo $((0×2dec)) | Base conversion (hex to dec) ((shell arithmetic expansion)) |
| • | units -t ‘100m/9.69s’ ‘miles/hour’ | Unit conversion (metric to imperial) |
| • | units -t ‘500GB’ ‘GiB’ | Unit conversion (SI to IEC prefixes) |
| • | units -t ‘1 googol’ | Definition lookup |
| • | seq 100 | (tr ‘n’ +; echo 0) | bc | Add a column of numbers. |
| calendar | ||
| • | cal -3 | Display a calendar |
| • | cal 9 1752 | Display a calendar for a particular month year |
| • | date -d fri | What date is it this friday. |
| • | [ $(date -d "tomorrow" +%d) = "01" ] || exit | exit a script unless it’s the last day of the month |
| • | date –date=’25 Dec’ +%A | What day does xmas fall on, this year |
| • | date –date=’@2147483647′ | Convert seconds since the epoch (1970-01-01 UTC) to date |
| • | TZ=’:America/Los_Angeles’ date | What time is it on West coast of US (use tzselect to find TZ) |
| echo “mail -s ‘get the train’ P@draigBrady.com < /dev/null” | at 17:45 | Email reminder | |
| • | echo “DISPLAY=$DISPLAY xmessage cooker” | at “NOW + 30 minutes” | Popup reminder |
| locales | ||
| • | printf “%’dn” 1234 | Print number with thousands grouping appropriate to locale |
| • | BLOCK_SIZE=’1 ls -l | get ls to do thousands grouping appropriate to locale |
| • | echo “I live in `locale territory`” | Extract info from locale database |
| • | LANG=en_IE.utf8 locale int_prefix | Lookup locale info for specific country. |
| • | locale | cut -d= -f1 | xargs locale -kc | less | List fields available in locale database |
| recode (Obsoletes iconv, dos2unix, unix2dos) | ||
| • | recode -l | less | Show available conversions (aliases on each line) |
| recode windows-1252.. file_to_change.txt | Windows “ansi” to local charset (auto does CRLF conversion) | |
| recode utf-8/CRLF.. file_to_change.txt | Windows utf8 to local charset | |
| recode iso-8859-15..utf8 file_to_change.txt | Latin9 (western europe) to utf8 | |
| recode ../b64 < file.txt > file.b64 | Base64 encode | |
| recode /qp.. < file.txt > file.qp | Quoted printable decode | |
| recode ..HTML < file.txt > file.html | Text to HTML | |
| • | recode -lf windows-1252 | grep euro | Lookup table of characters |
| • | echo -n 0×80 | recode latin-9/x1..dump | Show what a code represents in latin-9 charmap |
| • | echo -n 0×20AC | recode ucs-2/x2..latin-9/x | Show latin-9 encoding |
| • | echo -n 0×20AC | recode ucs-2/x2..utf-8/x | Show utf-8 encoding |
| CDs | ||
| gzip < /dev/cdrom > cdrom.iso.gz | Save copy of data cdrom | |
| mkisofs -V LABEL -r dir | gzip > cdrom.iso.gz | Create cdrom image from contents of dir | |
| mount -o loop cdrom.iso /mnt/dir | Mount the cdrom image at /mnt/dir (read only) | |
| cdrecord -v dev=/dev/cdrom blank=fast | Clear a CDRW | |
| gzip -dc cdrom.iso.gz | cdrecord -v dev=/dev/cdrom - | Burn cdrom image (use dev=ATAPI -scanbus to confirm dev) | |
| cdparanoia -B | Rip audio tracks from CD to wav files in current dir | |
| cdrecord -v dev=/dev/cdrom -audio *.wav | Make audio CD from all wavs in current dir (see also cdrdao) | |
| oggenc –tracknum=’track’ track.cdda.wav -o ‘track.ogg’ | Make ogg file from wav file | |
| disk space) | ||
| • | ls -lSr | Show files by size, biggest last |
| • | du -s * | sort -k1,1rn | head | Show top disk users in current dir. |
| • | df -h | Show free space on mounted filesystems |
| • | df -i | Show free inodes on mounted filesystems |
| • | fdisk -l | Show disks partitions sizes and types (run as root) |
| • | rpm -q -a –qf ‘%10{SIZE}t%{NAME}n’ | sort -k1,1n | List all packages by installed size (Bytes) on rpm distros |
| • | dpkg -query -W -f=’${Installed-Size;10}t${Package}n’ | sort -k1,1n | List all packages by installed size (KBytes) on deb distros |
| • | dd bs=1 seek=2TB if=/dev/null of=ext3.test | Create a large test file (taking no space). |
| • | > file | truncate data of file or create an empty file |
| monitoring/debugging | ||
| • | tail -f /var/log/messages | Monitor messages in a log file |
| • | strace -c ls >/dev/null | Summarise/profile system calls made by command |
| • | strace -f -e open ls >/dev/null | List system calls made by command |
| • | ltrace -f -e getenv ls >/dev/null | List library calls made by command |
| • | lsof -p $$ | List paths that process id has open |
| • | lsof ~ | List processes that have specified path open |
| • | tcpdump not port 22 | Show network traffic except ssh. See |
| • | ps -e -o pid,args –forest | List processes in a hierarchy |
| • | ps -e -o pcpu,cpu,nice,state,cputime,args –sort pcpu | sed ‘/^ 0.0 /d’ | List processes by % cpu usage |
| • | ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS | List processes by mem usage. |
| • | ps -C firefox-bin -L -o pid,tid,pcpu,state | List all threads for a particular process |
| • | ps -p 1,2 | List info for particular process IDs |
| • | last reboot | Show system reboot history |
| • | free -m | Show amount of (remaining) RAM (-m displays in MB) |
| • | watch -n.1 ‘cat /proc/interrupts’ | Watch changeable data continuously |
| system information (‘#’ means root access is required) | ||
| • | uname -a | Show kernel version and system architecture |
| • | head -n1 /etc/issue | Show name and version of distribution |
| • | cat /proc/partitions | Show all partitions registered on the system |
| • | grep MemTotal /proc/meminfo | Show RAM total seen by the system |
| • | grep “model name” /proc/cpuinfo | Show CPU(s) info |
| • | lspci -tv | Show PCI info |
| • | lsusb -tv | Show USB info |
| • | mount | column -t | List mounted filesystems on the system (and align output) |
| • | grep -F capacity: /proc/acpi/battery/BAT0/info | Show state of cells in laptop battery |
| # | dmidecode -q | less | Display SMBIOS/DMI information |
| # | smartctl -A /dev/sda | grep Power_On_Hours | How long has this disk (system) been powered on in total |
| # | hdparm -i /dev/sda | Show info about disk sda |
| # | hdparm -tT /dev/sda | Do a read speed test on disk sda |
| # | badblocks -s /dev/sda | Test for unreadable blocks on disk sda |
| interactive | ||
| • | readline | Line editor used by bash, python, bc, gnuplot, … |
| • | screen | Virtual terminals with detach capability, … |
| • | mc | Powerful file manager that can browse rpm, tar, ftp, ssh, … |
| • | gnuplot | Interactive/scriptable graphing |
| • | links | Web browser |
| • | xdg-open http://www.pixelbeat.org/ | open a file or url with the registered desktop application |
| miscellaneous | ||
| • | alias hd=’od -Ax -tx1z -v’ | Handy hexdump. (usage e.g.: • hd /proc/self/cmdline | less) |
| • | alias realpath=’readlink -f’ | Canonicalize path. (usage e.g.: • realpath ~/../$USER) |
| • | set | grep $USER | Search current environment |
| touch -c -t 0304050607 file | Set file timestamp (YYMMDDhhmm) | |
| • | python -m SimpleHTTPServer | Serve current directory tree at http://$HOSTNAME:8000/ |
Import or clone remote git (gitorious) repository using Eclipse EGit
Reference : http://www.thinkplexx.com/learn/howto/scm/git/import-or-clone-remote-git-gitorious-repository-using-eclipse-egit
Ubuntu 9.10
Git
Eclipse Helios
EGit
most Linux distos
any Eclipse with can EGit
Get the Uri and protocolsGitorious shows the proper Uri. Select your project in Gitorious in web browser and then go to your Repository.
You see “Clone & push urls” (1).
We will need this info:
which protocols are enabled (2) (default is “ssh”)
path for “git clone” (3) (copy it)
You can learn more about basic operations on particular repository using ” ? ” in repo view (4).
EGit importIn Eclipse: [ Import -> Git -> [Clone BUTTON] ]
Fill in data in “Clone Git Repository” dialog
Copy the path for “git clone” (copied in step 1) into “URI” field. Now, git complains about “Host not supported on file protocol”.
On some systems just pasting the right url and setting the protocol seems to be enough. On others, manual steps are needed as well.
Set the protocol drop down list to be ssh:// if that is the protocol your gitorious shows. Try the [ Next >] button. If it works, go to the step with entering the password. Skip the manual steps described next.
Prefix URI with ssh:// . That changes the protocol.
In host, make sure only host Url is shown, not host.name:project-name (for some reason my Gui always sets it this way). Copy project-name to the ‘repository-path’ input field instead
Do “Next >”. You will be asked for the pass phrase for your SSH “.rsa” or “.dsa” key.
Important
Here Gitorious expects that you have your private key from the key pair locally. The public key must have been previously stored in the Gitorious.
Enter password for your local private key, if any.
Now, cloning with Git should work.
That’s it, have fun!
I first had problems, how simple “git clone” can be done using Eclipse Egit. After it worked I decided to write a small how-to.
Basically, I have a remote repository in Gitorious and want it in Eclipse. Works for:
Should also work for:
| 1 |
You see “Clone & push urls” (1).
We will need this info:
| 2 |
| 3 |
Here Gitorious expects that you have your private key from the key pair locally. The public key must have been previously stored in the Gitorious.
Now, cloning with Git should work.
That’s it, have fun!
install qt4 dev 2
sudo apt-get install libgl-dev libglu-dev
install qt4 dev
sudo apt-get install libglib2.0-dev libSM-dev libxrender-dev libfontconfig1-dev libxext-dev
Thursday, January 6, 2011
install part 1
cd /var/downloads/
wget http://mirror.switch.ch/mirror/apache/dist/tomcat/tomcat-7/v7.0.5-beta/bin/apache-tomcat-7.0.5.tar.gz
tar xvzf apache-tomcat-7.0.5.tar.gz
mv apache-tomcat-7.0.5 tomcat7
sudo cp -rf tomcat7 /usr/share/tomcat7
sudo ln -s /usr/share/tomcat7 /usr/share/tomcat
sudo chmod 777 /usr/share/tomcat7/bin/*.sh
sudo useradd -d /usr/share/tomcat -s /sbin/nologin tomcat
Create Start Script
If you plan not to configure more than one instance, you can also change the variables INSTANCE_NAME and CATALINA_BASE.
The JVM Arguments (e.g. JAVA_OPTS) may not fit your needs, thus you should tweak them.
sudo vim /etc/init.d/<TOMCATINSTANCENAME>
/etc/init.d/<TOMCATINSTANCENAME>
001 #!/bin/sh
002 #
003 # /etc/init.d/tomcat -- startup script for the Tomcat 7 servlet engine
004 #
005 ### BEGIN INIT INFO
006 # Provides: tomcat
007 # Required-Start: $local_fs $remote_fs $network
008 # Required-Stop: $local_fs $remote_fs $network
009 # Should-Start: $named
010 # Should-Stop: $named
011 # Default-Start: 2 3 4 5
012 # Default-Stop: 0 1 6
013 # Short-Description: Start Tomcat.
014 # Description: Start the Tomcat servlet engine.
015 ### END INIT INFO
016
017 set -e
018
019 #PATH=/bin:/usr/bin:/sbin:/usr/sbin
020 NAME=tomcat7
021 INSTANCE_NAME=tomcat1
022 #For Default installations
023 #INSTANCE_NAME=$NAME
024 DESC="Tomcat servlet engine"
025 DAEMON_HOME=/usr/share/$NAME
026 DAEMON=$DAEMON_HOME/bin/jsvc
027 CATALINA_HOME=/usr/share/$NAME
028 TMP_DIR=/var/tmp/$INSTANCE_NAME
029
030 # Run Tomcat 7 as this user ID
031 TOMCAT_USER=tomcat
032
033 # Directory for per-instance configuration files and webapps
034 CATALINA_BASE=/var/lib/$INSTANCE_NAME
035 #For Default installations
036 #CATALINA_BASE=$CATALINA_HOME
037
038 ERR_LOG_FILE=$CATALINA_BASE/logs/$INSTANCE_NAME\_err.log
039 OUT_LOG_FILE=$CATALINA_BASE/logs/$INSTANCE_NAME\_out.log
040
041 if [ `id -u` -ne 0 ]; then
042 echo "You need root privileges to run this script"
043 exit 1
044 fi
045
046 # Make sure tomcat is started with system locale
047 if [ -r /etc/default/locale ]; then
048 . /etc/default/locale
049 export LANG
050 fi
051
052 . /lib/lsb/init-functions
053 . /etc/default/rcS
054
055
056
057 # The first existing directory is used for JAVA_HOME (if JAVA_HOME is not
058 # defined in $DEFAULT)
059 JDK_DIRS="/usr/lib/jvm/java-6-sun /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.5-sun /usr/lib/j2sdk1.5-ibm"
060
061 # Look for the right JVM to use
062 for jdir in $JDK_DIRS; do
063 if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
064 JAVA_HOME="$jdir"
065 fi
066 done
067 export JAVA_HOME
068
069 if [ -z "$JAVA_OPTS" ]; then
070 #JAVA_OPTS="-jvm server -DJINTEGRA_NATIVE_MODE -DJINTEGRA_PREFETCH_ENUMS -Djava.awt.headless=true -Xms128M -Xmx512M -XX:MaxPermSize=128m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSClassUnloadingEnabled -XX:+CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=30 -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:ParallelCMSThreads=2 -XX:+UseCMSCompactAtFullCollection -XX:+DisableExplicitGC -XX:MaxHeapFreeRatio=70 -XX:MinHeapFreeRatio=40 -XX:MaxTenuringThreshold=30 -XX:MaxNewSize=384m -XX:SurvivorRatio=2 -Dsun.rmi.dgc.client.gcInterval=1200000 -Dsun.rmi.dgc.server.gcInterval=1200000"
071 JAVA_OPTS="-jvm server -DJINTEGRA_NATIVE_MODE -DJINTEGRA_PREFETCH_ENUMS -Djava.awt.headless=true -Xss256K -Xms128M -Xmx512M -XX:MaxPermSize=128m -XX:NewSize=256M -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:CMSInitiatingOccupancyFraction=80"
072 fi
073
074 if [ ! -f "$CATALINA_HOME/bin/bootstrap.jar" ]; then
075 log_failure_msg "$NAME is not installed"
076 exit 1
077 fi
078
079 [ -f "$DAEMON" ] || exit 0
080
081 JAVA_OPTS="$JAVA_OPTS -Dcatalina.base=$CATALINA_BASE -Dcatalina.home=$CATALINA_HOME -Djava.io.tmpdir=$TMP_DIR"
082
083 # Set juli LogManager if logging.properties is provided
084 if [ -r "$CATALINA_BASE"/conf/logging.properties ]; then
085 JAVA_OPTS="$JAVA_OPTS "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" "-Djava.util.logging.config.file="$CATALINA_BASE/conf/logging.properties"
086 fi
087
088 # Define other required variables
089 CATALINA_PID="/var/run/$INSTANCE_NAME.pid"
090 BOOTSTRAP_CLASS=org.apache.catalina.startup.Bootstrap
091 JSVC_CLASSPATH="$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/bin/commons-daemon.jar:$CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/tomcat-juli.jar"
092
093 case "$1" in
094 start)
095 if [ -z "$JAVA_HOME" ]; then
096 log_failure_msg "no JDK found - please set JAVA_HOME"
097 exit 1
098 fi
099
100 if [ ! -d "$CATALINA_BASE/conf" ]; then
101 log_failure_msg "invalid CATALINA_BASE: $CATALINA_BASE"
102 exit 1
103 fi
104
105 log_daemon_msg "Starting $DESC" "$NAME"
106 if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
107 --user $TOMCAT_USER --startas "$JAVA_HOME/bin/java" \
108 >/dev/null; then
109
110 # Remove / recreate JVM_TMP directory
111 rm -rf "$TMP_DIR"
112 mkdir "$TMP_DIR" || {
113 log_failure_msg "could not create JVM temporary directory"
114 exit 1
115 }
116 chown $TOMCAT_USER "$TMP_DIR"
117 cd "$TMP_DIR"
118
119
120 $DAEMON -user "$TOMCAT_USER" -cp "$JSVC_CLASSPATH" \
121 -outfile "$OUT_LOG_FILE" -errfile "$ERR_LOG_FILE" \
122 -pidfile "$CATALINA_PID" $JAVA_OPTS "$BOOTSTRAP_CLASS"
123
124
125 sleep 5
126 if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
127 --user $TOMCAT_USER --startas "$JAVA_HOME/bin/java" \
128 >/dev/null; then
129 log_end_msg 1
130 else
131 log_end_msg 0
132 fi
133 else
134 log_progress_msg "(already running)"
135 log_end_msg 0
136 fi
137 ;;
138 stop)
139 log_daemon_msg "Stopping $DESC" "$NAME"
140 if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
141 --user "$TOMCAT_USER" --startas "$JAVA_HOME/bin/java" \
142 >/dev/null; then
143 log_progress_msg "(not running)"
144 else
145 $DAEMON -cp "$JSVC_CLASSPATH" -pidfile "$CATALINA_PID" \
146 -stop "$BOOTSTRAP_CLASS"
147 fi
148 rm -rf "$TMP_DIR"
149 log_end_msg 0
150 ;;
151 status)
152 if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
153 --user $TOMCAT_USER --startas "$JAVA_HOME/bin/java" \
154 >/dev/null; then
155
156 if [ -f "$CATALINA_PID" ]; then
157 log_success_msg "$DESC is not running, but pid file exists."
158 exit 1
159 else
160 log_success_msg "$DESC is not running."
161 exit 3
162 fi
163 else
164 log_success_msg "$DESC is running with pid `cat $CATALINA_PID`"
165 fi
166 ;;
167 restart|force-reload)
168 if start-stop-daemon --test --stop --pidfile "$CATALINA_PID" \
169 --user $TOMCAT_USER --startas "$JAVA_HOME/bin/java" \
170 >/dev/null; then
171 $0 stop
172 sleep 1
173 fi
174 $0 start
175 ;;
176 try-restart)
177 if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
178 --user $TOMCAT_USER --startas "$JAVA_HOME/bin/java" \
179 >/dev/null; then
180 $0 start
181 fi
182 ;;
183 *)
184 log_success_msg "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
185 exit 1
186 ;;
187 esac
188
189 exit 0
#########3
sudo chmod +x /etc/init.d/<TOMCATINSTANCENAME>
sudo chmod 755 /etc/init.d/<TOMCATINSTANCENAME>
/etc/profile.d/env.sh
1 export JAVA_HOME=/usr/lib/jvm/java-6-sun
2 export JRE_HOME=$JAVA_HOME/jre
3 export TOMCAT_HOME=/usr/share/tomcat7
4 export PATH=$PATH:$JAVA_HOME/bin
5 export CLASSPATH=.:$JRE_HOME/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
sudo chmod +x /etc/profile.d/env.sh
Native APR Support
cd /usr/share/tomcat7/bin
sudo tar xvzf tomcat-native.tar.gz
JAVA_HOME=/usr/lib/jvm/java-6-sun
export JAVA_HOME
CATALINA_HOME=/usr/share/tomcat7
export CATALINA_HOMEcd /usr/share/tomcat/bin/tomcat-native-1.1.20-src/jni/native/
sudo ./configure --with-apr=/usr --with-java-home=$JAVA_HOME --with-ssl=yes --prefix=$CATALINA_HOME
sudo make
sudo make install
cd /usr/lib
sudo rm -f libtcnative-1.so
sudo ln -s /usr/local/apr/lib/libtcnative-1.so libtcnative-1.so
Daemon Support
cd /usr/share/tomcat7/bin
sudo tar xvfz commons-daemon-native.tar.gz
cd commons-daemon-1.0.4-native-src/unix/
sudo ./configure --with-java=$JAVA_HOME
sudo make
sudo cp jsvc ../..
Create a Tomcat Instance
This procedure is the same for every instance. As home for instances I chose /var/lib.
cd /var/lib/
sudo mkdir -p tomcat<InstanceNr>
sudo mkdir -p tomcat<InstanceNr>/conf
sudo mkdir -p tomcat<InstanceNr>/logs
sudo mkdir -p tomcat<InstanceNr>/temp
sudo mkdir -p tomcat<InstanceNr>/work
sudo mkdir -p tomcat<InstanceNr>/webapps
sudo cp /usr/share/tomcat7/conf/server.xml ./tomcat<InstanceNr>/conf/
sudo cp /usr/share/tomcat7/conf/web.xml ./tomcat<InstanceNr>/conf/
sudo cp /usr/share/tomcat7/conf/tomcat-users.xml ./tomcat<InstanceNr>/conf/
sudo cp -R /usr/share/tomcat7/conf/Catalina ./tomcat<InstanceNr>/conf/
###
New Note 36
export CATALINA_HOME
cd /usr/share/tomcat/bin/tomcat-native-1.1.20-src/jni/native/
sudo ./configure --with-apr=/usr --with-java-home=$JAVA_HOME --with-ssl=yes --prefix=$CATALINA_HOME
sudo mkdir -p
sudo cp /usr/share/tomcat7/conf/server.xml ./tomcat1/conf/
tomcat1
[...]
<Server port="8105" shutdown="SHUTDOWN">
[...]
<Connector port="8<InstanceNr>80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8<InstanceNr>43" />
[...]
<Connector port="8<InstanceNr>09" protocol="AJP/1.3" redirectPort="8<InstanceNr>43" />
[...]
##########
Troubleshooting Steps Of Tomcat Server
12/10/2010 09:25:00 PM Posted by Meghana M Bhombhore
Labels: Tomcat, Troubleshooting
Share
Troubleshooting Steps to check whether the Tomcat server is runing or not?
Step1 : Check ps command output
#ps -ef | grep tomcat
Step2 : Check with nmap whether port 8080 is opened or not?
#nmap localhost
Step3 : Check with telnet command as shown in below by executing GET / HTTP/1.0 Host: localhost command once logged in to server at 8080 port.
#telnet localhost 8080 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. GET / HTTP/1.0 Host: localhost
This command should output hte test tomcat page.
Enjoy the troubleshooting:)
#########3
sudo apt-get install sun-java6-bin sun-java6-jre
sudo apt-get install sun-java6-jdk
sudo update-java-alternatives -s java-6-sun
sudo apt-get install libapr1-dev libssl-dev gcc
sudo vim /etc/jvm
java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)
##########
sudo apt-get install sun-java6-jdk
sudo apt-get install ant
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export ANT_HOME=/usr/share/ant
You can put those two commands in your /home/username/.profile if you want to make them permanent.
sudo apt-get install openjdk-6-jdk
How To Change The Java Version In Linux?
12/10/2010 01:16:00 AM Posted by Surendra Kumar Chowdary
Labels: How-To's
Share
This post is regarding how to change java version if multiple java versions are installed?
Check what are the java versions are installed on your system
#java -version
Example output
OpenJDK Runtime Environment (build 1.6.0-b09)
OpenJDK Client VM (build 1.6.0-b09, mixed mode)
So now I want to change the one version to another version.
If more than one java is installed. Execute below command to see how many java versions are installed? And what is the default version (Default version will be indicated by *)
#update-alternatives --config java
This command will display which is default java version used by your machine..
Example output.
# update-alternatives --config java
There are 2 programs which provided 'java'.
Selection Command
-----------------------------------------------
1. /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
Enter to keep the current selection[+], or type selection number:
So if you want to change the java version from 1.6 (now 2 is default version as shown) to 1.4 just press “1” with out quotes.
Please let us know if you know other way of changing java version.
#cd /opt
#wget http://www.trieuvan.com/apache/tomcat/tomcat-6/v6.0.29/bin/apache-tomcat-6.0.29.tar.gz
#tar xvfz apache-tomcat-6.0.29.tar.g
UFW is installed by default, but if you need a graphical interface, install GUFW.
sudo apt-get install gufw
update-alternatives --config java
How to set java path in Linux?
Ans : Check where java is installed by using below command
#update-alternatives --config java
This command will show installed java packages in your machine.
Example output :
# update-alternatives --config java
There are 2 programs which provide 'java'.
Selection ----------------------------------------------- 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java *+ 2
From above you can see java version in use it. 1.6.
Setting java path(In Temporary way)
#JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk #export $JAVA_HOME
Setting java path (In Permanent way)
Edit ~/.bashrc and place below two lines in that file and save the file.
Vi ~/.bashrc
JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk export $JAVA_HOME
Now save the file and exit, then logout and login to make those changes to reflect.
Command
/usr/lib/jvm/jre-1.6.0-openjdk/bin/java
$$$$$$$$$$$
How To Change The Java Version In Linux?
12/10/2010 01:16:00 AM Posted by Surendra Kumar Chowdary
Labels: How-To's
Share
This post is regarding how to change java version if multiple java versions are installed?
Check what are the java versions are installed on your system
#java -version
Example output
OpenJDK Runtime Environment (build 1.6.0-b09)
OpenJDK Client VM (build 1.6.0-b09, mixed mode)
So now I want to change the one version to another version.
If more than one java is installed. Execute below command to see how many java versions are installed? And what is the default version (Default version will be indicated by *)
#update-alternatives --config java
This command will display which is default java version used by your machine..
Example output.
# update-alternatives --config java
There are 2 programs which provided 'java'.
Selection Command
-----------------------------------------------
1. /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
Enter to keep the current selection[+], or type selection number:
So if you want to change the java version from 1.6 (now 2 is default version as shown) to 1.4 just press “1” with out quotes.
Please let us know if you know other way of changing java version.
###############
Install Java
sudo gedit /etc/apt/sources.list
# Add at the buttom
deb http://archive.canonical.com/ lucid partner
#
sudo apt-get update
#
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
# check
java -version
# resuts :
java version “1.6.0.20″
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Server VM (build 16.3-b01, mixed mode)
#
locate libjavaplugin
Results
/usr/lib/jvm/java-6-sun-1.6.0.22/jre/plugin/i386/ns7/libjavaplugin_oji.so
#
cd /usr/lib/mozilla/plugins
# Look for
/usr/lib/jvm/java-6-sun1.6.0.20/jre/plugin/i386/ns7/libjavaplugin_oji.so.
ln -s /usr/lib/jvm/java-6-sun-1.6.0.22/jre/plugin/i386/ns7/libjavaplugin_oji.so
# Now that you know the path you need to create a link to this in the /usr/lib/mozilla/plugins directory
#
restart Firefox and then enter about:plugins in the address bar to see that Java is now enabled in your browser.
# Another option :
ln -s /usr/lib/jvm/java-6-sun-1.6.0.20/jre/plugin/i386/ns7/libjavaplugin_oji.so libjavaplugin.so
#############
Install JDK on UBUNTU (any version) Without Internet Connection
These are the steps I used to install the Java JDK binary,Externally on my System which ain't have Internet.
1.Dowload the latest Java JDK for Linux Platform (in my case,jdk-6u22-linux-i586.bin) from the Sun Java site.Using any System Which Have Internet.
(you can also use jdk-6u3-linux-i586.bin and many other versions)
[*Note:Do not download ".rpm" version of jdk(like jdk-6u22-linux-i586-rpm.bin)]
2.In Terminal Change directory to /usr/local/lib [using comand $cd /usr/local/lib]
3.From there extract the JRE or JDK archive file you downloaded:
$ sudo sh /some/path/jdk-6u3-linux-i586.bin
[In the above commands, replace /some/path with where the JRE/JDK .bin resides and of course replace the filename with what it actually is in your case.]
(In my case: $sudo sh /home/Kishor/Downloads/jdk-6u22-linux-i586.bin)
4.Now Lets create some symlinks so that the executables can be run easily:
Change directory to /usr/local/bin [$ cd /usr/local/bin]
From there execute the following set of commands:
$ sudo ln -sf ../lib/jdk1.6.0_22/bin/* .
[Please Pay attention to the "dot(.)" at the end of the command, it is required and IMPORTENT.
And adjust the directory as well to what you have (e.g. jdk1.6.0_03 in folder /usr/local/lib)
(in mycase it is: jdk1.6.0_22/bin)]
5.Verify installation
To verify that the installation was successful, execute
$ java -version
The output should look something like this if everything is well
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)
6. Now you can Execute Java Programs From any directory from your system,here is a small example of mine:
kishor@ubuntu:~/Desktop$ javac HelloWorld.java
kishor@ubuntu:~/Desktop$ java HelloWorld
Hello World!!
kishor@ubuntu:~/Desktop$
#####
5) Download Ubuntu Tweak and VLC
Download Ubuntu Tweak here and install it by double clicking the .deb file
Download VLC by this command
sudo apt-get install vlc
######
4) Ubuntu-Restricted-extras
YouTube, LLCCan’t listen to MP3? Can’t watch Youtube video? Can’t run Java? Don’t worry, all you need to do is to install the ubuntu-restricted-extras package and it will install all the necessary files/codecs for you. Some common applications in the package include MP3 codec, Adobe Flash player, Java runtime and Microsoft core fonts.
sudo apt-get install ubuntu-restricted-extras
###
2) Enable the repositories
Every time I do a fresh install of Ubuntu, the first thing that I do is to enable the universe, multiverse, backport and Canonical’s ‘partner’ repositories. These repositories open up new application choices and allow you to install popular third party software easily and quickly.
Go to System -> Administration -> Synaptic Package Manager.
Click on Settings -> Repositories.
Check all the boxes.
Go to the Third-Party Software tab. Check all the boxes.
Click on Close button and press the Reload button at the top left corner to update the repositories.
###
ubuntu-restricted-extras
sudo apt-get install ubuntu-restricted-extras
###
http://www.linuxnix.com/2010/05/how-to-kill-defunct-or-zombie-process.html
* How To Access Web Server Through IP Address?
* How To Configure And Install Sendmail In Linux?
* How To Upgrade An Installed Source Package?
* How To Install Apache Tomcat on Linux(Redhat/Ubuntu)?
* How To Set Java Path In Linux?
######3
GDebi Package Installer
###
sudo apt-get install nautilus-open-terminal
##############################################
How To Install Apache Tomcat on Linux(Redhat/Ubuntu)?
12/10/2010 09:08:00 PM Posted by Meghana M Bhombhore
Labels: Advanced Servers, How-To's
Share
How to install Apache tomcat on Linux(Redhat/Ubuntu)?
What is Apache tomcat?
Ans : ApacheTomcat is an open source web application server which supports J2ee Servlets, JavaServer, Pages(JSP) and API's. Tomcat should not be confused with Apache web server which an HTTP web server.
---Wikipedia.
Some terminology about Apache tomcat.
Apache Tomcat can be configured by editing server.xml file. Those who knows apache web server. This server.xml can be taken as synonimas to httpd.conf file.
Servlet is defined as a way add dynamic content to a Web server using the Java platform. And a servlet container is a compiled, executable program. The servlet container name is tomcat is catalina.
Pre requists for Apache tomcat are
1. java
2. JDK
Step by step for installing Apache tomcat
Note : Avoide installing tomcat from reposatories, always prefer to install it from source downloaded from apache site.
Step1 : Install all the prequistes
Redhat :
#yum install java
Ubuntu :
#apt-get install java
Step2 : Download tomcat source package and uncompress it.
Redhat/Ubuntu
#cd /opt
#wget http://www.trieuvan.com/apache/tomcat/tomcat-6/v6.0.29/bin/apache-tomcat-6.0.29.tar.gz
#tar xvfz apache-tomcat-6.0.29.tar.gz
Step3 : Setup the paths for Catalina and others.
Setting catalina paths
Redhat/ubuntu
CATALINA_HOME=/opt/apache-tomcat-6.0.29
CATALINA_BASE=/opt/apache-tomcat-6.0.29
Setting java paths
Check what java versions are installed in your system
#update-alternatives --config java
This command will display which is default java version used by your machine.
Example output :
# update-alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
1
/usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2
/usr/lib/jvm/jre-1.6.0-openjdk/bin/java
Enter to keep the current selection[+], or type selection number:
If you see above the default java version is 1.6 so set the path to /usr/lib/jvm/jre-1.6.0-openjdk
JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk
JDK_HOMe=$JAVA_HOME
Step4 : Now start tomcat server
#/opt/apache-tomcat-6.0.29/bin/sartup.sh
Sample output.
Using CATALINA_BASE: /opt/apache-tomcat-5.5.26
Using CATALINA_HOME: /opt/apache-tomcat-5.5.26
Using CATALINA_TMPDIR: /opt/apache-tomcat-5.5.26/temp
Using JRE_HOME:
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/
Step5 : By default Apache Tomcat will be hosted onlocalhost : 8080 port by default. So try to access the site with web browser
http://localhost:8080
or
http://localhost:8080
or
http://systemname:8080
Stay tuned to other posts about troubleshooting tomcat installation.
###########3
Wine
Wine is a must-have application for those who can’t live without their Windows applications, It allows you to install your Windows application in your Ubuntu machine and run them like native Windows apps.
sudo apt-get install wine
Once you have installed Wine, remember to run the configuration (Applications -> Wine -> Configure Wine) before attempting to install your favorite Windows app.
wget http://mirror.switch.ch/mirror/apache/dist/tomcat/tomcat-7/v7.0.5-beta/bin/apache-tomcat-7.0.5.tar.gz
tar xvzf apache-tomcat-7.0.5.tar.gz
mv apache-tomcat-7.0.5 tomcat7
sudo cp -rf tomcat7 /usr/share/tomcat7
sudo ln -s /usr/share/tomcat7 /usr/share/tomcat
sudo chmod 777 /usr/share/tomcat7/bin/*.sh
sudo useradd -d /usr/share/tomcat -s /sbin/nologin tomcat
Create Start Script
If you plan not to configure more than one instance, you can also change the variables INSTANCE_NAME and CATALINA_BASE.
The JVM Arguments (e.g. JAVA_OPTS) may not fit your needs, thus you should tweak them.
sudo vim /etc/init.d/<TOMCATINSTANCENAME>
/etc/init.d/<TOMCATINSTANCENAME>
001 #!/bin/sh
002 #
003 # /etc/init.d/tomcat -- startup script for the Tomcat 7 servlet engine
004 #
005 ### BEGIN INIT INFO
006 # Provides: tomcat
007 # Required-Start: $local_fs $remote_fs $network
008 # Required-Stop: $local_fs $remote_fs $network
009 # Should-Start: $named
010 # Should-Stop: $named
011 # Default-Start: 2 3 4 5
012 # Default-Stop: 0 1 6
013 # Short-Description: Start Tomcat.
014 # Description: Start the Tomcat servlet engine.
015 ### END INIT INFO
016
017 set -e
018
019 #PATH=/bin:/usr/bin:/sbin:/usr/sbin
020 NAME=tomcat7
021 INSTANCE_NAME=tomcat1
022 #For Default installations
023 #INSTANCE_NAME=$NAME
024 DESC="Tomcat servlet engine"
025 DAEMON_HOME=/usr/share/$NAME
026 DAEMON=$DAEMON_HOME/bin/jsvc
027 CATALINA_HOME=/usr/share/$NAME
028 TMP_DIR=/var/tmp/$INSTANCE_NAME
029
030 # Run Tomcat 7 as this user ID
031 TOMCAT_USER=tomcat
032
033 # Directory for per-instance configuration files and webapps
034 CATALINA_BASE=/var/lib/$INSTANCE_NAME
035 #For Default installations
036 #CATALINA_BASE=$CATALINA_HOME
037
038 ERR_LOG_FILE=$CATALINA_BASE/logs/$INSTANCE_NAME\_err.log
039 OUT_LOG_FILE=$CATALINA_BASE/logs/$INSTANCE_NAME\_out.log
040
041 if [ `id -u` -ne 0 ]; then
042 echo "You need root privileges to run this script"
043 exit 1
044 fi
045
046 # Make sure tomcat is started with system locale
047 if [ -r /etc/default/locale ]; then
048 . /etc/default/locale
049 export LANG
050 fi
051
052 . /lib/lsb/init-functions
053 . /etc/default/rcS
054
055
056
057 # The first existing directory is used for JAVA_HOME (if JAVA_HOME is not
058 # defined in $DEFAULT)
059 JDK_DIRS="/usr/lib/jvm/java-6-sun /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.5-sun /usr/lib/j2sdk1.5-ibm"
060
061 # Look for the right JVM to use
062 for jdir in $JDK_DIRS; do
063 if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
064 JAVA_HOME="$jdir"
065 fi
066 done
067 export JAVA_HOME
068
069 if [ -z "$JAVA_OPTS" ]; then
070 #JAVA_OPTS="-jvm server -DJINTEGRA_NATIVE_MODE -DJINTEGRA_PREFETCH_ENUMS -Djava.awt.headless=true -Xms128M -Xmx512M -XX:MaxPermSize=128m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSClassUnloadingEnabled -XX:+CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=30 -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:ParallelCMSThreads=2 -XX:+UseCMSCompactAtFullCollection -XX:+DisableExplicitGC -XX:MaxHeapFreeRatio=70 -XX:MinHeapFreeRatio=40 -XX:MaxTenuringThreshold=30 -XX:MaxNewSize=384m -XX:SurvivorRatio=2 -Dsun.rmi.dgc.client.gcInterval=1200000 -Dsun.rmi.dgc.server.gcInterval=1200000"
071 JAVA_OPTS="-jvm server -DJINTEGRA_NATIVE_MODE -DJINTEGRA_PREFETCH_ENUMS -Djava.awt.headless=true -Xss256K -Xms128M -Xmx512M -XX:MaxPermSize=128m -XX:NewSize=256M -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:CMSInitiatingOccupancyFraction=80"
072 fi
073
074 if [ ! -f "$CATALINA_HOME/bin/bootstrap.jar" ]; then
075 log_failure_msg "$NAME is not installed"
076 exit 1
077 fi
078
079 [ -f "$DAEMON" ] || exit 0
080
081 JAVA_OPTS="$JAVA_OPTS -Dcatalina.base=$CATALINA_BASE -Dcatalina.home=$CATALINA_HOME -Djava.io.tmpdir=$TMP_DIR"
082
083 # Set juli LogManager if logging.properties is provided
084 if [ -r "$CATALINA_BASE"/conf/logging.properties ]; then
085 JAVA_OPTS="$JAVA_OPTS "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" "-Djava.util.logging.config.file="$CATALINA_BASE/conf/logging.properties"
086 fi
087
088 # Define other required variables
089 CATALINA_PID="/var/run/$INSTANCE_NAME.pid"
090 BOOTSTRAP_CLASS=org.apache.catalina.startup.Bootstrap
091 JSVC_CLASSPATH="$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/bin/commons-daemon.jar:$CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/tomcat-juli.jar"
092
093 case "$1" in
094 start)
095 if [ -z "$JAVA_HOME" ]; then
096 log_failure_msg "no JDK found - please set JAVA_HOME"
097 exit 1
098 fi
099
100 if [ ! -d "$CATALINA_BASE/conf" ]; then
101 log_failure_msg "invalid CATALINA_BASE: $CATALINA_BASE"
102 exit 1
103 fi
104
105 log_daemon_msg "Starting $DESC" "$NAME"
106 if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
107 --user $TOMCAT_USER --startas "$JAVA_HOME/bin/java" \
108 >/dev/null; then
109
110 # Remove / recreate JVM_TMP directory
111 rm -rf "$TMP_DIR"
112 mkdir "$TMP_DIR" || {
113 log_failure_msg "could not create JVM temporary directory"
114 exit 1
115 }
116 chown $TOMCAT_USER "$TMP_DIR"
117 cd "$TMP_DIR"
118
119
120 $DAEMON -user "$TOMCAT_USER" -cp "$JSVC_CLASSPATH" \
121 -outfile "$OUT_LOG_FILE" -errfile "$ERR_LOG_FILE" \
122 -pidfile "$CATALINA_PID" $JAVA_OPTS "$BOOTSTRAP_CLASS"
123
124
125 sleep 5
126 if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
127 --user $TOMCAT_USER --startas "$JAVA_HOME/bin/java" \
128 >/dev/null; then
129 log_end_msg 1
130 else
131 log_end_msg 0
132 fi
133 else
134 log_progress_msg "(already running)"
135 log_end_msg 0
136 fi
137 ;;
138 stop)
139 log_daemon_msg "Stopping $DESC" "$NAME"
140 if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
141 --user "$TOMCAT_USER" --startas "$JAVA_HOME/bin/java" \
142 >/dev/null; then
143 log_progress_msg "(not running)"
144 else
145 $DAEMON -cp "$JSVC_CLASSPATH" -pidfile "$CATALINA_PID" \
146 -stop "$BOOTSTRAP_CLASS"
147 fi
148 rm -rf "$TMP_DIR"
149 log_end_msg 0
150 ;;
151 status)
152 if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
153 --user $TOMCAT_USER --startas "$JAVA_HOME/bin/java" \
154 >/dev/null; then
155
156 if [ -f "$CATALINA_PID" ]; then
157 log_success_msg "$DESC is not running, but pid file exists."
158 exit 1
159 else
160 log_success_msg "$DESC is not running."
161 exit 3
162 fi
163 else
164 log_success_msg "$DESC is running with pid `cat $CATALINA_PID`"
165 fi
166 ;;
167 restart|force-reload)
168 if start-stop-daemon --test --stop --pidfile "$CATALINA_PID" \
169 --user $TOMCAT_USER --startas "$JAVA_HOME/bin/java" \
170 >/dev/null; then
171 $0 stop
172 sleep 1
173 fi
174 $0 start
175 ;;
176 try-restart)
177 if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
178 --user $TOMCAT_USER --startas "$JAVA_HOME/bin/java" \
179 >/dev/null; then
180 $0 start
181 fi
182 ;;
183 *)
184 log_success_msg "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
185 exit 1
186 ;;
187 esac
188
189 exit 0
#########3
sudo chmod +x /etc/init.d/<TOMCATINSTANCENAME>
sudo chmod 755 /etc/init.d/<TOMCATINSTANCENAME>
/etc/profile.d/env.sh
1 export JAVA_HOME=/usr/lib/jvm/java-6-sun
2 export JRE_HOME=$JAVA_HOME/jre
3 export TOMCAT_HOME=/usr/share/tomcat7
4 export PATH=$PATH:$JAVA_HOME/bin
5 export CLASSPATH=.:$JRE_HOME/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
sudo chmod +x /etc/profile.d/env.sh
Native APR Support
cd /usr/share/tomcat7/bin
sudo tar xvzf tomcat-native.tar.gz
JAVA_HOME=/usr/lib/jvm/java-6-sun
export JAVA_HOME
CATALINA_HOME=/usr/share/tomcat7
export CATALINA_HOMEcd /usr/share/tomcat/bin/tomcat-native-1.1.20-src/jni/native/
sudo ./configure --with-apr=/usr --with-java-home=$JAVA_HOME --with-ssl=yes --prefix=$CATALINA_HOME
sudo make
sudo make install
cd /usr/lib
sudo rm -f libtcnative-1.so
sudo ln -s /usr/local/apr/lib/libtcnative-1.so libtcnative-1.so
Daemon Support
cd /usr/share/tomcat7/bin
sudo tar xvfz commons-daemon-native.tar.gz
cd commons-daemon-1.0.4-native-src/unix/
sudo ./configure --with-java=$JAVA_HOME
sudo make
sudo cp jsvc ../..
Create a Tomcat Instance
This procedure is the same for every instance. As home for instances I chose /var/lib.
cd /var/lib/
sudo mkdir -p tomcat<InstanceNr>
sudo mkdir -p tomcat<InstanceNr>/conf
sudo mkdir -p tomcat<InstanceNr>/logs
sudo mkdir -p tomcat<InstanceNr>/temp
sudo mkdir -p tomcat<InstanceNr>/work
sudo mkdir -p tomcat<InstanceNr>/webapps
sudo cp /usr/share/tomcat7/conf/server.xml ./tomcat<InstanceNr>/conf/
sudo cp /usr/share/tomcat7/conf/web.xml ./tomcat<InstanceNr>/conf/
sudo cp /usr/share/tomcat7/conf/tomcat-users.xml ./tomcat<InstanceNr>/conf/
sudo cp -R /usr/share/tomcat7/conf/Catalina ./tomcat<InstanceNr>/conf/
###
New Note 36
export CATALINA_HOME
cd /usr/share/tomcat/bin/tomcat-native-1.1.20-src/jni/native/
sudo ./configure --with-apr=/usr --with-java-home=$JAVA_HOME --with-ssl=yes --prefix=$CATALINA_HOME
sudo mkdir -p
sudo cp /usr/share/tomcat7/conf/server.xml ./tomcat1/conf/
tomcat1
[...]
<Server port="8105" shutdown="SHUTDOWN">
[...]
<Connector port="8<InstanceNr>80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8<InstanceNr>43" />
[...]
<Connector port="8<InstanceNr>09" protocol="AJP/1.3" redirectPort="8<InstanceNr>43" />
[...]
##########
Troubleshooting Steps Of Tomcat Server
12/10/2010 09:25:00 PM Posted by Meghana M Bhombhore
Labels: Tomcat, Troubleshooting
Share
Troubleshooting Steps to check whether the Tomcat server is runing or not?
Step1 : Check ps command output
#ps -ef | grep tomcat
Step2 : Check with nmap whether port 8080 is opened or not?
#nmap localhost
Step3 : Check with telnet command as shown in below by executing GET / HTTP/1.0 Host: localhost command once logged in to server at 8080 port.
#telnet localhost 8080 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. GET / HTTP/1.0 Host: localhost
This command should output hte test tomcat page.
Enjoy the troubleshooting:)
#########3
sudo apt-get install sun-java6-bin sun-java6-jre
sudo apt-get install sun-java6-jdk
sudo update-java-alternatives -s java-6-sun
sudo apt-get install libapr1-dev libssl-dev gcc
sudo vim /etc/jvm
java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)
##########
sudo apt-get install sun-java6-jdk
sudo apt-get install ant
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export ANT_HOME=/usr/share/ant
You can put those two commands in your /home/username/.profile if you want to make them permanent.
sudo apt-get install openjdk-6-jdk
How To Change The Java Version In Linux?
12/10/2010 01:16:00 AM Posted by Surendra Kumar Chowdary
Labels: How-To's
Share
This post is regarding how to change java version if multiple java versions are installed?
Check what are the java versions are installed on your system
#java -version
Example output
OpenJDK Runtime Environment (build 1.6.0-b09)
OpenJDK Client VM (build 1.6.0-b09, mixed mode)
So now I want to change the one version to another version.
If more than one java is installed. Execute below command to see how many java versions are installed? And what is the default version (Default version will be indicated by *)
#update-alternatives --config java
This command will display which is default java version used by your machine..
Example output.
# update-alternatives --config java
There are 2 programs which provided 'java'.
Selection Command
-----------------------------------------------
1. /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
Enter to keep the current selection[+], or type selection number:
So if you want to change the java version from 1.6 (now 2 is default version as shown) to 1.4 just press “1” with out quotes.
Please let us know if you know other way of changing java version.
#cd /opt
#wget http://www.trieuvan.com/apache/tomcat/tomcat-6/v6.0.29/bin/apache-tomcat-6.0.29.tar.gz
#tar xvfz apache-tomcat-6.0.29.tar.g
UFW is installed by default, but if you need a graphical interface, install GUFW.
sudo apt-get install gufw
update-alternatives --config java
How to set java path in Linux?
Ans : Check where java is installed by using below command
#update-alternatives --config java
This command will show installed java packages in your machine.
Example output :
# update-alternatives --config java
There are 2 programs which provide 'java'.
Selection ----------------------------------------------- 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java *+ 2
From above you can see java version in use it. 1.6.
Setting java path(In Temporary way)
#JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk #export $JAVA_HOME
Setting java path (In Permanent way)
Edit ~/.bashrc and place below two lines in that file and save the file.
Vi ~/.bashrc
JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk export $JAVA_HOME
Now save the file and exit, then logout and login to make those changes to reflect.
Command
/usr/lib/jvm/jre-1.6.0-openjdk/bin/java
$$$$$$$$$$$
How To Change The Java Version In Linux?
12/10/2010 01:16:00 AM Posted by Surendra Kumar Chowdary
Labels: How-To's
Share
This post is regarding how to change java version if multiple java versions are installed?
Check what are the java versions are installed on your system
#java -version
Example output
OpenJDK Runtime Environment (build 1.6.0-b09)
OpenJDK Client VM (build 1.6.0-b09, mixed mode)
So now I want to change the one version to another version.
If more than one java is installed. Execute below command to see how many java versions are installed? And what is the default version (Default version will be indicated by *)
#update-alternatives --config java
This command will display which is default java version used by your machine..
Example output.
# update-alternatives --config java
There are 2 programs which provided 'java'.
Selection Command
-----------------------------------------------
1. /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
Enter to keep the current selection[+], or type selection number:
So if you want to change the java version from 1.6 (now 2 is default version as shown) to 1.4 just press “1” with out quotes.
Please let us know if you know other way of changing java version.
###############
Install Java
sudo gedit /etc/apt/sources.list
# Add at the buttom
deb http://archive.canonical.com/ lucid partner
#
sudo apt-get update
#
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
# check
java -version
# resuts :
java version “1.6.0.20″
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Server VM (build 16.3-b01, mixed mode)
#
locate libjavaplugin
Results
/usr/lib/jvm/java-6-sun-1.6.0.22/jre/plugin/i386/ns7/libjavaplugin_oji.so
#
cd /usr/lib/mozilla/plugins
# Look for
/usr/lib/jvm/java-6-sun1.6.0.20/jre/plugin/i386/ns7/libjavaplugin_oji.so.
ln -s /usr/lib/jvm/java-6-sun-1.6.0.22/jre/plugin/i386/ns7/libjavaplugin_oji.so
# Now that you know the path you need to create a link to this in the /usr/lib/mozilla/plugins directory
#
restart Firefox and then enter about:plugins in the address bar to see that Java is now enabled in your browser.
# Another option :
ln -s /usr/lib/jvm/java-6-sun-1.6.0.20/jre/plugin/i386/ns7/libjavaplugin_oji.so libjavaplugin.so
#############
Install JDK on UBUNTU (any version) Without Internet Connection
These are the steps I used to install the Java JDK binary,Externally on my System which ain't have Internet.
1.Dowload the latest Java JDK for Linux Platform (in my case,jdk-6u22-linux-i586.bin) from the Sun Java site.Using any System Which Have Internet.
(you can also use jdk-6u3-linux-i586.bin and many other versions)
[*Note:Do not download ".rpm" version of jdk(like jdk-6u22-linux-i586-rpm.bin)]
2.In Terminal Change directory to /usr/local/lib [using comand $cd /usr/local/lib]
3.From there extract the JRE or JDK archive file you downloaded:
$ sudo sh /some/path/jdk-6u3-linux-i586.bin
[In the above commands, replace /some/path with where the JRE/JDK .bin resides and of course replace the filename with what it actually is in your case.]
(In my case: $sudo sh /home/Kishor/Downloads/jdk-6u22-linux-i586.bin)
4.Now Lets create some symlinks so that the executables can be run easily:
Change directory to /usr/local/bin [$ cd /usr/local/bin]
From there execute the following set of commands:
$ sudo ln -sf ../lib/jdk1.6.0_22/bin/* .
[Please Pay attention to the "dot(.)" at the end of the command, it is required and IMPORTENT.
And adjust the directory as well to what you have (e.g. jdk1.6.0_03 in folder /usr/local/lib)
(in mycase it is: jdk1.6.0_22/bin)]
5.Verify installation
To verify that the installation was successful, execute
$ java -version
The output should look something like this if everything is well
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)
6. Now you can Execute Java Programs From any directory from your system,here is a small example of mine:
kishor@ubuntu:~/Desktop$ javac HelloWorld.java
kishor@ubuntu:~/Desktop$ java HelloWorld
Hello World!!
kishor@ubuntu:~/Desktop$
#####
5) Download Ubuntu Tweak and VLC
Download Ubuntu Tweak here and install it by double clicking the .deb file
Download VLC by this command
sudo apt-get install vlc
######
4) Ubuntu-Restricted-extras
YouTube, LLCCan’t listen to MP3? Can’t watch Youtube video? Can’t run Java? Don’t worry, all you need to do is to install the ubuntu-restricted-extras package and it will install all the necessary files/codecs for you. Some common applications in the package include MP3 codec, Adobe Flash player, Java runtime and Microsoft core fonts.
sudo apt-get install ubuntu-restricted-extras
###
2) Enable the repositories
Every time I do a fresh install of Ubuntu, the first thing that I do is to enable the universe, multiverse, backport and Canonical’s ‘partner’ repositories. These repositories open up new application choices and allow you to install popular third party software easily and quickly.
Go to System -> Administration -> Synaptic Package Manager.
Click on Settings -> Repositories.
Check all the boxes.
Go to the Third-Party Software tab. Check all the boxes.
Click on Close button and press the Reload button at the top left corner to update the repositories.
###
ubuntu-restricted-extras
sudo apt-get install ubuntu-restricted-extras
###
http://www.linuxnix.com/2010/05/how-to-kill-defunct-or-zombie-process.html
* How To Access Web Server Through IP Address?
* How To Configure And Install Sendmail In Linux?
* How To Upgrade An Installed Source Package?
* How To Install Apache Tomcat on Linux(Redhat/Ubuntu)?
* How To Set Java Path In Linux?
######3
GDebi Package Installer
###
sudo apt-get install nautilus-open-terminal
##############################################
How To Install Apache Tomcat on Linux(Redhat/Ubuntu)?
12/10/2010 09:08:00 PM Posted by Meghana M Bhombhore
Labels: Advanced Servers, How-To's
Share
How to install Apache tomcat on Linux(Redhat/Ubuntu)?
What is Apache tomcat?
Ans : ApacheTomcat is an open source web application server which supports J2ee Servlets, JavaServer, Pages(JSP) and API's. Tomcat should not be confused with Apache web server which an HTTP web server.
---Wikipedia.
Some terminology about Apache tomcat.
Apache Tomcat can be configured by editing server.xml file. Those who knows apache web server. This server.xml can be taken as synonimas to httpd.conf file.
Servlet is defined as a way add dynamic content to a Web server using the Java platform. And a servlet container is a compiled, executable program. The servlet container name is tomcat is catalina.
Pre requists for Apache tomcat are
1. java
2. JDK
Step by step for installing Apache tomcat
Note : Avoide installing tomcat from reposatories, always prefer to install it from source downloaded from apache site.
Step1 : Install all the prequistes
Redhat :
#yum install java
Ubuntu :
#apt-get install java
Step2 : Download tomcat source package and uncompress it.
Redhat/Ubuntu
#cd /opt
#wget http://www.trieuvan.com/apache/tomcat/tomcat-6/v6.0.29/bin/apache-tomcat-6.0.29.tar.gz
#tar xvfz apache-tomcat-6.0.29.tar.gz
Step3 : Setup the paths for Catalina and others.
Setting catalina paths
Redhat/ubuntu
CATALINA_HOME=/opt/apache-tomcat-6.0.29
CATALINA_BASE=/opt/apache-tomcat-6.0.29
Setting java paths
Check what java versions are installed in your system
#update-alternatives --config java
This command will display which is default java version used by your machine.
Example output :
# update-alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
1
/usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2
/usr/lib/jvm/jre-1.6.0-openjdk/bin/java
Enter to keep the current selection[+], or type selection number:
If you see above the default java version is 1.6 so set the path to /usr/lib/jvm/jre-1.6.0-openjdk
JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk
JDK_HOMe=$JAVA_HOME
Step4 : Now start tomcat server
#/opt/apache-tomcat-6.0.29/bin/sartup.sh
Sample output.
Using CATALINA_BASE: /opt/apache-tomcat-5.5.26
Using CATALINA_HOME: /opt/apache-tomcat-5.5.26
Using CATALINA_TMPDIR: /opt/apache-tomcat-5.5.26/temp
Using JRE_HOME:
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/
Step5 : By default Apache Tomcat will be hosted onlocalhost : 8080 port by default. So try to access the site with web browser
http://localhost:8080
or
http://localhost:8080
or
http://systemname:8080
Stay tuned to other posts about troubleshooting tomcat installation.
###########3
Wine
Wine is a must-have application for those who can’t live without their Windows applications, It allows you to install your Windows application in your Ubuntu machine and run them like native Windows apps.
sudo apt-get install wine
Once you have installed Wine, remember to run the configuration (Applications -> Wine -> Configure Wine) before attempting to install your favorite Windows app.
Subscribe to:
Posts (Atom)