Chinaunix首页 | 论坛 | 博客
  • 博客访问: 477471
  • 博文数量: 86
  • 博客积分: 4052
  • 博客等级: 上校
  • 技术积分: 914
  • 用 户 组: 普通用户
  • 注册时间: 2005-02-01 15:21
个人简介

If you don’t like this government, it won’t last forever.

文章分类

全部博文(86)

文章存档

2016年(2)

2015年(1)

2014年(4)

2013年(4)

2008年(4)

2007年(53)

2006年(17)

2005年(1)

我的朋友

分类: LINUX

2007-07-10 00:13:19

安装CentOS5、驱动usb-adsl、安装下载软件、安装多媒体软件、编译内核、适合新手。

在正文开始前我先说两句废话,我喜欢玩电脑但是很菜,所以以下所写的肯定会有很多错误的地方,比如正确的用语等等。希望高手们能多多的指正。以下方法只在CentOS5系统中通过,不保证其它系统也能通过。

第一步:CentOS5系统安装。

-、系统安装
介绍基本安装的文章很多,我这里只说一下我的分区情况和GRUB(开机引导程序)安装情况。安装顺序,先安装XP再装CentOS5.
1、分区
在安装进行到分区这一步时一定要选择自定义分区。建议建立两个主分区。下面是我的分区情况,供参考。
Device Boot Start End Blocks Id System
/dev/hdc1 1 787 6321546 7 HPFS/NTFS (第一主分区安装XP,大小看你的习惯)
/dev/hdc2 * 788 1934 9213277+ 83 Linux (第二主分区安装CentOS5,并设为活动分区。大小为8G,最好能在大点)
/dev/hdc3 1935 9729 62613337+ f W95 Ext'd (LBA)
/dev/hdc5 1935 3268 10715323+ 7 HPFS/NTFS
/dev/hdc6 3269 5563 18434556 b W95 FAT32
/dev/hdc7 5564 6839 10249438+ b W95 FAT32
/dev/hdc8 6840 9602 22193766 b W95 FAT32
/dev/hdc9 9603 9729 1020096 82 Linux swap / Solaris (linux交换分区,大小为你的内存大小或内存大小的两倍。把swap放在最后好像可以提高读写的速度,也不知道有没有道理。)
在安装结束后重起电脑会进入XP,并不会出现GRUB引导界面,别急,这是因为活动分区还是/dev/hdc1的过。进入XP利用PM之类的工具将活动分区改为/dev/hdc2重启后就出现GRUB引导界面了。
这样分区的好处是减少一个系统崩溃时对另一个系统的影响。比如XP崩溃需要重新安装时它会覆盖MBR,如果我们把GRUB安装在MBR,这时你就无法进入CentOS5了,你必须用引导盘进入linux的救援模式键入命令从装GRUB。这虽然简单但是对于一个从未接触过linux的新手来说也许是致命的。如果我们把GRUB安装在/dev/hdc2,在重装了XP后只需要改变下活动分区就可以了。再比如linux崩溃了(尽管这不容易,但是对于向我这一类的新手来说还是很有可能的)我们也同样只需利用win98或带有fdisk的DOS引导盘在DOS下把活动分区改为XP就可以进入XP了。(XP引导盘是不是也可以改变活动分区我不知道,如果可以的话还希望高手们教我们这些菜鸟)

2、GRUB引导设置。
我的配置文件:
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,1)
# kernel /boot/vmlinuz-version ro root=/dev/hdc2
# initrd /boot/initrd-version.img
#boot=/dev/hdc2
default=3 (默认引导系统,第一个为0,这里3代表第四个WinXP系统为默认引导系统)
timeout=8 (默认引导等待时间,单位秒)
splashimage=(hd0,1)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.20.10-02)
root (hd0,1)
kernel /boot/vmlinuz-2.6.20.10-02 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.20.10-02.img
title CentOS (2.6.18-8.el5)
root (hd0,1)
kernel /boot/vmlinuz-2.6.18-8.el5 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.18-8.el5.img
title CentOS (2.6.20.10)
root (hd0,1)
kernel /boot/vmlinuz-2.6.20.10 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.20.10.img
title WinXP
rootnoverify (hd0,0)
chainloader +1

你可以改变default=后面的数字以选择你要默认引导的系统。改变timeout=后面的数值以改变默认引导时的等待时间,如果为0表示不等待。
如果你在安装过程中遇到其他问题可以多多求助于网络。基本上都能得到解决。

第二步,连接互联网。

这一步非常的重要,现在的linux对互联网的依赖非常强。
我所使用的是usb的adsl。所以这里只介绍usb的adsl的安装方法。
说明:usb adsl芯片是Conexant的。



1、首先安装如下的软件包

