Tuesday, February 21, 2012

VSFTD

I downloaded VSFTP and ran the make install, everything extracted fine and the vsftpd was loaded into /usr/local/sbin/ and the config was loaded in to /etc

I have edited the /etc/vsftpd.conf, listen=YES and ran the command /usr/local/sbin/vsftpd &

If i run: ftp localhost, i can login with my user details. Now what process is this "standalone"?
If i want the ftp server to start from boot from what i read i have to edit the inetd.conf line

# Very Secure File Transfer Protocol (FTP) server.
ftp stream tcp nowait root /usr/sbin/tcpd vsftpd and then run /etc/rc.d/rc.inetd restart.

I have tried this but it doesnt seem to work, can anyone see what i'm doing wrong?

You need to use in /etc/inetd.conf:
ftp stream tcp nowait root /usr/sbin/tcpd /usr/local/sbin/vsftpd

I) What you need

  1. A Slackware Linux box on which you can log on as root.
  2. The Apache web server must be installed with mod_so enabled. (For more information, see my Apache install directions.)
  3. Some type of Internet access (to download the PHP source).
  4. About half an hour of uninterrupted work time.

II) Downloading PHP

You can download from one of the PHP mirrors. (PHP comes in both gzip and bzip2 archives. This document assumes the bzip2 type.)

NOTE: PHP 5.3 is out. I'm still using 5.2, due to issues with some of the Drupal modules we use.

In bzip2 form, PHP 5.2.x is around 9 MB, so if you're using dial-up this will take a while.

As of the time of this writing, the current 5.2.x branch PHP is version 5.2.13, so the file you get is called php-5.2.13.tar.bz2 or something similar.

Just store this somewhere that Linux can see it.

III) Installing PHP

cd to wherever you want the PHP source to live and extract it:

cd /usr/src
tar jxf /where_php_tarfile_is/php-5.2.13.tar.bz2

Change to the PHP top directory:

cd /usr/src/php-5.2.13

Configure PHP:
(This assumes that Apache is installed in /home/httpd. If it's not there, you'll need to figure out where apxs lives.)

./configure --with-mysql --with-apxs2=/home/httpd/bin/apxs

(NOTE: Apache must be installed with mod_so enabled.)

Assuming there are no error messages from configure, it's time to make and install PHP. Just type:

make ; make install

Now, we need a php.ini file to tell PHP how to act. I just use php.ini-recommended with one change.

First, put php.ini in the default location:

cp php.ini-recommended /usr/local/lib/php.ini

The only change I make is to turn off allow_url_fopen:

allow_url_fopen = Off

(NOTE: In the wrong hands, allow_url_fopen can be very dangerous! I write PHP code to avoid its use.)

All that's left to do is modify the Apache configuration file: /home/httpd/conf/httpd.conf by adding the line:

AddType application/x-httpd-php .php

While you're there, you may want to add .php indexes to the DirectoryIndex line:

DirectoryIndex index.html index.php index.shtml

To make it all work, stop the web server:

/etc/rc.d/rc.httpd stop

Then start it again:

/etc/rc.d/rc.httpd start

Apache Install

Download Apache

cd /usr/local/src/

tar -jxf /where_apache_tarfile_is/httpd-2.2.15.tar.bz2

cd /usr/local/src/http-x.x.x

Now, configure Apache:

(This assumes that we're installing Apache in /home/httpd. You can install it anywhere you wish by replacing /home/httpd with your location of choice.)

./configure --prefix=/home/httpd --enable-modules=so

maybe change to ./configure --prefix=/var/www/httpd --enable-modules=so

(NOTE: I've included the module so, which makes it easier to add stuff like PHP.)

make ; make install


you can edit the config-layout and add

#   Layout for Slackware Linux      prefix:        /usr     exec_prefix:   ${prefix}     bindir:        ${prefix}/bin     sbindir:       ${prefix}/sbin     libdir:        ${prefix}/lib     libexecdir:    ${prefix}/lib/libexec     mandir:        ${prefix}/man     sysconfdir:    /etc/httpd     datadir:       /var/www     installbuilddir: ${datadir}/build     errordir:      ${datadir}/error     iconsdir:      ${datadir}/icons     htdocsdir:     ${datadir}/htdocs     manualdir:     ${datadir}/manual     cgidir:        ${datadir}/cgi-bin     includedir:    ${exec_prefix}/include/httpd     localstatedir: /var     runtimedir:    ${localstatedir}/run     logfiledir:    ${localstatedir}/log/httpd     proxycachedir: ${localstatedir}/cache/httpd
and run ./configure --enable-layout=Slackware --enable-module=most --enable-mods-shared=most --enable-ssl=shared

If so, we only have a few steps left! If not, you'll need to start reading the error messages and the Apache documentation to figure out what went wrong.

If you'd like Apache to use something other than (or in addition to) index.html as an index page, Just edit the file /home/httpd/conf/httpd.conf and find the section labeledDirectoryIndex and add to the line that looks like:

DirectoryIndex index.html

You can add as many as you like, but I must mention that each one is an additional lookup each time a directory is accessed without a file name. Too many may slow your server down. Anyway, my line looks something like:

DirectoryIndex index.html index.php index.shtml index.htm default.htm

You may need to create rc.httpd in /etc/rc.d:
(This location is for Slackware; you may need a different location for other Linux distributions.)

It should look something like:

#!/bin/sh
if [ "$1" = "stop" ]; then
/home/httpd/bin/apachectl stop
elif [ "$1" = "restart" ]; then
/home/httpd/bin/apachectl restart
elif [ "$1" = "start" ]; then
/home/httpd/bin/apachectl start
else
echo "usage: $0 start|stop|restart";
fi

Then change it so that it can be executed:

chmod a+x rc.httpd

A reboot of your system should have you on your way. If you don't wanna restart, just type:

/etc/rc.d/rc.httpd start

If you can see the page: http://your_server/ then your installation was successful!