53 lines
1.5 KiB
Bash
53 lines
1.5 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
# Install Overpass API
|
||
|
|
||
|
# Step 1: Install required software packages
|
||
|
echo "Installing required packages..."
|
||
|
apt install wget g++ make expat libexpat1-dev zlib1g-dev liblz4-dev -y
|
||
|
|
||
|
# Step 2: Download the latest release of Overpass API
|
||
|
cd /opt
|
||
|
echo "Downloading Overpass API..."
|
||
|
wget https://dev.overpass-api.de/releases/osm-3s_latest.tar.gz
|
||
|
|
||
|
# Extract the package
|
||
|
echo "Extracting package..."
|
||
|
tar -xzf osm-3s_latest.tar.gz
|
||
|
|
||
|
# Navigate into the extracted directory
|
||
|
EXTRACTED_DIR=$(tar -tf osm-3s_latest.tar.gz | head -1 | cut -f1 -d"/")
|
||
|
ln -s "$EXTRACTED_DIR" osm
|
||
|
cd "$EXTRACTED_DIR"
|
||
|
|
||
|
# Compile the software
|
||
|
echo "Compiling Overpass API..."
|
||
|
./configure --enable-lz4
|
||
|
make
|
||
|
chmod 755 bin/*.sh cgi-bin/*
|
||
|
|
||
|
# Step 3: Load Data
|
||
|
DB_DIR="db"
|
||
|
|
||
|
echo "Cloning the database..."
|
||
|
mkdir -p $DB_DIR
|
||
|
bin/download_clone.sh --db-dir="$DB_DIR/" --meta=attic --source="https://dev.overpass-api.de/api_drolbr/"
|
||
|
|
||
|
# Step 4: Create system user
|
||
|
echo "Creating system user..."
|
||
|
useradd -m osm
|
||
|
chown -R osm:osm .
|
||
|
|
||
|
# Step 5: Set up systemd service files
|
||
|
echo "Setting up services..."
|
||
|
SCRIPT_DIR=$(dirname "$0")
|
||
|
cp "$SCRIPT_DIR/systemd/*" /etc/systemd/system/
|
||
|
install "$SCRIPT_DIR/oscmonitor/oscmonitor" /usr/local/bin/
|
||
|
systemctl enable --now overpass
|
||
|
systemctl enable --now overpassareas
|
||
|
systemctl enable --now overpassloop
|
||
|
systemctl enable --now overpassosc
|
||
|
systemctl enable --now oscmonitor.timer
|
||
|
|
||
|
echo "Overpass API installation completed."
|
||
|
echo "Please set up Apache based on the apache/example.conf file."
|