usbutils-0.71-2.i386.rpm ---可以用lsusb命令查看usb adsl的信息

linux-atm-2.5.0-1.20050118cvs.i3886.rpm
linux-atm-libs-2.5.0-0.20050118cvs.i386.rpm ---编译生成文件br2684ctl必须

linux-atm-libs-devel-2.5.0-0.20050118cvs.i386.rpm ---编译生成文件br2684ctl必须,安装

后三个包CentOS5光盘中没有,我是用的FC6中。
检查rp-pppoe是否安装:
[root@localhost tmp]# rpm -q rp-pppoe
rp-pppoe-3.5-32.1
如果没有安装CentOS5中就有,安装它。
在没有联网之前我们只能通过在终端下使用rpm来安装、升级、卸载软件包。基本命令如下。
rpm -q filename.rpm 查询名为filename的软件包是否安装。
rpm -ivh filename.rpm 安装名为filename的软件包。
rpm -e fielname.rpm 卸载名为filename的软件包。
rpm -qpl filename.rpm 查询名为filename的软件包都将安装那些文件到系统中。


2、准备要用的文件CnxEtU.sys
[root@localhost tmp]#cp /mnt/hdc1/WINDOWS/system32/drivers/CnxEtU.sys /tmp
如果你使用默认内核不支持ntfs分区,你可以在XP下把CnxEtU.sys先放到一个fat32分区。然后在linux下挂载这个fat32分区。
[root@localhost tmp]#mkdir /mnt/hdc7 新建一个文件夹,以便将一个WIN分区挂载到linux下。
[root@localhost tmp]#mount -t vfat /dev/hdc7 /mnt/hdc7 将/dev/hdc7分区以文件夹方式挂载到/mnt/hdc7。


3、用lsusb命令查看usb adsl连接情况

[root@localhost tmp]# lsusb

Bus 005 Device 001: ID 0000:0000

Bus 004 Device 001: ID 0000:0000

Bus 003 Device 001: ID 0000:0000

Bus 002 Device 002: ID 0572:cb00 Conexant Systems (Rockwell), Inc. E-Tech ADSL Modem v2

Bus 002 Device 001: ID 0000:0000

Bus 001 Device 001: ID 0000:0000




4、生成cxacru-fw.bin文件

需要CnxEtU.sys文件,此文件从windows版驱动而来,在windows下查找此文件。
利用编辑器,比如gedit新建cxacru-fw.c文件,将下面内容粘贴到文件中去。
/*****************************************************************************

* cxacru-fw - utility to extract firmware for the USB ADSL modems based on

* Conexant AccessRunner chipset, from the Conexant driver for

* Windows(R)

*

* Copyright (C) 2005 Roman Kagan (rkagan % mail ! ru)

*

* This program is free software; you can redistribute it and/or modify

* it under the terms of the GNU General Public License as published by

* the Free Software Foundation; either version 2 of the License, or

* (at your option) any later version.

*

* This program is distributed in the hope that it will be useful,

* but WITHOUT ANY WARRANTY; without even the implied warranty of

* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

* GNU General Public License for more details.

*

* You should have received a copy of the GNU General Public License

* along with this program; if not, write to the Free Software

* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

*

****************************************************************************/



#include

#include

#include

#include

#include

#include

#include

#include

#include

#include



#if __BYTE_ORDER == __BIG_ENDIAN

static inline uint16_t le16_to_cpup(uint16_t *x) {return bswap_16(*x);}

static inline uint32_t le32_to_cpup(uint32_t *x) {return bswap_32(*x);}

#else

static inline uint16_t le16_to_cpup(uint16_t *x) {return *x;}

static inline uint32_t le32_to_cpup(uint32_t *x) {return *x;}

#endif



uint8_t *findfw(uint8_t *buf, int len, int *fwlen)

{

const static uint8_t fwstart[] = { /* ARM LE asm */

0x1c, 0x24, 0x9f, 0xe5, /* e59f241c ldr r2, [pc, #0x41c] */

0x00, 0x10, 0xa0, 0xe3, /* e3a01000 mov r1, #0x0 */

0x00, 0x10, 0x82, 0xe5, /* e5821000 str r1, [r2] */

0x22, 0x00, 0x00, 0xeb, /* eb000022 bl 0x9c */

};



const static uint8_t bpstart[] = {

0x78, 0x20, 0x9f, 0xe5, /* e59f2078 ldr r2, [pc, #0x78] */

0x01, 0x10, 0xa0, 0xe3, /* e3a01001 mov r1, #0x1 */

0x00, 0x10, 0x82, 0xe5, /* e5821000 str r1, [r2] */

0x70, 0x20, 0x9f, 0xe5, /* e59f2070 ldr r2, [pc, #0x70] */

};



uint8_t *fw, *bp, *nt_header, *sect_header;

uint32_t tmp;

uint16_t nsect;

uint32_t dataoff, datalen;



*fwlen = 0;



/* IMAGE_DOS_HEADER size and .Signature */

if (len < 0x40 || memcmp(buf, "MZ", 2)) {

error(0, 0, "file is not a DOS executable");

return NULL;

}



/* IMAGE_NT_HEADERS size and .Signature */

tmp = le32_to_cpup((uint32_t *) (buf + 0x3c));

nt_header = buf + tmp;

if (len < tmp + 0x18 || memcmp(nt_header, "PE\0\0", 4)) {

error(0, 0, "file is not a portable executable (PE)");

return NULL;

}



/* IMAGE_NT_HEADERS.FileHeader.NumberOfSections */

nsect = le16_to_cpup((uint16_t *) (nt_header + 0x04 + 0x2));



/* IMAGE_NT_HEADERS.FileHeader.SizeOfOptionalHeader */

tmp = le16_to_cpup((uint16_t *) (nt_header + 0x04 + 0x10));

sect_header = nt_header + 0x18 + tmp;



for (; nsect; nsect--, sect_header += 0x28) {

if (sect_header + 0x28 > buf + len) {

error(0, 0, "file header corrupted");

return NULL;

}



if (!memcmp(sect_header, ".data", 5))

break;

}



if (!nsect) {

error(0, 0, "`.data' section not found");

return NULL;

}



/* IMAGE_SECTION_HEADER.SizeOfRawData */

datalen = le32_to_cpup((uint32_t *) (sect_header + 0x10));

/* IMAGE_SECTION_HEADER.PointerToRawData */

dataoff = le32_to_cpup((uint32_t *) (sect_header + 0x14));

if (dataoff + datalen > len) {

error(0, 0, "`.data' section extends beyond end of file");

return NULL;

}



/* find the starting sequence of the firmware image */

fw = (uint8_t *) memmem(buf + dataoff, datalen, fwstart, sizeof(fwstart));

if (!fw) {

error(0, 0, "firmware start sequence not found");

return NULL;

}

*fwlen = datalen - (fw - (buf + dataoff));



/* find the starting sequence of the boot ROM patch, if present */

bp = (uint8_t *) memmem(fw, *fwlen, bpstart, sizeof(bpstart));

if (bp)

*fwlen = bp - fw;

return fw;

}



const char * argp_program_version = "002";

const char * argp_program_bug_address =

"";

const static char args_doc[] = "INFILE OUTFILE";

const static char doc[] =

"Firmware extractor for Conexant AccessRunner ADSL USB modems\n"

"INFILE - Windows driver file containing firmware (usually CnxEtU.sys)\n"

"OUTFILE - firmware image (usually cxacru-fw.bin)";



struct args {

char *infile;

char *outfile;

};



static error_t parse_opts(int key, char *arg, struct argp_state *state)

{

struct args *args = state->input;

switch (key) {

case ARGP_KEY_ARG:

switch (state->arg_num) {

case 0:

args->infile = arg;

break;

case 1:

args->outfile = arg;

break;

default:

argp_usage (state);

}

break;



case ARGP_KEY_END:

if (state->arg_num < 2)

argp_usage (state);

break;



default:

return ARGP_ERR_UNKNOWN;

}

return 0;

}



static struct argp argp = {0, parse_opts, args_doc, doc};



int main(int argc, char **argv)

{

int ret, fd;

struct args args;

struct stat instat;

uint8_t *buf, *fw;

int len, fwlen;



argp_parse(&argp, argc, argv, 0, NULL, &args);



fd = open(args.infile, O_RDONLY);

if (fd < 0)

error(1, errno, "failed to open `%s' for reading", args.infile);



ret = fstat(fd, &instat);

if (ret)

error(1, errno, "failed to obtain the size of `%s'", args.infile);

len = instat.st_size;



buf = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);

close(fd);

if (!buf)

error(1, errno, "failed to mmap `%s'", args.infile);



fw = findfw(buf, len, &fwlen);

if (!fw)

error(1, 0, "can't find AccessRunner firmware in `%s'", args.infile);



fd = open(args.outfile, O_WRONLY | O_CREAT | O_EXCL,

S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);

if (fd < 0)

error(1, errno, "failed to open `%s' for writing", args.outfile);



if (write(fd, fw, fwlen) != fwlen)

error(1, errno, "failed to write firmware to `%s'", args.outfile);

close(fd);



munmap(buf, len);

printf("found firmware in `%s' at offset %#x\n", args.infile, fw - buf);

}

新建makefile将下面内容粘贴到文件中。

cxacru-fw:


编译cxacru-fw.c文件生成cxacru-fw可执行文件。

[root@localhost tmp]# make


