Skip to content

Commit 8791f00

Browse files
committed
Merge branch 'add-ubuntu-docs-script' into 'develop'
Add Ubuntu 24.04 support to development environment setup See merge request genaiic-reusable-assets/engagement-artifacts/genaiic-idp-accelerator!383
2 parents 054d04d + 8fa7521 commit 8791f00

File tree

3 files changed

+145
-8
lines changed

3 files changed

+145
-8
lines changed

docs/setup-development-env-linux.md

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Introduction
44

5-
This guide establishes a cloud-based development environment using Amazon Linux 2023 on AWS EC2, specifically designed for the GenAI IDP accelerator.
5+
This guide establishes a cloud-based development environment using Amazon Linux 2023 or Ubuntu 24.04 on AWS EC2, specifically designed for the GenAI IDP accelerator.
66

77
Purpose: Provides a standardized, scalable development infrastructure that combines the familiar VSCode interface on your local machine with powerful cloud compute resources. This approach eliminates local environment configuration issues while ensuring consistent development experiences across team members.
88

@@ -27,10 +27,9 @@ A hybrid development setup where your code runs on a pre-configured Amazon Linux
2727
## 1.2 Configure Instance Settings
2828

2929
Name: genai-idp-dev-environment(example)
30-
AMI Selection:
31-
Amazon Linux 2023
32-
33-
- Architecture: 64-bit (x86)
30+
AMI Selection (choose one):
31+
**Option 1: Amazon Linux 2023**
32+
**Option 2: Ubuntu 24.04**
3433

3534
Instance Type:
3635

@@ -81,7 +80,15 @@ ssh -i /path/to/genai-idp-dev-key.pem ec2-user@YOUR_INSTANCE_IP
8180

8281
### To install git run this command on EC2 Instance
8382

83+
**For Amazon Linux 2023:**
84+
```bash
8485
sudo dnf install git -y
86+
```
87+
88+
**For Ubuntu 24.04:**
89+
```bash
90+
sudo apt update && sudo apt install git -y
91+
```
8592

8693
### Clone Repository
8794

@@ -94,11 +101,30 @@ cd accelerated-intelligent-document-processing-on-aws/
94101
### Run the setup script for development tools which is scripts directory
95102

96103
cd scripts
97-
sh ./dev_setup.sh
104+
105+
**For Amazon Linux 2023:**
106+
```bash
107+
chmod +x ./dev_setup_al2023.sh
108+
./dev_setup_al2023.sh
109+
```
110+
111+
**For Ubuntu 24.04:**
112+
```bash
113+
chmod +x ./dev_setup_ubuntu.sh
114+
./dev_setup_ubuntu.sh
115+
```
98116

99117
### To upgrade the python version run this command on EC2 instance
100118

119+
**For Amazon Linux 2023:**
120+
```bash
101121
source /home/ec2-user/miniconda/bin/activate base
122+
```
123+
124+
**For Ubuntu 24.04:**
125+
```bash
126+
source /home/ubuntu/miniconda/bin/activate base
127+
```
102128

103129
# Step 4: Install Visual Studio Code on Local Machine
104130

@@ -122,6 +148,7 @@ Install Remote - SSH extension (by Microsoft)
122148
To open "SSH Config" go to "Remote Explorer" option on left bar
123149
You can open and edit "SSH config" file by settings option on "SSH" Tab
124150

151+
**For Amazon Linux 2023:**
125152
```
126153
Host genai-idp-dev
127154
HostName YOUR_INSTANCE_PUBLIC_IP
@@ -130,12 +157,23 @@ Host genai-idp-dev
130157
Port 22
131158
```
132159

160+
**For Ubuntu 24.04:**
161+
```
162+
Host genai-idp-dev-ubuntu
163+
HostName YOUR_INSTANCE_PUBLIC_IP
164+
User ubuntu
165+
IdentityFile /path/to/genai-idp-dev-key.pem
166+
Port 22
167+
```
168+
133169
# 4.3 Connect via VSCode
134170

