GRUB 2 中文指南

[不指定 2009/11/26 22:55 | by ipaddr ]


简介

GRUB 2 Ubuntu 9.10 (Karmic Koala) 的默认引导程序。在计算机启动时,GRUB 2 将显示菜单等待用户选择或者自动将控制权转交给操作系统内核。GRUB 2 继承自 GRUB (GRand Unified Bootloader)。它经过了完全的重写,以提供使用者更大的灵活性和性能改进。GRUB 2 是开放源代码软件。
在这份指南中,GRUB 2 版本为 1.96 或更新版本。传统 GRUB (0.97 ) 将以 GRUB 称之。


功能增强

GRUB 2 与原本的 GRUB 相比之下主要增加的功能包含:
l  支持脚本(Scripting),包括条件语法和函数
l  动态加载模块
l  救援模式
l  可定制菜单
l  主题
l  支持图形化启动菜单以及增强的引导画面功能
l  可直接由硬盘中的启动光盘映像文件来启动
l  新的配置文件结构
l  支持非 x86 平台(例如 PowerPC
l  全面支持 UUID(不只在 Ubuntu
l  openSUSE Fedora 尚未采用 GRUB 2


PDF全文下载:
[file]attachment/200911/grub2.rar[/file]

[转]Linux下core文件调试方法

[不指定 2009/11/24 17:38 | by ipaddr ]

在程序不寻常退出时,内核会在当前工作目录下生成一个core文件(是一个内存映像,同时加上调试信息)。使用gdb来查看core文件,可以指示出导致程序出错的代码所在文件和行数。


1.core文件的生成开关和大小限制
 1)使用ulimit -c命令可查看core文件的生成开关。若结果为0,则表示关闭了此功能,不会生成core文件。
 2)使用ulimit -c filesize命令,可以限制core文件的大小(filesize的单位为kbyte)。若ulimit -c unlimited,则表示core文件的大小不受限制。如果生成的信息超过此大小,将会被裁剪,最终生成一个不完整的core文件。在调试此core文件的时候,gdb会提示错误。


2.core文件的名称和生成路径
core文件生成路径:
输入可执行文件运行命令的同一路径下。
若系统生成的core文件不带其它任何扩展名称,则全部命名为core。新的core文件生成将覆盖原来的core文件。

1)/proc/sys/kernel/core_uses_pid可以控制core文件的文件名中是否添加pid作为扩展。文件内容为1,表示添加pid作为扩展名,生成的core文件格式为core.xxxx;为0则表示生成的core文件同一命名为core。
可通过以下命令修改此文件:
echo "1" > /proc/sys/kernel/core_uses_pid

2)proc/sys/kernel/core_pattern可以控制core文件保存位置和文件名格式。
可通过以下命令修改此文件:
echo "/corefile/core-%e-%p-%t" > core_pattern,可以将core文件统一生成到/corefile目录下,产生的文件名为core-命令名-pid-时间戳
以下是参数列表:
    %p - insert pid into filename 添加pid
    %u - insert current uid into filename 添加当前uid
    %g - insert current gid into filename 添加当前gid
    %s - insert signal that caused the coredump into the filename 添加导致产生core的信号
    %t - insert UNIX time that the coredump occurred into filename 添加core文件生成时的unix时间
    %h - insert hostname where the coredump happened into filename 添加主机名
    %e - insert coredumping executable name into filename 添加命令名


3.core文件的查看
 core文件需要使用gdb来查看。
 gdb ./a.out
 core-file core.xxxx
 使用bt命令即可看到程序出错的地方。
以下两种命令方式具有相同的效果,但是在有些环境下不生效,所以推荐使用上面的命令。
1)gdb -core=core.xxxx
file ./a.out
bt
2)gdb -c core.xxxx
file ./a.out
bt


4.开发板上使用core文件调试
如果开发板的操作系统也是linux,core调试方法依然适用。如果开发板上不支持gdb,可将开发板的环境(依赖库)、可执行文件和core文件拷贝到PC的linux下。
在PC上调试开发板上产生的core文件,需要使用交叉编译器自带的gdb,并且需要在gdb中指定solib-absolute-prefix和solib-search-path两个变量以保证gdb能够找到可执行程序的依赖库路径。有一种建立配置文件的方法,不需要每次启动gdb都配置以上变量,即:在待运行gdb的路径下建立.gdbinit。
配置文件内容:
set solib-absolute-prefix YOUR_CROSS_COMPILE_PATH
set solib-search-path YOUR_CROSS_COMPILE_PATH
set solib-search-path YOUR_DEVELOPER_TOOLS_LIB_PATH
handle SIG32 nostop noprint pass


注意:待调试的可执行文件,在编译的时候需要加-g,core文件才能正常显示出错信息!有时候core信息很大,超出了开发板的空间限制,生成的core信息会残缺不全而无法使用,可以通过挂载到PC的方式来规避这一点。

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/shaovey/archive/2008/07/31/2744487.aspx

1、下载:AdbeRdr9.1.0-1_i386linux_enu.deb

2、执行后会安装至/opt/Adobe/Reader9目录

3、下载中文简体字型:FontPack910_chs_i486-linux.tar.bz2

4、下载中文繁体字型:FontPack910_cht_i486-linux.tar.bz2

5、分别解开字型压缩档至CHSKIT及CHTKIT目录: tar jxvf压缩档

6、执行CHSKIT及CHTKIT目录中的INSTALL: sudo CHTKIT/INSTALL
一直以为Thinkpad T400都是用的是Intel的无线网卡,直到在T400上面安装Ubuntu9.10发现没有驱动,才发现有些型号的T400使用的是realtek的无线网卡,Lenovo可真会省钱呀。

默认ubuntu 9.10没有此无线网卡的驱动,需要自己下载编译安装,各位可从本站下载:
[file]attachment/200911/rtl8192se_linux_2.6.0010.1012.2009.tar.gz[/file]

下载后,解压编译安装,重启即可:
#tar zxvf rtlxxxxxxxxx.tar.gz
#cd rtl*
#make
#make install

鱼漂提醒你,需要进入到解压的路径当中后再make & make install。

There are so many hash. SHA1 is one of them which is widely used in recent years even though it is not safe to use right now. By the way, it is still the default hash function for storing password in LDAP especially OpenLDAP. In order to develop a website with LDAP authentication manually against POSIX account, SSHA hash function or SHA1 is the easiest solution.

Below are 2 functions for encoding given text to SSHA including {SSHA} and another one for verifying given text against SSHA hash.

function ssha_encode($text) {
  for ($i=1;$i<=10;$i++) {
    $salt .= substr('0123456789abcdef',rand(0,15),1);
  }
  $hash = "{SSHA}".base64_encode(pack("H*",sha1($text.$salt)).$salt);
  return $hash;
}
 
function ssha_check($text,$hash) {
  $ohash = base64_decode(substr($hash,6));
  $osalt = substr($ohash,20);
  $ohash = substr($ohash,0,20);
  $nhash = pack("H*",sha1($text.$osalt));
  return $ohash == $nhash;
}

For example, I would like to encode a password "test". One possible encrypted hash is
 {SSHA}5s6PB5P6KET18sZLycLKKNBFf71jMzkzNzk4Yzg2.

$password = "test";
$hash = ssha_encode($password);
print "$hash\n";
print var_export(ssha_check($password,$hash),true);

鱼漂注:
从SSHA的生成代码不难看出,SSHA用了一些随机生成的加密种子,这里只用了1位,通常也可以使用多位随机生成的加密种子.

I couldn't get ldap_bind to work on an ldaps connection until I followed some instructions about creating an ldap.conf file.  I don't see these instructions anywhere on the php site.  Maybe they're on the OpenLDAP site, but I thought it would be useful to have here as well.  Credit goes to a dude known as 'LRM', and I found my solution here: http://lists.horde.org/archives/sork/Week-of-Mon-20040503/001578.html

My setup is XAMPP on Win XP.
###### ApacheFriends XAMPP (basic package) version 1.6.3a ######

  + Apache 2.2.4
  + MySQL 5.0.45
  + PHP 5.2.3 + PHP 4.4.7 + PEAR
  + PHP-Switch win32 1.0 (please use the "php-switch.bat")
  + XAMPP Control Version 2.5 from www.nat32.com   
  + XAMPP Security 1.0   
  + SQLite 2.8.15
  + OpenSSL 0.9.8e
  + phpMyAdmin 2.10.3
  + ADOdb 4.95
  + Mercury Mail Transport System v4.01b
  + FileZilla FTP Server 0.9.23
  + Webalizer 2.01-10
  + Zend Optimizer 3.3.0
  + eAccelerator 0.9.5.1 for PHP 5.2.3  (comment out in the php.ini)

