页面

显示标签为“debian”的博文。显示所有博文
显示标签为“debian”的博文。显示所有博文

2009-05-12

debian系统维护旁门左道

有时候由于/etc/passwd或/etc/shadow文件损坏,甚至由于键盘设置不当,导致内核启动后无法登录,这个时候,可以通过设置grub(或lilo)来进入系统。此时的系统就是个赤裸裸的程序集合,没有任何权限分配。
  1. 在内核进入grub提示界面时按下“e”,进入编辑模式,找到kernel行,增加选项“init=/bin/bash”,看起来像:
    kernel /boot/vmlinuz-2.6.26-1-amd64 root=/dev/sda1 ro init=/bin/bash
    lilo系统这样修改:
    boot: linux init=/bin/bash

  2. 此时分区只是个只读分区,调整为可写:
    $ mount -o remount,rw /

  3. 重启后,直接进入bash。此时可以恢复引导程序:
    $ /usr/sbin/update-rc.d

    或者配置键盘:
    $ /usr/sbin/dpkg-reconfigure console-data

如果无法通过grub进入shell,那可以使用Live CD系统进行修复,因为大多数Live系统不要求密码,充其量用一个不要求密码的sudo指令。进入Live系统后直接chroot原系统:
$ sudo chroot /mnt

注:chroot(change root directory)这个指令用来指定新的根(/)路径。

2009-04-11

manual base on debian

All packages' manuals are placed in the directory:
/usr/share/doc/
By default, all manuals are plain text format. If HTML document is needed, users have to install it like:
$ aptitude install aptitude-doc-en
Then user can read HTML manual for aptitude:
/usr/share/doc/aptitude/html/en/index.html

build a non-default installed package list for immigration

Before a debian user changes to a new machine, it is better to build a list in which all non-automatically installed packages are list:
$ aptitude -F %p search '~i!~M'
When the user landed on the new box, he or she may write a script to install all needed packages based on the list.

About the search pattern, please see the section in aptitude manual: search pattern.

2008-07-16

Building SunBlade 150 with Debian

  1. 安装参数
    install video=atyfb:off ide=nodma
  2. 分区
    分区时出现错误,说分区表无法创建,40G硬盘只能分出10G,那就先分10G,然后会提示没有boot分区,返回前页,使用向导,重新对整个40G分区。
  3. 安装完毕重启前配置silo
    在第一次安装重启前在silo配置文件中配置显视参数,否则系统无法启动。在系统要求重启的时刻,选择回退按钮回到上一屏,应该是一个完整的安装选项菜单,在大概倒数第二个选项,进入系统维护命令行界面,进入系统的目前挂载点:/target。(可以用nano)编辑文件silo.conf,找到timeout=100行,在其下追加一行“append="video=atyfb:off ide=nodma"”,看起来像下面这个样子:
    .
    .
    .
    timeout=100
    append="video=atyfb:off ide=nodma"
    .
    .
    .



  1. Loading image
    install video=atyfb:off ide=nodma
  2. Dealing with partition exception
    An exception may be thrown when arranging partition - you can not succeed in create new partitions for the whole disk, or you can only create new partition from part of the whole disk. At this point, obey the installer's instruction creatting partition partly at first and then it will promp that there is not the 'boot' partition. Then backward previouse screen and use partition guide to arrange partitions. This time, you will succeed.
  3. Configure silo
    After most installation jobs, the installer will promp to reboot system. Do not reboot. Backward, and enter a holistic installation options menu. Choose almost last one entry to enter command line screen. Enter current system loading directory '/target' to edit file 'silo.conf'. Find the line 'timeout=100' and append one line under it: append="video=atyfb:off ide=nodma". You may use nano to edit this file. Like the follow:
    .
    .
    .
    timeout=100
    append="video=atyfb:off ide=nodma"
    .
    .
    .

2008-05-31

debian上的X11配置指令

lenny之前用下列指令对X11进行重新配置
$ dpkg-reconfigure xserver-xorg
lenny及之后的配置指令:
$ Xorg -configure

2008-04-24

开始玩PostgreSQL

今天开始配置 postgresql 数据库,比预想的麻烦,主要是用户权限问题。

