-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·53 lines (42 loc) · 1.44 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·53 lines (42 loc) · 1.44 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
#!/bin/bash
# AI Agent API Installation Script for CentOS 7/8/9
# Run as root
set -e
echo "Starting AI Agent API installation..."
# 1. Install Dependencies
echo "Installing Python 3 and Pip..."
yum install -y python3 python3-pip
# 2. Create Application Directory
APP_DIR="/opt/aiagent"
CONF_DIR="/etc/aiagent"
echo "Creating directories..."
mkdir -p $APP_DIR
mkdir -p $CONF_DIR
# 3. Copy Files
echo "Copying application files..."
cp ai_api.py $APP_DIR/
cp ai_agent.py $APP_DIR/
cp requirements.txt $APP_DIR/
cp config.json $CONF_DIR/
# 4. Install Python Requirements
echo "Installing Python requirements..."
pip3 install --break-system-packages -r $APP_DIR/requirements.txt || pip3 install -r $APP_DIR/requirements.txt
# 5. Setup Systemd Service
echo "Setting up systemd service..."
cp aiagent.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable aiagent
systemctl start aiagent
# 6. Configure Firewall (optional but recommended)
if command -v firewall-cmd > /dev/null; then
PORT=$(grep -oP '"port":\s*\K\d+' $CONF_DIR/config.json || echo 5005)
echo "Opening port $PORT in firewall..."
firewall-cmd --permanent --add-port=${PORT}/tcp
firewall-cmd --reload
fi
echo "------------------------------------------------"
echo "Installation complete!"
echo "Service status: $(systemctl is-active aiagent)"
echo "Config file: $CONF_DIR/config.json"
echo "Logs: journalctl -u aiagent -f"
echo "------------------------------------------------"