当前位置: > Linux发行版 > Debian >

记录一下 debian7.6 初始安装过程和备份一部分配置

时间:2015-10-08 14:28来源:linux.it.net.cn 作者:IT
  • 安装vim, ctags, postgresql, lnmp, setuptools, sqlite3, ruby, rubygems, mysql-python, ruby-mysql, git
  • 安装 python 相关的库
  • 配置 .bashrc, ssh, vim, git,
  • 配置 .bashrc,修改成
  • 配置 ssh
  • 配置 vim
  • 配置 git
  • 配置 IP 和 DNS

安装vimctagspostgresqllnmpsetuptoolssqlite3rubyrubygemsmysql-python,ruby-mysqlgit

<!-- lang: shell -->
apt-get update
apt-get upgrade
apt-get install vim ctags sqlite3 libsqlite3-dev git python-dev libxslt1-dev
apt-get install postgresql ruby ruby-dev rubygems

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

wget http://soft.vpser.net/lnmp/lnmp1.1-full.tar.gz
tar zxvf lnmp1.1-full.tar.gz
cd lnmp1.1-full

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

./debian.sh

./eaccelerator.sh
./ionCube.sh
./imageMagick.sh

# 解决 mysql_config not found  问题
ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config

# 解决 memcached 找不到目录的问题
mkdir -p /var/lock/subsys
./memcached.sh

安装 python 相关的库

<!-- lang: shell -->
easy_install pip
pip install virtualenv virtualenvwrapper vim_debug

配置 .bashrcsshvimgit,

配置 .bashrc,修改成

<!-- lang: shell -->
# ~/.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"

export VIRTUALENV_USE_DISTRIBUTE=1
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_RESPECT_VIRTUALENV=true

配置 ssh

请看另一篇博文《禁止 root 直接登录 sshd》

配置 vim

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

  • YouCompleteMe
  • NERD_commenter
  • NERD_tree
  • TagBar
  • txtbrowser
  • solarized - 主题
  • markdown
  • emmet
  • vim-powerline

下载配置

<!-- lang: shell -->
cd
git clone https://github.com/fxiao/vimrc-linux_osx.git .vim
mkdir ~/.vim/bundle
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
ln -s .vim/vimrc ./.vimrc

vim +PluginInstall +qall
cd ~/.vim/bundle/YouCompleteMe
git submodule update --init --recursive
./install.sh

配置 git

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

<!-- lang: shell -->
vi .gitconfig

写入

<!-- lang: shell-->
[user]
    name = fxiao
    email = heyun51@gmail.com
[core]
    excludesfile = /root/.gitignore_global
    editor = vim
[alias]
    co = checkout
    ci = commit
    st = status
    ca = commit -a
    b = branch
    lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset - %C(yellow)%cn%Creset' --abbrev-commit --date=relative
[diff]
    tool = vimdiff
[difftool]
    prompt = No
[merge]
    tool = vimdiff

配置 git 忽略文件规则

<!-- lang: shell -->
vi .gitignore_global

写入

<!-- lang: shell -->
#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
Runtime
*.swp
tags

配置 IP 和 DNS

IP,把 /etc/network/interfaces 修改成

<!-- lang: shell -->
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static

address 192.168.1.23
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.1.1

DNS,把 /etc/resolv.conf 修改成

<!-- lang: shell -->
nameserver 192.168.1.1

之后运行 reboot 重启电脑


(责任编辑:IT)
------分隔线----------------------------