从CnxEtU.sys提取固件信息生成firmeare文件。

[root@localhost tmp]# ./cxacru-fw cnxetu.sys cxacru-fw.bin


拷贝到/lib/firmware文件夹。

[root@localhost tmp]# cp cxacru-fw.bin /lib/firmware

热插拔一下adsl。



5、运行br2684ctl驱动adsl建立虚拟网卡界面nas0。

[root@localhost tmp]# br2684ctl -b -c 0 -a 0.35 (vpi 0,vci 35 你的vpi和vci的具体数值可以去看XP下的adsl信息或向当地ISP查询。)

RFC1483/2684 bridge: Interface "nas0" created sucessfully

RFC1483/2684 bridge: Communicating over ATM 0.0.33, encapsulation: LLC

RFC1483/2684 bridge: Interface configured

6、激活nas0
[root@localhost tmp]# ifconfig nas0 up
[root@localhost tmp]# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1426 errors:0 dropped:0 overruns:0 frame:0
TX packets:1426 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2271757 (2.1 MiB) TX bytes:2271757 (2.1 MiB)

nas0 Link encap:Ethernet HWaddr 00:08:5C:08:CB:6F
inet6 addr: fe80::208:5cff:fe08:cb6f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13114 errors:0 dropped:0 overruns:0 frame:0
TX packets:12551 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10585126 (10.0 MiB) TX bytes:1614057 (1.5 MiB)
如果有nas0出现,那说明操作成功。



7、pppoe的设置

[root@linux root]# adsl-setup

Welcome to the Roaring Penguin PPPoE client setup. First, I will run

some checks on your system to make sure the PPPoE client is installed

properly...

Looks good! Now, please enter some information:

USER NAME

>>> Enter your PPPoE user name (default bxxxnxnx@sympatico.ca):(输入你的adsl帐号)

INTERFACE

>>> Enter the Ethernet interface connected to the DSL modem

For Solaris, this is likely to be something like /dev/hme0.

For Linux, it will be ethn, where 'n' is a number.

(default eth0): nas0(就是nas0,不要用别的)

Do you want the link to come up on demand, or stay up continuously?

If you want it to come up on demand, enter the idle time in seconds

after which the link should be dropped. If you want the link to

stay up permanently, enter 'no' (two letters, lower-case.)

NOTE: Demand-activated links do not interact well with dynamic IP

addresses. You may have some problems with demand-activated links.

>>> Enter the demand value (default no):(默认就可以)

DNS

Please enter the IP address of your ISP's primary DNS server.

If your ISP claims that 'the server will provide DNS addresses',

enter 'server' (all lower-case) here.

If you just press enter, I will assume you know what you are

doing and not modify your DNS setup.

>>> Enter the DNS information here: (你的域名服务器的主IP地址,根据自己的情况设置)

Please enter the IP address of your ISP's secondary DNS server.

If you just press enter, I will assume there is only one DNS server.

>>> Enter the secondary DNS server address here: (你的域名服务器的副IP地址,根据自己的情况设置)

PASSWORD

>>> Please enter your PPPoE password:(帐号密码)

>>> Please re-enter your PPPoE password:(确认帐号密码)

FIREWALLING

Please choose the firewall rules to use. Note that these rules are

very basic. You are strongly encouraged to use a more sophisticated

firewall setup; however, these will provide basic security. If you

are running any servers on your machine, you must choose 'NONE' and

set up firewalling yourself. Otherwise, the firewall rules will deny

access to all standard servers like Web, e-mail, ftp, etc. If you

are using SSH, the rules will block outgoing SSH connections which

allocate a privileged source port.

The firewall choices are:

0 - NONE: This script will not set any firewall rules. You are responsible

for ensuring the security of your machine. You are STRONGLY

recommended to use some kind of firewall rules.

1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation

2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway

for a LAN

>>> Choose a type of firewall (0-2): 1(防火墙设置,自己家用,选1吧)

** Summary of what you entered **

Ethernet Interface: nas0

User name: (自己的adsl用户)

Activate-on-demand: No

Primary DNS: (自己的设置)

Secondary DNS: (自己的设置)

Firewalling: STANDALONE

>>> Accept these settings and adjust configuration files (y/n)? y(不保存怎么能行,当然是“y”)

Adjusting /etc/ppp/pppoe.conf

Adjusting /etc/resolv.conf

(But first backing it up to /etc/resolv.conf-bak)

Adjusting /etc/ppp/pap-secrets and /etc/ppp/chap-secrets

(But first backing it up to /etc/ppp/pap-secrets-bak)

(But first backing it up to /etc/ppp/chap-secrets-bak)



Congratulations, it should be all set up!

Type 'pppoe-start' to bring up your PPPoE link and 'pppoe-stop' to bring

