1. Installation
- # 镜像选择
- # choose
- # debian-8.5.0-amd64-CD-1.iso (含桌面等常用包)
- OR
- # debian-8.5.0-amd64-netinst.iso (network install,base)
-
- # 安装过程使用english,source 一定要选 Primary Debian mirror sites, e.g. ftp.cn.debian.org
-
#Choose software to install (我只勾选了如下两项)
-
-
Debian desktop environment (Gnome by default)
- Standard system utilities
2. Update the packages list && Upgrade the packages
-
- #配置 /etc/apt/sources.list
-
#
# deb cdrom:[Debian GNU/Linux 8.5.0 _Jessie_ - Official amd64 CD Binary-1 20160604-15:35]/ jessie main
# deb cdrom:[Debian GNU/Linux 8.5.0 _Jessie_ - Official amd64 CD Binary-1 20160604-15:35]/ jessie main
# main
deb jessie main contrib non-free
deb-src jessie main contrib non-free
# security
deb http://security.debian.org/ jessie/updates main contrib
deb-src http://security.debian.org/ jessie/updates main contrib
# jessie-updates, previously known as 'volatile'
deb jessie-updates main contrib non-free
deb-src jessie-updates main contrib non-free
-
- #更新软件列表、升级软件包
- $ apt-get update;apt-get upgrade
- OR
-
$ aptitude update; aptitude safe-upgrade
3. Quick-start
-
配置网络 /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
#To use DHCP
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
iface eth0 inet6 dhcp
# To use STATIC IP ADDRESS
auto eth0
iface eth0 inet static
address 172.16.7.11
netmask 255.255.255.0
network 172.16.7.0 #network, broadcast and gateway are optional
broadcast 172.16.7.255
gateway 172.16.7.7
dns-nameservers 223.5.5.5 223.6.6.6 #Place the line indented within an iface stanza, right after the gateway line.
dns-domain debian.org
配置 DNS /etc/resolv.conf
search debian.org
nameserver 10.1.1.36
nameserver 192.168.9.100
:wq
$ cat /etc/hostname (查看主机名)
debian8
-
- $ su -
-
# apt-get install sudo (安装sudo)
-
# adduser ko sudo; grep ko /etc/group
- # reboot (OR logout)
-
-
$ sudo apt-get install locales
-
$ sudo dpkg-reconfigure locales (使用中文的后果是,man 都会显示中文,内容特别老)
-
区域语言选择:zh_CN.UTF-8
-
默认语言选择:en_US.UTF-8
-
-
$ sudo apt-get install vim (安装vim)
- 配置 ~/.vimrc
-
set nocp
"filetype off
filetype plugin indent on
syntax on
set history=28
set hls is
set ic
set autoindent
"set cindent
set nobackup
set noswapfile
set backspace=2
set shiftwidth=1
set tabstop=1
set softtabstop=1
set expandtab
set ruler
set mouse=v
set showmatch
set cursorline
set fileencodings=utf-8
set number
"set showcmd
"set autoread
set foldmethod=syntax
"set bg=dark
"set laststatus=2
-
-
$ sudo apt-get install openssh-server (安装ssh server)
- $ scp -r ./debian-conf ko@172.16.7.X:~ko/ (拷贝之前的配置文件到remote server)
-
(# debian-conf包含我之前的配置文件:.bashrc .vimrc .zshrc interfaces resolv.conf sources.list)
-
-
$ sudo apt-get install tmux (安装tmux)
-
- # Automatically Starting tmux on SSH
-
#
ssh user@hostname -t tmux # create a new session, default name is 0
ssh user@hostname -t tmux attach # it will prefer the most recently used unattached session.
ssh user@hostname -t tmux attach -t target-session-name
ssh user@hostname -t tmux attach -t 0 #Attach to target session 0
ssh user@hostname -t -- /bin/sh -c 'tmux has-session && exec tmux attach-session || exec tmux' -
explanation below:
#-- tells SSH that what follows is a command. Without this, you'll get a cryptic ssh_exchange_identification: Connection closed by remote host error.
#/bin/sh -c allows us to use && and || in our command.
#exec replaces the /bin/sh process with tmux so that we don't have an extra process hanging around. If you don't care about this, a simple 'tmux attach || tmux' will do.
# 我自己用下面的方法
ssh user@hostname -t "tmux attach-session -t ko || tmux new-session -s ko"
#The tmux commands will connect to session ko if it already exists, or create a new session.
-
-
$ sudo apt-get install git (安装git,提示:git-core 已经obsolete)
-
$ sudo apt-get install curl (安装curl)
-
$ sudo apt-get install zsh (安装zsh)
-
$ chsh -s $(which zsh); grep ko /etc/passwd
-
$ sudo reboot
-
- Oh My Zsh Installation
-
Reference
- 配置 ~/.zshrc
-
alias wgetxx='wget -r -np -p -k -l 2'
alias curlxx='curl -fsSL'
alias ll='ls -l'
alias la='ls -a'
alias vi='vim'
alias grep='grep --color=auto'
alias -s html=vi
alias -s rb=vi
alias -s py=vi
alias -s js=vi
alias -s c=vi
alias -s java=vi
alias -s txt=vi
alias -s gz='tar -zxvf'
alias -s tgz='tar -zxvf'
alias -s bz2='tar -jxvf'
alias -s zip='unzip -d ./output/'
alias cl='clear'
alias clhistory='cat /dev/null > ~/.zsh_history'
alias youtube='youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best''
#alias youtube='youtube-dl --no-mtime -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best''
4. vsftpd setup
安装配置vsftpd服务:
-
$ sudo apt-get install vsftpd (安装ftp服务)
-
$ sudo grep ftp /etc/{passwd,group} (查找ftp账号家目录)
-
/etc/passwd:ftp:x:112:119:ftp daemon,,,:/srv/ftp:/bin/false
-
/etc/group:ftp:x:119:
-
-
$ cd /srv/ftp; mkdir pub (创建pub文件夹)
-
$ chown -R root:ftp /srv/ftp (修改ftp家目录访问权限)
-
$ vim /etc/vsftpd.conf (修改ftp服务配置文件)
-
- $ echo "welcome to yes4ko.com">/srv/ftp/pub/welcome.txt
5. Services Management
There are three simple utilities to manage your startup or init scripts:
开机运行服务管理:
-
$ /etc/init.d/vsftpd status (查看ftp服务状态)
-
$ invoke-rc.d vsftpd status (相当于Redhat系列 service vsftpd status)
-
- $ aptitude install rcconf (相当于Redhat系列 setup)
-
-
$ aptitude install sysv-rc-conf
- $ sysv-rc-conf --level 2345 vsftpd on (相当于Redhat系列 chkconfig --level 2345 vsftpd on)
-
- $ update-rc.d vsftpd enable 2 3 4 5 (系统默认已安装)
6. Reserved for future use...
7. Reserved for future use...
8. Reserved for future use...
9. Reserved for future use...
10. Reserved for future use...
Reference: