RedHat 7.3!!

web://cp INSTALL ============================================================================== This document covers briefly the installation of web://cp on a RedHat 7.3 GNU/Linux system. web://cp is compatible with almost every linux distributions but the file config.php will be more edited.

There are also other installation and help files and forums at http://www.web-cp.net/ ============================================================================== SYSTEM REQUIREMENTS

Recommended .rpm packages:

mysql-devel mysql mysql-server postgresql postgresql-devel postgresql-server bind bind-utils sendmail-cf sendmail proftpd proftpd-standalone apache apache-devel mod_ssl mod_bandwidth

apt (freshrpms.net)

Needed software:

php 4.3+ -- from source or SRPM http://php.net mod_watch http://www.snert.com/Software/mod_watch

Recommended software with sendmail + pop3:

poprelay http://poprelay.sourceforge.net

============================================================================== APT INSTALLATION

Go to http://apt.freshrpms.net/ and download apt for your RedHat server. apt is very usefull to keep your system up to date and install new software.

It is run like this: apt-get update

then to upgrade: apt-get dist-upgrade

or install new software: apt-get install prog-name1 prog-name2 etc...

It will come in handy when you need to install needed RPM dependencies or simply make sure you have all the latest & secure software.

============================================================================== PHP INSTALLATION

  • PHP 4.3 and + for newer system.

If you are using a newer linux installation, you probably have php with CLI already installed. However you still need the pcntl module, you will need to recompile it. You will need to download the latest php source rpm (SRPM).

  1. Install the source:

rpm -ivh *.src.rpm

  1. edit the install specs

cd /usr/src/redhat/SPECS

you then need to edit the php.spec file where it looks like:

  1. Build standalone /usr/bin/php

pushd build-cgi build --enable-force-cgi-redirect \ ...?

Add the following line right under '... build-cgi' or '... build-cli': --enable-pcntl \

You can then rebuild the rpm files with: rpm -ba php.spec or rpm-build -ba php.spec

If you are not using rpm packages, follow the instructions below to install from source.

  • PHP 4.2 and + for older systems:

PHP must be installed twice, once as a standalone binary and once as a module

Step 1. ** CGI binary installation **

  1. tar -zxf php-4.2.xx.tar.gz
  2. cd php-4.2.xx
  3. ./configure '--prefix=/usr' '--with-mysql=/usr' '--enable-ftp' \

    '--with-zlib-dir=/usr' '--with-openssl' '--enable-force-cgi-redirect' \ '--enable-pcntl'

  4. make
  5. make install

Step 2. ** Apache module installation **

  • I recommend to remove any previously installed php packages and use the source instead. The configure line below is simply a recommendation. web://cp needs: mysql, zlib, ftp but may use other modules later.
  1. make clean
  2. rm -f config.cache
  3. ./configure '--with-config-file-path=/etc/httpd/conf' '--with-mysql=/usr' \

    '--with-pgsql' '--with-imap' '--with-apxs=/usr/sbin/apxs' \ '--with-zlib-dir=/usr' '--with-gd=/usr' '--with-png-dir=/usr' \ '--with-jpeg-dir=/usr' '--with-openssl' '--with-curl-dir=/usr' \ '--enable-ftp' '--enable-shmop' '--enable-xml' '--enable-track-vars' \ '--with-ttf'

  4. make
  5. make install

Of course, this PHP installation might require some packages or programs you don't have setup already. Pay a visit to http://rpmfind.net or use nice tools like apt-get for rpm http://freshrpms.net/apt/ to fetch the files.

============================================================================== MOD_WATCH INSTALLATION

Please read the info included in the package, it is easy enough to setup:

  1. make install-dynamic

============================================================================== web://cp INSTALLATION

  1. useradd webcp
  2. cd /home

You can download web://cp from our website:

  1. wget http://www.web-cp.net/releases/webcp-X.X.X.tar.gz (where X.X.X is the current version)
  2. tar -zxf webcp-X.X.X.tar.gz

