Last active
January 22, 2025 18:35
-
-
Save aakashb95/6001957c9eb5c9db373ff52a98069a31 to your computer and use it in GitHub Desktop.
linux basic setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install packages | |
sudo apt update | |
sudo apt install -y zsh fzf bat openssh-server | |
# Install NVIDIA drivers | |
echo "Installing NVIDIA drivers..." | |
sudo ubuntu-drivers autoinstall | |
# Install Docker | |
echo "Installing Docker..." | |
curl -fsSL https://get.docker.com -o get-docker.sh | |
sudo sh get-docker.sh | |
rm get-docker.sh | |
# Add user to docker group to run docker without sudo | |
sudo usermod -aG docker $USER | |
sudo systemctl enable docker | |
sudo systemctl start docker | |
# Create local bin directory and link bat | |
mkdir -p ~/.local/bin | |
ln -s /usr/bin/batcat ~/.local/bin/bat | |
# Add ~/.local/bin to PATH if not already present | |
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then | |
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc | |
fi | |
# Setup fzf completion and key bindings | |
/usr/share/doc/fzf/examples/install || ~/.fzf/install | |
# Install oh-my-zsh | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended | |
# Make zsh default shell | |
chsh -s $(which zsh) | |
# Install zsh plugins | |
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions | |
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting | |
git clone https://github.com/agkozak/zsh-z ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-z | |
# Update plugins in .zshrc | |
sed -i 's/plugins=(git)/plugins=(git docker zsh-autosuggestions zsh-syntax-highlighting zsh-z)/' ~/.zshrc | |
# Add fzf and bat configs to .zshrc | |
echo '# Enable fzf key bindings and completion | |
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh | |
# Alias bat as cat if available | |
if command -v bat &> /dev/null; then | |
alias cat="bat --paging=never" | |
fi' >> ~/.zshrc | |
# Install uv package manager | |
curl -LsSf https://astral.sh/uv/install.sh | sh | |
# Install Miniconda | |
mkdir -p ~/miniconda3 | |
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh | |
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3 | |
rm -rf ~/miniconda3/miniconda.sh | |
~/miniconda3/bin/conda init bash | |
~/miniconda3/bin/conda init zsh | |
# Enable and start SSH server | |
sudo systemctl enable ssh | |
sudo systemctl start ssh | |
# Create backup of original zshrc for uninstallation | |
cp ~/.zshrc ~/.zshrc.backup | |
echo "Installation complete! You may need to restart your system for NVIDIA drivers to take effect." | |
echo "After restart, you can verify NVIDIA installation with 'nvidia-smi'" | |
# Start zsh | |
exec zsh -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment