#
# Install the MySql database tools.
yum -y install mysql mysql-server
#
# Start the database server.
/etc/init.d/mysqld start
#
# Configure the database to restart on boot.
chkconfig mysqld on
chkconfig --list mysqld
#
# Login to the database as root.
mysql --user=root mysql
#
# Create our database.
CREATE DATABASE astro ;
#
# Grant the required access.
GRANT USAGE ON *.* TO 'astro'@'localhost' IDENTIFIED BY 'pass' ;
GRANT CREATE, DROP, SELECT, INSERT ON astro.* TO 'astro'@'localhost' IDENTIFIED BY 'pass' ;
FLUSH PRIVILEGES ;
#
# Exit
\q
Next stage can be done as normal user
First, setup the directories and download the tools.
#
# Create the stilts directory.
mkdir ${ASTROGRID_HOME}/stilts
mkdir ${ASTROGRID_HOME}/stilts/jars
mkdir ${ASTROGRID_HOME}/stilts/data
mkdir ${ASTROGRID_HOME}/stilts/downloads
#
# Download the stilts library.
wget -P ${ASTROGRID_HOME}/stilts/jars http://www.star.bris.ac.uk/~mbt/stilts/stilts.jar
#
# MySql Java drivers available here :
# http://dev.mysql.com/downloads/connector/j/5.0.html
# Ignore the registration form - URLs are at bottom of page.
wget -P ${ASTROGRID_HOME}/stilts/downloads http://www.mirror.ac.uk/mirror/www.mysql.org/Downloads/Connector-J/mysql-connector-java-5.0.0-beta.tar.gz
#
# Extract the jar from the tar.gz file.
tar -xz --to-stdout \
-f ${ASTROGRID_HOME}/stilts/downloads/mysql-connector-java-5.0.0-beta.tar.gz \
mysql-connector-java-5.0.0-beta/mysql-connector-java-5.0.0-beta-bin.jar \
> ${ASTROGRID_HOME}/stilts/jars/mysql-java-5.0.0-beta.jar
Next, download the target FITS file and import it into the database.
#
# Download the source fits file.
wget -P ${ASTROGRID_HOME}/stilts/data http://www.mrao.cam.ac.uk/~tsg25/Documents/Oxford/FLSGMRT.FIT
#
# Run the stilts toolkit
$JAVA_HOME/bin/java \
-classpath ${ASTROGRID_HOME}/stilts/jars/stilts.jar:${ASTROGRID_HOME}/stilts/jars/mysql-java-5.0.0-beta.jar \
-Djdbc.drivers=com.mysql.jdbc.Driver \
uk.ac.starlink.ttools.Stilts \
tpipe \
in=${ASTROGRID_HOME}/stilts/data/FLSGMRT.FIT ifmt=fits \
omode=tosql \
protocol=mysql host=localhost database=astro newtable=flsgmrt user=astro
Connect to the database and check the results.
#
# Connect to the database as user astro.
mysql --password=pass --user=astro astro
#
# Check the tables.
SHOW TABLES ;
#
# Check the table structure.
DESCRIBE flsgmrt ;
#
# Count the rows.
SELECT count(ra) FROM flsgmrt ;
#
# Exit
\q
![]() |
Click here for the AstroGrid Service Web |
This is the AstroGrid Development Wiki |
|