Installation, Configuration and Operation on Linux

Installation

The following example will install
the server in /opt/odilon
and data in /opt/odilon-data

							
cd /opt
sudo wget http://odilon.io/resources/odilon-server-1.8.tar.gz
							
							

Create Linux user odilon and extract the server

							
sudo useradd -s /sbin/nologin -d /opt/odilon odilon
sudo chown -R odilon:odilon /opt/odilon-server-1.8.tar.gz
sudo tar xvf /opt/odilon-server-1.8.tar.gz
sudo chown -R odilon:odilon /opt/odilon
							
							

Create data directory

							
sudo mkdir -p /opt/odilon-data
sudo chown -R odilon:odilon /opt/odilon-data
sudo chmod u+rwx /opt/odilon-data
sudo chmod og-rwx /opt/odilon-data
							
							

Directories

app/
A self-contained Odilon server.

bin/
Scripts to startup, manage and interact with Odilon instances.

config/
odilon.properties is is Odilon's main configuration file, Other config files (like log4j2.xml for error logging)

examples/
Sample Java classes to create buckets, upload and download files, list objects, and others.

logs/
logs directories

Configuration

The next steps are
configure Odilon parameters in ./config/odilon.properties
configure the Java JVM runtime parameters in ./bin/config.sh
and finally register Odilon as a Linux service.

Odilon.properties

Odilon configuration is defined in file ./config/odilon.properties
This is where you can set up server url and credentials (url, port, accessKey, SecretKey), and data storage (RAID level, data storage directories), and other parameters

Sample properties file:
odilon.properties

A bare minimum odilon.properties file could look something like this:

	
server.port=9234
accessKey=odilon
secretKey=odilon
redundancyLevel=RAID 0
dataStorage=/opt/odilon-data/drive0

config.sh

The file ./bin/config.sh contains parameters required by the Java JVM.
You may need to edit the JAVA_HOME parameter and point it to the Java home directory on your server.
For example:

	
readlink -f $(which java)
/usr/lib/jvm/java-11-openjdk-11.0.21.0.9-1.el7_9.x86_64/bin/java

Content of config.sh:



# JAVA_HOME is found from the redlink command, if you want to use another JVM
# you have to set JAVA_HOME.
# This command will show where Java is in most Linux
# note that JAVA_HOME must point to Java 17 
#
# readlink -f $(which java)
#
#

export JAVA_HOME="$(readlink -f $(which java))"

# Define the app directory
directory="$ODILON_HOME/app"

# Find the first file inside the directory whose name starts with "odilon-server"
file=$(find "$directory" -type f -name "odilon-server*" | head -n 1)

# Assign the found file to the variable APP
if [ -n "$file" ]; then

     filename=$(basename "$file")
    export APP="$ODILON_HOME/app/$filename"

else
    echo "No file found with name starting with 'odilon-server' in directory '$directory'"
fi

export JETTY_STOP_PWD="OdilonShutd0wn"
export APP_USER="odilon"

export ODILON_PROPS="
-Xbootclasspath/a:$ODILON_HOME/resources:$ODILON_HOME/config
-Xms1G
-Xmx4G
-Dwork=$ODILON_HOME/tmp/
-Dlog-path=$ODILON_HOME/logs
-Dlog4j.configurationFile=log4j2.xml
-DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
-Djava.net.preferIPv4Stack=true
-Dfile.encoding="UTF-8"
-Dsun.jnu.encoding="UTF-8""

export DEBUG_PROP=""


Linux service

The final step is to set up the Linux service to start up and shutdown Odilon.

							
sudo vi /etc/systemd/system/odilon.service


							
							

Copy & paste this content into odilon.service

							
[Unit]
Description=Odilon
Documentation=https://odilon.io
Wants=network-online.target
After=network-online.target

[Service]
# Environment must define the variable ODILON_HOME pointing to the installation directory
Environment="ODILON_HOME=/opt/odilon"

# ExecStart must point to startup script 
ExecStart=/opt/odilon/bin/start-service.sh

# WorkingDirectory must point to the installation directory
WorkingDirectory=/opt/odilon

User=odilon
Group=odilon

PermissionsStartOnly=true

# Let systemd restart this service only if it has ended with the clean exit code or signal.
Restart=on-success

StandardOutput=journal
StandardError=inherit

# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536

# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0

# SIGTERM signal is used to stop Odilon
KillSignal=SIGTERM
SendSIGKILL=no
SuccessExitStatus=0

[Install]
WantedBy=multi-user.target

							
							

Register the Linux service and start

							
# Enable odilon service
sudo systemctl enable odilon

# reload daemon
sudo systemctl daemon-reload

# Start odilon
sudo systemctl start odilon
							
							

If there are errors you can check startup.log and odilon.log (default dir is /opt/odilon/logs)
ando also check the service status using systemctl or curl to print the /info page.

							
# check status of the service
sudo systemctl status odilon

# the following command should display the info page in the console
# odilon default server (localhost) port (9234) and credentials (accessKey: odilon, secretKey:odilon)
# these parameters can be edited in /config/odilon.properties

sudo curl -u odilon:odilon localhost:9234/info
							
							

Example screenshot -> systemctl status odilon

Example screenshot -> curl /info

Startup and Shutdown

Once you registered Odilon as a service

systemctl start odilon to startup the server
systemctl stop odilon to shutdown the server
systemctl status odilon check if the server status

Checking the info page

Odilon Server comes with an embedded web server.
Point your web browser to http://127.0.0.1:9234/info to ensure your server has started successfully.

Example:

See sample info page


You can also check the server metrics at any time at /metricsinformal

See sample metrics page


or using curl in Linux

							
# odilon default server (localhost) port (9234) and credentials (accessKey: odilon, secretKey:odilon)

# display the info page in the console
sudo curl -u odilon:odilon localhost:9234/info

# display the metrics page in the console
sudo curl -u odilon:odilon localhost:9234/metricsinformal