Files
metaverseDubai/scripts/install/install_ue5_5.4.1.sh
2026-07-07 03:43:19 -07:00

257 lines
8.1 KiB
Bash
Executable File

#!/bin/bash
# Dubai Metaverse - Unreal Engine 5.4.1 Linux/WSL Installation Script
# Automated installation script for UE 5.4.1 on Ubuntu/WSL
set -e
echo "=========================================="
echo "Dubai Metaverse - UE 5.4.1 Installation"
echo "=========================================="
echo ""
echo "This script will install Unreal Engine 5.4.1 from source on Ubuntu/WSL"
echo "Optimized for reduced disk space (~300GB) and limited CPU (4 cores)"
echo "Prerequisites:"
echo " 1. GitHub account linked to Epic Games account"
echo " 2. Sufficient disk space (~300GB+)"
echo " 3. Sufficient RAM (32GB+ recommended)"
echo " 4. This will take 4-6+ hours to build (using 4 CPU cores)"
echo ""
read -p "Continue? (y/n) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
print_step() {
echo -e "${GREEN}[STEP]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Step 1: Update system
print_step "Updating system packages..."
sudo apt update && sudo apt upgrade -y
# Step 2: Install dependencies
print_step "Installing build dependencies..."
# Add .NET backports repository for dotnet-sdk-6.0 (required for Ubuntu 24.04)
print_step "Adding .NET backports repository..."
sudo add-apt-repository -y ppa:dotnet/backports 2>/dev/null || echo "Repository may already exist or adding manually..."
sudo apt update
# Install dependencies
print_step "Installing build dependencies..."
sudo apt install -y \
build-essential \
clang \
cmake \
ninja-build \
mono-devel \
python3 \
python3-pip \
git \
git-lfs \
curl \
wget \
unzip \
libvulkan-dev \
libxcb-xinput-dev \
libgtk-3-dev \
libxrandr-dev \
libxinerama-dev \
libxi-dev \
libsdl2-dev \
libssl-dev \
libicu-dev \
libxml2-dev \
libxcursor-dev \
libxcb-icccm4-dev \
libxcb-image0-dev \
libxcb-keysyms1-dev \
libxcb-render-util0-dev \
libxcb-xkb-dev \
libxkbcommon-dev \
libxkbcommon-x11-dev \
mesa-common-dev \
libgl1-mesa-dev \
libc++-dev \
libc++abi-dev
# Try to install dotnet-sdk-6.0 (may not be available, but try)
print_step "Installing .NET SDK 6.0..."
if sudo apt install -y dotnet-sdk-6.0 2>/dev/null; then
echo "✓ .NET SDK 6.0 installed"
else
print_warning ".NET SDK 6.0 not available, trying alternative..."
# Try installing dotnet8 or skip if not critical
sudo apt install -y dotnet-sdk-8.0 2>/dev/null || echo "Note: .NET SDK optional, continuing without it..."
fi
# Step 3: Setup Git LFS
print_step "Setting up Git LFS..."
git lfs install
# Step 4: Check GitHub/Epic Games account
print_step "Checking GitHub access to Unreal Engine repository..."
if ! git ls-remote https://github.com/EpicGames/UnrealEngine.git &>/dev/null; then
print_error "Cannot access Unreal Engine repository"
echo ""
echo "Please ensure:"
echo " 1. Your GitHub account is linked to Epic Games account"
echo " 2. You have accepted the Unreal Engine license"
echo " 3. Visit: https://www.unrealengine.com/en-US/ue-on-github"
echo ""
exit 1
fi
# Step 5: Check for 5.4.1 tag
print_step "Checking for UE 5.4.1 tag..."
TAG_EXISTS=$(git ls-remote --tags https://github.com/EpicGames/UnrealEngine.git | grep -E "refs/tags/5\.4\.1" || echo "")
if [ -z "$TAG_EXISTS" ]; then
print_warning "Tag 5.4.1 not found, checking available 5.4.x tags..."
git ls-remote --tags https://github.com/EpicGames/UnrealEngine.git | grep "5.4" | tail -5
echo ""
read -p "Tag 5.4.1 not found. Use 5.4 branch instead? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
UE_VERSION="5.4"
USE_TAG=false
else
print_error "Installation cancelled"
exit 1
fi
else
UE_VERSION="5.4.1"
USE_TAG=true
print_step "Found tag 5.4.1"
fi
# Step 6: Clone repository
print_step "Cloning Unreal Engine ${UE_VERSION} repository..."
echo "This may take 30-60 minutes depending on connection speed..."
cd ~
if [ -d "UnrealEngine" ]; then
print_warning "UnrealEngine directory already exists"
read -p "Remove and re-clone? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm -rf UnrealEngine
else
echo "Using existing directory"
cd UnrealEngine
if [ "$USE_TAG" = true ]; then
print_step "Checking out tag ${UE_VERSION}..."
git fetch --tags
git checkout ${UE_VERSION}
fi
cd ~
fi
fi
if [ ! -d "UnrealEngine" ]; then
if [ "$USE_TAG" = true ]; then
print_step "Cloning repository (will checkout tag ${UE_VERSION} after clone)..."
# Clone without specifying branch/tag first
git clone --depth=1 https://github.com/EpicGames/UnrealEngine.git UnrealEngine
cd UnrealEngine
print_step "Checking out tag ${UE_VERSION}..."
# Fetch the specific tag
git fetch --depth=1 origin tag ${UE_VERSION}
# Checkout the tag
git checkout ${UE_VERSION}
cd ~
else
print_step "Cloning with branch ${UE_VERSION}..."
git clone --depth=1 --branch ${UE_VERSION} https://github.com/EpicGames/UnrealEngine.git UnrealEngine
fi
fi
# Step 7: Run Setup (with minimal dependencies)
print_step "Running Setup.sh (this may take 30-60 minutes)..."
cd ~/UnrealEngine
# Setup.sh will download required dependencies
./Setup.sh
# Step 8: Generate project files (Development Editor only)
print_step "Generating project files for Development Editor..."
# Generate project files - this creates the build system files
./GenerateProjectFiles.sh -game -engine
# Step 9: Build Unreal Engine (optimized for disk space and 4 cores)
print_step "Building Unreal Engine ${UE_VERSION}..."
echo "Building Development Editor only (reduces disk space)"
echo "Skipping Shipping builds, templates, and samples to save space"
echo "Using 4 CPU cores (will take 4-6+ hours)"
echo "To use more cores, edit this script and change NUM_CORES=4"
NUM_CORES=4
# Build only Development Editor (not Shipping, not all tools)
# This significantly reduces disk space requirements
make -j${NUM_CORES} UnrealEditor
# Step 10: Clean up intermediate files to save disk space
print_step "Cleaning up intermediate build files to save disk space..."
# Remove intermediate build files (keeps binaries and required files)
find Engine/Intermediate -type f -name "*.o" -delete 2>/dev/null || true
find Engine/Intermediate -type f -name "*.obj" -delete 2>/dev/null || true
find Engine/Intermediate -type f -name "*.d" -delete 2>/dev/null || true
find Engine/Intermediate -type f -name "*.pch" -delete 2>/dev/null || true
# Clean up source control files that aren't needed
find . -type f -name ".git*" -not -path "./.git/*" -delete 2>/dev/null || true
print_step "Cleanup complete. Checking disk usage..."
du -sh ~/UnrealEngine 2>/dev/null | awk '{print "Installation size: " $1}'
# Step 11: Verify installation
print_step "Verifying installation..."
if [ -f "Engine/Binaries/Linux/UnrealEditor" ]; then
echo -e "${GREEN}${NC} Unreal Editor built successfully!"
echo ""
echo "Installation location: ~/UnrealEngine/Engine/Binaries/Linux/UnrealEditor"
echo "Version: ${UE_VERSION}"
echo "CPU cores used: ${NUM_CORES}"
echo ""
# Create launch script
cat > ~/launch_ue5.sh << 'EOF'
#!/bin/bash
cd ~/UnrealEngine/Engine/Binaries/Linux
./UnrealEditor "$@"
EOF
chmod +x ~/launch_ue5.sh
echo "Launch script created: ~/launch_ue5.sh"
echo ""
echo "To launch:"
echo " ~/launch_ue5.sh"
echo " # Or directly:"
echo " ~/UnrealEngine/Engine/Binaries/Linux/UnrealEditor"
echo ""
echo "For WSL graphics, ensure X server is running (WSLg on Windows 11, or VcXsrv/Xming on Windows 10)"
else
print_error "Build failed - UnrealEditor binary not found"
exit 1
fi
echo ""
echo "=========================================="
echo "Installation Complete!"
echo "=========================================="
echo ""
echo "Next steps:"
echo "1. Set up X server for graphics (if using WSL)"
echo "2. Create project: Follow UE5_WSL_INSTALL.md"
echo "3. Configure project settings"
echo ""