-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathubuntu-setup.sh
More file actions
79 lines (65 loc) · 2.5 KB
/
Copy pathubuntu-setup.sh
File metadata and controls
79 lines (65 loc) · 2.5 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
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "Please run this script as root (use sudo)."
exit 1
fi
USER_HOME=$(eval echo ~$SUDO_USER)
echo "Updating and upgrading packages..."
apt update && apt upgrade -y
echo "Installing essential packages..."
apt install -y \
curl \
git \
zsh \
wget \
unzip \
build-essential \
software-properties-common \
fzf \
python3 \
python3-pip \
vim
echo "Installing Docker..."
apt install -y docker.io
usermod -aG docker $SUDO_USER
echo "Docker installed. You may need to log out and back in for group changes to apply."
if [ ! -d "$USER_HOME/.oh-my-zsh" ]; then
echo "Installing Oh My Zsh..."
sudo -u $SUDO_USER sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
chsh -s $(which zsh) $SUDO_USER
else
echo "Oh My Zsh already installed."
fi
if [ ! -d "$USER_HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions" ]; then
echo "Installing Zsh Autosuggestions..."
sudo -u $SUDO_USER git clone https://github.com/zsh-users/zsh-autosuggestions \
"$USER_HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
fi
if [ ! -d "$USER_HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting" ]; then
echo "Installing Zsh Syntax Highlighting..."
sudo -u $SUDO_USER git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \
"$USER_HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
fi
echo "Setting up Passion theme..."
sudo -u $SUDO_USER wget -O "$USER_HOME/.oh-my-zsh/themes/passion.zsh-theme" \
https://raw.githubusercontent.com/ChesterYue/ohmyzsh-theme-passion/master/passion.zsh-theme
echo "Configuring Zsh..."
sudo -u $SUDO_USER tee "$USER_HOME/.zshrc" > /dev/null <<EOF
export ZSH="$USER_HOME/.oh-my-zsh"
ZSH_THEME="passion"
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
source \$ZSH/oh-my-zsh.sh
EOF
echo "Setting up Git..."
read -p "Enter your Git name: " git_name
read -p "Enter your Git email: " git_email
sudo -u $SUDO_USER git config --global user.name "$git_name"
sudo -u $SUDO_USER git config --global user.email "$git_email"
sudo -u $SUDO_USER git config --global core.editor "vim"
if [ ! -f "$USER_HOME/.ssh/id_rsa" ]; then
echo "Generating SSH key..."
sudo -u $SUDO_USER ssh-keygen -t rsa -b 4096 -C "$git_email" -f "$USER_HOME/.ssh/id_rsa" -N ""
echo "Your public key (add this to GitHub/GitLab):"
cat "$USER_HOME/.ssh/id_rsa.pub"
fi
echo "Setup complete! Restart your terminal and enjoy your new setup. 🚀"