How to setup apt and CentOS repository on RHEL
Earlier today someone asked me to help with installing typical apache/mysql/php combo on a Linux server. After logging in I found that the distro is RHEL4. Obviously yum is not available there... as shitty as yum is, it's still better than the infamous rpm hell, right? So I decided to install yum. After downloading a yum rpm, it failed to install because a bunch of dependencies were not met. "Hell," I started to wonder, "if I have to go through this why not install apt for what it's worth?"
Then I googled a bit and made apt work. In order to install mysql-server and php-mysql I also had to use CentOS's repository. Here is what I did:
Download & install the apt rpm package from
http://dag.wieers.com/packages/apt(Optional) Download & install the rpmforge package from
http://dag.wieers.com/packages/rpmforge-releaseImport CentOS 4 PGP key:
rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4
Add CentOS 4 repository to apt sources list by editing /etc/apt/sources.list.d/os.list and uncomment the lines about mirror.centos.org. You can also change the url to a mirror closer to you, mine looks like this:
1 | repomd http://ftp.nara.wide.ad.jp/pub/Linux/centos/$(VERSION)/os/$(ARCH) |
if you want to install mysql 5 and php 5 (4 by default), you can also add a line for centosplus:
1 | repomd http://ftp.nara.wide.ad.jp/pub/Linux/centos/$(VERSION)/centosplus/$(ARCH) |
Now you can use your normal apt commands like apt-get update && apt-get install. Sweeeet!
For third-party repositories you can also use atrpms.net repo.