sobota, 5 lipca 2008

CentOS 5.1 -> 5.2. Yum update problem

Today I wanted to update my CentOS 5.1 Server to current release - CentOS 5.2. After #yum update I got an error:
Error: Missing Dependency: libegroupwise-1.2.so.12 is needed by package evolution
and no update possible. After couple moments my amazing brain foud resolution (I really have no idea how it - brain - knows those things ;) ).

I downloaded .iso of CentOS 5.2 and mounted it in loop mode:

#mount -o loop /path-to-iso/CentOS-5.2-i386-bin-DVD.iso /mnt/cd
#cd /mnt/cd/CentOS/
#for i in *.rpm
> do
> yum localupdate $i
> done

.... and here I made mistake. Much more smarter would be: > yum -y localupdate $i . I had to spent two hours typing y, Enter :/

Anyway, it's one of resolutions but I have to find better because in company I work there is about 20 servers to be updated and this way is not very efficient.

poniedziałek, 28 kwietnia 2008

Hardy and VmWare

Hi, there is new version of ubuntu/kubuntu. It is very easy to upgrade ... if you believe in fairy tales.

In fact, it's completely unpredictable. If you have a lot of packets (I have about 2k) it is almost 100% sure that you will destroy your system.

There is resolution. Try to do it without logging into kde/gnome. Just console. apt-get dist-upgrade should work fine. I don't guarantee but it should :) . If it's not then check if file /etc/apt/sources.list contains 'gutsy' or 'hardy' lines. If still gutsy then copy file to some .old file and do #sed 's/gutsy/hardy/g' sources.list.old > sources.list and then #apt-get dist-upgrade. After couple of hours of fixing broken dependencies I have new updated kubuntu :D

One more big bug I just found is problem with VmWare Server. Simply, not working. Its common with VmWare that it's not working with new kernels and Hardy uses 2.6.24-16 (Thats why I like centos - old kernels ;)). There is quite fast way to resolve.

I used this post and it works.

piątek, 28 marca 2008

CentOS 5.1 and amanda ssh option

Hi,

I really don't have time. There is a lot interesting things I'm doing but no time for describing.

Last time I found the problem with auth "ssh" option in CentOS 5.1 amanda package. This option is included in amanda 2.5.0p2-4 version (which CentOS 5.1 contains) but can't use additional and required options. Those are ie.: ssh_keys "/var/lib/amanda/.ssh/id_rsa" and others. Additionally I found that this amanda version (I mean CentOS) is, a little bit different then provided by amanda team. Anyway. I decided to use rpm provided by zmanda for rhel4 (server client). There is no problem with this package on CentOS 5.1 so you can use it. All the options with ssh, key authentication, and others - just works. Some can ask why this version if there is new version with package for rhel5. Answer: I usually do not install newest versions.

I won't describe installation process but I'll post couple of useful links:
http://www.zmanda.com/quick-backup-setup.html (really helpful)
http://www.djatlantic.net/?p=268 (additional info about packages for rhel5)

środa, 23 stycznia 2008

Web calendar

This is first post about services I installed/found/whatever. I think it could be useful. Sometimes it's hard to find suitable resolution.

I've been looking for easy and functional web shared calendar. It should be light, fast, should have mail reminders functions. Any other functionalities are welcome but this shouldn't be overloaded.

After couple days of searching I found perfect one. It's written in PHP so it's light enough and has all functionalities I wanted. Here is a link to developer site. It looks very simple and minimalistic but you can create own CSS style to make it look better. I don't think it is worth of print screen right now because I don't have such CSS style yet.

niedziela, 23 grudnia 2007

CentOS 5.0 - Home Server Tutorial - part 2

Last time I created local lan but I have server! Not router but server and every real sever has its http instance. In this part I'll describe how to create your own http/https server with virtual hosts, how to create self-sined ssl certificates and couple other things. We will use standard apache server version 2.2. It is default version on Centos 5.o and it can do whatever you want.

I belive that you know basics of apache configuration and you can claryfy diference between http and https. I advise you to restart httpd server after configuration steps. It prevents of makeing stupid mistakes at the beginning.

Let's start. How? I hope you know. Installation of httpd, of course.

1. Simple site

#yum install httpd

After this you will have fresh installation of apache 2.2 server. To start it type:

#/etc/init.d/httpd start

