Affichage des articles dont le libellé est Linux. Afficher tous les articles
Affichage des articles dont le libellé est Linux. Afficher tous les articles

mercredi 26 juin 2013

UBUNTU: HOW TO CHANGE THE COMPUTER NAME (HOSTNAME)




Change Your Computer Name (Ubuntu)
You might run into a situation that requires you to change your (hostname) computer name, either because you need it to meet a naming scheme or you’re just bored with it and want something better. By following these steps, you’ll give your computer a new identity in no time.
  1. To get started, press Ctrl – Alt – T on your keyboard to open the Terminal. Next, type the command below to open the hostname file.
  2. Type this commande into the terminal and remember that the current computer name is @aymen-Aspire-E1-571


gksu gedit /etc/hostname
3.   Then change the name to whatever you like and save the file.

4. Next, while command console is still open, type the command below to open the hosts file.
gksu gedit /etc/hosts

5. Finally, change the name shown to complete the change and save the file.

6. Close all open windows and restart your system.
After your system has restarted, it will have the new computer name.

How do I increase the permgen size of Tomcat Server ?





  • Increase the Heap size from the catalina.sh file



Tomcat production server sometime will hit the following java.lang.OutOfMemoryError: PermGen space error.


java.lang.OutOfMemoryError: PermGen space
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)

you should increase the memory by make change in catalina.sh.

Cataline.sh is located at \tomcat folder\bin\catalina.sh
Assign following line to JAVA_OPTS variable and add it into catalina.sh file.
export CATALINA_OPTS="-Xms512m -Xmx1024m"
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 
-server -Xms2536m -Xmx2536m
-XX:NewSize=256m -XX:MaxNewSize=1024m -XX:PermSize=1536m 
-XX:MaxPermSize=1536m -XX:+DisableExplicitGC"

  • Increase the Heap size from the the Eclipse IDE


if you are using tomcat sever with eclipse you need to resolve this exception by modifying the tomcat arguments :
If you see java.lang.OutOfMemoryError: PermGen space errors, you need to increase the permanent generation space available to Eclipse.
PermGen is the permanent generation of objects in the VM (Class names, internalized strings, objects that will never get garbage-collected). An easy, if somewhat memory-hungry fix is to enlarge the maximum space for these objects by adding


  • double click on the tomcat server
  • Click to Open Launch Configuration

  • Choose the Arguments tab and add the following parameters
     -Xms1024m -Xmx1024m -XX:PermSize=1024m -XX:MaxPermSize=1024m





  • Be Careful !!!!
you have to be careful when increasing the heap size of your tomcat server and jvm.


 As you can see, if you allocate a large Java Heap (2 GB+) for a 32-bit JVM process, the native memory space capacity will be reduced automatically, opening the door for JVM native memory allocation failures.
you will get the following exception :OutOfMemoryError: unable to create new native thread


For a 64-bit JVM process, your main concern, from a JVM C-Heap perspective, is the capacity and availability of the OS physical, virtual and swap memory.
 What you will learn shortly is that this JVM problem is very often related to native memory depletion; either at the JVM process or OS level. For now please keep in mind that:



  • A 32-bit JVM process is in theory allowed to grow up to 4 GB (even much lower on some older 32-bit Windows versions).
  • For a 32-bit JVM process, the C-Heap is in a race with the Java Heap and PermGen space e.g. C-Heap capacity = 2-4 GB – Java Heap size (-Xms, -Xmx) – PermGen size (-XX:MaxPermSize)
  • A 64-bit JVM process is in theory allowed to use most of the OS virtual memory available or up to 16 EB (16 million TB)






mardi 25 juin 2013

Freeing up a TCP/IP port



Usually when using tomcat server the following exception will be handled :

Several ports (8005, 8080, 8009, 8443) required by Tomcat v7.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).



To resolve this exception you need to free the TCP/IP ports that are already on 'LISTEN' state.
you'll have to kill all processes that are listening on that port. The easiest way to do that would be to use the fuser(1) command. For example, to see all of the processes listening for http requests on port 8080 (run as root or use sudo):


netstat -ln | grep ':8080 ' | grep 'LISTEN'



If you want to kill them, then just add the -k option.


fuser -k 8080/tcp
fuser -k 8443/tcp
fuser -k 8005/tcp
fuser -k 8009/tcp

vendredi 21 juin 2013

How to install amd drivers on Debian ubuntu


Some People can have problems after installing amd drivers and after viewing the specific error log file we see this error :

    "one or more tools for installation cannot be found on the system. install the required tools before installing the fglrx driver. Optionally, run the installer with --force option to install without the tools. Forcing install will disable AMD hardware acceleration and may make your system unstable. Not recommended. see log for details."


So to fix this error you just need the headers for your kernel. Run the following to install them:
sudo apt-get install linux-headers-$(uname -r)

after these step , you are able now to install your amd driver . 
I hope this can help you :)

mercredi 19 juin 2013

How to find files in Linux using 'find'

Files can be found under Linux in many different ways. Using the find tool is one of the best ways to find files. The find tool has a huge number of parameters which can be set so that Linux finds exactly those files that you were searching for. 

Many users use the find tool with just the basic parameters. They get the results that they were looking for.

 Unfortunately most of the users don't spend time to learn all about find. If they do, they can make excellent use of this tool and I am sure you would be surprised at the possibilities.

In case you just want to know where a particular file exists on your system, and nothing else is required, then use locate tool



$ find / -name 'program.c'




/
Start searching from the root directory (i.e / directory)
-name
Given search text is the filename rather than any other attribute of a file
'program.c'
Search text that we have entered. Always enclose the filename in single quotes

samedi 15 juin 2013

Apt-Get Update: failure to fetch; can't connect to any sources

the first sample methode to resolve apt-get update errors is to add an alternate DNS servers (the public DNS servers run by Google) by putting this lines  to your /etc/resolv.conf(tested on ubuntu)


 nameserver 8.8.8.8 

also there is another  method that is the best way I have found since I run server edition and have no GUI tools! Below I will show you how :
Actually for me it made this easier by putting all into the /etc/network/interfaces file. The same configurations that you would have written to resolv.conf can now be in the same file as your network adapter configurations like the example below:


 # The loopback network interface  
 auto lo  
 iface lo inet loopback  
 # The primary network interface  
 auto eth0  
 iface eth0 inet static  
     address 192.168.1.2  
     netmask 255.255.255.0  
     network 192.168.0.0  
     broadcast 192.168.1.255  
     gateway 192.168.1.1  
     dns-nameservers 8.8.8.8  
     dns-search local  

that all !! Hope it Helps SomeOne :)