12.22.2006

Notes of the LFS making(Fin)

I focused on the LFS about a week, I have finished installed the LFS, It can boot and work very well.
In fact I can finish it in 2 days, but I made some mistakes that shouldn't happen to me.

I didn't read the Notice on the LFS handbook. so I paid!
Most important: check the $LFS, and chroot (Esp when u reboot the PC).

When U install the Perl, U may face this problem:

Updating man page uname.1
Can't locate POSIX.pm in @INC (@INC contains: /tools/lib/perl5/5.8.4/i686-linux /tools/lib/perl5/5.8.4 /tools/lib/perl5/site_perl/5.8.4/i686-linux /tools/lib/perl5/site_perl/5.8.4 /tools/lib/perl5/site_perl .) at ./help2man line 28.
BEGIN failed--compilation aborted at ./help2man line 28.
make[2]: *** [uname.1] Error 2
make[2]: Leaving directory `/sources/coreutils-5.2.1/man'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/sources/coreutils-5.2.1'
make: *** [all] Error 2

Can't locate POSIX.pm in @INC (@INC contains: /tools/lib/perl5/5.8.4/i686-linux /tools/lib/perl5/5.8.4 /tools/lib/perl5/site_perl/5.8.4/i686-linux /tools/lib/perl5/site_perl/5.8.4 /tools/lib/perl5/site_perl .) at ./help2man line 28.
#ls /tools/lib/perl5/5.8.X
#ln -s /tools/lib/perl5/5.8.X /tools/lib/perl5/5.8.Y
#make

Error on installing
Shadow-4.0.9
./configure --libdir=/lib --enable-shared

/mnt/lfs/tools/bin/../lib/gcc/i686-pc-linux-gnu/3.4.3/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status


## ----------- ##
## confdefs.h. ##
## ----------- ##

#define PACKAGE "shadow"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME ""
#define PACKAGE_STRING ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define VERSION "4.0.9"
#define _GNU_SOURCE 1

configure: exit 77

Check the $LFS and chroot. :-)

Most of the check is no need, except the ones needed. :-)
Also, I cp the cmd to the shell. Wish U good Luck on the LFS!

12.19.2006

Notes of the LFS making

nYesterday, I began to make the LFS.and have some notes as follow
FATAL: can't create pic/regex.o



This maybe caused by didn't deleting the gcc-3.4.3 & gcc-build
So we'd better mv gcc-3.4.3 gcc-3.4.3bak &mv gcc-build gcc-buildbak

If any problems , I will post them.(To be continued).

12.18.2006

I was refused by Inspur!

Today, exactly yesterday, My classmates received the interview anouncement. Without mine.
I do want to enter a big IT provider though Inspur have close relationship with Microsoft. To tell the truth,I want to use my linux in my future job. However, Feel depressed to some extent, At least I tried.
Their exam is about C++, I don't like to programm. so I choose the Support depart, Why? The exam is basic, I failed. Funny, isn't it?My advantages can't be showed now. So I tell myself, If I am excellent, I will prove it!
Inspur, I won't let you down, Today, U refused me. Tomorrow, U will find U made a wrong descison. If u still keep so close with Microsoft. We should have our own OS, I don't want to hear that our national products be eaten by Microsoft.
Good Luck To Inspur and Myself!
A new start show on my way to success! Cheer Up!

12.14.2006

Basic tips for Linux programming(ZT)

If you’re new to Linux programming, then you might be interested in considering these aspects before you start your wonderful journey. Especially if you’ve programmed in Windows, you might want to change some of your ideas, so that you minimize the “culture” shock you experience when you encounter completely different ideas and ways of thinking.

Here are some of my tips, based on common questions asked in forums about Linux programming especially from experienced Windows programmers.

Evaluate every available alternative

Unlike the unified Windows API which provides the Windows programmer with a single method of achieving a certain objective, Linux provides a variety of ways to achieve the same objective. For instance there are a variety of GUI abstraction toolkits, the major ones being QT and GTK to write GUI programs. Again, you need not necessarily choose C or C++. There are many choices for programming including basic shell scripting, Perl, Python and PHP. So do not always have a fixed idea that you need to learn the “hard” way. In fact, you might be surprised to discover the power and elegance of scripting.

Do not be overwhelmed by choices. Just be aware of all of them and pick the tools and techniques that you’re most comfortable with.

IDEs are not necessarily more productive

Programmers who’ve used Microsoft Visual Studio extensively to do their development might find it uncomfortable to adapt to Linux’s way of doing things. While there are some pretty decent IDEs in Linux including Kdevelop, anjuta and Eclipse, you might actually find that using a text editor and creating a make file to be a better idea in the long run. Particularly when you are developing Free Software applications, you might not want to tie down development to a particular platform or IDE considering that your code will be shared and other programmers might also be contributing to your project. While IDEs are not always bad, you might find developing smaller projects using a simple text editor and a makefile a better idea.

Do not look for distribution-specific features

It might surprise many Windows programmers to know that you can practically make no assumptions about a default Linux configuration on the end user’s machine. Different distros use different configuration file locations and settings. Unless you’re writing a system configuration utility for a particular distro, try and avoid distro-specific assumptions. Also never force users to run as “root” unless your application’s sole purpose is to modify system specific settings.

Do NOT modify or attempt to modify system files

Apart from being bad programming etiquette,

  1. You cannot assume that a certain system file exists on the end user’s machine (because of distribution-specific differences).
  2. You simply cannot modify system files as a “normal” user and you cannot expect a normal productivity app to be run as “root.”

In most cases, you will find you hardly have any good reason to touch system specific files.

Be consistent visually

GUI programmers, especially GTK and QT programmers, need to understand that these libraries are heavily themeable (meaning that the end-user can modify the visual appearance of GUIs in almost any way possible - including fonts, colours and the widget appearance). Therefore, avoid using specific fonts or colours in your GUIs. You don’t need them. Do not force your end users to install any particular font on their system. Leave your application’s visual rendering entirely to the GUI library that you use. Unless you’re writing a word processor you might hardly ever need to directly handle fonts in your application’s code.

Be prepared to do some research

Linux does not come with an MSDN-like tool to provide you documentation for every single programming tool or API available out there. It’s simply not practical because Linux is not developed by a single company. In most cases if you’re using third-party libraries, you will be able to find documentation (either downloadable or online) on the official website of that particular library’s maintainer. Also be aware that quite a few libraries come with incomplete documentation or none at all.

You might have to look for sample code or even at header files to learn more about a particular library. Fortunately you might not encounter this situation in the case of most popular third-party libraries, but it’s better to be prepared nevertheless.

Do not package dependencies

When you’re creating a “distributable package” do not include dependencies along with your tarball. Just include the source and provide compiling instructions (the more generic, the better). Also mention the required dependencies in your README or INSTALL files and in your website. Since most Linux distributions have their own package management systems (and if you’re application is good enough, it might even be included in the official package repository), you should leave the dependency handling either to the end user who compiles your program manually or to the distribution package maintainer who ships your application as part of his package. Since every Linux distribution has a different way to manage dependencies, do not interfere with it by creating an “installation” routine that tries to be smart and installs other libraries.

Apart from creating versioning problems, it’s simply tedious and cumbersome to include dependencies with the program. Also try and keep the dependencies to a minimum, particularly if your program tends to use exotic third-party libraries.

Even if you’re not releasing your program as Free Software, try and keep the packaging to a minimum and provide instructions to the user on dependencies.

I hope this has been of use to you as a newbie to Linux programming. Happy programming!

From:

http://hari.literaryforums.org/2006/12/11/basic-tips-for-linux-programming/

12.13.2006

About asking questions.

Do u know how to use google? If someone ask me a question about computer.
Before we ask others questions, have we consider reslove the problem by ourselves?
Don't always keep asking, "勤学好问" is good words, Do u notice that "勤学" comes first?
I seldom refuse to answer if someone ask me (of course,if I know).But now I want to say, Please check google/baidu first.

PS: I had this idea,because I read some posts from BBS.Most of the questions could be sloved by using google/baidu! why do we wait for the others?
In the past, If I lock my putty with Ctrl+S, I would restart the putty. Today I search it. Found the solution: Ctrl+Q. Just simple! But I never thought of google before. :-) Easy and Funny. That's the description of our common problems.

Excellent Words From Guoing Zhou.

This morning, Suddenly read sth about Guoping.Zhou. So search sth about him.
This is his blog http://blog.sina.com.cn/m/zhouguoping
And I collect some excellent words from that blog, (at least I feel they are excellent. :-)
什么是人文精神呢?我理解的人文精神,简单地说,就是现在人们经常说的“以人为本”。也就是说,要把人放在最重要的位置上,要尊重人的价值。具体到教育 上,就是要把人身上的那些最宝贵的价值通过教育实现出来,一种合格的教育就应该是把学生身上那些人之为人的价值放在最重要的位置上的,应该是能够让学生把 这些价值实现出来的。教育就是育人,就是要把学生培育成真正的人,亦即人的宝贵禀赋都得到发展的人,而不是仅仅能够满足社会上、市场上某种需要的人。简要 地说,人文精神的核心是尊重人之为人的价值。与此相应,教育的根本使命就是要实现人之为人的价值。

我认为人身是有三样东西是最宝贵的。第一个是生命,生命对于每个人来说都是最宝贵的,没有生命其它一切都谈不上。第二个是头脑,人是有理性能力的,有智力 活动的。第三是灵魂,人是有精神需要、精神追求、精神生活的。所以,与这三样东西相应,为了实现这三样最宝贵的东西的价值,我们就有相应的教育项目。

教育最重要的任务,第一是培养学生对知识的兴趣,第二是培养学生自主学习的能力。作为大学生,尤其是研究生,你必须有这个清醒的意识,千万不要把注意力放 在学习死的知识上。你要学会自己安排自己的学习,知道自己要朝哪个方向钻研,应该看些什么书。自主学习是一切有成就的人的共同特点,他们都必定是具备这个 能力的。

谈到美育,现在许多家长好像很重视孩子的艺术教育,给孩子报各种班,学各种技能,弹钢琴呀,画画呀,但出发点极其功利,无非是为了孩子将来多一条路可走。 这是很糟糕的,违背了美育的本义,结果只能是败坏孩子对艺术的感觉。艺术是最自由、最没有功利性的精神活动,搀杂进功利的考虑,就不是艺术了。

人类的精神宝库属于每一个人,向每一个人敞开着,你不走进去享受里面的珍宝,就等于你把自己的权利放弃了,那是何等可惜。

To read more, U could visit his blog.
Some of his words hit the faults of our education excatly.

12.12.2006

Grid VS Cluster

Grid computing is where you have separate administrative domains over a wide area, machines used by different people trying to cooperate.

Clustering is where you have a set of machines in one place, and you're trying to get them look like a single machine.

There are different aspects from the user's standpoint when they run their jobs, from the administration side when you do things like update the software.

The grid refers to a parallel and distributed system with *distributed* resource management , whereas a cluster hascentralised resource management.
Usually, a Grid would be composed of nodes that are themselves clusters.

Think of a cluster as a 'local' concept, and a grid as a 'global' concept...

Now I could understand the difference between the grid and cluster to some extent, what about you?

12.10.2006

Some idea of the job!

My teacher told me something about job today, To tell the truth, I didn't care the job too much.
I found it's most exciting do my study, especially the Linux. One of my best friends also
asked me about my plan, I say "No hurry." It's not because I don't want to assign the job, but no company need some students like me. Don't want to program as a student come from Computer Science.
The truth is: I want to do sth in the field of Linux/Network. So, I join the CCNA class now. and will gain the CCNA paper to prove sth, therefore, I have the ability that class require. "Who would believe? They won't let u act your ability in the interview." My friends warned me. Yes, I can't operate Linux on the spot, and without RHCE paper. They won't believe. So I do the test...... Pay money for proving sth. Isn't funny? That's the reality.
I want to find a job that will fit the company and me. That's the development for both of us. If I could find a job that could fill my favourite, Is the salary a problem? Or, Will I be happy with boring work? Money is one thing, Future is another!

12.08.2006

Build Our First Cluster(Simple Ver)

1、Prepare our cluster hosts(at least 2 hosts,U can use Vmware).
Our example is based on 2 hosts because of my poor pc env. to slow for more hosts.
2、Set the cluster hosts, our hosts are linux
PC1 ip:192.168.0.150 netmask 255.255.255.0
PC2 ip:192.168.0.160 netmask 255.255.255.0
#service sshd start (both the hosts)
Note: we should set the ssh service for logging into each other without password.
do as follow:
a. pc1$ssh 192.168.0.160 if ok then b
b. pc1$ssh-keygen rsa (passphrse u can type : yourpassword (twice of course))
c. pc1$scp -p .ssh/id_rsa.pub pc2:.ssh/authorized_keys
d. pc1$ssh-agent $SHELL
e. pc1$ssh-add (input the : "yourpassword" u just input in step b)
f. pc1$ssh 192.168.0.160 will need no password if not check with the follow web site
http://kimmo.suominen.com/docs/ssh/
3、Get the code and make it.
the taskmaster code offered by ClusterMonkey
Put the code for task.c and its Makefile in a subdirectory on your system(s) and build it (just entering "make" should do it, if gcc and make are installed and correctly set up).
Put the resulting "task" binary on a consistent path on all the systems. This might be someplace like /tmp/task.
Put the taskmaster script in a convenient place -- probably your working subdirectory where you have the task.c source. If you execute the taskmaster script without arguments (be sure to set its executable bits) it will also tell you its argument list. If it complains about not knowing about threads, you will need to update your version of perl to one that includes thread support.
4、Test the cluster
$vi hostfile ( had better in the taskmaster directory:-)
$cat hostfile
192.168.0.160
192.168.0.150
$chmod +x taskmaster
$./taskmaster 1 10 1
$./taskmaster 2 10 1 ( comp the time consume by the task)
$./taskmaster 1 10 10
$./taskmaster 2 10 10 ( comp the time consume by the task)
Will You find something different. Then We succeed! Congratulations!

Reference:
ClusterMonkey Web Site http://www.clustermonkey.net

Linux security expert Kurt Seifried(Part)

Lc: There's so many distributions out there. Can someone still be a "Linux security" expert today without having to be on top of all the nuances in all the many distributions, or is this another layer of complexity they have to know?

KS: Well, the good news is that most Linux systems are pretty similar. You have the same class of vulnerabilities and attacks in most cases: poor file permissions, badly written applications, etc.

There are, of course, differences (Where the heck is config file X? And why did they allow this service by default?), but once you learn the core fundamentals, how to read man pages, and probably most importantly of all how to use Google, you should be ok.

Lc: Do you have any favorite Linux security tools?

KS: SELinux for host security (fine grained control, but a monster to configure!). Nmap for verifying that my firewall rules are correct. Emacs for editing files to configure my system securely. There is literally no one tool that is my favorite, but indeed hundreds.

Lc: What's the one most important thing that your average Linux admin can do to increase security?

KS: I guess that would be run the automatic updater your distribution comes with. If nothing else, this will minimize the number of gaping-wide holes in your system. Security is a holistic practice, you are only as strong as your weakest link, an attacker only needs to find one mistake to exploit a system.

Lc: So can it be said that newer software -- like in unstable or beta releases -- is generally more secure than old, tested software that's been around for a few years?

KS: Nope. [The new software] probably contains a ton of security holes as well -- just not widely known ones (yet).

The difference being, an older version has holes for which I can get exploit code from Packet Storm or Metasploit, and break in trivially. The newer holes take a little more time to develop exploit code for.

Original Link:
http://www.linux.com/article.pl?sid=06/12/01/18023

More About the Linux Security Guide by Kurt Seifried
http://www.seifried.org/lasg/

旧的Blog

今天打开看看,有些东西还是 值得收藏的,先连接过去吧
http://xfsuper.cublog.cn

RedHat9.0安装qmail--ABC

如果爱.请别用眼泪感动爱情(ZT)

Fcitx3.x不能输入问题

用 Linux 打造路由器(转载)

12.07.2006

GFS与RHCS安装记录(转贴自CU)

GFS与RHCS安装记录
硬件环境 :双 AMD 275HE双核CPU/4G内存/73G scsi
操作系统 :RedHat AS 4 update 2
内核版本 :2.6.9-22.ELsmp

1. 到redhat 网站上下载相应的Cluster Suite/GFS软件。由于没有注册号,无法通过up2date升级,因此会比较麻烦。
到ftp: //ftp.redhat.com/pub/redhat/linux/updates/enterprise/4AS/en/下载 相应的RHCS和 RHGFS的src.rpm文件,在一个目录下,往往有相同软件的几个版本存在。以下安装笔记中所使用的软件是以RHAS4 U2为 准。
1.1 安装cman-kernel-2.6.9-39.5.src.rpm
rpm -iv cman-kernel-2.6.9-39.5.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba --nodeps cman-kernel.spec #加--nodeps 的 原因是提示,kernel-hugemem-devel = 2.6.9-22.EL is needed,尝试解决未果,放弃。希望不会出现问题。
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh cman-ker*

1.2 安装magma-1.0.1-4.src.rpm

1.3 安装dlm-kernel-2.6.9-37.7.src.rpm

1.4 安装dlm-1.0.0-5.src.rpm

1.5 安装ccs-1.0.2-0.src.rpm

1.6 安装gulm-1.0.4-0.src.rpm

1.7 安装magma-plugins-1.0.2-0.src.rpm

1.8 安装cman-1.0.11-0.src.rpm

1.9 安装fence-1.32.10-0.src.rpm

1.10 安装iddev-2.0.0-3.src.rpm

1.11 安装perl-Net-Telnet-3.03-1.2.el4.rf.src.rpm

1.13 安装piranha-0.8.1-1.src.rpm

1.14 安装rgmanager-1.9.38-0.src.rpm

1.15 安装system-config-cluster-1.0.16-1.0.src.rpm

1.16 安装GFS-kernel-2.6.9-42.1.src.rpm

1.17 安装GFS-6.1.2-0.src.rpm

1.18 安装gnbd-kernel-2.6.9-9.12.src.rpm

1.19 安装gnbd-1.0.1-1.src.rpm

1.20 安装lvm2-cluster-2.01.14-1.0.RHEL4.src.rpm

1.21 安装rgmanager-1.9.38-0.src.rpm

1.22 安装ipvsadm-1.24-7.src.rpm
rpm -iv ipvsadm-1.24-7.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba ipvsadm.spec
cd /usr/src/redhat/RPMS/x86_64/
rpm -ivh ipvsadm-*
安装完毕

2. 完成GFS server的配置(该文章参考suran007 的GFS6.1 ON RHAS4 U2安装文档)

2.1 确保相关设备的主机名和IP地址的对应关系都在/etc/hosts中
例:
10.1.5.161 host1
10.1.5.162 host2
10.1.5.163 host3 #host3作为gnbd的server

2.2 在host3上配置GFS通过gnbd进行export
启动gnbd_serv进程
root@host3 # /sbin/gnbd_serv –v –n
导出设备
root@host3# gnbd_export -v -e gfs -d /dev/sdb1 –c
查看export状态信息
root@host3# gnbd_export -v -l
完成GFS server,为了使实验更顺利,建议将防火墙停掉 service iptables stop

3. 使用system-config-cluster工具对node1和node2进行配置
在node1的命令格式下输入:system-config-cluster,进入配置界面
3.1然后在系统中,第一次配置会提示是否要创建配置文件/etc/cluster/cluster.conf,点击"create "
3.2然后选择 锁机制,选择dlm。
3.3添加cluster nodes。
点击“add a cluster node",添加node1,quorum votes填1。
点击“add a cluster node",添加node2,quorum votes填1。
3.4 添加fence设备
在”fence device"中,选择“add a fence device",这里添加的是"manual Fencing",名字任意,这里写”web"。
在"cluster Nodes->node1和node2”,中“manange fencing for this node",选择”add a fence level"。
3.5 创建"failover domains"
在“manager resource->failover domains"中,”create a failover domain",名称为web
点击“manager resource->failover domains->web", "edit failover domain propertis",在"available cluster node2"中,将node1和 node2都添加进取。
3.6 创建”resource"
"create a resource",选择IP address,地址为“10.1.5.169",后边的monitor link要选中。
"create a resource",选择script,name 为"httpd",script为"/etc/init.d/httpd"。
先保存,然后将cluster.conf传到node2相同位置一份。下边要配置gfs的一些resource,但是前提是cluster mananger的进程需要启动才能进行设置。
4. 配置GFS参数
启动cluster进程顺序:
service ccsd start
service cman start
service fenced start
service clvmd start
service gfs start
service rgmanager start
然后在node1上,首先
modprobe gnbd
将gfs通过gnbd倒入:gnbd_import -v -i node3
检查加载状态:gnbd_import -v -l
modeprobe gfs
gfs_mkfs -p lock_dlm -t cluster1:gfs -j 2 /dev/gnbd/gfs 创建文件系统
在node2上重复此操作,只是不用再重做创建文件系统的操作
再打开system-config-cluster,
接着创建"resource"
"create a resource",选择GFS,name "web_content",mount point:"/gfs",device:"dev/gnbd/gfs"。

5.配置service
由于是为了实现httpd的集群,因此需要对/etc/httpd/conf/httpd.conf一些内容进行修改,包括
设置监听地址为floating ip:Listen 10.1.5.169:80
修改DocumentRoot 为"/gfs/"

同时chkconfig httpd off,将httpd 的自启动关闭
"service","create a service", name设为httpd。
failover domain为 web。
点”add a shared resource to this service" ,首先把ip address加入。
选择”10.1.5.169 ip address share",然后再“attach a shared resource to the selecetion",分别添加刚才设的script和gfs的resource。
保存配置,并复制该文件到node2。

分别重新启动进程:
service rgmanager stop
service gfs stop
service clvmd stop
service fenced stop
service cman stop
service ccsd stop

service ccsd start
service cman start
service fenced start
service clvmd start
service gfs start
service rgmanager start

6. 开启service
打开,system-config-cluster,如果刚才的管理进程都正常的话,将会有cluster management的tab。
在service 中,点击httpd 按"enable"启动。

debug技巧:如果无法正常启动,尝试着去掉一些resource,然后再看是否正常启动,来定位故障。
如果要学习和试验,建议按如下顺序进行前期的阅读:
Data sharing with a GFS storage cluster :
http://www.redhat.com/magazine/006apr05/features/gfs/ 看一遍
Red Hat Cluster Suite Configuring and Managing a Cluster
http://www.redhat.com/docs/manuals/csgfs/pdf/rh-cs-en-4.pdf 看2遍
Red Hat GFS 6.1 Administrator's Guide http://www.redhat.com/docs/manuals/csgfs/pdf/rh-gfs-en-6_1.pdf 看1遍

GFS6.1 ON RHAS4 U2安装文档 http://bbs.chinaunix.net/viewthread.php?tid=746833&extra=page%3D1 照着做一遍

现在能有一大概的认识
看http://unixnotebook.blogspot.com/2005/07/redhat-cluster-4-how-to.html 一遍 做试验。

呵呵,竟然作者在本站有Blog?

庆祝CUPLinux社区开业!

以前找了很多的Blog,都不怎么样,不知道这个能怎么样,毕竟新开业。庆祝一下,如果好就把那些搬家喽。希望能给朋友们带来一些你想要的东西。