Archive

Archive for March, 2012

CentOS Java JDK install quick guide

March 18th, 2012

It is recommended to install JDK from Sun Oracle.

Download the latest from Oracle’s website by selecting the correct version for your server.

Eg. latest version available now is jdk-7u3

Linux x86 (32-bit) 63.65 MB jdk-7u3-linux-i586.rpm
Linux x64 (64-bit) 64.53 MB jdk-7u3-linux-x64.rpm

Check your OS version with the following command:

uname -a

x86_64 GNU/Linux  is a 64 bit OS

ia64 GNU/Linux is a 64 bit OS

i386 GNU/Linux is a 32 bit OS

Once download, you can install it by running the file

rpm -iv jre-<version>-linux-<os>.rpm

JDK will be installed under /usr/java

If you have downloaded the binary installer and not a rpm file, refer to this.

Software, Technology , , , ,

CentOS LAMP quick guide

March 17th, 2012

Quick guide to install LAMP – Linux Apache MySQL PHP on CentOS server.

Install LAMP

yum -y install httpd php mysql mysql-server php-mysql

This will take a few minutes to download (total package size is 16Mb)

Once its done Yum will say “Complete!” and you will be returned to shell.

Next, you need to set a MySQL root password. Without this, your MySQL server is open to attack, and it WILL happen! Use the following command (WITH QUOTES) to set your root password:

mysqladmin -u root password 'ENTER-PASSWORD-HERE'

NOTE: Single quotes are required

Finally, we are going to set Apache & MySQL to run on startup. This is useful if your server has a power outage or needs to be rebooted as it will automatically restart Apache & MySQL for you.

  /sbin/chkconfig httpd on
  /sbin/chkconfig --add mysqld
  /sbin/chkconfig mysqld on
  /sbin/service httpd start
  /sbin/service mysqld start

To check everything worked, browse to the web servers directory (on CentOS its /var/www/html) and create a new file using text editor called phpinfo.php.

Enter the following code into that file to check PHP is working:

<php echo phpinfo(); ?>

Credit : Ricky Mills

Install MySQL Admin tools

Download from MySQL website at http://dev.mysql.com/downloads/gui-tools/5.0.html

You will find these useful : MySQL Administrator and MySQL Query Browser.

Select your version for download:

RedHat Enterprise Linux 3 (x86) RPM (bundled dependencies) 5.0r12 19.4M
RedHat Enterprise Linux 4 (x86) RPM (bundled dependencies) 5.0r12 17.8M

Or you could try the newer Workbench.

Software, Technology , , , , ,

CentOS VNC quick guide

March 16th, 2012

1. Installing the required packages

Check if vnc-server is already installed by running the command rpm -q vnc-server

If the server is not installed, install it with the command: yum install vnc-server

Make sure to install a window manager in order to get a normal GUI desktop. You can use the command yum groupinstall “GNOME Desktop Environment” to install the Gnome Desktop and requirements, for example.

2. Configuring un-encrypted VNC

You will perform the following steps to configure your VNC server:

  1. Create your VNC users.
  2. Set your users’ VNC passwords.
  3. Edit the server configuration.
  4. Create and customize xstartup scripts.
  5. Start the VNC service.
  6. Test each VNC user.
  7. Setup the VNC service to start on reboot.
  8. Additional optional enhancements

2.1. Create your VNC users

As root:

$ su -
# useradd marvin
# passwd marvin

2.2. Set your users’ VNC passwords

Login to each user, and run vncpasswd . This will create a .vnc directory.

[~]$ cd .vnc
[.vnc]$ ls
passwd

2.3. Edit the server configuration

Edit /etc/sysconfig/vncservers, and add the following to the end of the file.

VNCSERVERS="1:marvin"
VNCSERVERARGS[1]="-geometry 640x480"

2.4. Create xstartup scripts ( Skip this step for CentOS 6 )

We will create the xstartup scripts by starting and stopping the vncserver as root.

# /sbin/service vncserver start
# /sbin/service vncserver stop

Login to each user and edit the xstartup script. To use Larry as an example, first login as larry

[~]$ cd .vnc
[.vnc] ls
mymachine.localnet:1.log  passwd  xstartup

Edit xstartup. The original should look like:

#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

Add the line indicated below to assure that an xterm is always present, and uncomment the two lines as directed if you wish to run the user’s normal desktop window manager in the VNC. Note that in the likely reduced resolution and color depth of a VNC window the full desktop will be rather cramped and a look bit odd. If you do not uncomment the two lines you will get a gray speckled background to the VNC window.

#!/bin/sh
# Add the following line to ensure you always have an xterm available.
( while true ; do xterm ; done ) &
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

2.5. Start the VNC server

Start the vncserver as root.

# /sbin/service vncserver start

2.6. Test each VNC user

2.6.1. Testing with a java enabled browser

Let us assume that mymachine has an IP address of 192.168.0.10. The URL to connect to each of the users will be:

Marvin is http://192.168.0.10:5801

2.6.2. Testing with a vnc client

Install a vnc client on your PC eg from RealVNC

Access with 192.168.0.10:1

2.6.3. Starting vncserver at boot

To start vncserver at boot, enter the command /sbin/chkconfig vncserver on.

For basic VNC configuration the procedure is now complete.

For more details and with enhanced security, visit http://wiki.centos.org/HowTos/VNC-Server

Software, Technology ,