InstallManual_OPUS-College_environment_LINUX.doc

outstandingmaskΔιαχείριση Δεδομένων

29 Νοε 2012 (πριν από 4 χρόνια και 7 μήνες)

306 εμφανίσεις

outstandingmask_eeb6025f
-
e564
-
4888
-
b234
-
87c7df19f3e2.doc

Pagina
1

van

10

outstandingmask_eeb6025f
-
e564
-
4888
-
b234
-
87c7df19f3e2.doc


note



Version:

4 2009
-
03
-
06

Subject

Install Manual OPUS
-
College

environment
-

LINUX

To

Ed Simons

CC

opus User Group

From

Nelson Chamba

Karol Nunes

Markus Pscheidt


Monique in het Veld

[date]

[doccodeuci]


move






This document is meant for the SYSTEM ADMINISTRATOR and the DEVELOPER


0. Get install
-
files from the opus college website


All (or most) install
-
files in this document can be fetched from the opus college website:


http://www.opuscollege.net/

Go to the menu: SUPPORT


Also update
-
files in the future can be fetched from this website.


1. Installation of Linux


Go to the website of Ubuntu, Redhat or SuSe and download and install the latest version of their
Lin
ux.



2. Installation of JDK 1.5


Get JDK 1.5 from the internet (
http://java.sun.com
) OR from the installation
-
package of eSURA and
install it on your Linux
-
server. First try to execute the install
-
file without rpm:

./j
dk
-
1_5_0_17
-
linux
-
i586.bin


Click through the screens until you find the question about the license agreement.

Here you have to say yes to the license agreement.


If this doesn’t work, then try this:

chmod a+x jdk
-
1_5_0_17
-
linux
-
i586.bin


If this doesn’t w
ork, unpack the install
-
file with rpm. If it still doesn’t work, there may be a security
problem. Then try this:


chmod a+x jdk
-
1_5_0_17
-
linux
-
i586
-
rpm.bin


The installation will put the jdk
-
directory into the installdirectory. Move the jdk:

mv
jdk1.5.0_17

/usr/share/java/



3. Installation of Tomcat 5.5



Go to the website of Apache Tomcat (
http://www.apache.org/
) OR from the installation
-
package of
eSURA. and download and install version 5.5 for Linux in the directory
.

Unzip the tar
-
file with:

tar

xvvf apache
-
tomcat
-
5.5.27.tar

It will be copied into the installdirectory. Then move the webserver:

mv
apache
-
tomcat
-
5.5.27

/usr/share/java/


You can manage the memory the server will use by altering the
/usr/share/java/apa
che
-
tomcat
-
5.5.27/bin/Catalina.sh

file. Alter the following line:

JAVA_OPTS=%JAVA_OPTS%
-
D...


Change it to:

JAVA_OPTS=%JAVA_OPTS%
-
Xmx512M
-
D...



4. Copy the postgresql jdbc driver into tomcat


Copy the jdbc driver
postgresql
-
jdbc
-
8.2.504.jar

to the serv
er/lib dir of tomcat:

cp postgresql
-
jdbc
-
8.2.504.jar /usr/share/java/apache
-
tomcat
-
5.5.27/server/lib/


Give the correct privileges. Go to the following directory:

/usr/share/java/apache
-
tomcat
-
5.5.27/server/lib/


Type:

chmod 644 postgresql
-
jdbc
-
8.2.504.jar


4. Environment variables

You need to setup the global environment variables in /etc/profile file for all users. Therefore type
the following in the shell:

vi /etc/profile

Add these lines at the bottom of the file (with INSERT)

export JAVA_HOME=/usr/shar
e/java/jdk1.5.0_17

export JRE_HOME=/usr/share/java/jdk1.5.0_17/jre

export CATALINA_HOME=/usr/share/java/apache
-
tomcat
-
5.5.27

export PATH=$JAVA_HOME/bin:$PATH


Exit the file with:

<ESC>

