Skip to content

Instantly share code, notes, and snippets.

@ngtkana
Last active September 7, 2023 12:02
Show Gist options
  • Save ngtkana/7c4837ee2d75bd0cb31e989c7cce0bcd to your computer and use it in GitHub Desktop.
Save ngtkana/7c4837ee2d75bd0cb31e989c7cce0bcd to your computer and use it in GitHub Desktop.
Linux セットアップ手順

Install apt packages

sudo apt update && sudo apt upgrade
sudo apt install -y \
    build-essential \
    libncurses-dev \
    libffi-dev \
    linux-tools-common \
    x11-xserver-utils \
    g++-10 \
    cmake \
    nodejs \
    npm \
    zip \
    unzip \
    direnv \
    x11-apps \
    tree

WSL

sudo apt install \
    wslu \
    gedit

Pyenv

See: https://github.com/pyenv/pyenv/wiki#suggested-build-environment

sudo apt update; sudo apt install build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

Git

Install GitHub CLI

See: https://github.com/cli/cli/blob/trunk/docs/install_linux.md

true \
&& type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y) \
&& curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
gh auth login

Config user

git config --global user.email "ngtkana@gmail.com"
git config --global user.name "Nagata Kana"
git config --global core.editor vim

Docker

See: https://docs.docker.com/engine/install/ubuntu/

sudo apt-get update && \
sudo apt-get install ca-certificates curl gnupg && \
sudo install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \
sudo chmod a+r /etc/apt/keyrings/docker.gpg && \
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null && \
sudo apt-get update && \
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

ble.sh

true \
&& curl -L https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz | tar xJf - \
&& mkdir -p ~/.local/share/blesh \
&& cp -Rf ble-nightly/* ~/.local/share/blesh/ \
&& rm -rf ble-nightly

Make symlinks

true \
&& mkdir repos \
&& cd repos \
&& gh repo clone ngtkana/dotfiles \
&& cd ..
true \
&& mkdir .cargo .vim \
&& ln -s repos/dotfiles/.bashrc \
&& ln -s repos/dotfiles/.bash_profile \
&& ln -s repos/dotfiles/.fonts \
&& ln -s repos/dotfiles/.inputrc \
&& ln -s repos/dotfiles/.vimrc \
&& ln -s repos/dotfiles/.config/starship.toml \
&& cd .config \
&& ln -s ../repos/dotfiles/.config/starship.toml \
&& ln -s ../repos/dotfiles/.config/key_bindings.ron \
&& cd .. \
&& cd .cargo \
&& ln -s ../repos/dotfiles/.cargo/config.toml \
&& cd .. \
&& cd .vim \
&& ln -s ../repos/dotfiles/.vim/coc-settings.json \
&& cd ..

Rust

Install Rust

See: https://www.rust-lang.org/tools/install

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
rustup install nightly

Troubleshooting

Install Cargo packages

cargo install --locked \
    cargo-make \
    starship \
    gitui \
    ripgrep \
    fd-find

Python

Install rye

curl -sSf https://rye-up.com/get | bash
source "$HOME/.rye/env"

Install pyenv

curl https://pyenv.run | bash

Append this to .bash_profile

Install python

pyenv install 3.11; pyenv global 3.11

Install poetry

pip install poetry

Node.js, yarn, deno

Refresh nodejs, npm, n

sudo npm -g install n \
&& sudo n latest \
&& exec -l $SHELL \
&& sudo apt -y autoremove \
&& sudo apt -y clean all
sudo npm install -g yarn

See: https://deno.com/manual@v1.34.3/getting_started/installation

curl -fsSL https://deno.land/x/install/install.sh | sh

Setup Vim

Update to Vim 9.0

true \
&& gh repo clone vim/vim \
&& cd vim/src \
&& make \
&& sudo make install \
&& cd .. \
&& rm -rf vim \
&& cd \
&& exec -l $SHELL \
&& source .bashrc

Install vim-plug

See: https://github.com/junegunn/vim-plug

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

In Vim,

:PlugInstall

See: https://qiita.com/Taichi-yzrh/items/5868e618c82e328c89f6

cd ~/.cache/debin/repos/github.com/neoclide/coc.nvim
yarn install
cd

必要になったらやるやつ

protoc

true \
&& PROTOC_VERSION=$(curl -s "https://api.github.com/repos/protocolbuffers/protobuf/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+') \
&& curl -Lo protoc.zip "https://github.com/protocolbuffers/protobuf/releases/latest/download/protoc-${PROTOC_VERSION}-linux-x86_64.zip" \
&& sudo unzip -q protoc.zip bin/protoc 'include/*' -d /usr/local \
&& sudo chmod a+x /usr/local/bin/protoc
&& rm -rf protoc.zip

Clang 16

??

true \
&& curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/llvm.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/llvm.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" | sudo tee /etc/apt/sources.list.d/llvm.list > /dev/null \
&& sudo apt update

ImageMagick

sudo apt install imagemagick
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment