Red Hat 133 Course notes part 1
These are my course notes on Red Hat. Notes here are not detailed as it should be, but I did it on purpose. I do not want to fall in to details too deep. I only highlighted the important things.
1. Package Management
- Setup Repository: /etc/yum.repos.d/
- Import Key: rpm --import /etc/pki/{redhat release}
2. System Initialization
Boot Sequence:
1. BIOS
2. Boot Loader => 1st stage, 2nd stage
3. Kernel
4. init starts, execute:
a. /etc/rc.d/rc.sysinit
b. /etc/rc.d/rc /etc/rc.d/rc[0-6].d/
c. /etc/rc.d/rc.local
d. Virtual consoles
e. X display
3. Kernel Services
Kernel Modules
– lsmod => list of loaded modules
– modinfo
– modproble => load & unload module
– /etc/modprobe.conf
Initial RAM Disk (initrd)
– mkinitrd /boot/initrd-`uname -r`.img `uname -r`
– mkinitrd --with=[modules name]
– /etc/modprobe.conf
– /etc/sysconfig/mkinitrd
Kernel configuration
– /proc/sys/
– /etc/sysctl.conf
– sysctl -a => list current setting
– sysctl -p => reprocess setting
– sysctl -w net_ipv4_ip_forward=1 => write config
Managing Devices
– /etc/udev/rules.d/
A letter for Firman
What could unite us, Indonesian, as a nation? Nonetheless, no other than football. And tomorrow is the D-day, the final match, not as classy as world cup final, but for our people, AFF Suzuki Cup final is prestigious enough.
Yes, I know we are having difficult time now, being beaten 3-0 by Malaysian must be a hard blow. But, you must see the light in the end of the tunnel, even if we lose tomorrow, the light of hope never ceases to shine.
Here is a letter to our team captain, Firman Utina, from ES Ito. A very well versed and inspirational letter indeed. Read it.
Surat Untuk Firman
Kawan, kita sebaya. Hanya bulan yang membedakan usia. Kita tumbuh di tengah sebuah generasi dimana tawa bersama itu sangat langka. Kaki kita menapaki jalan panjang dengan langkah payah menyeret sejuta beban yang seringkali bukan urusan kita. Kita disibukkan dengan beragam masalah yang sialnya juga bukan urusan kita. Kita adalah anak-anak muda yang dipaksa tua oleh televisi yang tiada henti mengabarkan kebencian. Sementara adik-adik kita tidak tumbuh sebagaimana mestinya, narkoba politik uang membunuh nurani mereka. Orang tua, pendahulu kita dan mereka yang memegang tampuk kekuasaan adalah generasi gagal. Suatu generasi yang hidup dalam bayang-bayang rencana yang mereka khianati sendiri. Kawan, akankah kita berhenti lantas mengorbankan diri kita untuk menjadi seperti mereka?
Di negeri permai ini, cinta hanyalah kata-kata sementara benci menjadi kenyataan. Kita tidak pernah mencintai apapun yang kita lakukan, kita hanya ingin mendapatkan hasilnya dengan cepat. Kita tidak mensyukuri berkah yang kita dapatkan, kita hanya ingin menghabiskannya. Kita enggan berbagi kebahagiaan, sebab kemalangan orang lain adalah sumber utama kebahagiaan kita. Kawan, inilah kenyataan memilukan yang kita hadapi, karena kita hidup tanpa cinta maka bahagia bersama menjadi langka. Bayangkan adik-adik kita, lupakan mereka yang tua, bagaimana mereka bisa tumbuh dalam keadaan demikian. Kawan, cinta adalah persoalan kegemaran. Cinta juga masalah prinsip. Bila kau mencintai sesuatu maka kau tidak akan peduli dengan yang lainnya. Tidak kepada poster dan umbul-umbul, tidak kepada para kriminal yang suka mencuci muka apalagi kepada kuli kamera yang menimbulkan kolera. Cinta adalah kesungguhan yang tidak dibatasi oleh menang dan kalah.
Hari-hari belakangan ini keadaan tampak semakin tidak menentu. Keramaian puluhan ribu orang antre tidak mendapatkan tiket. Jutaan orang lantang bersuara demi sepakbola. Segelintir elit menyiapkan rencana jahat untuk menghancurkan kegembiraan rakyat. Kakimu, kawan, telah memberi makna solidaritas. Gocekanmu kawan, telah mengundang tarian massal tanpa saweran. Terobosanmu, kawan, menghidupkan harapan kepada adik-adik kita bahwa masa depan itu masih ada. Tendanganmu kawan, membuat orang-orang percaya bahwa kata “bisa” belum punah dari kehidupan kita. Tetapi inilah buruknya hidup di tengah bangsa yang frustasi, semua beban diletakkan ke pundakmu. Seragammu hendak digunakan untuk mencuci dosa politik. Kegembiraanmu hendak dipunahkan oleh iming-iming bonus dan hadiah. Di Bukit Jalil kemarin, ada yang mengatakan kau terkapar, tetapi aku percaya kau tengah belajar. Di Senayan esok, mereka bilang kau akan membalas, tetapi aku berharap kau cukup bermain dengan gembira.
Firman Utina, kapten tim nasional sepak bola Indonesia, bermain bola lah dan tidak usah memikirkan apa-apa lagi. Sepak bola tidak ada urusannya dengan garuda di dadamu, sebab simbol hanya akan menggerus kegembiraan. Sepak bola tidak urusannya dengan harga diri bangsa, sebab harga diri tumbuh dari sikap dan bukan harapan. Di lapangan kau tidak mewakili siapa-siapa, kau memperjuangkan kegembiraanmu sendiri. Di pinggir lapangan, kau tidak perlu menoleh siapa-siapa, kecuali Tuan Riedl yang percaya sepak bola bukan dagangan para pecundang. Berlarilah Firman, Okto, Ridwan dan Arif, seolah-olah kalian adalah kanak-kanak yang tidak mengerti urusan orang dewasa. Berjibakulah Maman, Hamzah, Zulkifli dan Nasuha seolah-olah kalian mempertahankan kegembiraan yang hendak direnggut lawan. Tenanglah Markus, gawang bukan semata-mata persoalan kebobolan tetapi masalah kegembiraan membuyarkan impian lawan. Gonzales dan Irvan, bersikaplah layaknya orang asing yang memberikan contoh kepada bangsa yang miskin teladan.
Kawan, aku berbicara tidak mewakili siapa-siapa. Ini hanyalah surat dari seorang pengolah kata kepada seorang penggocek bola. Sejujurnya, kami tidak mengharapkan Piala darimu. Kami hanya menginginkan kegembiraan bersama dimana tawa seorang tukang becak sama bahagianya dengan tawa seorang pemimpin Negara. Tidak, kami tidak butuh piala, bermainlah dengan gembira sebagaimana biasanya. Biarkan bola mengalir, menarilah kawan, urusan gol seringkali masalah keberuntungan. Esok di Senayan, kabarkan kepada seluruh bangsa bahwa kebahagiaan bukan urusan menang dan kalah. Tetapi kebahagiaan bersumber pada cinta dan solidaritas. Berjuanglah layaknya seorang laki-laki, kawan. Adik-adik kita akan menjadikan kalian teladan!
[Errno 14] PYCURL ERROR 7
If you ever experienced this:
http://ftp.jaist.ac.jp/pub/Linux/Fedora/updates/13/i386/repodata/b87fb6411aa863b41e08a5a7a9a66502850dc8d04df5199a06b23b7369809916-primary.sqlite.bz2:[Errno 14] PYCURL ERROR 7 – “” Trying other mirror.
Probably coz’ you didn’t set up your proxy right.
Check your /etc/yum.conf for you proxy setting.
Open Source Solution: CACTI
One thing I like about open source community is that they always have solution for your problem at hand, for free. Let see, I needed tools to monitor my servers and I needed only to lay my fingers on my keyboard and type “monitoring tools linux” (it’s google in case you asking), so behold the list of open source monitoring tools presented in front of me. It’s like magic. I then chose one just based on my liking.
I chose CACTI. What kind of magic does CACTI do? In their own word, CACTI is
“A complete network graphing solution designed to harness the power of RRDTool‘s data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for LAN-sized installations up to complex networks with hundreds of devices.”
Next step was to install it. I looked around and found this nice installation guide:
http://www.cyberciti.biz/faq/fedora-rhel-install-cacti-monitoring-rrd-software/
The article covers almost all what you need to have a working CACTI. I said almost, because I stumbled upon few hurdles, which I will present shortly.
First hurdle was the installation path was different, in my case the installation files went to /var/www/ instead of /usr/share/. But, this was no drama, I can pass this easily.
Second hurdle was solely because of my stupidity and my tendency to skip all ‘unimportant’ part of any guide. The guide stated that I have to setup cron job and off course the guide have step by step guide on how to do this. I skipped it. You see, setting cron job is a trivial job, this was what I did:
#sudo crontab -e
Adding the file with this line:
*/5 * * * * cacti /usr/bin/php /var/www/cacti/poller.php > /dev/null 2>&1
Voila, crontab is set up nicely. Little that I knew, this action would cause me painful hours of debugging the application. After the installation was finished and everything seemed heavenly, I suddenly lost some data. The graph did not show any data for about 15 minutes span and then the data showed up just like that. Below I show you the graphic.
Graphic above shows disk utilization. It cannot be right, because in some part it shows total disk size is zero. So, the data gathering process must be flawed.
I realized my mistake when I found yet another good article (it is actually an official manual from CACTI)
http://docs.cacti.net/manual:087:4_help.2_debugging#debugging
Look at the “RPM Installation?” section. It discusses about the possibility of two cron jobs (also known as poller job) running which there should be only one cron job running. This can happen because newer RPMs automatically set up cron job for you and it put the cron job configuration in /etc/cron.d/cacti. What I did was ‘crontab -e‘ and this command put the cron job configuration in other place. So, I basically set two cron jobs instead of one. This was what causing the weird graphic result. To fix this, I just have to remove the cron job I set earlier using this command:
#sudo crontab -r
After I fixed this, the CACTI works like a charm.
Kernel Update
Download kernel from http://www.kernel.org/pub/linux/kernel/v2.6/ or any other place that suits your preferences.
After you have the kernel, follow these steps to update (steps below is updating kernel from 2.6.18-92 to 2.6.24.1 in Centos 5.2) :
1. Untar the kernel.
#tar -zxf linux-2.6.24.1.tar.gz
2. Go to the resulting directory, in this case, it is linux-2.6.24.1. And then configure the kernel. Configuring the kernel can be done several way either by make oldconfig, make menuconfig, or make xconfig. I prefer the make menuconfig.
#cd linux-2.5.24.1
#make menuconfig
3. Choose your option and make the kernel.
#make
#make modules
4. Install modules and kernel.
#make modules_install
#make install
5. Check the grub configuration file, /boot/grub/grub.conf, there should be additional line, similar to the following:
title CentOS (2.6.24.1)
root (hd0,0)
kernel /vmlinuz-2.6.24.1 ro root=/dev/VolGroup00/LogVol01 rhgb quiet
initrd /initrd-2.6.24.1.img
6. Reboot your system and choose to boot from your new kernel.
#reboot
modprobe vs insmod
For a novice linux user (like me), the differences between modprobe and insmod can be somewhat confusing. I know that modprobe and insmod are used to install or load modules to linux kernel, but then what are the differences? Even more, when I tried the following
modprobe /path/to/module.ko
it didn’t work, while when I used
insmod /path/to/module.ko
it worked like a charm.
It turned out to be simple, here are the key points:
1. modprobe calculates all of the module dependencies and then load the module along with the dependencies, while insmod does not care about dependencies, insmod only loads the module in question.
2. How modprobe calculates module dependencies? First let me introduce you the depmod tool, this tool’s function is to calculate module dependencies for all modules located in /lib/modules/`uname -r`/ and then keep the dependencies information in /lib/modules/`uname -r`/modules.dep. depmod usually runs when system is booted or when there is new module installed or when you call depmod -a from shell. For example, consider module A, and this module depends on module B and module C. depmod finds that module A needs module B and module C, and then depmod keeps this information in form of “A:B C” in /lib/modules/`uname -r`/modules.dep. Now, let us return to modprobe. modprobe basically reads the modules.dep file and then loads, using insmod, the module and all of the dependencies.
3. So why modprobe /path/to/module.ko didn’t work? It is simply because modprobe only deals with modules in /lib/modules/`uname -r`/. So, if you want it to work, create soft link from /path/to/module.ko to /lib/modules/`uname -r`/.
ln -s /path/to/module.ko /lib/modules/`uname -r`
and don’t forget to refresh the modules.dep
depmod -a
and call the modprobe, also loose the .ko
modprobe module
So that’s it.
`uname -r`The Big Bang Theory (TV serial)
I just bought the season 3 DVD.
It is funny as hell…
OMG I cannot stop LMAO…

