Showing posts with label Cent Os. Show all posts
Showing posts with label Cent Os. Show all posts

Friday 21 February 2014

Fatal server error: Cannot establish any listening sockets - Make sure an X server isn't already running

Issue
I have installed vncserver and when I tried to start it but I get the error below
"WARNING: The first attempt to start Xvnc failed, possibly because the font catalog is not properly configured. Attempting to determine an appropriate font path for this system and restart Xvnc using that font path ... Could not start Xvnc.
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed _XSERVTransMakeAllCOTSServerListeners: server already running Warning: Xalloc: requesting unpleasantly large amount of memory: 0 bytes.
Fatal server error: Cannot establish any listening sockets - Make sure an X server isn't already running _XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed _XSERVTransMakeAllCOTSServerListeners: server already running Warning: Xalloc: requesting unpleasantly large amount of memory: 0 bytes.
Fatal server error: Cannot establish any listening sockets - Make sure an X server isn't already running"
Solution
Terminate all VNCs processes. You can find the process number by running the following command:
#ps -e | grep vnc
11028   ?        00:00:00 Xvnc
kill the process using
#skill -p <pid>
#skill -p 11028 

Reinstall vncserver

Tiger VNC on Centos 6.3 fails, font catalog not properly configured

Issue
Whe  I try to set up Tiger VNC server on CentOS 6.3 but I'm getting the following error message when I run the command vncserver:
WARNING: The first attempt to start Xvnc failed, possibly because the font catalog is not properly configured. Attempting to determine an appropriate font path for this system and restart Xvnc using that font path ... Could not start Xvnc.
/usr/bin/Xvnc: symbol lookup error: /usr/bin/Xvnc: undefined symbol: pixman_composite_trapezoids
/usr/bin/Xvnc: symbol lookup error: /usr/bin/Xvnc: undefined symbol: pixman_composite_trapezoids

Solution
To resolve the above issue, run the below command in terminal

#yum install pixman pixman-devel libXfont

Installing VNCserver in centOS 6.4


1.    Installing GNOME Desktop
Install a window manager in order to get a full-featured GUI desktop
[root@localhost ~] #yum groupinstall "X Window System" "Desktop"
2.    Installing TightVNC Server
For CentOS 6, the server is: tigervnc-server not:  vnc-server
[root@localhost ~] #yum install tigervnc-server
3.    Create a user and a vnc login
[root@localhost ~]# useradd tom 
[root@ localhost ~]# passwd tom 
Changing password for user tom  . 
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully. 
4.    Login to new user and set vnc password
[root@localhost ~]# su - tom
[tom@localhost ~]$ vncpasswd 
Password: 
Verify: 
[tom@localhost ~]$ ls .vnc
passwd
[tom@localhost ~]$ exit
logout
5.    Start vnc
Create Xstartup Script by starting the vncserver
[root@localhost ~]#  service vncserver start
Starting VNC server: 1:tom
New 'localhost.localdomain:1 (tom)' desktop is localhost.localdomain:1

Starting applications specified in /home/tom/.vnc/xstartup
Log file is /home/tom/.vnc/localhost.localdomain:1.log 
[root@localhost ~]# su -l tom
[tom@localhost ~]$ ls .vnc
localhost.localdomain:1.log  localhost.localdomain:1.pid  passwd  xstartup
[tom@localhost ~]$ exit
logout
6.    Edit the server configuration file
Edit /etc/sysconfig/vncservers, and add the following to the end of the file.
VNCSERVERS="1:tom"
VNCSERVERARGS[1]="-geometry 1024x768"
For multiple users repeat the steps 3 to 5 and add the user to the VNCSERVERS list and add a VNCSERVERARGS[x] entry.
So for two users:
VNCSERVERS="1:tom 2:john" 
VNCSERVERARGS[1]="-geometry 1024x768" 
VNCSERVERARGS[2]="-geometry 640x480" 
7.    Open the port by editing the iptables
stop iptables

[root@localhost ~]# service iptables stop

open /etc/sysconfig/iptables

add the below lines before COMMIT

-A INPUT -p tcp -m state --state NEW -m tcp -m multiport --dports 5901:5910,6001:6010 -j ACCEPT

