---
title: "记录一下 debian 初始安装过程和备份一部分配置"
author: "xiao"
date: "2013-02-16T10:36:57Z"
tags: []
categories: ["操作系统"]
slug: "debian"
draft: false
lastmod: "2013-02-16T10:40:31Z"
id: 1798260
url: "https://xiao.iteye.com/blog/1798260"
---

## 修改源并更新

```
# 下载163整理的源文件`sources.list`
wget http://mirrors.163.com/.help/sources.list.squeeze
mv ./sources.list.squeeze /etc/apt/sources.list

apt-get update
apt-get upgrade
```

 

## 安装\`vim\`, \`ctags\`, \`postgresql\`, \`lnmp\`, \`setuptools\`, \`sqlite3\`, \`ruby\`, \`rubygems\`, \`mysql-python\`, \`ruby-mysql\`, \`git\`

```
apt-get install vim ctags sqlite3 libsqlite3-dev postgresql python-dev ruby rubygems git

# 要在安装 lnmp 之前安装 libmysqld-dev，否则安装 libmysqld-dev 就会破坏 lnmp 所安装的 mysql
apt-get install libmysqld-dev

mkdir down
cd down
wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
easy_install mysql-python

wget http://soft.vpser.net/lnmp/lnmp0.9-full.tar.gz
tar zxvf lnmp0.9-full.tar.gz
cd lnmp0.9-full

# 修改 debian.sh 让安装后的 php-fpm 支持 postgresql，添加 `--with-pgsql=/var/lib/postgresql/8.4/main` 到374行的行尾
vi debian.sh

# 替换 vhost.sh 中所有的 wwwroot 为 www。让新建的站点默认的根目录在 /home/www 下
vi vhost.sh

./debian.sh

./eaccelerator.sh
./ionCube.sh
./imageMagick.sh
./memcached.sh
```

 

## 安装 \`python\` 相关的库

```
easy_install 'lxml==2.3.6'
easy_install django PyQuery pattern path.py
```

 

## 配置 \`.bashrc\`, \`ssh\`, \`vim\`, \`git\`

### 配置 \`.bashrc\`，修改成

```
# ~/.bashrc: executed by bash(1) for non-login shells.

# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
# export LS_OPTIONS='--color=auto'
# eval "`dircolors`"
alias ls='ls -h --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

alias la='ls -AF'
alias ll='ls -lF'
alias l='ls -CF'

# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# grep 过滤svn
export GREP_OPTIONS="--exclude-dir=\.svn"
```

 

### 配置 \`ssh\`

请看另一篇博文《[禁止 root 直接登录 sshd](/blog/1026087)》

 

### 配置 \`vim\`

clone github 已经配置好的。 已配置的相关插件：

- blog
- calendar
- neocomplcache
- NERD\_commenter
- NERD\_tree
- taglist
- txtbrowser
- vimwiki
- voom
- zencoding

 

下载配置

```
cd
git clone https://github.com/fxiao/vimrc-linux_osx.git .vim

ln -s .vim/vimrc ./.vimrc
```

 

### 配置 \`git\`

配置 git 的基本信息和命令缩写

```
vi .gitconfig
```

 写入

```
[user]
    name = fxiao
    email = heyun51@gmail.com
[core]
    excludesfile = /root/.gitignore_global
[alias]
    co = checkout
    ci = commit
    st = status
    ca = commit -a
    b = branch
```

 配置 git 忽略文件规则

```
vi .gitignore_global
```

 写入

```
#compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sqlite

# OS generated files #
######################
.DS_Store*
ehthumbs.db
._*
.Spotlight-V100
.Trashes
Icon?
Thumbs.db
.svn
*.bak
ehthumbs.db
```