Showing posts with label done. Show all posts
Showing posts with label done. Show all posts

Tuesday, November 30, 2010

Show IP address before login

Put following in your /etc/rc.local file:

echo "CentOS release 5 (Final)" > /etc/issue
echo "Kernel \r on an \m" >> /etc/issue
echo "">> /etc/issue
echo "$(ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1)" >> /etc/issue
echo "" >> /etc/issue


http://crazytoon.com/2008/04/22/linux-how-to-change-login-prompt-in-linux/
http://linuxhelp.blogspot.com/2005/10/change-system-login-banner-in-linux.html

Change hostname

vi /etc/sysconfig/network

HOSTNAME=Cent.localdomain

#change to Cent

http://wiki.centos.org/FAQ/CentOS5

Sunday, November 7, 2010

Enable python CGI script in user directory (public_html/cgi-bin)

edit /etc/httpd/conf/httpd.conf
add these section


<Directory "/home/*/public_html/cgi-bin">
    Options ExecCGI
    AddHandler cgi-script .py
</Directory>

Then restart the server
/usr/sbin/apachectl restart


If there is any error, check httpd error log
tail /var/log/httpd/error_log

[Mon Nov 08 10:21:05 2010] [error] [client 192.168.106.31] suexec policy violation: see suexec log for more details
[Mon Nov 08 10:21:05 2010] [error] [client 192.168.106.31] Premature end of script headers: ...py

error from suexec, check suexec log
tail /var/log/httpd/suexec.log

[2010-11-08 10:22:51]: uid: (500/s) gid: (500/500) cmd: ..py
[2010-11-08 10:22:51]: directory is writable by others: ..


The directory should not be writable by others (security reason)
chmod 711 /home/user-abc/public_html/cgi-bin

If there is another error, check both logs again.

Enable user directory (public_html)

edit /etc/httpd/conf/httpd.conf

remove this line
UserDir disable

and uncomment this line
UserDir public_html

(or can just change the first line)

Then restart the server
/usr/sbin/apachectl restart

If SELinux is enabled (I did), you must also need to run these

/usr/sbin/setsebool -P httpd_enable_homedirs true
chcon -R -t httpd_sys_content_t /home/user-abc/public_html

(do not forget to change the path on the second line)


from Apache Userdir with SELinux on Fedora 13/14, CentOS 5.5, Red Hat (RHEL) 5.5/6

Saturday, November 6, 2010

Install etckeeper

After installing git (see this)
clone (copy) from kitenet.net

git clone  git://git.kitenet.net/etckeeper

Then go into etckeeper and edit etckeeper.conf


# The VCS to use.
VCS="hg"
#CS="git"
#VCS="bzr"
#VCS="darcs"

# Options passed to git commit when run by etckeeper.
GIT_COMMIT_OPTIONS=""

# Options passed to hg commit when run by etckeeper.
HG_COMMIT_OPTIONS="-u etckeeper@a.com"

# Options passed to bzr commit when run by etckeeper.
BZR_COMMIT_OPTIONS=""

# Options passed to darcs record when run by etckeeper.
DARCS_COMMIT_OPTIONS="-a"

# Uncomment to avoid etckeeper committing existing changes
# to /etc automatically once per day.
#AVOID_DAILY_AUTOCOMMITS=1

# Uncomment to avoid etckeeper committing existing changes to
# /etc before installation. It will cancel the installation,
# so you can commit the changes by hand.
#AVOID_COMMIT_BEFORE_INSTALL=1

# The high-level package manager that's being used.
# (apt, pacman-g2, yum etc)
HIGHLEVEL_PACKAGE_MANAGER=yum

# The low-level package manager that's being used.
# (dpkg, rpm, pacman-g2, etc)
LOWLEVEL_PACKAGE_MANAGER=rpm


Then we can install and create an initial version.

make installl
cd /etc
/usr/sbin/etckeeper init
/usr/sbin/etckeeper commit -m "Initial"


Add RPMforge

To add rpm from RPMforge


rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm

rpm -K rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm

rpm -i rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm

# if not using x64
# rpm -i rpmforge-release-0.5.1-1.el5.rf.i386.rpm

Now we can use
yum install mercurial
yum install p7zip
yum install git
yum install django
It still does not have etckeeper :(


more software installed
yum install lynx

from
http://wiki.centos.org/AdditionalResources/Repositories/RPMForge