135171
1. Press Ctrl+Shift+P
136172
2. Type "Remote-SSH: Connect to Host"
137-
3. Select "genai-idp-dev"
138-
4. Open folder: /home/ec2-user/accelerated-intelligent-document-processing-on-aws
173+
3. Select "genai-idp-dev" (Amazon Linux) or "genai-idp-dev-ubuntu" (Ubuntu)
174+
4. Open folder:
175+
- Amazon Linux: `/home/ec2-user/accelerated-intelligent-document-processing-on-aws`
176+
- Ubuntu: `/home/ubuntu/accelerated-intelligent-document-processing-on-aws`
139177

140178
# Step 5: AWS Configure
141179

File renamed without changes.

scripts/dev_setup_ubuntu.sh

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/bin/bash
2+
3+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
# SPDX-License-Identifier: MIT-0
5+
6+
##############################################################################################
7+
# Linux Development Environment Setup Script
8+
#
9+
# This script automates the installation of development tools for the GenAI IDP accelerator
10+
# on Ubuntu 24.04 systems. It installs Python 3.12, AWS CLI, SAM CLI, Node.js, Docker,
11+
# and other essential development tools.
12+
#
13+
# Usage: ./dev_setup_ubuntu.sh
14+
# Note: Logout/login required after completion for Docker group permissions
15+
##############################################################################################
16+
17+
# exit on failure
18+
set -ex
19+
20+
pushd /tmp
21+
22+
# developer tools
23+
sudo apt update -y
24+
sudo apt install build-essential -y
25+
26+
# python/pip/conda
27+
sudo apt install python3.12 python3.12-venv python3-pip unzip wget zip -y
28+
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1
29+
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1
30+
pip3 install --upgrade pip --break-system-packages
31+
pip3 install virtualenv typer ruff --break-system-packages
32+
curl -LO https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
33+
bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda || bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda -u
34+
35+
# aws cli
36+
sudo apt remove awscli -y || true
37+
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
38+
unzip -q awscliv2.zip
39+
sudo ./aws/install --update
40+
41+
# sam cli
42+
wget -q https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip
43+
unzip -q aws-sam-cli-linux-x86_64.zip -d ./sam-cli
44+
sudo ./sam-cli/install --update
45+
46+
# node 20
47+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
48+
export NVM_DIR="$HOME/.nvm"
49+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
50+
nvm install 20
51+
52+
# docker
53+
sudo apt install docker.io -y
54+
sudo systemctl start docker
55+
sudo systemctl enable docker
56+
sudo usermod -a -G docker $USER
57+
58+
# local .bashrc scripts
59+
mkdir -p ~/.bashrc.d
60+
cat <<'_EOF' > ~/.bashrc.d/bob-prefs
61+
62+
_bash_history_sync() {
63+
builtin history -a
64+
}
65+
66+
# modifications needed only in interactive mode
67+
if [ "$PS1" != "" ]; then
68+
# keep more history
69+
shopt -s histappend
70+
export HISTSIZE=100000
71+
export HISTFILESIZE=100000
72+
export PROMPT_COMMAND="history -a;"
73+
74+
if [[ "$PROMPT_COMMAND" != *_bash_history_sync* ]]; then
75+
PROMPT_COMMAND="_bash_history_sync; $PROMPT_COMMAND"
76+
fi
77+
78+
# default prompt (from Cloud9)
79+
_prompt_user() {
80+
if [ "$USER" = root ]; then
81+
echo "$USER"
82+
else
83+
echo ""
84+
fi
85+
}
86+
PS1='\[\033[01;32m\]$(_prompt_user)\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(__git_ps1 " (%s)" 2>/dev/null) \$ '
87+
88+
alias python=python3
89+
alias pip=pip3
90+
alias interpreter="interpreter --model bedrock/us.anthropic.claude-3-haiku-20240307-v1:0"
91+
92+
# Add local bin to PATH
93+
export PATH="$HOME/.local/bin:$PATH"
94+
fi
95+
_EOF
96+
97+
popd
98+
99+
echo "DONE - Please log out and log back in for Docker group permissions to take effect."

0 commit comments

Comments
 (0)