it down. Type 'pppoe-status' to see the link status.



8、建立连接。
[root@localhost tmp]# adsl-start

[root@localhost tmp]# ifconfig

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:2281 errors:0 dropped:0 overruns:0 frame:0

TX packets:2281 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:2415979 (2.3 MiB) TX bytes:2415979 (2.3 MiB)

nas0 Link encap:Ethernet HWaddr 00:08:5C:61:75:1A

inet6 addr: fe80::208:5cff:fe61:751a/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:576 errors:0 dropped:0 overruns:0 frame:0

TX packets:594 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:350866 (342.6 KiB) TX bytes:78820 (76.9 KiB)

ppp0 Link encap:Point-to-Point Protocol

inet addr:124.129.83.213 P-t-P:221.0.255.157 Mask:255.255.255.255

UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1

RX packets:430 errors:0 dropped:0 overruns:0 frame:0

TX packets:442 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:3

RX bytes:344960 (336.8 KiB) TX bytes:58169 (56.8 KiB)

如果有ppp0出现,那说明你成功了。

现在你可以去上网冲浪了。

第三步、BT下载工具、amule(电驴)、的安装和使用

1、transmission(BT)
从网上下个transmission-0.72.tar.gz回来然后解压缩。
[root@localhost tmp]#tar -zxvf transmission-0.72.tar.gz

进入解压缩目录
[root@localhost tmp]# cd transmission
[root@localhost transmission]#

接下来执行./configure,这个好像是检查当前系统是否适合安装所要安装的软件,以及所依赖的其它软件是否安装。好像是这个目的,望高手指正。
[root@localhost transmission]# ./configure --prefix=/usr/local/transmission
加入--prefix=/usr/local/transmission是指定安装路经,以便于我们日后删除方便。
注意执行./configure后终端显示的信息,如果报错停止那么要记下出错的信息开始是为什么出错,多数是应为依赖关系得不到满足。如果你解决不了可以把错误信息帖到网上来大家帮你解决。

接下来执行make进行编译。
[root@localhost transmission]# make

如果make也正确结束的话下来就是安装了make install
[root@localhost transmission]# make install

安装完成,进入安装目录
[root@localhost transmission]# cd /usr/local/transmission/bin
[root@localhost bin]#

执行transmission-gtk
[root@localhost bin]# ./transmission-gtk
加入./的意思是执行当前目录中的程序,不然系统会到/bin、/sbin、/usr/bin、/usr/sbin去寻找transmission-gtk,当然就找不到了。你可以在桌面建立快捷方式方便使用。transmission虽然功能简单但是在我这里速度还可以。你还可以尝试Azureus,在我这里Azureus的速度实在没法接受。另外还有BitTorrent,这个我还没试过。
启动transmission后打开首选项在listening port 中填入6881,这是你使用的端口,当然你还可以使用其它端口。然后打开终端使用下面的命令打开6881端口。
[root@localhost ~]# iptables -I INPUT -p tcp --dport 6881 -j ACCEPT
[root@localhost ~]# iptables -I INPUT -p udp --dport 6881 -j ACCEPT
你也可以把这两条命令加入到/etc/ppp/firewall-standalone文件中。在执行adsl-start自动执行这两条命令。
 
 
 
 
 
 
 
 
 
 
 
 
 
2、amule(电驴)
照样还是在网上寻找aMule-2.1.3.tar.bz2、wxBase-2.6.4.tar.gz、wxGTK-2.6.4.tar.gz三个包,然后分别解压安装。因为有了上面安装transmission的经验我们这里就简单点。需要说一下的是tar.bz2和tar.gz的压缩包解压稍有不同。使用命令tar -xjvf解压tar.bz2其中
x 是释放文件
j 是告诉tar解压的是.bz2文件
v 是显示文件清单
f 是使用归档文件或文件系统

先装wxBase再装 wxGTK,最后装 aMule,安装wxBase后要执行一下 ldconfig命令(大概是使其生效的意思,高手在那里?),wxGTK 编译参数为./configure --with-gtk(这个参数我也不明白什么意思)。

#cd wxBase-2.6.4;./configure;make;make install; /sbin/ldconfig;cd ..
#cd wxGTK-2.6.4;./configure --with-gtk;make;make install;make clean;cd ..
#cd aMule-2.1.3;./configure --prefix=/usr/local/amule;make;make install

#ln -s /usr/local/lib/libwx_base-2.6.so.0.4.0 /usr/lib/libwx_base-2.6.so.0
#ln -s /usr/local/lib/libwx_base_net-2.6.so.0.4.0 /usr/lib/libwx_base_net-2.6.so.0
#ln -s /usr/local/lib/libwx_gtk2_adv-2.6.so.0.4.0 /usr/lib/libwx_gtk2_adv-2.6.so.0
#ln -s /usr/local/lib/libwx_gtk2_core-2.6.so.0.4.0 /usr/lib/libwx_gtk2_core-2.6.so.0

