Notice
Recent Posts
Recent Comments
«   2024/12   »
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
Tags
more
Archives
Today
Total
관리 메뉴

topcue

Ubuntu Linux 초기 환경 구축 본문

기타

Ubuntu Linux 초기 환경 구축

topcue 2021. 2. 21. 22:24

host pc : OS X 10.15 VMware Fusion

Ubuntu Linux 18.04 Server (+ 20.04 일부 추가)


0. 기본 패키지 설치

기본적인 패키지 설치

sudo apt-get update
sudo apt-get install -y vim git curl gdb openssh-server gcc-multilib

1. 패키지 관리 서버 변경

sudo vi /etc/apt/sources.list

아래 명령어로 일괄 변경 후 저장

:%s/kr.archive.ubuntu.com/mirror.kakao.com
:wq!

패키지 업데이트

sudo apt-get update

2. vim 설정

# for Vundle
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

vi ~/.vimrc

vimrc 파일 수정

" Vundle
set nocompatible           " be iMproved, required
filetype off               " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" Vundle Pugin here
Plugin 'VundleVim/Vundle.vim'

call vundle#end()


set hlsearch               " highlight search
set nu                     " line number
set scrolloff=3            " keep scroll offset
set ts=4                   " tag select
set sts=4                  " st select
set sw=1                   " scroll bar width
set autowrite              " auto write
set autoread               " auto read
set bs=eol,start,indent    " backspace
set history=256            " history
set laststatus=2           " display status bar
set showmatch              " highlight pair of brackets


"set paste                 " smart paste
"set smartcase             " case sensitive when searching

set smarttab
set softtabstop=4
set tabstop=4
set bg=dark
set ruler                  " show current cursor
set incsearch
set title
set statusline=\ %<%l:%v\ [%P]%=%a\ %h%m%r\ %F\
set term=screen-256color
set cursorline             " highlight cursor line (row)
"set cursorcolumn          " highlight cursor line (column)

" auto cmd: Bufenter
au Bufenter *.\(c\|cpp\|h\|py\|java\) set et


set shiftwidth=4           " indent width
set autoindent             " indent w/ new line
set cindent                " tatiion in c
set smartindent            " recognize some symbols
filetype indent plugin on  " indent per filetype

" cursor tracing where I modified it last
au BufReadPost *
\ if line("‘\"") > 0 && line("‘\"") <= line("$") |
\ exe "norm g`\"" |
\ endif

" syntax highlight
if has("syntax")
	syntax on
endif

" color scheme
colorscheme peachpuff
let g:airline_powerline_fonts = 1
nmap <F8> :NERDTreeToggle<CR>
set term=xterm-256color


" EOF

3. oh-my-zsh

# install zsh
sudo apt-get install -y zsh

# chsh
chsh -s `which zsh`

# oh-my-zsh
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh

# restart tetminal session
exec zsh -l

# zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

# zsh-autosuggestions
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

vi ~/.zshrc

zshrc 파일 수정

export ZSH="/home/topcue/.oh-my-zsh"
ZSH_THEME="funky"

alias py2="python2"
alias py3="python3"
alias py="python"

alias cl="clear"
plugins=(
	git
	zsh-syntax-highlighting
	zsh-autosuggestions
)
source $ZSH/oh-my-zsh.sh

# EOF

zshrc 작용

source ~/.zshrc

4. python2 + python3

  • for Ubuntu <= 18.04
sudo apt-get install -y python3-pip

sudo apt update
sudo apt upgrade
sudo apt install -y python2.7
sudo apt install -y python-pip
  • for Ubuntu == 20.04
sudo apt-get install python3-pip
sudo apt update
sudo apt upgrade

# python2
sudo add-apt-repository universe
sudo apt update
sudo apt install -y python2

curl https://bootstrap.pypa.io/2.7/get-pip.py --output get-pip.py
sudo python2 get-pip.py

5. peda

git clone https://github.com/longld/peda.git ~/.peda
echo "source ~/.peda/peda.py" >> ~/.gdbinit

6. pwntools

  • for python2
sudo apt-get install -y python2.7-dev python-pip
sudo apt-get install -y python-setuptools
sudo apt-get install -y libcapstone-dev

pip install pwntools
  • for python3
sudo apt-get update
sudo apt-get install -y python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade pwntools

7. checksec

git clone https://github.com/slimm609/checksec.sh
sudo cp checksec.sh/checksec /usr/local/bin/

8. libc-database

git clone https://github.com/niklasb/libc-database
Comments