免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 860 | 回复: 0
打印 上一主题 下一主题

Debian 手册(一些乱七八糟的 东西) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-08-23 13:11 |只看该作者 |倒序浏览

                                                                        I.                  IP设置默认安装Debian的时候是用dhcp服务的,有时需要设置一下静态IP。
一共涉及两个文件的修改 /etc/network/interfaces
①       DHCP自动分配iface eth0 inet dhcp
②       手动设置静态IPiface eth0 inet static //
address 192.168.1.121
netmask 255.255.255.0
gateway 192.168.1.254
③       设置DNS服务器/etc/resolv.conf里面设置DNS服务器,在公司应该就是gateway的地址
nameserver 192.168.2.2
④       设置route以root执行下面命令
$route add default gw 192.168.1.254

最后重新启动计算机或者重起网络服务#/etc/init.d/networking restart

II.                设置keymap以root执行下面命令
$depk-reconfigure console-data
会出现如下界面

选择[ Select keymap from full list ]
进入keymap 列表
选择[ pc / qwerty / US American / Standard / Standard ]
[ OK ] 退出



III.               重新编译内核
下载  apt-get install kernel-source-2.4.27-2-386
如果编译内核还需要apt-get install kernel-package ncurses-dev fakeroot bzip2
然后cp /boot/config-2.4.17-2-386 /usr/src/kernel-source-2.4.17-2-386/.config
现在可以修改hub.c文件了。
修改后make menuconfig
退出 save  一下
$ make-kpkg clean                          # 必须执行这步(per: man make-kpkg)
$ fakeroot make-kpkg --append_to_version -386 --initrd --revision=rev.01 kernel_image  modules_image                             # modules_image可以是pcmcia-cs*等。
$ cd ..
$ dpkg -i kernel-image*.deb pcmcia-cs*.deb               # 安装


IV.             升级内核首先找到安装源:
安装源分3种:stable(稳定的版本,已经测试)\testing(不稳定,正在测试)\unstable(极不稳定)
修改/etc/apt/sources.list文件,就可以得到新的安装源!
我的sources.list 如下:
# sources.list generated by apt-spy v3.1
deb http://debian.shimpinomori.net/debian/ testing main
deb-src http://debian.shimpinomori.net/debian/ testing main
#deb http://security.debian.org/ stable/updates main

更新升级数据库:apt-get update

查找要安装的软件:apt-cache search 软件包名
apt-cache search linux-image-2.6.17-2-686

安装软件包:apt-get install 软件包名
apt-get install linux-image-2.6.17-2-686



V.               FTP以root执行下面命令
#apt-get install vsftpd(插入Debian安装盘CD1)

修改ftp配置文件
#vi /etc/vsftpd.conf
*************************************************************************************# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone?  vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=YES
#
# Run standalone with IPv6?
# Like the listen parameter, except vsftpd will listen on an IPv6 socket
# instead of an IPv4 one. This parameter and the listen parameter are mutually
# exclusive.
#listen_ipv6=YES
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
#local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
*************************************************************************************
重新启动ftp服务
/etc/init.d/vsftpd restart


VI.             Telnet以root执行下面命令
#apt-get install telnetd

VII.            系统管理常用命令
①       Debian如何查看已安装的deb包的文件装到哪里了?
dpkg -L package-name|more②       察看文件空间Df –h 察看系统磁盘空间
Du –h 察看文件大小
Du –sh 察看单个文件夹大小
③       系统常用配置命令
rcconf           系统引导时启动的服,也可以用sysvconfig替代
base-config   基本系统配置
debconf  Debian        包配置系统
dpkg-reconfigure packagename             配置一个已经安装的包
apt-get install etherconf
dpkg-reconfiguration etherconf
网络配置工具,非常有用
dpkg-reconfiguration xserver-xfree86     X配置
modconf        模块配置
modprobe    用来加载模块
modprobe –c              显示当前正被使用的模块配制
modprobe –l 显示能匹配的模块列表,你可以找你需要的模块
modprobe modname 加载模块
modprobe -r modname             移除模块
insmod         给正在运行的内核安装一个可加载模块。
rmmod          从正在运行的内核卸载模块。
lsmod            列出已加载的模块。
modinfo modname      显示每个模块的信息,很有趣。
apt-setup      配制apt源,就是安装时的你看到的那个,帮助你写/etc/apt/source.list
apt-get install aptconf
dpkg-reconfigure aptconf
配制apt,如禁用哪个apt源,自定义添加apt源(就象是个储藏室)等,找的是你的source.list,好玩。
apt-get install timezoneconf
dpkg-reconfigure timezoneconf
配制时区,日期,和时间。
④       删除软件包删除软件包但保留其配置文件:

     # apt-get remove package ...
     # dpkg  --remove package ...
删除软件包并删除配置文件:

     # apt-get remove --purge package ...
     # dpkg    --purge        package ...

VIII.          利用ntp实现时间同步更新:
前提:正确配置网络,能直接连到internet。
1.  首先在http://ntp.buptnet.edu.cn/ntp_chinese/down/server/ntp-4.2.0.tar.gz下载ntp

2.  # tar zxvf ntp-4.2.0.tar.gz  
# cd ntp-4.2.0
# ./configure
# make
# make check
# make install
# mkdir -p /etc/ntp/drift                     //modify by songfei
# vi  /etc/ntp.conf                          // 本来没有,直接vi一个出来,写入下面的内容就好了。

在ntp.conf里添加如下内容:
------------------------------------------------------------
server pool.ntp.org
driftfile  /etc/ntp/drift
-------------------------------------------------------------
退出保存
(注意:上述pool.ntp.org是ntp服务器地址,提供标准时间,如果不止一个,可以另起一行,添加服务器)