or get the latest version from CVS (please note, the CVS version may not always be optimal, the version from our website is safer):

http://www.web-cp.net/cvs.php

File privileges, for security

  1. chown -R webcp.webcp webcp
  2. chmod 755 webcp
  3. cd webcp
  4. chmod 755 -R httpd suspended imap named
  5. chmod 700 -R headers skel tag web server
  6. chmod 755 server server/autoreply.php
  7. chmod 777 autoresponder

MySQL database creation

  1. mysql -u root -p

    CREATE DATABASE webcp; quit

  2. mysql -u root -p -D webcp < webcp.sql

web://cp configuration

  1. cp config.php-sample config.php
  2. chmod 700 config.php
  3. chown webcp.webcp config.php
  4. pico -w config.php

Now go through all settings and remove all lines that can be left to their default settings. Pay special attention to the settings: basedir, adminmail, sysname, sslang, key <= MAKE IT SECRET & UNIQUE, dbpass, devhd

Remember to take the time to configure web://cp properly!

You can now start the webcp.php daemon to see if all works correctly: interactively to actch any errors: /home/webcp/server/webcp.php

then as a daemon: /home/webcp/server/webcp.php -d

You can add it to your rc.local file for auto-start or make an init script for it...

If you use sendmail and want the e-mail autoresponder feature to work, you need to make a symbolic link from your smrsh directory.

  1. cd /etc/smrsh/
  2. ln -s /home/webcp/server/autoreply.php

============================================================================== Apache, Sendmail, Bind and ProFTPd / vsFTPd CONFIGURATION (optional)

||||||||||[ Sendmail CONFIGURATION If you use sendmail, I recommend the sendmail add-on: http://poprelay.sourceforge.net/ Download the little script, add the indicated lines to your sendmail.mc file and you will have a working server. This is not related to web://cp in particular.

||||||||||[ Bind CONFIGURATION Add the following line to your /etc/named.conf configuration file: Include /home/webcp/named/include.named

||||||||||[ ProFTPd CONFIGURATION If you use proftpd , I recommend that you remove anonymous login and add or modify your config ( /etc/proftpd.conf ) to have the following:

  1. A basic recommended settings

Umask 002 <Global>

AllowOverwrite? yes <Limit ALL SITE_CHMOD>

AllowAll?

</Limit>

</Global> DefaultRoot? UseReverseDNS off MaxLoginAttempts? 3 RequireValidShell? off LsDefaultOptions? "-a" TimeoutNoTransfer? 900 TimeoutIdle? 600 TimeoutLogin? 300 IdentLookups? off AllowRetrieveRestart? on AllowStoreRestart? on

[ vsftpd - Very Secure FTP Daemon CONFIGURATION

If you use vsftpd, I recommend that you remove anonymous login and add or modify your config ( /etc/vsftpd/vsftpd.conf ) to have the following:

  1. Allow anonymous FTP?

anonymous_enable=NO #

  1. Default umask for local users is 077. You may wish to change this to 022,
  2. if your users expect that (022 is used by most other ftpd's)

local_umask=002

  1. Chroot user to his home directory

chroot_local_user=YES

  1. Disable user list (for now)

userlist_enable=NO

[ Apache CONFIGURATION

You will probably want a custom apache configuration, especially if you add several new modules. You will need at least the PHP module installed must add the following line to your /etc/httpd/httpd.conf file.

Include /home/webcp/httpd/include.httpd

  1. Also edit your log format so the 'combined' look like:

LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

  1. and specify the server-wide log file:

CustomLog? /var/log/httpd/access combined

  1. activate custom error pages

ErrorDocument? 401 /errors/401.html ErrorDocument? 403 /errors/403.html ErrorDocument? 404 /errors/404.html ErrorDocument? 500 /errors/500.html

[ web://cp httpd server CONFIGURATION

When using web://cp, you have 2 choices to serve the secure web://cp web interface.

1- You can trust the security & stability of Apache and run another instance,

dedicated to web://cp to insure security;

2- You can try the bundled webcp-httpd.php server that is still experimental.

** WE RECOMMEND THAT YOU USE THE APACHE CONFIGURATION **

  • webcp-httpd.php CONFIGURATION (experimental)

In order to setup this software, you simply need to take a look at all settings in /home/webcp/web/config.inc.php and make sure that all server & httpd settings are set right. If you wish to use SSL, go to: /home/webcp/httpd/conf and create a server certificate with: openssl req -new -x509 -nodes -out ssl-cert.pem -keyout ssl-cert.pem -days 365

Also make sure that you set 'ssl'? to true in the config.php page. You will need stunnel setup for it to works (it comes with OpenSSL).

You then need to start webcp-httpd.php: in interactive ode first to catch any errors: /home/webcp/server/webcp-httpd.php then in daemon mode: /home/webcp/server/webcp-httpd.php -d

  • Apache CONFIGURATION (RECOMMENDED)

To setup your new apache instance, The best way to act is to copy httpd.conf: cp /etc/httpd/conf/httpd.conf /home/webcp/httpd/conf/httpd.conf

then edit the file to trim all the unneeded modules & config. If you wish to use SSL, you will need to create a new certificate.

  1. Sample instructions:

openssl genrsa -rand /var/log/messages -out server.key 1024 openssl req -new -key server.key -out server.csr openssl x509 -req -days 730 -in server.csr -signkey server.key -out server.crt

then copy those files in /home/webcp/httpd/conf/

In order to configure httpd.conf for web://cp, here is a list of settings you should double check:

LockFile? /var/run/httpd-cp.lock PidFile? /var/run/httpd-cp.pid ScoreBoardFile? /home/webcp/httpd/logs/apache_runtime_status MinSpareServers? 1 MaxSpareServers? 5 StartServers 2 LoadModule? php4_module modules/libphp4.so

AddModule? mod_php4.c

Port 81

Listen 81

User webcp Group webcp

  1. This line if ** NON-SSL INSTALLATION **

DocumentRoot "/home/webcp/web"

  1. ********

DirectoryIndex? index.html index.htm index.php

ErrorLog? /home/webcp/httpd/logs/error_log

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

CustomLog? /home/webcp/httpd/logs/access_log combined

AddType application/x-httpd-php .php .php4 .php3 .phtml

  1. These lines if ** SSL INSTALLATION **

<VirtualHost? default:81>

  1. General setup for the virtual host

DocumentRoot "/home/webcp/web" ServerName? servername.domain.com ServerAdmin admin php_admin_flag engine On

  1. SSL Engine Switch:

SSLEngine on

  1. Server Certificate:

SSLCertificateFile /home/webcp/httpd/conf/server.crt

  1. Server Private Key:

SSLCertificateKeyFile /home/webcp/httpd/conf/server.key

  1. SSLOptions +FakeBasicAuth? +ExportCertData? +CompatEnvVars? +StrictRequire?

<Files "\.(cgi|shtml|phtml|php3?)$">

SSLOptions +StdEnvVars?

</Files> <Directory "/var/www/cgi-bin">

SSLOptions +StdEnvVars?

</Directory>

  1. Per-Server Logging:

CustomLog? logs/ssl_request_log \

"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost?>

The last step is to start it to see if it works: httpd -f /home/webcp/httpd/conf/httpd.conf

you may need to add a few arguments and make it look like: httpd -f /home/webcp/httpd/conf/httpd.conf -DHAVE_SSL -DHAVE_PHP4 -DHAVE_GZIP

If it works fine, you can auto start it or make an init script for it.

============================================================================== Final step...

Once the web://cp server daemon and the httpd web://cp server is up (apache or webcp-httpd), go to your http(s)://servername.domain.com:81/ and follow the forms to complete your setup & create the first account on your system.

** If you are in need of assistance or have a question, please go to the FORUMS or DOCUMENTATION sections ** http://www.web-cp.net

.r6web://cp INSTALL

============================================================================== This document covers briefly the installation of web://cp on a RedHat 7.3 GNU/Linux system. web://cp is compatible with almost every linux distributions but the file config.php will be more edited.

There are also other installation and help files provided on http://webcp.net, its forums and http://www.web-cp.net/manual ============================================================================== SYSTEM REQUIREMENTS

Recommended .rpm packages:

mysql-devel mysql mysql-server postgresql postgresql-devel postgresql-server bind bind-utils sendmail-cf sendmail proftpd proftpd-standalone apache apache-devel mod_ssl mod_bandwidth

apt (freshrpms.net)

Needed software:

php 4.3+ -- from source or SRPM http://php.net mod_watch http://www.snert.com/Software/mod_watch

Recommended software with sendmail + pop3:

poprelay http://poprelay.sourceforge.net

============================================================================== APT INSTALLATION

Go to http://apt.freshrpms.net/ and download apt for your RedHat server. apt is very usefull to keep your system up to date and install new software.

It is run like this: apt-get update

then to upgrade: apt-get dist-upgrade

or install new software: apt-get install prog-name1 prog-name2 etc...

It will come in handy when you need to install needed RPM dependencies or simply make sure you have all the latest & secure software.

============================================================================== PHP INSTALLATION

  • PHP 4.3 and + for newer system.

If you are using a newer linux installation, you probably have php with CLI already installed. However you still need the pcntl module, you will need to recompile it. You will need to download the latest php source rpm (SRPM).

  1. Install the source:

rpm -ivh *.src.rpm

  1. edit the install specs

cd /usr/src/redhat/SPECS

you then need to edit the php.spec file where it looks like:

  1. Build standalone /usr/bin/php

pushd build-cgi build --enable-force-cgi-redirect \ ...?

Add the following line right under '... build-cgi' or '... build-cli': --enable-pcntl \

You can then rebuild the rpm files with: rpm -ba php.spec or rpm-build -ba php.spec

If you are not using rpm packages, follow the instructions below to install from source.

  • PHP 4.2 and + for older systems:

PHP must be installed twice, once as a standalone binary and once as a module

Step 1. ** CGI binary installation **

  1. tar -zxf php-4.2.xx.tar.gz
  2. cd php-4.2.xx
  3. ./configure '--prefix=/usr' '--with-mysql=/usr' '--enable-ftp' \

    '--with-zlib-dir=/usr' '--with-openssl' '--enable-force-cgi-redirect' \ '--enable-pcntl'

  4. make
  5. make install

Step 2. ** Apache module installation **

  • I recommend to remove any previously installed php packages and use the source instead. The configure line below is simply a recommendation. web://cp needs: mysql, zlib, ftp but may use other modules later.
  1. make clean
  2. rm -f config.cache
  3. ./configure '--with-config-file-path=/etc/httpd/conf' '--with-mysql=/usr' \

    '--with-pgsql' '--with-imap' '--with-apxs=/usr/sbin/apxs' \ '--with-zlib-dir=/usr' '--with-gd=/usr' '--with-png-dir=/usr' \ '--with-jpeg-dir=/usr' '--with-openssl' '--with-curl-dir=/usr' \ '--enable-ftp' '--enable-shmop' '--enable-xml' '--enable-track-vars' \ '--with-ttf'

  4. make
  5. make install

Of course, this PHP installation might require some packages or programs you don't have setup already. Pay a visit to http://rpmfind.net or use nice tools like apt-get for rpm http://freshrpms.net/apt/ to fetch the files.

============================================================================== MOD_WATCH INSTALLATION

Please read the info included in the package, it is easy enough to setup:

  1. make install-dynamic

============================================================================== web://cp INSTALLATION

  1. useradd webcp
  2. cd /home

You can download web://cp from our website:

  1. wget http://www.web-cp.net/releases/webcp-X.X.X.tar.gz (where X.X.X is the current version)
  2. tar -zxf webcp-X.X.X.tar.gz

or get the latest version from CVS (please note, the CVS version may not always be optimal, the version from our website is safer):

http://www.web-cp.net/cvs.php

File privileges, for security

  1. chown -R webcp.webcp webcp
  2. chmod 755 webcp
  3. cd webcp
  4. chmod 755 -R httpd suspended imap named
  5. chmod 700 -R headers skel tag web server
  6. chmod 755 server server/autoreply.php
  7. chmod 777 autoresponder

MySQL database creation

  1. mysql -u root -p

    CREATE DATABASE webcp; quit

  2. mysql -u root -p -D webcp < webcp.sql

web://cp configuration

  1. cp config.php-sample config.php
  2. chmod 700 config.php
  3. chown webcp.webcp config.php
  4. pico -w config.php

Now go through all settings and remove all lines that can be left to their default settings. Pay special attention to the settings: basedir, adminmail, sysname, sslang, key <= MAKE IT SECRET & UNIQUE, dbpass, devhd

Remember to take the time to configure web://cp properly!

You can now start the webcp.php daemon to see if all works correctly: interactively to actch any errors: /home/webcp/server/webcp.php

then as a daemon: /home/webcp/server/webcp.php -d

You can add it to your rc.local file for auto-start or make an init script for it...

If you use sendmail and want the e-mail autoresponder feature to work, you need to make a symbolic link from your smrsh directory.

  1. cd /etc/smrsh/
  2. ln -s /home/webcp/server/autoreply.php

============================================================================== Apache, Sendmail, Bind and ProFTPd / vsFTPd CONFIGURATION (optional)

||||||||||[ Sendmail CONFIGURATION If you use sendmail, I recommend the sendmail add-on: http://poprelay.sourceforge.net/ Download the little script, add the indicated lines to your sendmail.mc file and you will have a working server. This is not related to web://cp in particular.

||||||||||[ Bind CONFIGURATION Add the following line to your /etc/named.conf configuration file: Include /home/webcp/named/include.named

||||||||||[ ProFTPd CONFIGURATION If you use proftpd , I recommend that you remove anonymous login and add or modify your config ( /etc/proftpd.conf ) to have the following:

  1. A basic recommended settings

Umask 002 <Global>

AllowOverwrite? yes <Limit ALL SITE_CHMOD>

AllowAll?

</Limit>

</Global> DefaultRoot? UseReverseDNS off MaxLoginAttempts? 3 RequireValidShell? off LsDefaultOptions? "-a" TimeoutNoTransfer? 900 TimeoutIdle? 600 TimeoutLogin? 300 IdentLookups? off AllowRetrieveRestart? on AllowStoreRestart? on

[ vsftpd - Very Secure FTP Daemon CONFIGURATION

If you use vsftpd, I recommend that you remove anonymous login and add or modify your config ( /etc/vsftpd/vsftpd.conf ) to have the following:

  1. Allow anonymous FTP?

anonymous_enable=NO #

  1. Default umask for local users is 077. You may wish to change this to 022,
  2. if your users expect that (022 is used by most other ftpd's)

local_umask=002

  1. Chroot user to his home directory

chroot_local_user=YES

  1. Disable user list (for now)

userlist_enable=NO

[ Apache CONFIGURATION

You will probably want a custom apache configuration, especially if you add several new modules. You will need at least the PHP module installed must add the following line to your /etc/httpd/httpd.conf file.

Include /home/webcp/httpd/include.httpd

  1. Also edit your log format so the 'combined' look like:

LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

  1. and specify the server-wide log file:

CustomLog? /var/log/httpd/access combined

  1. activate custom error pages

ErrorDocument? 401 /errors/401.html ErrorDocument? 403 /errors/403.html ErrorDocument? 404 /errors/404.html ErrorDocument? 500 /errors/500.html

[ web://cp httpd server CONFIGURATION

When using web://cp, you have 2 choices to serve the secure web://cp web interface.

1- You can trust the security & stability of Apache and run another instance,

dedicated to web://cp to insure security;

2- You can try the bundled webcp-httpd.php server that is still experimental.

** WE RECOMMEND THAT YOU USE THE APACHE CONFIGURATION **

  • webcp-httpd.php CONFIGURATION (experimental)

In order to setup this software, you simply need to take a look at all settings in /home/webcp/web/config.inc.php and make sure that all server & httpd settings are set right. If you wish to use SSL, go to: /home/webcp/httpd/conf and create a server certificate with: openssl req -new -x509 -nodes -out ssl-cert.pem -keyout ssl-cert.pem -days 365

Also make sure that you set 'ssl'? to true in the config.php page. You will need stunnel setup for it to works (it comes with OpenSSL).

You then need to start webcp-httpd.php: in interactive ode first to catch any errors: /home/webcp/server/webcp-httpd.php then in daemon mode: /home/webcp/server/webcp-httpd.php -d

  • Apache CONFIGURATION (RECOMMENDED)

To setup your new apache instance, The best way to act is to copy httpd.conf: cp /etc/httpd/conf/httpd.conf /home/webcp/httpd/conf/httpd.conf

then edit the file to trim all the unneeded modules & config. If you wish to use SSL, you will need to create a new certificate.

  1. Sample instructions:

openssl genrsa -rand /var/log/messages -out server.key 1024 openssl req -new -key server.key -out server.csr openssl x509 -req -days 730 -in server.csr -signkey server.key -out server.crt

then copy those files in /home/webcp/httpd/conf/

In order to configure httpd.conf for web://cp, here is a list of settings you should double check:

LockFile? /var/run/httpd-cp.lock PidFile? /var/run/httpd-cp.pid ScoreBoardFile? /home/webcp/httpd/logs/apache_runtime_status MinSpareServers? 1 MaxSpareServers? 5 StartServers 2 LoadModule? php4_module modules/libphp4.so

AddModule? mod_php4.c

Port 81

Listen 81

User webcp Group webcp

  1. This line if ** NON-SSL INSTALLATION **

DocumentRoot "/home/webcp/web"

  1. ********

DirectoryIndex? index.html index.htm index.php

ErrorLog? /home/webcp/httpd/logs/error_log

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

CustomLog? /home/webcp/httpd/logs/access_log combined

AddType application/x-httpd-php .php .php4 .php3 .phtml

  1. These lines if ** SSL INSTALLATION **

<VirtualHost? default:81>

  1. General setup for the virtual host

DocumentRoot "/home/webcp/web" ServerName? servername.domain.com ServerAdmin admin php_admin_flag engine On

  1. SSL Engine Switch:

SSLEngine on

  1. Server Certificate:

SSLCertificateFile /home/webcp/httpd/conf/server.crt

  1. Server Private Key:

SSLCertificateKeyFile /home/webcp/httpd/conf/server.key

  1. SSLOptions +FakeBasicAuth? +ExportCertData? +CompatEnvVars? +StrictRequire?

<Files "\.(cgi|shtml|phtml|php3?)$">

SSLOptions +StdEnvVars?

</Files> <Directory "/var/www/cgi-bin">

SSLOptions +StdEnvVars?

</Directory>

  1. Per-Server Logging:

CustomLog? logs/ssl_request_log \

"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost?>

The last step is to start it to see if it works: httpd -f /home/webcp/httpd/conf/httpd.conf

you may need to add a few arguments and make it look like: httpd -f /home/webcp/httpd/conf/httpd.conf -DHAVE_SSL -DHAVE_PHP4 -DHAVE_GZIP

If it works fine, you can auto start it or make an init script for it.

============================================================================== Final step...

Once the web://cp server daemon and the httpd web://cp server is up (apache or webcp-httpd), go to your http(s)://servername.domain.com:81/ and follow the forms to complete your setup & create the first account on your system.

** If you are in need of assistance or have a question, please go to: http://www.web-cp.net**

Notice: "unserialize() [<a href='function.unserialize'>function.unserialize</a>]: Error at offset 6961 of 6999 bytes" (...repeated 2 times)