Skip to content

Instantly share code, notes, and snippets.

@larry0x
Last active December 21, 2022 01:07
Show Gist options
  • Save larry0x/d58da0bdc5774cbd9444af4f734dd594 to your computer and use it in GitHub Desktop.
Save larry0x/d58da0bdc5774cbd9444af4f734dd594 to your computer and use it in GitHub Desktop.
Linux server setup

Linux server setup

Start from a freshly installed Ubuntu Server.

Install stuff

sudo apt update &&
sudo apt upgrade -y &&
sudo apt install aria2 build-essential cmake git jq libclang-dev libleveldb-dev liblz4-tool net-tools neofetch vim unzip -y &&
sudo apt autoremove
reboot

Install Go

curl -LO https://go.dev/dl/go1.19.4.linux-amd64.tar.gz && \
tar xfz ./go1.19.4.linux-amd64.tar.gz && \
rm ./go1.19.4.linux-amd64.tar.gz && \
sudo rm -rfv /usr/local/go && \
sudo mv go /usr/local
go version

Install Rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Install NodeJS

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
nvm install 19
nvm alias default 19

Install Starship

Starship is a customizable command prompt:

cargo install starship --locked

Configure shell

Remove the original .bashrc:

rm .bashrc

Create one with the following content:

# ls
alias ls="ls -avhl --color=auto --group-directories-first"

# 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)"

Example system service file

sudo vim /etc/systemd/system/osmosisd.service
[Unit]
Description=Osmosis Daemon
After=network.target

[Service]
Type=simple
User=larry
ExecStart=/home/larry/.go/bin/osmosisd start
Restart=on-failure
RestartSec=5s
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment