Skip to content

Instantly share code, notes, and snippets.

@larry0x
Last active February 24, 2023 03:05
Show Gist options
  • Save larry0x/6b66110b76d2e7f48eae6ba7574af6cd to your computer and use it in GitHub Desktop.
Save larry0x/6b66110b76d2e7f48eae6ba7574af6cd to your computer and use it in GitHub Desktop.
Set up a Ubuntu server
# ls
alias ls="ls -avhl --color=auto --group-directories-first"
# systemd
alias start="sudo systemctl start"
alias stop="sudo systemctl stop"
alias restart="sudo systemctl restart"
# ports
alias ports="netstat -tulpn | sort -t: -k2 -n"
# go
export GOROOT=/usr/local/go
export GOPATH=$HOME/.go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOPATH/bin:$GOROOT/bin
# rust
. "$HOME/.cargo/env"
# nodejs
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
# command prompt
eval "$(starship init bash)"
# ===== login as root =====
# add larry user
useradd larry --create-home --shell /bin/bash
usermod larry -aG sudo
passwd -d larry
# add larry ssh key
mkdir /home/larry/.ssh
vim /home/larry/.ssh/authorized_keys
# ===== login as larry =====
# update and install stuff
sudo apt update
sudo apt upgrade -y
sudo apt install aria2 build-essential cmake git jq libclang-dev libleveldb-dev liblz4-tool neofetch net-tools vim unzip -y
sudo apt autoremove -y
# go
wget -q -O - https://go.dev/dl/go1.20.1.linux-amd64.tar.gz | sudo tar xvfz - -C /usr/local
# rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# nodejs
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
nvm install 19
nvm use 19
nvm alias default 19
# starship
cargo install starship --locked
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment