-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathRedhatInstall.sh
More file actions
157 lines (129 loc) · 4.69 KB
/
Copy pathRedhatInstall.sh
File metadata and controls
157 lines (129 loc) · 4.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/bin/bash
#################################
# NOTE! This is experimental and has only been tested on one RedHat server
#################################
echo "Installing Sigma"
echo "Downloading prerequisites"
# Update and install unzip
sudo yum update
sudo yum install -y unzip
# Install git
sudo yum install -y git
# Install ant - must be manual on Redhat since yum ant requires JDK 1.8
# Install make
sudo yum install -y make
# Install cmake
sudo yum install -y cmake
# Install gcc
sudo yum install -y gcc
# Install graphviz
sudo yum install -y graphviz
sudo yum install -y httpd
# Install build-essential (required for compiling Vampire)
sudo yum groupinstall "Development Tools"
# Install OpenJDK 21
sudo yum install java-21-openjdk-devel
# uncomment to have a web server for installation on a server
# sudo yum install -y httpd
# sudo systemctl enable httpd # For CentOS/RHEL
# echo '<h1>default page</h1>' > /home/www/html/index.html
# Add universe repository and update
# sudo add-apt-repository -y universe # not for RedHat
sudo yum update
echo "Pre-requisites have been installed."
# Check if .bashrc exists, and create it if not
if [ ! -f "$HOME/.bashrc" ]; then
echo ".bashrc does not exist. Creating it now..."
touch "$HOME/.bashrc"
else
echo ".bashrc already exists."
fi
# Function to check and add a line to .bashrc
add_to_bashrc() {
local LINE="$1"
if ! grep -Fxq "$LINE" "$HOME/.bashrc"; then
echo "Adding: $LINE to .bashrc..."
echo "$LINE" >> "$HOME/.bashrc"
else
echo "$LINE already exists in .bashrc."
fi
}
# Add the necessary lines to .bashrc
add_to_bashrc "alias dir='ls --color=auto --format=vertical -la'"
add_to_bashrc "export HISTSIZE=10000 HISTFILESIZE=100000"
add_to_bashrc "export SIGMA_HOME=\"\$HOME/.sigmakee\""
add_to_bashrc "export ONTOLOGYPORTAL_GIT=\"\$HOME/workspace\""
add_to_bashrc "export SIGMA_SRC=\"\$ONTOLOGYPORTAL_GIT/sigmakee\""
add_to_bashrc "export CATALINA_OPTS=\"\$CATALINA_OPTS -Xmx10g -Xss1m\""
add_to_bashrc "export CATALINA_HOME=\"\$HOME/Programs/apache-tomcat-9.0.107\""
add_to_bashrc "export SIGMA_CP=\"\$SIGMA_SRC/build/sigmakee.jar:\$SIGMA_SRC/lib/*\""
# Source the .bashrc file to apply changes
echo "Sourcing .bashrc to apply changes..."
source "$HOME/.bashrc"
# Create the Programs directory and navigate into it
if [ ! -d "$HOME/Programs" ]; then
echo "Creating Programs directory in $HOME..."
mkdir "$HOME/Programs"
else
echo "Programs directory already exists in $HOME."
fi
cd "$HOME/Programs"
#install ant
wget https://dlcdn.apache.org//ant/binaries/apache-ant-1.10.15-bin.zip
unzip apache-ant-1.10.15-bin.zip
add_to_bashrc "export JAVA_HOME=\"/usr/lib/jvm/java-21-openjdk-21.0.6.0.7-1.el8.x86_64\""
add_to_bashrc "export ANT_HOME=\"/home/apease/Programs/apache-ant-1.10.15\""
add_to_bashrc "export PATH=\"\$CATALINA_HOME/bin:\$ANT_HOME/bin:\$PATH\""
# Create the workspace directory and navigate into it
if [ ! -d "$HOME/workspace" ]; then
echo "Creating workspace directory in $HOME..."
mkdir "$HOME/workspace"
else
echo "Workspace directory already exists in $HOME."
fi
cd "$HOME/workspace"
# Clone or update repositories
REPOS=(
"https://github.com/ontologyportal/sigmakee"
"https://github.com/ontologyportal/sumo"
"https://github.com/ontologyportal/TPTP-ANTLR"
"https://github.com/ontologyportal/sigmaAntlr"
"https://github.com/ontologyportal/SigmaUtils"
)
for REPO in "${REPOS[@]}"; do
DIR_NAME=$(basename "$REPO" .git)
if [ ! -d "$HOME/workspace/$DIR_NAME" ]; then
echo "Cloning $REPO..."
git clone "$REPO"
else
echo "$DIR_NAME repository already exists. Pulling the latest changes..."
cd "$HOME/workspace/$DIR_NAME"
git pull
cd "$HOME/workspace"
fi
done
# Navigate to the sigmakee directory and run ant commands
cd "$HOME/workspace/sigmakee"
echo "Running ant install..."
output=$(ant install 2>&1 | tee /dev/tty)
if echo "$output" | grep -q "BUILD FAILED"; then
echo "BUILD FAILED detected. Exiting the script."
exit 1
else
echo "Install completed successfully."
fi
echo "Running ant to compile..."
output=$(ant 2>&1 | tee /dev/tty)
if echo "$output" | grep -q "BUILD FAILED"; then
echo "BUILD FAILED detected. Exiting the script."
exit 1
else
echo "Ant sigmakee compile completed successfully."
fi
echo "SIGMA has been installed! To start the server:"
echo "startup.sh"
echo "Then point your browser to: http://localhost:8080/sigma/login.html"
echo "username: admin password: admin"
echo "The first time logging in can take several minutes while the system is indexing. For low memory machines, restrict Knowledge Bases loaded in \$HOME/.sigmakee/KBs/config.xml"
echo "To shutdown the server:"
echo "shutdown.sh"