1. create C:\OpenLDAP\sysconf\ldap.conf (Yes, it MUST be this path because it's hard-coded in the dll)
2. put this line at the top:

TLS_REQCERT never

3. Save, stop/start apache.

The reason is, I think, because it doesn't understand the certificate, so this directive tells it to not bother checking it.  I guess that could be unsafe in some cases, but in my case I'm confident with the server I'm connecting to.

My connection code was as follows (nothing new here, I don't think):

<?php
$con
= @ldap_connect('ldaps://the.ldap.server', 636);
ldap_set_option($con, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($con, LDAP_OPT_REFERRALS, 0);
var_dump(@ldap_bind($con, 'user@sub.domain.com', 'password'));
?>

Good luck!  LDAPS can be a real bitch.

PHP扩展模块安装手记

[不指定 2009/11/11 19:43 | by ipaddr ]

一.curl
编译安装PHP 5.3.0时,使用--with-curl选项会导致无法编译成功,经查是5.3.0的bug,已经在snapshot版本中修复,可以从:
http://snaps.php.net/
站点下载5.3.0的snapshot,将里面的ext/curl替换掉,再重新编译就可以解决.

二.pecl_http
PHP中的http相关函数需要使用pecl-http扩展模块,通过以下步骤可以安装:
(鱼漂www.eit.name原创,转载请注明)
1. 从 http://pecl.php.net/package/pecl_http下载最新代码
2. 编译
#tar –xzvf pecl_http-1.6.5.tgz
#cd pecl_http-1.6.5/
#phpize
#./configure
#make
#make install
3.配置php.ini
在make install的输出当中,会显示http.so的安装路径,修改php.ini的配置,加载此扩展:
extension=/usr/local/lib/php/extensions/no-debug-non-zts-20090626/http.so
4.重启Apache并通过phpinfo()检查是否已加载.

此外,Windows下的pcel-http也不好安装,我使用的是PHP 5.2.10,最终在网上找到了pecl-5.2.6-Win32.zip,将里面的php_http.dll放到php的ext目录后,在php.ini中加载也可以使用.


你也可以通过本站下载php_http.dll
[file]attachment/200911/1257939789_0.zip[/file]

innodb_buffer_pool_size
如果用Innodb,那么这是一个重要变量。相对于MyISAM来说,Innodb对于buffer size更敏感。MySIAM可能对于大数据量使用默认的key_buffer_size也还好,但Innodb在大数据量时用默认值就感觉在爬了。 Innodb的缓冲池会缓存数据和索引,所以不需要给系统的缓存留空间,如果只用Innodb,可以把这个值设为内存的70%-80%。和 key_buffer相同,如果数据量比较小也不怎么增加,那么不要把这个值设太高也可以提高内存的使用率。

innodb_additional_pool_size
这个的效果不是很明显,至少是当操作系统能合理分配内存时。但你可能仍需要设成20M或更多一点以看Innodb会分配多少内存做其他用途。

innodb_log_file_size
对于写很多尤其是大数据量时非常重要。要注意,大的文件提供更高的性能,但数据库恢复时会用更多的时间。我一般用64M-512M,具体取决于服务器的空间。

innodb_log_buffer_size

默认值对于多数中等写操作和事务短的运用都是可以的。如果经常做更新或者使用了很多blob数据,应该增大这个值。但太大了也是浪费内存,因为1秒钟总会 flush(这个词的中文怎么说呢?)一次,所以不需要设到超过1秒的需求。8M-16M一般应该够了。小的运用可以设更小一点。

innodb_flush_log_at_trx_commit  (这个很管用)
抱怨Innodb比MyISAM慢 100倍?那么你大概是忘了调整这个值。默认值1的意思是每一次事务提交或事务外的指令都需要把日志写入(flush)硬盘,这是很费时的。特别是使用电池供电缓存(Battery backed up cache)时。设成2对于很多运用,特别是从MyISAM表转过来的是可以的,它的意思是不写入硬盘而是写入系统缓存。日志仍然会每秒flush到硬盘,所以你一般不会丢失超过1-2秒的更新。设成0会更快一点,但安全方面比较差,即使MySQL挂了也可能会丢失事务的数据。而值2只会在整个操作系统挂了时才可能丢数据。

分页: 1/1 第一页 1 最后页 [ 显示模式: 摘要 | 列表 ]