Introduction
CentOS is a 100%-compatible, service-free
distribution of Red Hat Enterprise Linux. If you like the OS but don't need the
service, CentOS is the thing for you.
Setup
By default, CentOS 5 comes as a
single DVD or a set of six CD's. If you don't have a DVD burner and don't want
to burn that many CD's, here's how to burn a small, bootable CD just to boot
up, and fetch the actual install files from a remote server (FTP or HTTP):
- Download the 7MB os/i386/images/boot.iso (a.k.a. netinstall.iso), and burn this to a CDR(W)
- Write down a list of different FTP or HTTP servers from
which to fetch files. It's good to have more than one, since that server
might be busy or off-line while you're installing.
For instance, to download CentOS 5 from French ISP Free: FTP = ftp.free.fr, Directory = /mirrors/ftp.centos.org/5.3/os/i386/ , DNS = 212.27.54.252 and 208.67.220.220
List of mirrors from which to install CentOS
- At the boot prompt, type "linux askmethod"
- Once installed, update the system with "yum update". In case a new kernel was installed, type "reboot" to boot up with that new kernel
Post-install
setup
Removing
packages
yum list installed
yum remove exim
Stopping
and removing IP(6)Tables
- /etc/init.d/iptables stop
- /etc/init.d/ip6tables stop
- yum remove iptables
NTP
- yum install ntp
- chkconfig ntpd on
- ntpdate 0.fr.pool.ntp.org
- vim /etc/ntpd.conf
server 0.fr.pool.ntp.org
server 1.fr.pool.ntp.org
server 2.fr.pool.ntp.org
server 3.fr.pool.ntp.org
- /etc/init.d/ntpd start
Once NTPd is up and running, you
might need to set the BIOS clock to match the system clock:
- date
- hwclock
If the BIOS ("hardware")
clock is in the wrong time zone, run the following and check again:
- hwclock --systohc
- hwclock
Vim
yum install vim
vim ~/.vimrc
set tabstop=4
set autoindent
syntax enable
Checking
CPU information
dmidecode processor
Monitoring
temperature
- (Motherboard-dependent) yum install kmod-it87
- yum install lm_sensors
- sensors-detect
- sensors
If "sensors" fails,
reboot, and give it another shot. Alternatively, try loading the required
drivers manually, eg.
# modprobe coretemp
# modprobe i2c-i801 (check which
driver you need by checking data writtent to /etc/sysconfig/lm_sensors)
Man
pages
yum install man
yum install man-pages
DHCP
to Static IP
To go from DHCP to static IP, either
run system-config-network, or do this:
- vim /etc/sysconfig/networking/devices/ifcfg-eth0
BOOTPROTO=none
NETMASK=255.255.255.0
IPADDR=192.168.0.100
GATEWAY=192.168.0.1 - vim /etc/resolv.conf
search your-dns-search-path
nameserver dns1-ip-address
nameserver dns2-ip-address - service network restart
- ifconfig
Samba
Here's how to share the whole root
filesystem:
- Edit /etc/samba/smb.conf:
workgroup is set to 'Workgroup'
turn on encrypted passwords
set up a share with '/' as the directory path, read+write access and proper user/group control - user alias for root in /etc/samba/smbusers that looks like this: root=administrator
- set root's samba password with smbpasswd to the same as the 'administrator' on your windows computer.
- restart samba
- log in as administrator on the windows machine and test your config - you should just be able to log in without entering a password or username in this config. If you're a different user, it should ask for a username and password.
Tips
& Tricks
Using
Netstat to display open TCP and UDP ports
netstat -tua
Editing
the PATH environment variable
- Create a new text file in the /etc/profile.d/ directory
- Add this line:
export PATH=$PATH:/my/new/path
- Change access rights to this file: chmod 755
- Log off and log back on
- echo $PATH
Capturing
a whole session
"script" starts a new
shell and everything you do will be captured to a file named typescript. Type
"exit" to close this shell, and the whole session is found in a file
named "typescript".
Nano
Support for keys Home, End and Del
(Del!=Backspace) ?
Compiling
a new kernel
I needed to build a kernel for a
Pentium CPU, ie. that uses the i586 command set instead of the default kernel
that uses the i686: How To Compile A Kernel - The CentOS Way :
- yum groupinstall "Development Tools" (installs kernel source + devel + headers, and rpm-build?)
- wget http://mirror.centos.org/centos/5.1/os/SRPMS/kernel-2.6.18-53.el5.src.rpm
- rpm -Uvh kernel-2.6.18-53.el5.src.rpm
- cd /usr/src/redhat/SPECS
- # rpmbuild -bp --target=i586 kernel-2.6.spec
error: Architecture is not included: i586 - cp /boot/config-2.6.18-53.1.4.el5 /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i386/.config
- cd /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i386/
- make menuconfig
HOSTCC scripts/kconfig/lxdialog/checklist.o
In file included from scripts/kconfig/lxdialog/checklist.c:24:
scripts/kconfig/lxdialog/dialog.h:31:20: error: curses.h: No such file or directory
In file included from scripts/kconfig/lxdialog/checklist.c:24: scripts/kconfig/lxdialog/dialog.h:128: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘use_colors’
scripts/kconfig/lxdialog/dialog.h:129: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘use_shadow’
scripts/kconfig/lxdialog/dialog.h:131: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘attributes’
scripts/kconfig/lxdialog/dialog.h:143: error: expected ‘)’ before ‘*’ token
- cd /usr/src/redhat/SPECS
- rpmbuild -bp --target=i386 kernel-2.6.spec
- cp /boot/config-2.6.18-53.1.4.el5 /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i386/.config
- cd /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i386/
- make menuconfig
HOSTCC scripts/kconfig/lxdialog/checklist.o
In file included from scripts/kconfig/lxdialog/checklist.c:24: scripts/kconfig/lxdialog/dialog.h:31:20: error: curses.h: No such file or directory
In file included from scripts/kconfig/lxdialog/checklist.c:24: scripts/kconfig/lxdialog/dialog.h:128: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âuse_colorsâ
- yum install rpm-build kernel-devel.i686
- yum install redhat-rpm-config.noarch ncurses-devel
- cd /usr/src/redhat/SPECS
- rpmbuild -bp --target i386 kernel-2.6.spec
- cd /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i386
- ln -s /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i386 /usr/src/linux
- make mrproper
- cp /boot/config-2.6.18-53.1.4.el5 .config
- make menuconfig
- make bzImage
arch/i386/kernel/cpu/cpufreq/powernow-k8.c: In function âpowernowk8_initâ: arch/i386/kernel/cpu/cpufreq/powernow-k8.c:1435: error: âstruct cpuinfo_x86â has no member named âbooted_coresâ
make[3]: *** [arch/i386/kernel/cpu/cpufreq/powernow-k8.o] Error 1
Installing
a DHCP + TFTP servers
- yum install dhcp
- edit /etc/dhcpd.conf
- if not installed by the package, "touch /var/lib/dhcpd/dhcpd.leases"
- yum install xinetd
- wget http://dag.wieers.com/rpm/packages/tftp/tftp-server-0.34-0.2.el5.rf.i386.rpm
- rpm -Uvh tftp-server-0.34-0.2.el5.rf.i386.rpm
- vim /etc/xinetd.d/tftp : disable = no
- service xinetd start
- mkdir -p /tftpboot/pxelinux.cfg
- vim /tftpboot/pxelinux.cfg/default:
prompt 1
default linux
timeout 100
label linux
kernel vmlinuz
append initrd=initrd.img ramdisk_size=9216 noapic acpi=off - To test:
touch /tftpboot/dummy.txt
yum install tftp
tftp tftpserver.test.net
tftp > get dummy.txt
tftp > quit - chkconfig --level 2345 dhcpd on
- cd /tftpboot
- wget ftp://ftp.free.fr/mirrors/ftp.centos.org/5.1/os/i386/images/pxeboot/vmlinuz
- mv vmlinuz pxelinux.0
- wget ftp://ftp.free.fr/mirrors/ftp.centos.org/5.1/os/i386/images/pxeboot/initrd.img
- Launch in console mode: /usr/sbin/dhcpd -d -f
A
client can't connect to CentOS
By default, CentOS runs SELinux and
the firewall iptables. Make sure those don't keep the clients from connecting
to the server.
Using
yum/rpm to manage packages
- yum install yum-fastestmirror
- yum list available
- yum search somestuff | less (Note: Searches automatically include both installed and available packages. To search for a specific package by name, use the list function. If you do not know the name of the package, use the search or provides options. Alternatively, use wild cards or regular expressions with any yum search option to broaden the search critieria.)
- To add an extra repository, place a definition file in the /etc/yum.repos.d/
- yum localinstall tsclient-0.132-4.i386.rpm
- rpm -qa | less
How
do I change my server's name
- hostname acme.dev.nul
- adding or editting the "HOSTNAME=" line in: /etc/sysconfig/network
- Some applications also want to be able to do a lookup of hostname to IP, and for that purpose, editting /etc/hosts is often done
- Another and better solution to that second question is to place the server in an environment with a working forward and reverse DNS and letting the initscripts manage the matter. initscripts is the first instance handle the setting of the server name based on the values found in /etc/sysconfig/network or /etc/sysconfig/network-scripts/ifcfg-ethX
Kernel
panic - not syncing: IO-APIC + timer doesn't work
If you get this message when
rebooting, add "noapic" to the kernel options when booting, and add
it to Grub's kernel line (/boot/grub/grub.conf to make it permanent for this
kernel).
Alternatively : "I got a ASUS
M2N-MX just installed and also got the same error when begin installation. I
change the ACPI support to 2.0 in BIOS (also put the correct frequency and
delays in memmories), and since too many trestarts and power off and power on
to test I didn't get the "Kernel Panic - not syncing: IO-APIC + timer
doesn't work!" anymore! If this option is not present in the mother you
buy, just update the BIOS (I have not to do it). I also disabled in BIOS
Chipset-> SouthBridge-> MCP61 ACPI HPET TABLE : If you enable it you will
get again the IO-APIC error..."
"running with noapic is for the
replacement for the old PIC chip that used to come on motherboards that allowed
you to setup nterrupts. sometimes motherboards come with small defects ( called
bugs ) and loading the kernel without the this apic is the only way to load
you're system. my PC at home would not run CentOS 5 smp kernel or Fedora
5,6,7,8 without setting noapic.the way to test it is to edit the grub menulist
while booting and adding noapic at the end"
In case you're interested, APIC
is "an Advanced Programmable Interrupt Controller (APIC), a more intricate
Programmable Interrupt Controller (PIC) containing a magnitude more outputs and
much more complex priority schemas. Advanced IRQ management."
Lots
of ACPI errors
Looks like Linux doesn't like the
way this host supports ACPI:
ACPI Error (psargs-0355): [HPTF] Namespace lookup failure,
AE_NOT_FOUND
ACPI Error (psparse-0537): Method parse/execution failed
[\_SB_.PCI0.HPET._STA] (Node ffff81003bfb17f0), AE_NOT_FOUND
ACPI: PCI Interrupt Link [LNK1] (IRQs 5 7 9 10 11 14 15) *0,
disabled.
What
kernel and CentOS am I running?
- # cat /proc/version
- # /usr/bin/lsb_release -a
- # cat /etc/issue
rm
-y
By default, CentOS comes with the
alias "rm -i" to rm, which is a pain if you want to delete several
files. An easy alternative is keep this protection, but type "rm -f"
when you don't want to be prompted.
Resources