start iptables

root@localhost ~]# service iptables start

Install Vnc Viewer for remote accessing the desktop

1.    Download VNC Client

Now go to your Windows or Linux machine and download VNC Viewer client and install in your system to access the centos server desktop.

2.    Connect to Remote Desktop(centos server) Using Client

After you installed the VNC Viewer client, open it you’ll get similar to below screen. Enter VNC Server IP address( IP address of centos server in which vncserver is installed) along with VNC ID (i.e 1) for user tom.













Uninstalling vncserver

[root@localhost ~]# service vncserver stop
[root@localhost~]#yum remove tigervnc-server

Thursday 24 October 2013

Installing the Java Plugin for Firefox on CentOS

The OpenJDK bundled with CentOS is missing a java plugin for Firefox. A simple method of getting Java to run inside the webbrowser and to run java applications is to install icedtea-web

Open a terminal and type the below command

yum install icedtea-web

Then restart your browser
Click Tools- >Add-ons
The Add-ons Manager tab will open.
In the Add-ons Manager tab, select Plugins
Click icedtea-web plugin to select it and click on the Enable button

The java verification applet (http://www.javatester.org/version.html) works fine.

Installing and configuring Java in cent OS

Most of the Linux operating systems comes with pre-installed OpenJDK package to run java-based applications and plugins.But in certain cases we need Sun/Oracle Java program to compile and run
particular development applications.

1. Download java from  
http://www.oracle.com/technetwork/java/javase/downloads/index.html

2. install java using rpm -uvh
   ## Install Java on 32-Bit OS ##
   # rpm -Uvh jdk-7u45-linux-i586.rpm
   # rpm -Uvh jdk-7u45-linux-i586.rpm

   ## Install Java on 64-Bit OS ##
   # rpm -Uvh jdk-7u45-linux-x64.rpm
   # rpm -Uvh jdk-7u45-linux-x64.rpm

3. check java installed
   # java -version

   output should be
   java version "1.7.0_45"

4. Setting up java environment variables
The easiest way to set an environment variable in CentOS is to use export as in

$> export JAVA_HOME=/usr/java/jdk.1.7.0_45

$> export PATH=$PATH:$JAVA_HOME

However, variables will disappear the moment you exit the shell. Obviously this is not helpful when setting environment variables that need to persist even when the system reboots.In such cases, you need to set the variables within the system wide profile. In CentOS , the folder /etc/profile.d/ is the recommended place to add  customizations to the system profile.

5. Create a new file called java.sh
vim /etc/profile.d/java.sh

6. Copy paste the below content in java.sh

export JRE_HOME=/usr/java/jdk.1.7.0_45/jre
export PATH=$PATH:$JRE_HOME/bin
export JAVA_HOME=/usr/java/jdk.1.7.0_45
export JAVA_PATH=$JAVA_HOME
export PATH=$PATH:$JAVA_HOME/bin

7.  If you want to load the environment variables within java.sh without having  to restart the machine, you can use the source command as in:
   $> source java.sh

Friday 12 July 2013

Cannot access xampp from internet in Cent OS

Issue

I have xampp installed on Cent OS. I started the xampp server and tried to access it with localhost, it is working. But i cant access it using the system IP. I can ping the server.But I can't  access the server from any other computer on the network.

Solution

The default firewall of CentOS permits ssh input(tcp 22) and icmp(ping). Open a terminal and type


[root@ ~]# cat /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
Try at first stopping your firewall issuing the following command:

[root@ ~]# /etc/init.d/iptables stop
Now, test if you can access your XAMPP server.
Go to File System -> etc - >sysconfig
Open iptables. Remove the below line


-A INPUT -j REJECT --reject-with icmp-host-prohibited
 Add the below new line

iptables -A INPUT -m state --state NEW -m tcp -p tcp -m multiport --dports 80,443 -j ACCEPT
It enables the ports you need to access(80 , 443).
Now your iptables looks like


# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp -m multiport --dports 80,443 -j ACCEPT
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
Save the file and close it.
Start your firewall issuing the following command:


[root@ ~]# /etc/init.d/iptables start
Now  you can access your XAMPP server using your macine ip address