后四条命令是建立快捷方式,不然运行amule会报错。在其它版本的linux中也不并不需要建立这四个连接。执行命令启动amule
[root@localhost ~]# /usr/local/amule/bin/./amule

现在 aMule 已经是 GTK 2 界面了,很漂亮,中文支持也很好,不过界面可是英文的。安装之后,设置服务器在IP:port中填入62.241.53.2:4242。然后点加入,这个按钮倒是中文的很奇怪。另外还有其他的服务器,例如华语psp源动力,地址61.152.93.254:4661;还有Razorback 2,地址为195.245.244.243:4661。aMule使用方法和eMule几乎一样,很快可以上手。

第四部、多媒体

在上一步中你是不是下载了很多mp3和小电影呢,可是你会发现你却欣赏不了,别急我们马上就来解决。

1、xmms 听mp3必选
去网上下载xmms-1.2.10-1.i386.rpm,我也下过其它很多包,不过就这个包很顺利的通过安装了。启动xmms
[root@localhost ~]# xmms
然后在选项-首选项-字体中默认的字体后面加入,*(一个逗号和一个星号)同时把 使用字体集 和 使用 X 字体 两项全部选中。这样就可以正确显示中文了 ,但是中文字体很大,高手指点怎么使用其它中文字体。

2、mplayer 万能播放器。
下载mplayer-1.0rc1。tar.bz2 all-20061022.tar.bz2 windows-all-20061022.zip Blue-1.7.tar.bz2 四个包。(是不是发觉离开了网络linux就没法用了)

1、安装解码器。