or

#service httpd start

Now, if you'll point your browser to http://localhost/ you'll see default centos/apache site. But it wasn't our aim. Create file for your http site. For testing purposes create file index.html containing:

<html>
<head>
<title>Default page</title>
</head>
<body>
My test page.
</body>
</html>

Put this file to /var/www/html/ directory and reload your browser. Yupi! That's it.

2. VIRTUAL DOMAIN AND SSL CERTIFICATES

In fact that is still not what I wanted. I bought two domains and they point to my public IP address. Let's call them examle1.com and example2.com. Now both domains shows the same - blithe 'My test page.' site. I'd like situation when on different domains will be difarent sites. More over I'd like to have different sites displayed via http:// and https:// protocols.

At the beginning I have to install ssl extension for httpd server.

#yum install mod_ssl

After restarting httpd you can point your browser (if there is no firawall) to https://localhost/. The same as previous site should appear. The browser will ask you to accept site certificate. If you will check this certificate you will notice that there are fields like 'SomeOrganisation'. We don't want them.

To create your own self-signed ssl certificate use this page. It describes very well how to do it. I changed directory when a put needed files to /etc/httpd/conf/.

OK. Now I have server.crt and server.key files and I can create my https virtual domain. But at first edit /etc/httpd/conf.d/ssl.conf file and remove part begginig with to the end of file. Now edit /etc/httpd/conf/httpd.conf file and add three lines to the end of file:

NameVirtualHost *:80
NameVirtualHost *:443
Include sites/*.site

Last line means that, in this moment, apache will include files from /etc/httpd/sites which ends with '.site'. But there is no such a directory. Create it! It is god practise to have each virtual domain configured in separate file. You will not get lost after couple of reconfigurations. Here I paste those four configuration files. Change them in your own way.

# cat example1.com.site
<VirtualHost *:80>
DocumentRoot /var/www/example1.com

ServerName http://example1.com

ErrorLog logs/example1.com.error.log

TransferLog logs/example1.com.transfer.log

CustomLog logs/example1.com.access.log common

<Directory /var/www/example1.com/>

Options Indexes FollowSymLinks MultiViews

AllowOverride None

Order allow,deny

allow from all

</Directory>
</VirtualHost>

# cat example1.com.https.site
<VirtualHost *:443>
DocumentRoot /var/www/example1.com.https

ServerName https://example1.com

ErrorLog logs/example1.com.https.error.log

TransferLog logs/example1.com.https.transfer.log

CustomLog logs/example1.com.https.access.log common

SSLEngine On

SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

SSLCertificateFile /etc/httpd/conf/server.crt

SSLCertificateKeyFile /etc/httpd/conf/server.key

<Directory /var/www/example1.com.https/>

Options Indexes FollowSymLinks MultiViews

AllowOverride None

Order allow,deny

allow from all

</Directory>
</VirtualHost>

and two others just with example2.com instead of example1.com. As you can see those files points apache server to directories /var/www/example*. You have to create them and put there simple files to check if every domain and protocol displays diferent thing. To do so, insert different text between tags in those files.

Now you can fill your sites. Sever should be now able to handle http/https requests.

I hope I didn't miss any part of configuration because I've done those steps last month but I didn't have enough time to put them to this blog.

wtorek, 13 listopada 2007

CentOS 5.0 - Home Server Tutorial - part 1

There is a moment in life of every human when he starts to feel lack of remote shell, own apache or something else. One can say, that since human descend the tree, he've been looking for way to send files between computers. I'm couple years after this moment.

Last week my old server machine completely broke down, so I bought new one and I'm now installing systems on it. It's good opportunity to create series of posts about setting up own home server machine.

If you are savvy administrator do not expect anything new, but if you are experienced desktop linux user or intermediate level admin you can find something interesting. In this series I won't compile any programs (except absolutely necessary), because I like easily configurable systems. I don't like to investigate after 2 years "what actually I've done here those 2 years ago".

Ok, after this too long introduction I can start. Let's start with diagram of situation. As you can see it's common arrangement of LAN. I have access to internet and one static IP address bounded with my ethernet card MAC address. My internet provider allows me to connect more than one device to internet but in that situation I'd have slow connection between my computers.

I can create my own LAN! To do so, I'll need server with two ethernet cards and switch. Cables are of course also required. When I have this equipment I can start. Firstly I install system on the server machine. According to title of this post, this time it will be CentOS 5.0. I won't now describe whole installation process because majority of you done this already or can do it without any help. If you really need guide I recommend this :P (but better try google). If you just installed or you will start installation in the minute I advise you to consider creation of RAID with LVM. I described it in one of my previous posts.

CentOS already installed.

Ok. Everything connected, server machine installed and no internet just behind server :(. What we want? I want just to connect laptop to switch and have internet. No configuration. To have it I'll need DHCP and masquerade on server machine.

Steps:

1. My eth1 (LAN side) does not have IP address. There is no source of dynamically attached IP address on this side. We will attach static IP address to eth1 card. Edit file /etc/sysconfig/network-scripts/ifcfg-eth1 and put there lines like this:

DEVICE=eth1
ONBOOT=yes

BOOTPROTO=static

HWADDR=00:1a:4d:3c:42:e2

BROADCAST=192.168.33.255

IPADDR=192.168.33.1

IPV6ADDR=

IPV6PREFIX=

NETMASK=255.255.255.0

NETWORK=192.168.33.0


Of course leave your HWADDR line and change subnet address to one you like. Now type:

#/etc/init.d/network restart

and

#ifconfig eth1

You will see that device has its IP address setted.

2. Still no internet on LAN side. Yes, I have IP address of server card but machines inside LAN should obtain IP addresses too. Firs install DHCP daemon. Try:

#yum install dhcp

When dhcp is installed edit file /etc/dhcpd.conf and insert there something like:

ddns-update-style interim;
ignore client-updates;
subnet 192.168.33.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.33.1;
option subnet-mask 255.255.255.0;
option domain-name "example.com";
#your default DNS servers
option domain-name-servers 11.22.33.44, 22.33.44.55;
range dynamic-bootp 192.168.33.50 192.168.33.100;
default-lease-time 21600;
max-lease-time 43200;
}

(Remember about brackets and semicolons.) Now type:

#/etc/init.d/dhcpd start

Should start without error. After this step if you reboot computer inside LAN it should obtain IP address dynamically. But still no internet :/

3. Last step (yes, last :)) is creation of iptables masquerade mechanism. I should now explain rules of iptables but I won't. Maybe i'll post about it later - it is huge topic. Generally, iptables is great tool for operating on packets. It can be perfect firewall, advanced router, traffic shaper, etc.

I assume that you have iptables firewall already created (you can do it in installation process) or you know how to do it.

Masquerade mechanism is couple of instructions for server how to translate internal IP addresses for outcoming/incoming packets. To create such instructions create script in (for example) /etc/masq.conf and put there:

#!/bin/sh
iptables -t nat -A POSTROUTING -s 192.168.33.0/24 -j MASQUERADE

iptables -A FORWARD -s 192.168.33.0/24 -j ACCEPT


Make the file executable. Now add to file /etc/rc.local line:

/etc/masq.conf

Try to reboot server machine and then connect some computer to local network. It should have connection with internet.

Well done. Now I have software router. I don't know what i'll put in next post but probably something about apache installation and configuration.

poniedziałek, 12 listopada 2007

OnBoard Ethernet Gigabyte 8i945GCMX-S2 in CentOS5

Situation:

- CeontOS5.0 with Xen installed on machine with Gigabyte 8i945GCMX-S2
- No ethernet card discovered

Resolution:

try:

#lspci

for this device there should be:

01:05.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8169SC Gigabit Ethernet (rev 10)

if so, then download linux 2.6 driver from here and untar it. Next steps are described in its readme file but i'll put short in here.

on CentOS5.0 with Xen type (as root):

#yum install kernel-xen-devel

(If your kernel is without xen it will be #yum install kernel-devel).
Now change directory to this unpacked driver previously downloaded and type:

# make clean modules

# make install

# depmod -a

# insmod ./src/r8169.ko


Now it should work. Try dmesg. It should show something like:

r8169 Gigabit Ethernet driver 6.003.00-NAPI loaded
ACPI: PCI Interrupt 0000:01:05.0[A] -> GSI 21 (level, low) -> IRQ 20
eth1: RTL8169SC/8110SC at 0xee62e000, 00:1a:4d:3c:42:e2, IRQ 20

You can also try ifconfig -a. There should be eth0 (or ethN where N is number)