Blog » Blog Entry

Setting up a Fedora development server

April 10, 2005

I recently setup Fedora Core 3 on an old server I had as a new a PHP/MySQL development environment. I downloaded the Fedora Core 3 #1 .iso image and burned it to cd. I booted it up and chose the 'minimal' install. Even the minimal install was fairly large, over 500MBs. The install completed without a hitch and I began to configure the system.

First I tried up2date. This is supposedly RedHat's (in)famous rpm/system management tool. Just running up2date with no flags places you into a configuration update mode. Everything looked swell to me so I typed 'q' and ended the configuration. Next I tried up2date --help to see the available commands. It returned giberish I could only assume were error messages:

# up2date --help
Traceback (most recent call last):
  File "/usr/sbin/up2date", line 1248, in ?
    sys.exit(main() or 0)
  File "/usr/sbin/up2date", line 355, in main
    (options, pkgNames) = optparser.parse_args()
  File "/usr/lib/python2.3/optparse.py", line 1129, in
  parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib/python2.3/optparse.py", line 1169, in
  _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib/python2.3/optparse.py", line 1244, in
  _process_long_opt
    option.process(opt, value, values, self)
  File "/usr/lib/python2.3/optparse.py", line 611, in
  process
    return self.take_action(
  File "/usr/lib/python2.3/optparse.py", line 632, in
  take_action
    parser.print_help()
  File "/usr/sbin/up2date", line 89, in print_help
    OptionParser.print_help(self, file)
  File "/usr/lib/python2.3/optparse.py", line 1370, in
  print_help
    file.write(self.format_help())
TypeError: descriptor 'write' requires a 'file' object
but received a 'str'

So I tried 'man up2date' instead. I was then able to read some documentation. I saw that I should use --update to update my system. So I gave it a whirl:

# up2date --update
http://fedora.redhat.com/download/up2date-mirrors/
fedora-core-3 using mirror:
http://ftp.isu.edu.tw/pub/Linux/Fedora/linux/core/3/
i386/os
http://fedora.redhat.com/download/up2date-mirrors/
updates-released-fc3

It would always get about that far then it would die with some I/O error. I tried it several times. I guess the Fedora servers are quite busy.

So I started poking around on the Fedora site to look for docs on how to keep my system up to date. I found a how-to for 'yum'. I had heard of yum before but never used it. As the docs described I did 'yum check-update' to initialize yum for my system. After a nice little (long) wait I was able to do 'yum update' to get my system all up to date. I gave it a reboot. After about 3 hours or so I had an up to DATE Fedora Core 3 minimal system.

Now I wanted to install Apache and PHP. I have a database server with MySQL and Postgres on my network already so I just needed the support built into my PHP.

I did:

# yum list available > ~/available

This gave wrote for me a text file with all the available rpms. Just doing 'yum list available' takes a long time to complete so you don't want to be doing that everytime you just want to look for an rpm or two. So then I went strolling though my 'available' rpm list and found httpd. I installed it:

# yum install httpd
Setting up Install Process
Setting up Repos
[...]
Installed: httpd.i386 0:2.0.52-3.1
Dependency Installed: apr.i386 0:0.9.4-24.2
apr-util.i386 0:0.9.4-17 httpd-suexec.i386
0:2.0.52-3.1
Complete!

The httpd install asked me for approval to add some dependencies. I typed 'y' to accept them. Next I added PHP to the system:

# yum install php
Setting up Install Process
Setting up Repos
[...]
Installed: php.i386 0:4.3.10-3.2
Dependency Installed: curl.i386 0:7.12.3-2 libidn.i386
0:0.5.6-1 php-pear.i386 0:4.3.10-3.2
Complete!

PHP installed without any issues so I started Apache:

# /etc/init.d/httpd start
Starting httpd:
[  OK  ]

I pulled up the default page in my browser. It looked good. Next I wanted to check out my PHP configuration. So I made a phpinfo() page and tried to load it on the server. Opps! I hadn't installed an FTP server yet. So I used vi to create the page in the server root. I was then able to view my phpinfo() page. I realized there was no MySQL, Postgres, or GD support in my PHP. So in one long command I added several rpms to the system:

# yum install php-gd php-mysql php-pgsql vsftpd
Setting up Install Process
Setting up Repos
[...]
Installed: php-gd.i386 0:4.3.10-3.2 php-mysql.i386
0:4.3.10-3.2 php-pgsql.i386 0:4.3.10-3.2 vsftpd.i386
0:2.0.1-5
Dependency Installed: mysql.i386 0:3.23.58-16.FC3.1
perl-DBD-MySQL.i386 0:2.9003-5 perl-DBI.i386 0:1.40-5
postgresql-libs.i386 0:7.4.7-3.FC3.1
Complete!

The PHP/FTPd server install completed with no problems, so I restarted Apache:

# /etc/init.d/httpd restart
Stopping httpd:
[  OK  ]
Starting httpd:
[  OK  ]

I rechecked my phpinfo() page and all the support I wanted was there. Next I needed to add the web server and ftp servers to startup:

# chkconfig --level 345 vsftpd on
# chkconfig --level 345 httpd on

I also wanted to have a look for anything I didn't want to run at startup since RedHat is notorious for adding 'crap' to a default install:

# chkconfig --list|grep ':on'
xinetd          0:off 1:off 2:off 3:on  4:on  5:on
6:off
httpd           0:off 1:off 2:off 3:on  4:on  5:on
6:off
iptables        0:off 1:off 2:on  3:on  4:on  5:on
6:off
kudzu           0:off 1:off 2:off 3:on  4:on  5:on
6:off
pcmcia          0:off 1:off 2:on  3:on  4:on  5:on
6:off
rpcgssd         0:off 1:off 2:off 3:on  4:on  5:on
6:off
rhnsd           0:off 1:off 2:off 3:on  4:on  5:on
6:off
rpcidmapd       0:off 1:off 2:off 3:on  4:on  5:on
6:off
network         0:off 1:off 2:on  3:on  4:on  5:on
6:off
sendmail        0:off 1:off 2:on  3:on  4:on  5:on
6:off
crond           0:off 1:off 2:on  3:on  4:on  5:on
6:off
gpm             0:off 1:off 2:on  3:on  4:on  5:on
6:off
nfslock         0:off 1:off 2:off 3:on  4:on  5:on
6:off
isdn            0:off 1:off 2:on  3:on  4:on  5:on
6:off
haldaemon       0:off 1:off 2:off 3:on  4:on  5:on
6:off
cpuspeed        0:off 1:on  2:on  3:on  4:on  5:on
6:off
readahead       0:off 1:off 2:off 3:off 4:off 5:on
6:off
netfs           0:off 1:off 2:off 3:on  4:on  5:on
6:off
messagebus      0:off 1:off 2:off 3:on  4:on  5:on
6:off
readahead_early 0:off 1:off 2:off 3:off 4:off 5:on
6:off
apmd            0:off 1:off 2:on  3:on  4:on  5:on
6:off
smartd          0:off 1:off 2:on  3:on  4:on  5:on
6:off
acpid           0:off 1:off 2:off 3:on  4:on  5:on
6:off
cups            0:off 1:off 2:on  3:on  4:on  5:on
6:off
mdmonitor       0:off 1:off 2:on  3:on  4:on  5:on
6:off
vsftpd          0:off 1:off 2:off 3:on  4:on  5:on
6:off
portmap         0:off 1:off 2:off 3:on  4:on  5:on
6:off
rpcsvcgssd      0:off 1:off 2:off 3:on  4:on  5:on
6:off
sshd            0:off 1:off 2:on  3:on  4:on  5:on
6:off
anacron         0:off 1:off 2:on  3:on  4:on  5:on
6:off
autofs          0:off 1:off 2:off 3:on  4:on  5:on
6:off
irqbalance      0:off 1:off 2:off 3:on  4:on  5:on
6:off
atd             0:off 1:off 2:off 3:on  4:on  5:on
6:off
syslog          0:off 1:off 2:on  3:on  4:on  5:on
6:off

I was right, there was much crap to turn off. I disabled nearly everything with commands like this:

# chkconfig --level 12345 kudzu off

I gave the system a reboot to make sure I hadn't killed anything important. My basic PHP development server's startup then looked like this:

# chkconfig --list|grep ':on'        
httpd           0:off 1:off 2:off 3:on 4:on 5:on 6:off
network         0:off 1:off 2:on  3:on 4:on 5:on 6:off
sendmail        0:off 1:off 2:on  3:on 4:on 5:on 6:off
crond           0:off 1:off 2:on  3:on 4:on 5:on 6:off
vsftpd          0:off 1:off 2:off 3:on 4:on 5:on 6:off
sshd            0:off 1:off 2:on  3:on 4:on 5:on 6:off
autofs          0:off 1:off 2:off 3:on 4:on 5:on 6:off
syslog          0:off 1:off 2:on  3:on 4:on 5:on 6:off

Next I installed subversion so I could check out a copy of my project code from my main development server:

# yum install subversion
Setting up Install Process
Setting up Repos
[...]
Installed: subversion.i386 0:1.1.4-1.1
Dependency Installed: guile.i386 5:1.6.4-14 neon.i386
0:0.24.7-4 perl-URI.noarch 0:1.30-4 swig.i386
0:1.3.21-6 umb-scheme.i386 0:3.2-35
Complete!

Subversion was installed so I checked out a copy of my favorite project:

$ svn checkout \
  svn+ssh://destiney@saturn/svn/Destiney_rated_images\
  Destiney_rated_images

No problems there. If you use CVS you might want to checkout Subversion. It's like a much improved CVS.

Finally I added a few things to /etc/bashrc to make my prompt a bit more useful:

eval dircolors -b /etc/DIR_COLORS
alias d="ls --color"
alias ls="ls --color=auto"
alias l='ls -GF --color'
alias ll='ls -laGF --color'
alias cp='cp -i'
alias ..='cd ..'
alias ...='cd ../..'

Black="[33[0;30m]"
DarkGray="[33[1;30m]"
LightGray="[33[0;37m]"
White="[33[1;37m]"
Blue="[33[0;34m]"
LightBlue="[33[1;34m]"
Green="[33[0;32m]"
LightGreen="[33[1;32m]"
Cyan="[33[0;36m]"
LightCyan="[33[1;36m]"
Red="[33[0;31m]"
LightRed="[33[1;31m]"
Purple="[33[0;35m]"
LightPurple="[33[1;35m]"
Brown="[33[0;33m]"
Yellow="[33[1;33m]"

if [ /usr/bin/whoami = 'root' ]
then
  # Do not set PS1 for dumb terminals
  if [ "$TERM" != 'dumb'  ] && [ -n "$BASH" ]
  then
    export PS1='[33[01;31m]h [33[01;34m]W $ [33[00m]'
  fi
  export \
  PATH="/bin:/sbin:/usr/bin:/usr/sbin:${ROOTPATH}"
  UColor=$Red
else
  # Do not set PS1 for dumb terminals
  if [ "$TERM" != 'dumb'  ] && [ -n "$BASH" ]
  then
    export PS1='[33[01;32m]u@h [33[01;34m]W $ \
    [33[00m]'
  fi
  export PATH="/bin:/sbin:/usr/bin:/usr/sbin:${PATH}"
  UColor=$LightPurple
fi

PS1="n$Yellow-$LightCyan+$LightBlue($LightGreenD{%D \
%r}
$LightBlue)"
PS1="$PS1n$Yellow-$LightCyan+$LightBlue($UColoru\
$LightCyan@
$Purpleh$LightBlue)"
PS1="$PS1n$Yellow-$LightCyan+$LightBlue($Yelloww\
$LightBlue)
$DarkGray>$LightGray>>$White> "
PS2="$DarkGray-$LightGray-$LightGray-$White "

export PS1 PS2

I copied some stuff into /etc/hosts from one of my other servers and called it a day..

Tags: php, mysql, core, fedora, up2date, yum, postgres, rpm, redhat

« Last question only? Web hosting woes.. »

Add a comment:

Title:

Comment:

Name:

Email: