Fénix Manual - Setting Up a Linux Box



A. Setting Up a Linux Box

Currently most linux distributions are fairly easy to install. The following text provides step-by-step instructions for configuring a Fedora/Redhat box. The configuration of other distributions is probably very similar. If anyone should detect any differences or issues regarding the steps here describe we would appreciate being informed at the following mailing list: https://mlists.ist.utl.pt/mailman/listinfo/fenix-user


A.1 System Encoding

To set the system encoding to ISO-8859-15, edit the file: /etc/sysconfig/i18n so as to resemble the following:

LANG="en_US.iso885915"
SUPPORTED="en_US.iso885915:en_US:en:pt_PT@euro:pt_PT:pt"
SYSFONT="lat0-sun16"
SYSFONTACM="iso15"
Note:

This alteration may require the installation of extra packages. Pay attention to the boot messages.

A.2 Java Virtual Machine

Installing the Java Standard Development Kit is straightforward, simply execute the downloaded package net.sourceforge.fenixedu.from Suns website. Once the package net.sourceforge.fenixedu.is installed the JAVA_HOME environment variable must be defined. To do so, create a symbolic link pointing to the directory where Java was installed:

ln -s /usr/java/j2sdk1.4.X_xx /usr/java/java

Next, to define and export the JAVA_HOME environment variable, just add the following lines the file /etc/profile:

export JAVA_HOME=/usr/java/java
export PATH=${PATH}:${JAVA_HOME}/bin

Finally, indicate the amount of memory used by the Java Virtual Machine, defining the JAVA_OPTS environment variable in the file /etc/profile:

export JAVA_OPTS="-Xms256m -Xmx768m -server"

The -Xms option indicates the initial amount of memory allocated when the Java Virtual Machine starts. The -Xmx option indicates the maximum amount of memory available to the Java Virtual Machine. These values should be defined taking into consideration the amount of physical memory of the underlying hardware. The values provided above are for a development machine with 1GB of RAM. For a production server, both the -Xms option and the -Xmx option should be set to the same value. This will cause a slower startup of Java processes, but will minimize memory management overhead after startup.

A.3 Apache Ant

To install Ant just download the latest archive from Ants website. Unzip the archive and create a symbolic link as follows:

ln -s /usr/local/ant-1.6.X /usr/local/ant

Next, define and export the ANT_HOME environment variable. Just add the following lines the file /etc/profile:

export ANT_HOME=/usr/local/ant
export PATH=${PATH}:${ANT_HOME}/bin

Finally, indicate the amount of memory used by the ANT, defining the ANT_OPTS environment variable in the file /etc/profile:

export ANT_OPTS="-Xmx512m"

The -Xmx option indicates the maximum amount of memory available when running Ant tasks. The -Xms option may also be defined. These values should be defined taking into consideration the amount of physical memory of the underlying hardware, and the amount of memory required to run the tasks. Setting these values too high might be an unnecessary waste of system resources.

A.4 Database

To setup the MySQL database download the necessary RPM packages from MySQLs website and install them using the rpm -ivh command. To enable InnoDB tables (this will permit transactional support for applications) and optimize the database for performance place the following content in the /etc/my.cnf file:

[client]
port = 3306
socket = /var/lib/mysql/mysql.sock

[mysqld]
port = 3306
datadir = /var/lib/mysql
socket = /var/lib/mysql/mysql.sock
skip-locking
set-variable = max_connections=500
set-variable = key_buffer=16M
set-variable = max_allowed_packet=11M
set-variable = table_cache=64
set-variable = sort_buffer=512K
set-variable = net_buffer_length=8K
set-variable = myisam_sort_buffer_size=8M
log-bin
server-id = 4
max_binlog_cache_size = 4G
#tmpdir = /tmp/
log-update = /var/log/mysql/db-apl-log-update
innodb_data_file_path = ibdata1:400M:autoextend
innodb_data_home_dir = /var/lib/mysql/
innodb_log_group_home_dir = /var/lib/mysql/
innodb_log_arch_dir = /var/lib/mysql/
set-variable = innodb_mirrored_log_groups=1
set-variable = innodb_log_files_in_group=3
set-variable = innodb_log_file_size=5M
set-variable = innodb_log_buffer_size=8M
innodb_flush_log_at_trx_commit=1
innodb_log_archive=0
set-variable = innodb_buffer_pool_size=16M
set-variable = innodb_additional_mem_pool_size=2M
set-variable = innodb_file_io_threads=4
set-variable = innodb_lock_wait_timeout=50

[mysqldump]
quick
set-variable = max_allowed_packet=16M

[mysql.server]
user=mysql
basedir=/var/lib
set-variable = max_heap_table_size=512M

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[mysql]
no-auto-rehash

[isamchk]
set-variable = key_buffer=20M
set-variable = sort_buffer=20M
set-variable = read_buffer=2M
set-variable = write_buffer=2M

[myisamchk]
set-variable = key_buffer=20M
set-variable = sort_buffer=20M
set-variable = read_buffer=2M
set-variable = write_buffer=2M

[mysqlhotcopy]
interactive-timeout
socket=/var/lib/mysql/mysql.sock
datadir=/var/lib/mysql

The log-bin option is only necessary for production servers. If the machine being installed is not a production server, then we recommend commenting this option to save disk space.

To start MySQL automatically when the system boots, type ntsysv as root and select mysqld.

Finally create a user for the Fénix application, an example of how to do so follows:

mysql -Dmysql -uroot
insert into user values ('%', 'fenix', Password('xXxXxXxXxX'),
   'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N');
insert into db values ('%', 'fenix', 'fenix',
   'Y', 'Y', 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', 'N');
quit
mysqladmin -uroot flush-hosts flush-privileges

A.5 Application Server

To install the JBoss application server simply download the archive from JBosss website and unzip the archive. Create a symbolic link as follows:

ls -s /usr/local/jboss-3.2.X /usr/local/jboss

And define and export the JBOSS_HOME environment variable by adding the following lines the file /etc/profile:

export JBOSS_HOME=/usr/local/jboss
export PATH=${PATH}:${JBOSS_HOME}/bin

Next "create" a service installation script to start and stop the jboss server. On Fedora/Redhat simply create a symbolic link as follows:

ln -s /usr/local/jboss/bin/jboss_init_redhat.sh /etc/init.d/jboss

A.6 Servlet Container