:wq

Then restart the server OR type:

source /etc/profile

Test if Java

environment is successfully installed by typing in this in the shell:

java
-
version

You should see something like:

version “1.5.0_17″

Java(TM) SE Runtime Environment (build 1.5.0_17
-
b05)

Java HotSpot(TM) Server VM (build 1.5.0_17
-
b05, mixed mode)


Also tr
y typing:

$JAVA_HOME

It should show the java
-
directory:

/usr/share/java



5. Create tomcat configuration
-
file


Go to:
/etc/init.d/

Edit or create the file tomcatsecurity

by typing:
vi tomcatsecurity


Type the following line in the new file or add the line
at the bottom of the file:

TOMCAT5_SECURITY=no


Activate the file by typing:

source tomcatsecurity


6. Test the tomcat
-
installation


Go to:
/usr/share/java/apache
-
tomcat
-
5.5.27/bin

Type:
./startup.sh


Open a browser and type:
http://localhost:8080/

The tomcat
-
rootfile should be shown.


Stop the server by typing:
./shutdown.sh


N.B. You can always use these commands to manually start / stop tomcat.


7.

Install Apache Tomcat as a service


Edit or create the file tomcat5

by typing:
vi tomcat5


# Wrapper script for starttomcat.sh:

# processname: root


case "$1" in


start)




echo "Starting Tomcat..."


su
-

root
-
c "/usr/share/java/apache
-
tomcat
-
5.5.2
7
/bin/startup.sh
$@"



;;




stop)



echo "Stopping Tomcat
..."


su
-

root
-
c "/usr/share/java/apache
-
tomcat
-
5.5.2
7
/bin/shutdown.sh
$@"



;;


esac


Add

the file to services by typing
:

chmod 755 /etc/init.d/tomcat5

ln
-
s /etc/init.d/tomcat
5

/etc/rc1.d/K99tomcat
5

ln
-
s /etc/init.d/tomcat
5

/etc/rc2.d/S99tomcat
5


Restart the server.


Note: if you want to delete the service, remove the files in etc
-
rc like this:

r
m /etc/rc1.d/K99tomcat5

r
m /etc/rc2.d/S99tomcat5




3. Installation of Postgres 8.3


Go to the website of PostgreSQL (www.postgresql.org) OR from the insta
llation
-
package of eSURA
and download and install version 8.3 for Linux:

./postgresql
-
8.3.6
-
1
-
linux
-
x32.bin


If this does not work, try first:

chmod +x postgresql
-
8.3.6
-
1
-
linux
-
x32.bin


Do the following while these steps occur:



Location:
/usr/share/java/P
ostgreSQL/8.3/



Data
-
location:
/usr/share/java/PostgreSQL/8.3/data



Password:
123koffie



Default port:
5432



Locale:
en_us.utf8



Uncheck the checkbox of the installation of Stack Builder at the end of the installation
procedure (do NOT install this one!)



6. C
reate the database with pgAdmin


Open pgAdmin to connect to the server. If there is no server created, create one manually:

Name:
PostgreSQL Databaseserver 8.3

Hostname:

localhost

Maintenance db:
postgres

User:
postgres

Password:
123koffie


Create in the d
atabaseserver the database in PostgreSQL 8.3 manually:

CREATEDB opusCollege UTF8 owner postgres tablespace pg_default;


OR create the database through the graphical interface of pgadmin:



Figure
1
: Right click on "Databases" and
choose "New database..."



Figure
2
: Enter the value as shown in the picture to create the opusCollege database







Figure
3
: Choose database "opusCollege"
.




Figure
4
: Righ
t click on "
Schemas
" and choose "
New schema
..."

: opuscollege





First you do the initial install of the college module, in the directory:
installation_files_server_admins_V
3
.0
\
database_scripts


S
tep on the database opusCollege and right
-
click. Choose
rest
ore

and go to the following file:

160_opuscollege_version30_cleandump.backup


