Personal tools

Creating an OpenDAPServer in VMWare

From MohidWiki

Revision as of 14:20, 6 January 2012 by Davidbrito (talk | contribs)
Jump to: navigation, search

Create VM in VMWare vSphere

1GB RAM
100GB and fedora created its own partitions
Linux Red Hat FEDORA 16. FEDORA 10 (old OpenDAP version) was not accesible
1 CPU
Installed VMTools from the console making a CD Link to the VMWareTools in \\Davinci\Software\VMWare\Tools. vSphere does not support the linux version to do the installation from vSphere.

Configure VM in FEDORA console

Update your distro

> su
> yum update

Add a new PV, a new VG and new LVs

> pvcreate -ff /dev/sda3                   (sda3 being the disk with 100GB - use Disk Utility)
> pvscan

> vgcreate -p 4 -v data /dev/sda3          (-p maxphysicalvolumes; -v verbose; data volumegroupname; /dev/sda3 physicaldevice)
> vgscan
> lvcreate -n opendap -L 80G data

  the latter was not possible because already existed the volume group name vg_opendap2 and logical volumes /dev/vg_opendap2/lv_root and /dev/vg_opendap2/lv_home each with 50GB

Create filesystems and mount them

> mkfs -t ext2 /dev/vg_opendap2/lv_home
> mkdir /lv_home
> vim /etc/fstab
fstab> /dev/vg_opendap2/lv_home       
/lv_home                ext2    defaults        0 0
> mount -a
> df

The llater were not performed because file systems were already present in the two logical volumes but mkdir had to be done

> mkdir /lv_home

Configure users and groups

  • Go to System-->Administration-->Users and groups
  • Make users the primary group of user user.
  • Create the group Maretec. Every user of this system should be applied to the group Maretec.
  • Create the user datamover. Make his primary group Maretec.

Configure permissions

> chgrp -R maretec /lv_home 
> chmod g+w /lv_home

Configure the firewall

From the X environment, open up the Applications-->Other-->Firewall. Then open up the ports 22(ssh), and 8080(tomcat).

Enable sshd

> vim /etc/ssh/sshd_config
sshd_config> #PermitRootLogin yes
sshd_config> PermitRootLogin no
Remeber in vim:
i - insert
:w - save
:q - quit
> service sshd start
> service sshd status
> chkconfig --level 345 sshd on
> chkconfig | grep sshd

and smb

> yum install samba
> service smb start
> chkconfig --level 345 smb on
> chkconfig | grep smd
> smbpasswd -a datamover                                 (Typed the Administrator Password)
> vim /etc/samba/smb.conf
smb.conf> see a typical config here         ??? Did not getted what to do
> chcon -R -t samba_share_t /lv_home

Install Thredds

It is needed java and apache tomcat.

  • Download current Java SE Developer Kit (JDK) from Sun for linux (.tar.gz file)
  • extract the zip file in the current folder or copy it to the destination folder before this command as a regular user (not as root).
> cd [destinationfolder]                   'in this case [destinationfolder] was /home/user/Downloads/
> tar xvzf [tarfilename]                   'in this case [tarfilename] was jdk-7u2-linux-i586.tar.gz
  • Download apache tomcat for linux (.tar.gz file)
  • extract the zip file in the current folder or copy it to the destination folder before this command as a regular user (not as root).
> cd [destinationfolder]                   'in this case [destinationfolder] was /home/user/Downloads/
> tar xvzf [tarfilename]                   'in this case [tarfilename] was apache-tomcat-7.0.23.tar.gz
  • start the apache,
> cd [apachefolder]                        'in this case [apachefolder] was /home/user/Downloads/apache-tomcat-7.0.23
> bin/startup.sh
  • and check that responds.
test nº1:
> ps -ef | grep tomcat

and test nº2: 
Open a new browser window/tab and go to http://localhost:8080/ to verify Tomcat is running a message appers saying that 
"If you're seeing this page trough a web page it means that you have setup tomcat sucessfull"
  • Download the TDS WAR file from Unidata's web site.
  • copy the thredds.war file to the apache /webapps folder
> cp [folderorigin]/thredds.war [apachefolder]/webapps     'in this case [apachefolder] was /home/user/Downloads/apache-tomcat-7.0.23 and [folderorigin] was /home/user/Downloads
  • Assure that tomcat is launched at startup:

1) Create a script saved in /etc/init.d/tomcat as root

> su
> touch /etc/init.d/tomcat             'creates an empty file
> chmod a+rx /etc/init.d/tomcat        'permissions(+) reading and executing (r e x) for all (a)
> vim /etc/init.d/tomcat

tomcat>
#! /bin/sh
#
# tomcat:       Starts the tomcat Daemon
#
# chkconfig: 345 96 02
# processname: apache-tomcat
# description: tomcat fedora init script \
# config:
# Author: Brito e Riflet

base=${0##*/}

# See how we were called.
case "$1" in
 start)
       /home/user/Downloads/apache-tomcat-7.0.23/bin/startup.sh
       RETVAL=0
       ;;
 stop)
       /home/user/Downloads/apache-tomcat-7.0.23/bin/shutdown.sh
       RETVAL=0
       ;;
 restart)
       /home/user/Downloads/apache-tomcat-7.0.23/bin/shutdown.sh
       echo "Waiting for daemon to exit..."
       sleep 5
       /home/user/Downloads/apache-tomcat-7.0.23/bin/startup.sh
       RETVAL=0
       ;;
 *)
       echo $"Usage: $0 {start|stop|restart}"
       exit 2
       ;;
esac

exit $RETVAL


2) Create a link to the script

> cd /etc/rc.d/rc3.d                         'tomcat initialization in init level 3
> ln -s ../init.d/tomcat S30tomcat           'symbolic link for the script in init.d/tomcat
> exit

3) Test the script and connectivity

> service tomcat start                       'Test the script
> service tomcat stop
> service tomcat restart
> netstat -tlnap | grep 8080                 'Test if 8080 port is activ (tomcat port)

4) Test if tomcat service is started in boot Restart the VM and test http://localhost:8080 in web browser. it should say

"If you're seeing this page trough a web page it means that you have setup tomcat sucessfull"

Links

VMWare