先对 postgresql 进行初始化,即运行 initdb 指令,在运行该指令前先建立数据库存储目录:/var/db。建好该目录后还得给后边运行 initdb 指令的用户指定权限(postgresql 不允许 root 用户执行相关指令):
chown uu /var/db
执行 initdb :
/usr/lib/postgresql/7.4/bin/initdb -E UTF-8 -D /var/db
初始化操作成功后,目前有个系统配置方面的 BUG :此时 postgresql 重启后应该读取的配置文件全在 /var/db 下,但实际上并不是。此时 postgresql 读取的配置文件位于 /var/lib/postgresql/7.4/main 下,执行指令 ls -l 可以看到有三个 p 打头的链接文件链的是 /etc/postgresql/7.4/main/ 下的同名文件。删除此三个链接文件,重新建立链接文件到 /var/db 目录下的配置文件,比如:
ln -s /var/db/postgresql.conf postgresql.conf
此后所作的所有有关配置文件下的更改都应是 /var/db 目录下的文件。重启 postgresql :
/usr/lib/postgresql/7.4/bin/postmaster -D /var/db
postgresql 提供一个默认超级用户(建立在操作系统级)postgres,开始只能通过该用户创建其他用户、创建数据库。这个用户的口令在系统配置文件中的定义是“*”,就是说你输什么都不行,必须切换到 root 用户再 su postgres 来使用或更改其口令。建立一个数据库用户 dbuser :
su postgres -c createuser
有了第一个用户,接下来就可以建数据库了:
postgres@unx$ createdb -O uu -e wooo 'database wooo'
更改用户口令可以在 psql 里做:
ALTER USER *username* WITH PASSWORD '*password*';
查看 postgresql 版本:
psql --version
删除数据库:
postgres@unx$ dropdb -U uu -i wooo

2008-04-23

debian etch r2 环境中 tomcat5.5 的安装配置

debian 自带 tomcat5.5 可以如下安装:aptitude install tomcat5.5。

如果用 gcj 作为 jdk,安装后做如下两步调整:
1)/etc/init.d/tomcat5.5
调整环境变量“JDK_DIRS”为“/usr/lib/jvm/java-gcj”,“TOMCAT5_SECURITY”为“no”。
2)/etc/default/tomcat5.5
调整环境变量“JAVA_HOME”为“/usr/lib/jvm/java-gcj”。
此时可以正常启动 tomcat5.5:/etc/init.d/tomcat5.5 start。

默认地,尽管 tomcat 安装目录在“/usr/share/tomcat5.5”(即环境变量 CATALINA_HOME 值),但该目录下大部分内容仅为连接(link),所有 web 应用实际上应置于这个位置:/var/lib/tomcat5.5/webapps/ROOT。服务器配置文件也在 /var 目录下:/var/lib/tomcat5.5/conf/server.xml。实际应用部署目录可以通过环境变量“CATALINA_BASE”(在文件 /etc/default/tomcat5.5 中)指定,然后在 CATALINA_HOME目录中建立连接即可。

基于 gcj 的 swing 或 awt 程序依赖包

在 gcj 作为 jdk 的编译环境中,要开发 swing 或 awt 应用,必须安装包 libgcj7-awt:aptitude install libgcj7-awt。目前 debian 版本:etch r2。

debian etch 非中文环境下的中文打印

debian etch 非中文环境下(我目前的升级版本是 r2)默认只能打印西文,所有中文打印出来都变成了方框。解决方案如下:
1)安装非自由软件 Ghostscript 的套件 gs-cjk-resource,cmap-adobe-gb1(简体中文),以及 cmap-adobe-cns1(繁体中文),这需要配置 apt 的资源列表/etc/atp/sources.list:deb http://ftp.debian.org/ etch main contrib non-free。添加后执行:aptitude update。然后安装前述套件:aptitude install gs-cjk-resource;aptitude install cmap-adobe-gb1;aptitude install cmap-adobe-cns1。
2)重新安装一种 TrueType 字体,文泉驿的正黑体已经非常好,目前,我从这里找到安装资源:http://wqy.sourceforge.net/cgi-bin/index.cgi?ZenHei。这个页面上可以找到做好的 debian 安装包,下载后执行:dpkg -i wqy-zenhei*.deb。星号代表实际包的版本。

此时已经可以正常打印中文了,但因为文泉驿的正黑体是矢量字体,在液晶屏幕上显示很漂亮,但在 CRT 上仍显模糊,可以安装文泉驿点阵宋体用于屏幕,目前可以在这里找到安装资源:http://wqy.sourceforge.net/cgi-bin/index.cgi?BitmapSong。同样有 debian 安装包提供,安装指令同前。安装该点阵字体后,在 gnome 桌面环境下指定所有字体为 WenQuanYi Bitmap Song 即可。有些应用程序,如 gedit,iceweasel 等仍需分别予以指定。

现在,在普通屏幕分辨率下的字体显示已经非常令人满意了,而且,CUP 在中文打印过程中会自动选择文泉驿正黑体字体,打印效果也很好了。