Then open the sql
-
editor and execute all sql
-
files within the range 100
-

200 following their
ascending numbers in this directory.


If you want to install some of the modules, yo
u should also execute the sql
-
files which belong to
that specific module:


200
-
299
-
range: fee

300
-
399
-
range: scholarship

400
-
499
-
range: report

500
-
599
-
range: alumni


Note: always execute the files in ascending order following their numbers.



7. Copy the w
ar file to tomcat's webapps dir


Copy the war file:

cp /<install
-
dir>/<last
-
update>/war/eSURA.war /usr/share/java/
apache
-
tomcat
-
5.5.27
/w
ebapps/





Figure 2: Open your browser and go to http://localhost:8080/eSURA to see if the deployment
has been successf
ul



8. Inspect the log file


Use the tail command in following mode (always use the log file of the current day):

tail
-
f /var/log/tomcat5.5/catalina.<current
-
date>.log


Note: see an example of the log
-
file of Karol in the document:

Logfile_installation_O
PUS
-
College_environment_LINUX.doc



10. Create a log directory and a backup directory for the application


Create a log
-
file directory and a backup directory with the following path. In the application this path
is used, so you have to explicitly use this
path.


mkdir /usr/share/java/logs/

mkdir /usr/share /java/backups/



DATABASE MAINTENANCE


1. Create the backup file with pgAdmin

To make a backup, go to pgAdmin, select the database (opusCollege) and choose “Backup…”
from the Tools menu. The option has to

be ‘COMPRESS’.

Then choose a location where to save the file. Choose a filename for the backup file.

The extension will be .’backup’.


2. Restore the backup file with pgAdmin


To restore the database from your backup file, you need to drop the schema from
the database:
select the schema (opuscollege) and choose ‘DROP Cascaded’ from the Tools Menu.

Then select the database. Then select “Restore…” from the Tools menu. Find the backup
-
file and
execute it,


3.

Making manual backups of the database


Go
with a comm
and prompt

to the directory where Postgres is installed. Then go to the bin
-
directory of the PostgreSQL
-
installation or login to PostgreSQL.


Here you find commands to dump and restore the database: pg_dump.exe. And the reverse action:
pg_restore.

You can
run these commands from the command
-
line, using the following options.


The right syntax is:

pg_dump
-
i
-
h localhost
-
p 5432
-
U postgres
-
F c
-
b
-
v
-
f
"/java/backups/opuscollege.backup" "opusCollege"


Note: to logon to Postgres you need your database
-
accou
nt (the second account you
created when creating the database server),


See: Postgres_Commands.doc for details about the syntax.


PG_RESTORE


Of course you can do a restore with the Postgres admin tool. You can follow the instructions above
and then choose

the location C:
\
Java
\
backups
\

and then the file pg_dump_opuscolleg.backup.


However, if you want to choose your own options on restoring, then you can do this manually.
Therefore g
o
with a command prompt

to the directory where Postgres is installed. Then
go to the
bin
-
directory or login to Postgres.


Here you find command to restore the database: pg_restore.

You can run this command from the command
-
line, using the following options.


The right default syntax is:

pg_restore
-
i
-
h localhost
-
p 5432
-
U postg
res
-
d "opusCollege"
-
v
java/backups/opuscollege.backup"


See: Postgres_Commands.doc for details about the syntax.


4.

Making automatic backups of the database


You can also make a CRONTAB job to run the backup automatically.

Therefore you have to create or
edit the crontab of your server as follows:

$ crontab
-
e



In the crontab
-
editor you can now put (or add) the following line:

45 23 * * * /usr/share/java/PostgreSQL/8.3/bin/pg_dump
-
i
-
h localhost
-
p
5432
-
U postgres
-
F c
-
b
-
v
-
f
"/usr/share/java/backups/o
puscollege_batchfile.backup" "opusCollege"


This will make sure the backups of the database will be run every night at half past 12.

Make sure you control if the crontab is actually working !!!