3.  根据需要手动设置时区:
    # tzconfig
根据命令提示来选择你要设置的时区。
    设定成功以后,利用下列命令查看结果
    #file  /etc/localtime

4. 启动ntpd进程
#/# /usr/local/bin/ntpd –c /etc/ntp.conf

5.# vi /etc/crontab(添加系统计划任务)
*/1 * * * * root /usr/local/bin/ntpdate pool.ntp.org; /sbin/hwclock –w
# /etc/init.d/cron  restart
# pgrep cron(返回了进程号,就说明启动了)
6.测试:
   先把时间修改成以前的时间:
  #date 082110002003
等待一分钟过后,
  #date 再查看系统时间,就能看到准确地当前时间了

IX.              实现控制台下 root用户自动登陆
1.首先修改/etc/inittab文件
参照红色部分修改:
#  :::
#
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
#1:2345:respawn:/sbin/getty 38400 tty1
1:2345:respawn:/sbin/getty -n -l /bin/autologin 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
#
修改完后,保存退出!
2.制作 autologin可执行文件
$ vi autologin
内容如下:
#!/bin/sh
/bin/login -f root
保存退出,赋予执行权限
chmod 755 autologin

至此自动登陆功能实现完成



X.               SAMBA安装
# apt-get intall samba
2.启动
# /etc/rc.d/init.d/smb start
当安装完 samba 套件后,也立即拥有以下的 samba 工具:
smbclient:利用这个工具可连接其它 Unix like 的 Samba Server,或是连接 Windows 机器,以取得档案分享服务。
testparm :这个工具可让您测试 smb.conf 组态档定义是否正确。
testprns :这个工具可让您测试定义在 printcap 档里的列表机。
smbstatus:这个工具可用来显示目前 client 端连接到 Samba Server 的联机状况。
nmblookup:这个工具可使用 NT/2000 网域内的主机名称查询出对应的 IP 地址。
smbpasswd:这个工具可用来建立、变更登入到 Samba server 的加密密码。
swat:这个工具让您可使用 web接口(如:IE、Netscape)对Samba Server做组态设定。

3.配置:
设定Samba的组态档最基本可分为三个阶段:Server基本设定、使用者home目录的设定、目录分享设定。至于「共享列表机设定」则是当您有需要时再做设定。若是在Samba 的组态设定档/etc/smb.conf档里做设定,则是针对[global]、[homes]、[分享目录]三大项目做设定。
 
  vi /etc/samba/smb.conf
  若是在etc/smb.conf档里做设定,则是在[global]项目里设定如下:
  [global]
  workgroup = MYGROUP ;不分大小写
  unix password sync = Yes
  设定 Linux 与 samba 使用相同的密码
    domain master = yes
  设定 samba 成为 PDC (网域主控者),注意:若是将Samba设定为独立服务器,则无须设定此项。
    client code page = 950
  如果想使用者能看到中文文件名称﹐可以将这行加进 [global] 设定中
  [homes]
  browseable = yes
  writable = yes
  public = yes
  write list = @staff
  samba 内定帐号拥有者可对帐号目录做读写动作,若想让某些使用者也有权利对此目录做写入动作时,请在「Users」卷标的「write list」字段里输入其它使用者名称,如:abc、test、working。
  所谓的使用者home目录是指,以使用者帐号登入 Samba Server 后个人所拥有的帐号目录,如:以帐号 root 登入后,内定的个人目录是 /root。一般而言,对「使用者home目录的设定」着重于是否将此个人目录分享出来及设定存取的权限,其余项目大抵上是无需设定。
  注意:若您选择了「Public access」、「Writable」两个选项,并不代表所有的使用者皆有权利对您所分享的home目录下的档案具有写入权,还得视档案原来在Linux下的权限设定,例如,档案权限为rwxr-xr-x(chmod 755),表示只有拥有者具可写入权,此点务必留意。
  [works]
  comment = share works
  browseable = yes
  path = /works
  public = yes
  writable = yes
  目录分享设定
  使用 Samba 最大的用途当然是将特定的目录分享出去,分享目录的原则不外乎是读写权限及分享对象,把握此原则就可很迅速的设定好分享目录
  用 testparm 来测试一下smb.conf的语法是否正确,或是使用 smbclient -L (computer_name)
  重新激活 SAMBA
  /etc/rc.d/init.d/smb restart


security = share#这是安全级别,这种方式不需要密码(user 是linux默认的方式)



XI.              安装内核头文件
#uname -r//看一下你的内核版本
#apt-cache search kernel-headers-内核版本
#apt-get install kernel-headers-内核版本

XII.            安装内核源文件
#uname -r//看一下你的内核版本
#apt-cache search kernel-sources-内核版本
#apt-get install kernel- sources -内核版本

XIII.           安装开发手册

使用man不能查询linux programmer’s mannal,需要安装glibc-doc manpages-dev

Apt-get install glibc-doc manpages-dev

XIV.         优化debian的安装源1、
[color="#003366"]apt-spy
方式:
apt-spy 会根据站点回应时间和带宽自动创建`sources.list'。
#apt-get install apt-spy
#mv sources.list sources.list.bak //backup
#man apt-spy //获取详细的使用方法
#apt-spy update //更新您的镜像列表文件 /var/lib/apt-spy/mirrors.txt
# apt-spy -d testing -a Asia
//在亚洲区寻找速度最快的testing版镜像,并生成 sources.list文件,也可使用 -o 参数指定写入文件

提示:这是一个漫长,确实一劳永逸的过程.
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/42971/showart_365962.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP