您的位置:首页 > 职场人生

Debian 5.0.0 Lenny安装全过程

2010-08-03 20:51 519 查看
从Debian的官方网站下载(网络安装版的ISO镜像):

// http://www.debian.org/
debian-500-i386-netinst.iso

// http://www.debian.org/ debian-500-i386-netinst.iso


设置网络环境

// 设置DNS,直接编辑/etc/resolv.conf 可以同时设置多个DNS

nameserver 202.103.96.68

nameserver 202.103.96.112

// 设置IP,直接编辑/etc/network/interfaces

// 采用固定IP:

auto lo eth0

iface lo inet loopback

iface eth0 inet static

address 192.168.6.243

netmask 255.255.255.0

broadcast 192.168.0.255

gateway 192.168.6.1

// 采用DHCP:

auto eth0

iface eth0 inet dhcp

// 激活和终止网络接口

ifdown eth0

ifup eth0

// 上面的设定只有重启网络后才会生效:

/etc/init.d/networking restart

// 设置DNS,直接编辑/etc/resolv.conf 可以同时设置多个DNS
nameserver 202.103.96.68
nameserver 202.103.96.112

// 设置IP,直接编辑/etc/network/interfaces
// 采用固定IP:
auto lo eth0
iface lo inet loopback

iface eth0 inet static
address 192.168.6.243
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.6.1

// 采用DHCP:
auto eth0
iface eth0 inet dhcp

// 激活和终止网络接口
ifdown eth0
ifup eth0

// 上面的设定只有重启网络后才会生效:
/etc/init.d/networking restart


Debian 更新工具使用说明:

apt-get update // 更新源列表

apt-cache search xxx // 在源中搜索xxx软件

apt-get install xxx // 从源中安装xxx软件

apt-get download xxx // 从源中下载xxx debian deb包

apt-get source xxx // 从源中下载xxx的源码包

apt-get remove xxx // 删除包

dpkg -l // 查看已安装的包

// 清除:当使用 apt-get install 指令安装套件,下载下来的 deb 会放置于

// /var/cache/apt/archives, 使用 apt-get clean 指令可以将之清除,

// 避免占用硬盘空间

apt-get clean

apt-get update // 更新源列表
apt-cache search xxx // 在源中搜索xxx软件
apt-get install xxx // 从源中安装xxx软件
apt-get download xxx // 从源中下载xxx debian deb包
apt-get source xxx // 从源中下载xxx的源码包
apt-get remove xxx // 删除包
dpkg -l // 查看已安装的包

// 清除:当使用 apt-get install 指令安装套件,下载下来的 deb 会放置于
// /var/cache/apt/archives, 使用 apt-get clean 指令可以将之清除,
// 避免占用硬盘空间
apt-get clean


设定更新源

// 在/etc/apt/sources.list中添加更新源:

// 选择一:

deb http://debian.cn99.com/debian/ stable main non-free contrib

deb http://debian.cn99.com/debian-non-US/ stable/non-US main contrib non-free

// 选择二:

deb http://mirrors.163.com/debian etch main

deb http://mirrors.163.com/debian lenny main contrib non-free

// 从源获得最新软件列表:

apt-get update

apt-get install apt-spy // 安装 apt-spy

mv sources.list sources.list.bak // 备份老的源列表文件

man apt-spy // 获取详细的使用方法

// 更新您的镜像列表文件 /var/lib/apt-spy/mirrors.txt

apt-spy update

// 在亚洲寻找速度最快的stable版镜像, 并生成sources.list文件

apt-spy -d stable -a Asia

cp /etc/apt/sources.list.d/apt-spy.list /etc/apt/sources.list

// 更新源:

apt-get update

// 在/etc/apt/sources.list中添加更新源:

// 选择一:
deb http://debian.cn99.com/debian/ stable main non-free contrib
deb http://debian.cn99.com/debian-non-US/ stable/non-US main contrib non-free

// 选择二:
deb http://mirrors.163.com/debian etch main
deb http://mirrors.163.com/debian lenny main contrib non-free

// 从源获得最新软件列表:
apt-get update

apt-get install apt-spy // 安装 apt-spy
mv sources.list sources.list.bak // 备份老的源列表文件
man apt-spy // 获取详细的使用方法

// 更新您的镜像列表文件 /var/lib/apt-spy/mirrors.txt
apt-spy update

// 在亚洲寻找速度最快的stable版镜像, 并生成sources.list文件
apt-spy -d stable -a Asia
cp /etc/apt/sources.list.d/apt-spy.list /etc/apt/sources.list

// 更新源:
apt-get update


安装Telnet,SSH

// 安装telnet:

apt-get install telnetd

/etc/init.d/openbsd-inetd start

// 安装 openssh server:

apt-get install openssh-server

/etc/init.d/ssh restart

// 安装telnet:
apt-get install telnetd
/etc/init.d/openbsd-inetd start

// 安装 openssh server:
apt-get install openssh-server
/etc/init.d/ssh restart


基本参数设定:

# 打开颜色显示:

修改/etc/profile

alias ls='ls --color'

# 打开颜色显示:
修改/etc/profile
alias ls='ls --color'


修改时区:

// 安装ntpdate

apt-get install ntpdate

// 设定主机时区:

编辑/etc/timezone,写入Asia/Shanghai

// 更新时间

ntpdate 210.72.145.44

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

// 安装ntpdate
apt-get install ntpdate

// 设定主机时区:
编辑/etc/timezone,写入Asia/Shanghai

// 更新时间
ntpdate 210.72.145.44

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime


安装vsftpd

apt-get install vsftpd

// 编辑/etc/vsftpd.conf

激活

local_enable=YES

write_enable=YES

// 启动 vsftpd

/etc/init.d/vsftpd restart

apt-get install vsftpd

// 编辑/etc/vsftpd.conf
激活
local_enable=YES
write_enable=YES
// 启动 vsftpd
/etc/init.d/vsftpd restart


安装编辑工具vim:

apt-get install vim-full

// 编辑/etc/vim/vimrc文件

打开syntax on、set nu

apt-get install vim-full

// 编辑/etc/vim/vimrc文件
打开syntax on、set nu


安装编译,工程构建,调试工具

/*

* 说明:

* build-essential: 基本编译环境 (gcc, g++, libc, make等)

* autoconf: 自动配置工具

* automake: make相关

* gdb: 调试工具

*/

apt-get install build-essential

apt-get install autoconf

apt-get install automake

apt-get install gdb

/*
* 说明:
* build-essential: 基本编译环境 (gcc, g++, libc, make等)
* autoconf:        自动配置工具
* automake:        make相关
* gdb:             调试工具
*/
apt-get install build-essential
apt-get install autoconf
apt-get install automake
apt-get install gdb


安装开发文档:

/*

* 说明:

* manpages-dev: C/C++man帮助手册

* Binutils: 链接器(ld)、汇编器(as)、反汇编器(objdump)和档案的工具(ar)

* glibc-doc: GUN C标准库文档

* stl-manual: 标准C++ STL模板文档

*/

apt-get install manpages-dev

apt-get install binutils-doc

apt-get install cpp-doc

apt-get install gcc-doc

apt-get install glibc-doc

apt-get install libstdc++6-4.3-doc

apt-get install stl-manual

/*
*  说明:
*  manpages-dev: C/C++man帮助手册
*  Binutils:   链接器(ld)、汇编器(as)、反汇编器(objdump)和档案的工具(ar)
*  glibc-doc:  GUN C标准库文档
*  stl-manual: 标准C++ STL模板文档
*/
apt-get install manpages-dev
apt-get install binutils-doc
apt-get install cpp-doc
apt-get install gcc-doc
apt-get install glibc-doc
apt-get install libstdc++6-4.3-doc
apt-get install stl-manual


Perl相关:

// 安装perl帮助文档

apt-get install perl-doc

// 安装通用模块

apt-get install libtext-template-perl

// 安装perl帮助文档
apt-get install perl-doc

// 安装通用模块
apt-get install libtext-template-perl


在VMware中增加新硬盘:

关闭VM中正在运行的虚拟系统

在虚拟机系统名称上点击右键-> Vitual Machine Settings

在虚拟机edit页新增一个磁盘。

可以看见Hardware中出现了一块新的硬盘HardDisk2.

启动虚拟机,进入/dev目录下ls,查看刚加的硬盘名称。如: /dev/sdb

对/dev/sdb进行分区:fdisk /dev/sdb

Command (m for help): m Help info

Command (m for help): n Add a new partition

Command (m for help): w Write table to disk and exit

格式化硬盘为ext3分区格式:mke2fs -j /dev/sdb1

检查新分区是否存在:fdisk -l

修改/etc/fstab,使得刚新建的分区可以开机自动挂载。

# <file system> <mount point> <type> <options> <dump> <pass>

/dev/sdb1 /oracle ext3 errors=remount-ro 0 1

重新启动,查看结果:df -h

关闭VM中正在运行的虚拟系统
在虚拟机系统名称上点击右键-> Vitual Machine Settings
在虚拟机edit页新增一个磁盘。
可以看见Hardware中出现了一块新的硬盘HardDisk2.
启动虚拟机,进入/dev目录下ls,查看刚加的硬盘名称。如: /dev/sdb
对/dev/sdb进行分区:fdisk /dev/sdb
Command (m for help): m Help info
Command  (m for help): n Add a new partition
Command  (m for help): w Write table to disk and exit
格式化硬盘为ext3分区格式:mke2fs -j /dev/sdb1
检查新分区是否存在:fdisk -l
修改/etc/fstab,使得刚新建的分区可以开机自动挂载。
# <file system>    <mount point>    <type>    <options>	    <dump>    <pass>
/dev/sdb1    /oracle    ext3    errors=remount-ro    0    1
重新启动,查看结果:df -h


/**

* 尝试Linux上各种文件系统。

* 首先安装必须的软件

*/

apt-get install reiserfsprogs // for reiserfs

apt-get install jfsutils // for jfs

apt-get install xfsdump // for xfs

// 格式化/dev/md0为reiserfs

/**
* 尝试Linux上各种文件系统。
* 首先安装必须的软件
*/
apt-get install reiserfsprogs // for reiserfs
apt-get install jfsutils      // for jfs
apt-get install xfsdump       // for xfs

// 格式化/dev/md0为reiserfs


oracle:/oradata# mkfs.reiserfs /dev/md0

mkfs.reiserfs 3.6.19 (2003 www.namesys.com)

A pair of credits:

Chris Mason wrote the journaling code for V3, which was enormously more useful

to users than just waiting until we could create a wandering log filesystem as

Hans would have unwisely done without him.

Jeff Mahoney optimized the bitmap scanning code for V3, and performed the big

endian cleanups.

Nikita Danilov wrote most of the core balancing code, plugin infrastructure,

and directory code. He steadily worked long hours, and is the reason so much of

the Reiser4 plugin infrastructure is well abstracted in its details. The carry

function, and the use of non-recursive balancing, are his idea.

Guessing about desired format.. Kernel 2.6.26-2-686 is running.

Format 3.6 with standard journal

Count of blocks on the device: 6291408

Number of blocks consumed by mkreiserfs formatting process: 8403

Blocksize: 4096

Hash function used to sort names: "r5"

Journal Size 8193 blocks (first block 18)

Journal Max transaction length 1024

inode generation number: 0

UUID: c20b05fb-bf1d-44f0-bd79-688fe0497991

ATTENTION: YOU SHOULD REBOOT AFTER FDISK!

ALL DATA WILL BE LOST ON '/dev/md0'!

Continue (y/n):y

Initializing journal - 0%....20%....40%....60%....80%....100%

Syncing..ok

Tell your friends to use a kernel based on 2.4.18 or later, and especially not a

kernel based on 2.4.9, when you use reiserFS. Have fun.

ReiserFS is successfully created on /dev/md0.

oracle:/oradata# mkfs.reiserfs /dev/md0
mkfs.reiserfs 3.6.19 (2003 www.namesys.com)

A pair of credits:
Chris Mason wrote the journaling code for V3,  which was enormously more useful
to users than just waiting until  we could create a wandering log filesystem as
Hans would have unwisely done without him.
Jeff Mahoney optimized the bitmap  scanning code for V3,  and performed the big
endian cleanups.

Nikita Danilov  wrote  most of the core  balancing code, plugin infrastructure,
and directory code. He steadily worked long hours, and is the reason so much of
the Reiser4 plugin infrastructure is well abstracted in its details.  The carry
function, and the use of non-recursive balancing, are his idea.

Guessing about desired format.. Kernel 2.6.26-2-686 is running.
Format 3.6 with standard journal
Count of blocks on the device: 6291408
Number of blocks consumed by mkreiserfs formatting process: 8403
Blocksize: 4096
Hash function used to sort names: "r5"
Journal Size 8193 blocks (first block 18)
Journal Max transaction length 1024
inode generation number: 0
UUID: c20b05fb-bf1d-44f0-bd79-688fe0497991
ATTENTION: YOU SHOULD REBOOT AFTER FDISK!
ALL DATA WILL BE LOST ON '/dev/md0'!
Continue (y/n):y
Initializing journal - 0%....20%....40%....60%....80%....100%
Syncing..ok

Tell your friends to use a kernel based on 2.4.18 or later, and especially not a
kernel based on 2.4.9, when you use reiserFS. Have fun.

ReiserFS is successfully created on /dev/md0.


// 挂载到/raid目录,并检查文件格式。

oracle:/oradata# mount /dev/md0 /raid

oracle:/oradata# df -T

Filesystem Type 1K-blocks Used Available Use% Mounted on

/dev/mapper/oracle-root

ext3 329233 139022 173213 45% /

tmpfs tmpfs 258148 0 258148 0% /lib/init/rw

udev tmpfs 10240 680 9560 7% /dev

tmpfs tmpfs 258148 0 258148 0% /dev/shm

/dev/sda1 ext2 233335 26271 194616 12% /boot

/dev/mapper/oracle-home

ext3 2789856 69796 2578340 3% /home

/dev/mapper/oracle-tmp

ext3 238003 6177 219538 3% /tmp

/dev/mapper/oracle-usr

ext3 2822096 687956 1990780 26% /usr

/dev/mapper/oracle-var

ext3 1350552 126452 1155492 10% /var

/dev/mapper/optvg-optlv

ext3 8252856 2579504 5254128 33% /opt

/dev/mapper/oradatavg-oradatalv

ext3 8252856 252112 7581520 4% /oradata

/dev/md0 reiserfs 25164860 32840 25132020 1% /raid

// 挂载到/raid目录,并检查文件格式。
oracle:/oradata# mount /dev/md0 /raid
oracle:/oradata# df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/mapper/oracle-root
ext3      329233    139022    173213  45% /
tmpfs        tmpfs      258148         0    258148   0% /lib/init/rw
udev         tmpfs       10240       680      9560   7% /dev
tmpfs        tmpfs      258148         0    258148   0% /dev/shm
/dev/sda1     ext2      233335     26271    194616  12% /boot
/dev/mapper/oracle-home
ext3     2789856     69796   2578340   3% /home
/dev/mapper/oracle-tmp
ext3      238003      6177    219538   3% /tmp
/dev/mapper/oracle-usr
ext3     2822096    687956   1990780  26% /usr
/dev/mapper/oracle-var
ext3     1350552    126452   1155492  10% /var
/dev/mapper/optvg-optlv
ext3     8252856   2579504   5254128  33% /opt
/dev/mapper/oradatavg-oradatalv
ext3     8252856    252112   7581520   4% /oradata
/dev/md0  reiserfs    25164860     32840  25132020   1% /raid


// 将/dev/md0更换为JFS格式

oracle:/oradata# umount /raid/

oracle:/oradata# mkfs.jfs /dev/md0

mkfs.jfs version 1.1.12, 24-Aug-2007

Warning! All data on device /dev/md0 will be lost!

Continue? (Y/N) Y

\

Format completed successfully.

25165632 kilobytes total disk space.

oracle:/oradata# mount /dev/md0 /raid/

oracle:/oradata# df -T

Filesystem Type 1K-blocks Used Available Use% Mounted on

/dev/mapper/oracle-root

ext3 329233 139022 173213 45% /

tmpfs tmpfs 258148 0 258148 0% /lib/init/rw

udev tmpfs 10240 680 9560 7% /dev

tmpfs tmpfs 258148 0 258148 0% /dev/shm

/dev/sda1 ext2 233335 26271 194616 12% /boot

/dev/mapper/oracle-home

ext3 2789856 69796 2578340 3% /home

/dev/mapper/oracle-tmp

ext3 238003 6177 219538 3% /tmp

/dev/mapper/oracle-usr

ext3 2822096 687956 1990780 26% /usr

/dev/mapper/oracle-var

ext3 1350552 126452 1155492 10% /var

/dev/mapper/optvg-optlv

ext3 8252856 2579504 5254128 33% /opt

/dev/mapper/oradatavg-oradatalv

ext3 8252856 252112 7581520 4% /oradata

/dev/md0 jfs 25131892 3200 25128692 1% /raid

// 将/dev/md0更换为JFS格式
oracle:/oradata# umount /raid/
oracle:/oradata# mkfs.jfs /dev/md0
mkfs.jfs version 1.1.12, 24-Aug-2007
Warning!  All data on device /dev/md0 will be lost!

Continue? (Y/N) Y
\

Format completed successfully.

25165632 kilobytes total disk space.
oracle:/oradata# mount /dev/md0 /raid/
oracle:/oradata# df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/mapper/oracle-root
ext3      329233    139022    173213  45% /
tmpfs        tmpfs      258148         0    258148   0% /lib/init/rw
udev         tmpfs       10240       680      9560   7% /dev
tmpfs        tmpfs      258148         0    258148   0% /dev/shm
/dev/sda1     ext2      233335     26271    194616  12% /boot
/dev/mapper/oracle-home
ext3     2789856     69796   2578340   3% /home
/dev/mapper/oracle-tmp
ext3      238003      6177    219538   3% /tmp
/dev/mapper/oracle-usr
ext3     2822096    687956   1990780  26% /usr
/dev/mapper/oracle-var
ext3     1350552    126452   1155492  10% /var
/dev/mapper/optvg-optlv
ext3     8252856   2579504   5254128  33% /opt
/dev/mapper/oradatavg-oradatalv
ext3     8252856    252112   7581520   4% /oradata
/dev/md0       jfs    25131892      3200  25128692   1% /raid


将/dev/md0更换为xfs格式

oracle:~# umount /dev/md0

oracle:~# mkfs.xfs /dev/md0

mkfs.xfs: /dev/md0 appears to contain an existing filesystem (jfs).

mkfs.xfs: Use the -f option to force overwrite.

oracle:~# mkfs.xfs -f /dev/md0

meta-data=/dev/md0 isize=256 agcount=16, agsize=393200 blks

= sectsz=4096 attr=2

data = bsize=4096 blocks=6291200, imaxpct=25

= sunit=16 swidth=48 blks

naming =version 2 bsize=4096

log =internal log bsize=4096 blocks=3071, version=2

= sectsz=4096 sunit=1 blks, lazy-count=0

realtime =none extsz=196608 blocks=0, rtextents=0

oracle:~# mount /dev/md0 /raid/

oracle:~# df -T

Filesystem Type 1K-blocks Used Available Use% Mounted on

/dev/mapper/oracle-root

ext3 329233 139022 173213 45% /

tmpfs tmpfs 258148 0 258148 0% /lib/init/rw

udev tmpfs 10240 680 9560 7% /dev

tmpfs tmpfs 258148 0 258148 0% /dev/shm

/dev/sda1 ext2 233335 26271 194616 12% /boot

/dev/mapper/oracle-home

ext3 2789856 69796 2578340 3% /home

/dev/mapper/oracle-tmp

ext3 238003 6177 219538 3% /tmp

/dev/mapper/oracle-usr

ext3 2822096 687956 1990780 26% /usr

/dev/mapper/oracle-var

ext3 1350552 126460 1155484 10% /var

/dev/mapper/optvg-optlv

ext3 8252856 2579504 5254128 33% /opt

/dev/mapper/oradatavg-oradatalv

ext3 8252856 252112 7581520 4% /oradata

/dev/md0 xfs 25152516 4832 25147684 1% /raid
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  职场 Debian 休闲