Personal tools

Difference between revisions of "Creating an OpenDAPServer in VMWare2"

From MohidWiki

Jump to: navigation, search
(Add Thredds catalogs and crontab and install packages)
(Configure VM in FEDORA console)
Line 11: Line 11:
  
 
During installation chose a custom partition definition.
 
During installation chose a custom partition definition.
  Created partition 'sda1' - boot (2MB) and partition 'sda2' - PV (300GB).  
+
  Created partition 'sda1' - boot (2MB) and partition 'sda2' - LVM PV (300GB).  
  created VG 'vg_opendap2' and  
+
  created VG 'vg_opendap2' from 'sda2' and on top
 
  i) LV 'swap' (swap fs 2GB);  
 
  i) LV 'swap' (swap fs 2GB);  
 
  ii) LV 'root' (ext4 fs) in / (30GB)
 
  ii) LV 'root' (ext4 fs) in / (30GB)
Line 163: Line 163:
 
In the VMWare the text file was saved to  
 
In the VMWare the text file was saved to  
 
  > cp /opendap/catalogs/crontab /home/user/Downloads
 
  > cp /opendap/catalogs/crontab /home/user/Downloads
so that it could be used when the all files were copied from opendap.mohid.com and crontab could work-
+
so that it could be used when the all files were copied from opendap.mohid.com and crontab could work.
  
 
*Install necessary packages so that the Thredds (and scripts) work:
 
*Install necessary packages so that the Thredds (and scripts) work:

Revision as of 23:46, 10 January 2012

Create VM in VMWare vSphere

1GB RAM
300GB. 
Linux Red Hat FEDORA 16. FEDORA 10 (Xen 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

This steps were made based on Xen OpenDAP configuration wiki and with help from Guillaume.

During installation chose a custom partition definition.

Created partition 'sda1' - boot (2MB) and partition 'sda2' - LVM PV (300GB). 
created VG 'vg_opendap2' from 'sda2' and on top
i) LV 'swap' (swap fs 2GB); 
ii) LV 'root' (ext4 fs) in / (30GB)
iii) LV 'home' (ext4 fs) in /home (10GB)
iv) LV 'opendap' (ext4 fs) in /opendap (265GB)

Update your distro

> su
> yum update

Configure users and groups

  • Go to Other-->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 /opendap 
> chmod g+w /opendap

Configure the firewall

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

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

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:

These steps were different than in Xen OpenDAP configuration because it did not worked - Guillaume made them. 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
>chmod a+rwx -R /home

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"

Add Thredds catalogs and crontab and install packages

  • Pass the catalogs from the Xen OpenDAP to VMWare OpenDAP

In the Xen VM, create a new folder /opendap/catalogs and copy the catalogs from apache folder/content/threadds to there

> mkdir /opendap/catalogs
> cp /home/user/Downloads/apache-tomcat-6.0.18/content/threadds/*.xml /opendap/catalogs

Create the same folder in the VMWare VM and copy the files between machines (visible in network).

In the VMware VM copy the xml files to

> cp /opendap/catalogs/*.xml /home/user/Downloads/apache-tomcat-7.0.23/content/threadds (and rewrited).

Each catalog was open (threddsconfig.xml) in vim to replace each appearence of tomcat folder (versions were different)

>:%s/apache-tomcat-6.0.18/apache-tomcat-7.0.23/g

Pass the crontab from the Xen OpenDAP to VMWare OpenDAP In the Xen OpenDAP copy the crontab and save as txt file to be shared as previously.

> cp /etc/crontab /opendap/catalogs

In the VMWare the text file was saved to

> cp /opendap/catalogs/crontab /home/user/Downloads

so that it could be used when the all files were copied from opendap.mohid.com and crontab could work.

  • Install necessary packages so that the Thredds (and scripts) work:

Install Netcdf, nco and ruby

> yum install netcdf
> yum install nco
> yum install ruby

Make the machine folders visible with Samba

> yum install samba
> service smb start
> chkconfig --level 345 smb on
> chkconfig | grep smd
> smbpasswd -a datamover                                  (Typed the datamover Password)
> vim /etc/samba/smb.conf
smb.conf> see a typical config here         (did not changed nothing here, used Samba server configuration tool, below)
> chcon -R -t samba_share_t /opendap                      (change file SELinux security context to folder opendap)
  • Change permissions in folder /opendap:
> chmod a+rwx -R /opendap         'to all (a) give permissions (+) read (r), write (w) and execute (x)
  • In Firewall allowed samba and samba client as trusted
  • Installed Samba Server Configuration tool
> su
> yum install system-config-samba
  • In Samba Server Configuration tool (Application->Other->Samba) edited workgroup as MARETEC, users datamover and added /opendap folder share (acces to datamover)


Future tasks

  • Copy all the content from Xen Opendap to new Opendap2.
  • Change crontab. Use the text file saved in Downloads to copy the content to crontab (in /etc):
>crontab -e                 'edit crontab

Links

Go Back to VMWare

Xen OpenDAPserver