mkdir /usr/lib/codecs
mkdir /usr/lib/wincodecs
tar jxvf all-20060611.tar.bz2
mv all-20060611/* /usr/lib/codecs
unzip windows-all-20060611.zip
mv windows-all-20060611/* /usr/lib/wincodecs

2、安装mplayer。
[root@localhost ~]# ./configure --prefix=/usr/local/mplayer --enable-gui --enable-freetype --with-codecsdir=/usr/lib/codecs/ --with-win32libdir=/usr/lib/wincodecs/ --language=zh_CN --cc=gcc32
--prefix=/usr/local/mplayer 指定安装目录。
--enable-gui 安装图形界面。
--enable-freetype 设置字体缩放。
--with-codecsdir=/usr/lib/codecs/ 指定解码器目录。
--with-win32libdir=/usr/lib/wincodecs/ 指定解码器目录。
--language=zh_CN 指定语言环境。(我没用这个参数,以前用过界面是乱码。)
--cc=gcc32 指定用 gcc32编译器,mplayer不能用gcc4.0编译。(我也没用这个参数,CentOS5的gcc版本是4.1.1)
[root@localhost ~]#make
[root@localhost ~]#make install

3、反安装命令:[root@localhost ~]# make uninstall (要反安装必须在当初执行make install安装时的目录执行make uninstall才行。或者你可以手工删除/usr/local/mplayer目录和/root/.mplayer目录。不过这样手工删除是否能删除干净我也不太清楚。)

4.安装皮肤

tar jxvf Abyss-1.6.tar.bz2
mv Abyss /usr/local/mplayer/share/mplayer/skins/
cd /usr/local/mplayer/share/mplayer/skins/
mv Abyss default

至此mplayer已经成为了万能播放器,执行程序在 /usr/local/mplayer/bin中

5.安装字体
cp /usr/share/fonts/chinese/TrueType/uming.ttf $HOME/.mplayer下
每个用户都有自己的环境变量HOME
cd $home/.mplayer
mv uming.ttf subfont.ttf 结束!

我安装的mplayer还不能支持中文文件名,不知那位高手指点。


第五步、编译内核

在开始编译内核前请先阅读colddawm在chinaunix论坛发表的一篇文章。

RedHat企业版自从AS4开始,桌面版本自从FC3开始,不再单独提供kernel -sourcecode的rpm安装包,原因是RedHat认为没有必要维护单独的kernel-sourcecode包,因为所有的源代码包都应该包含在.src.rpm中而不是rpm中。所以在这些高版本的RedHat Linux上,我们如果需要定制内核的话,没有直接的源代码rpm可以安装,只能通过kernel.org下载的tar.gz的包手工安装,或者通过 kernel-*.src.rpm编译出kernel-source包再来安装。后面一种方法可以享受到RedHat针对内核的某些参数和代码的优化,因此对使用RedHat发行版特别是企业版本的,是有一定好处的。
但是目前很多人至今分不清内核,内核开发,内核源代码一些包之间的关系,因此在编译内核的时候经常走弯路,同时RedHat官方对于如果得到kernel-source也没有明确的指示,导致很多人不得要领。

首先认清楚各rpm包的内容和用途
kernel-*.rpm ------------- 内核二进制包,没有的话系统都起不来
kernel-sourcecode-*.rpm------------------- 内核源代码包,安装到/usr/src/linux-*下面的,包含内核源代码,编译内核必须(当然是不考虑用kernel.tar.gz编译的情况),但高版本RedHat Linux不再提供此rpm,原因参见官方Release Note,这篇文章的最终目的就是要我们自己把这个包搞出来。
kernel-devel-*.rpm----------------内核开发包,安装到/usr/src/kernels,用于内核模块开发,组织形式跟内核源代码包类似,包含了部分内核源代码。注意很多人误认为这个就是内核源代码包,直接拿它来编译内核,当然不可能成功。这个包只是用于内核模块一级开发,例如驱动程序等,虽然也可以 make menuconfig make dep等,但make bzImage是不可能成功的,因为缺失了核心源代码。
kernel-*.src.rpm---------------RedHat提供的用于建立rpm的源代码包,安装到/usr/src/redhat中,使用rpmbuild可以从这个包中build出上面所说的所有包。


现在就来从src.rpm编译出上面的所有的包,除了sourcecode这个包其他的包都可以在不用修改任何地方的情况下直接rpmbuild出来,唯有sourcecode这个比较麻烦,一定要按照下面的步骤来做,我以RedHat AS4 所带的版本为例,其他版本相同。

#首先安装src.rpm
rpm -ivh kernel-2.6.9-5.EL.src.rpm
#进入相应目录,要修改spec文件
cd /usr/src/redhat/SPECS
vi kernel-2.6.spec
#主要修改如下地方:
1,define buildsource 0------------我的这个在第8行,改为1,这就是为什么没有源代码包的原因,因为默认不生成源代码包
2, Requires: qt-devel, gtk2-devel readline-devel ncurses-devel-------我的在572行,如果没用用X的话,把这句注释掉,这样编译出来的包就不依赖于X-window的某些包,因为内核配置是可以make xconfig的,所以默认依赖X-window,我没装X-window,因此这个就去掉了。
#保存退出
touch /etc/beehive-root
#这句命令非必须,如果不做的话,最后编译出来的包都会变成kernel-*.*-root.rpm,多了个root,据说是为了标示包的编译人的,如果touch了这个文件,就没有这个问题了,命名和官方rpm一样。
rpmbuild -ba --target=i686 ./kernel-2.6.spec
#编译i686平台的所有包,这样上面介绍的所有包都会生成,或者换成rpmbuild -bb --target=i686 ./kernel-2.6.spec只编译非src.rpm。
#所有包就会生成到/usr/src/redhat/RPMS/i686下面

#如果只需要sourcecode而并非所有rpm包,那在修改spec文件时还要修改如下行:

48 %ifarch noarch
49 %define builddoc 1
50 %define buildsource 0----------------这里0修改为1
在编译的时候使用rpmbuild -ba --target=noarch ./kernel-2.6.spec,这样仅仅编译soucecode和doc包,会节省很多时间。

我也试图按照文中的方法试过,不过我在kernel-2.6.spec文件中没有找到define buildsourc 0 这一行。而且编译过程也出了错就没能成功。我最后选择了linux-2.6.20.10.tar.gz内核源代码包。具体过程如下。

1、将源代码包解压到/usr/src中。
# cp linux-2.6.20.10.tar.gz /usr/src
# cd /usr/src
# tar -zxvf linux-2.4.7-12.tar.gz

2、检查/usr/src目录下是否有linux这个目录连接,如果有删除它重建。
# ls
kernel linux linux-2.6.20.10 redhat
# rm -f linux (删除原有连接)
# ln -s linux-2.6.20.10 linux (建立到linux-2.6.20.10的新连接)

3、修改Makefile文件。
# cd /usr/src/linux
然后编辑Makefile(这个文件是用来控制编译用的),找到这一行:
EXTRAVERSION =
修改为(比如".10-02"这样编译出来的内核将是vmlinuz-2.6.20.10-02,这是我第二次编译2.6.20.10内核,所以加个“-02”你也许不止一次编译内核,加上编号你可以清楚的知道自己每次编译内核的具体情况。)
EXTRAVERSION = .10-02

4、开始编译。
4.1执行命令.make mrproper该命令保证源代码目录下没有不正确的.o文件以及文件的相互倚赖关系.第一次编译源码包不用此命令,但如果多次使用这些源码编译内核,那么一定要先运行本命令.
#make mrproper

4.2执行命令下列命令中的一个
# make oldconfig (使用一个旧的config文件来编译内核,因该是当前使用的内核的config文件。)
# make config (文本界面逐项编译内核,不太好用,不推荐)
# make menuconfig (也是在文本界面下编译内核,但是是通过菜单来编译的,比较灵活,同时对其他软件的倚赖关系较少,推荐)
# make xconfig (在X界面下编译内核,但是对其它其它软件的依赖关系较多,你可以试一下,如果能行那最好了)

4.3内核选项
我手里也没有2.6.20内核的选项的详细资料。我是直接使用的2.6.18内核的选项config文件,然后参考一些比较接近2.6.20内核的其它内核选项资料来编译.26.20内核的。这样做的坏处是red hat 的2.6.18内核的某些选项在通用版本的2.6.20内核中是没有,在使用新内核启动过程中会出现一些报错,不过一般不影响系统的正常使用,(高手我这样想对不对?)。所以这里把关于内核的具体选项的情况就省略了,如果以后有了2.6.20内核的选项资料在及时补充。你可以到网上去搜索相关资料。
# cp /boot/config-2.6.18-8.el5 /usr/src/linux/.config
# make menuconfig
然后选择Load an Alternate Confidguration File来读入一个已经存在的config文件,默认.config就行。在你对内核选项选择完后别忘了Save an Alternate Configuration File来保存你所做的修改。

4.4make dep
# make dep 不太明白什么意思,好象是使你刚才对.config做的修改生效。

4.5make clean
# make clean 好像是清扫错误的连接呀、文件呀什么的,为了在接下来的编译过程中不出现错误。

4.6make
# make 真正的编译过程开始了,大概需要一个小时左右。以前这步的命令是make bzImage,最初linux对内核的大小是有限制的,make bzImage的意思是编译一个超过正常大小的巨大内核,不然系统就无法加载这个内核了,也就启动不了了。不过现在只需要make就可以了,我试过如果执行make bzImage反而会报错。不知我说的对不对。

4.7make modules
# make modules 编译内核模块,我们在选择内核选项是将很多选项选为了意思是在内核需要是加载这些模块,这样做主要是为了减小内核的大小,以便系统运行的更快。

4.8make modules_install
# make modules_isntall 安装4.7编译好的内核模块。不然系统就无法使用这些模块。

4.9make install
# make install 安装4.6编译好的新内核并在grub.conf配置文件中添加对应的启动选项。以前要使用一个新内核你要手动cp,ln -s,修改grub.conf文件,比较麻烦,现在只需make install就全搞定了,当然如果你愿意你还是可以手动添加新内核。

好了现在就shutdown -r now 或 reboot 重启电脑,你会发现你的新内核也出现在引导菜单中了。


第六步 一些有用的命令和使用技巧。

6.1 ~/.bashrc
linux有个别名命令。举例来说明这个命令的作用,比如我们要加载一个Fat32分区hdc7,需要输入命令
# mount -t vfat /dev/hdc7 /mnt/hdc7
可是每次加载是都要输入这么长的命令是不是比较麻烦,这时我们可以在~/.bashrc文件中加入:
alias hdc7='mount -t vfat /dev/hdc7 /mnt/hdc7'
以后我们要加载这个hdc7是只需输入命令
# hdc7
就可以,是不是有用?

6.2 shutdown -h now
关闭计算机的命令有poweroff和shutdown -h now,其中poweroff是直接关闭电源。这里我们要将的是shutdown -h now。
# shutdown -h (进入单用户模式)
# shutdown -h now (立刻关闭计算机)
# shutdown -h 12:00 now (在12:00关闭计算机,另外还可以规定在多长时间后关机,具体的表达式我忘记了。)
取消一个关机命令的命令是shutdown -c,比如你输入了shutdown -h 12:00 now ,可是你零时决定不在12:00关机了,你可以在打开一个新的终端输入
# shutdown -c
来取消刚才的关机命令。

6.3 >> 输出重定向(好像是叫这个明字吧)
举例说明它的用处,比如我们刚才编译内核是执行make命令后要输出许多显示到屏幕上,如果我们加入>>log
# make >>log
这时所有的对于屏幕的输出将全部作为文件log的输入。这样我们就可以通过log文件来具体分析整个的编译过程,便于我们找出出错的原因。

6.4 && 和 ; (叫不来它俩的名字,作用也只知道一点)
还是举例说明,还是make,时间很长,这时我们也许要外出,怎么办?
# make >>log &&shutdown -h now 就是把make的输出结果定义到log 并且make执行成功编译完成后 运行shutdown 关机命令

# make >>log;shutdown -h now 不管make执行是否成功在 make执行后 都运行shutdown
这样我们就可以在回来后通过分析log文家知道编译是否成功,如果出错,错误在那里。不必浪费时间在屏幕前傻等半天。是不是很有用啊。
阅读(1756) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~