vi /etc/network/interface
interface (part):
# The primary network interface
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
# host-only
auto eth1
allow-hotplug eth1
iface eth1 inet static
address 192.168.56.102
netmask 255.255.255.0
gateway 192.168.56.255
restart it
/etc/init.d/networking restart
dpkg-reconfigure locales
locale-gen
时区
dpkg-reconfigure tzdata
apt-get update
apt-get upgrade
adduser yewen
vi /etc/inittab
注释掉
#1:2345:respawn:/sbin/getty 38400 tty1
#2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6
vi ~/.ssh/authorized_keys
apt-get install sudo
vi /etc/sudoers
sudoers (part):
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
yewen ALL=(ALL:ALL) ALL
sudo vi /etc/profile
profile (part):
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games"
fi
export PATH
sudo vi ~/.bashrc
.bashrc (part)
# some more ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
# more powerful grep
function search() {
KEY_EXP="${1}"
shift
grep "${KEY_EXP}" --color="auto" --exclude-dir=".git" -Inr "${@:-.}" 2>"/dev/null"
unset KEY_EXP
}
sudo apt-get install vim
sudo vim /etc/vim/vimrc.local
vimrc.local (all):
set nocompatible " 非 vi 兼容模式
syntax on " 色彩高亮
set number " 显示行数
set ruler " 显示当前位置于右下角
set backspace=2 " 设置 backspace 模式为标准
set showmatch " 显示配对括号
set incsearch " 增量查找
set hlsearch
set ai " 智能缩进
set si " 智能缩进
set cindent " 智能缩进
set tabstop=4 " Tab 宽度
set softtabstop=4 " Tab 宽度
set shiftwidth=4 " Tab 宽度
set expandtab " 输入的 tab(\t) 均不保持为 tab 而转换为空格
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,sjis,euc-kr,ucs-2le,latin1 "字符编码
set encoding=utf-8
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%04l,%04v][%p%%]\ [LEN=%L] " 状态栏格式
set laststatus=2 " 一直显示状态栏
colorscheme torte " 256color-xterm 下的配色方案, 同 16 色下的 default
" 插入模式切换
map <F7> :set paste!<BAr>set paste?<CR>
" 多 Tab 时翻页
map <silent> <F6> :tabnext<CR>
imap <silent> <F6> <Esc>:tabnext<CR>gi
安装 markdown 语法高亮 http://www.vim.org/scripts/script.php?script_id=2882
vim markdown-<version>.vba.gz +":source % | quit"
install python-dev
sudo apt-get install python-dev
install
sudo apt-get install python-pip python-virtualenv
use virtualenv
virtualenv ve_ye
source ve_ye/bin/activate
deactivate
use pip
pip freeze > requirements.txt
pip install -r requirements.txt
install:
sudo apt-get install subversion git
set vim as git editor
git config --global core.editor "vim"
git diff use vimdiff:
git config --global diff.tool vimdiff
git config --global difftool.prompt false
git config --global alias.d difftool
store git username/password
vim .git/config
url = https://username:password@gist.github.com/8437975.git
ssh-keygen -t rsa -b 1024
cat ~/.ssh/id_rsa.pub
install
sudo apt-get install nginx php5 php5-fpm php5-curl php5-mysql mysql-server mysql-client
running
sudo nginx
reload config
sudo nginx -s reload
install
sudo apt-get install lrzsz
use
# upload from local to remote server
rz -bey
# download from remote server to local
sz -bey
install
sudo apt-get install sqlite3
use
# open exists db or create a new db
sqlite3 local.db
# quit sqlite command line
sqlite> .q
install
sudo apt-get install screen
config
vim ~/.screenrc
.screenrc
# see the startup message
startup_message off
term linux
# set a biger buffer
defscrollback 4096
# 设置状态栏
hardstatus alwayslastline
shelltitle "$|bash"
# a short version, can use C-a
hardstatus string '%{= kg}[%= %?%{kg}%-Lw%?%{Y}%n*%f %t%?(%u)%?%?%{kg}%+Lw%? %{kg} %=][%{kG} %Y/%m/%d %c %{g}]'
# shutdown the noise
vbell off
# w to show the window list
bind w windowlist -b
bind ^w windowlist -b
# initial apps to run
screen
screen
select 0
# 进行快捷键的绑定
bindkey -k k8 screen
bindkey -k k9 title
bindkey -k k; detach
bindkey -k F1 prev
bindkey -k F2 next
# unkonwn
attrcolor u "-u B"
autodetach on
use
# init a new screen session
screen -S scr_name
# use [^a] [Esc] to the copy mode
# (as vim keys, h/j/k/l move, v select, y copy, q quit)
# use bindkey F8/F9 to new/rename a screen window
# use bindkey F10 to detach screen session
# use bindkey F11/F12 to switch screen windows
# restore an exists screen session
screen -r scr_name
# force detach a screen session and restore it
screen -r -D scr_name
# exit a screen session, repeat this to all screen windows
exit
install
sudo apt-get install tmux
config
vim ~/.tmux.conf
.tmux.conf
set -g default-terminal "screen-256color"
bind-key -n F8 new-window
bind-key -n F9 command-prompt 'rename-window %%'
bind-key -n F10 detach
bind-key -n F11 previous-window
bind-key -n F12 next-window
bind-key b send-prefix
set-window-option -g window-status-current-fg brightyellow
set -g status-right "#h %Y-%m-%d %H:%M"
use
# init a new tmux session
tmux new -s ss_name
# use "^b [" to the copy mode
# use bindkey F8/F9 to new/rename a tmux window
# use bindkey F10 to detach tmux session
# use bindkey F11/F12 to switch tmux windows
# restore an exists tmux session
tmux attach -t ss_name
# exit a tmux session, repeat this to all tmux windows
exit
script_dir="$(readlink -f $(dirname $0))"
sudo find . -mtime +7 -exec rm -f {} \;