Updating Apache to the latest version on DirectAdmin

You can check the current version of apache by running
/usr/sbin/httpd -v

CustomBuild – current

If you’re using custombuild (as most new boxes are), run the following
cd /usr/local/directadmin/custombuild
./build update
./build apache
./build php n
./build rewrite_confs

CustomApache – end-of-life

If you are using customapache with the 1.3 version of apache to the most recent, run the following:
cd /usr/local/directadmin/customapache
./build clean
./build update
./build apache_mod_ssl

If you’re using apache 2.x, use “./build apache_2” isntead of apache_mod_ssl.
This should update both the configure options and the version of apache to the most recent version. Once the update has completed, you’ll need to restart apache:

RedHat:
/sbin/service httpd restart

FreeBSD:
/usr/local/etc/rc.d/httpd restart

Advertisements

Partition /var is Full [DirectAdmin]

If you have a /var partition, and if that partition is too small it may fill up quickly. If you want to move the data which is stored in “/var” to another partition, run the following:

 

cd /var
du | sort -n

This will give you a full readout of all the directories that are using the most space. The directory using the most disk space will appear at the bottom of the list.

One common culprit is mysql (/var/lib/mysql on Redhat). To move that path to another partition, run the following:

 

cd /home
mkdir mysql
chown mysql:mysql mysql
cd mysql
/sbin/service mysqld stop
cp -Rp /var/lib/mysql/* .
cd /var/lib
mv mysql mysql_old
ln -s /home/mysql ./mysql
/sbin/service mysqld start

 

#once satisfied that mysqld is running, remove the old data:
rm -rf mysql_old

Spamassassin : Can’t locate HTML/Parser.pm in @INC

If you are trying to install Spamassassin but get that error, then it means you require the HTML/Parser.pm perl module.

RedHat:

 

perl -MCPAN -eshell
install HTML::Parser

 

If that gives you problems, run “unset LANG” then try again.

FreeBSD:

 

cd /usr/ports/www/p5-HTML-Parser
make install clean

 

or to manually compile from source for either OS:

 

wget http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/HTML-Parser-3.35.tar.gz
tar xvzf HTML-Parser-3.35.tar.gz
cd HTML-Parser-3.35
perl Makefile.PL
make
make install

 

Disk Usage is showing 0.00 [DirectAdmin]

DirectAdmin relies on the system quotas to return a value for how much space is being used. DirectAdmin will run

 

/usr/sbin/repquota /home

 
Where /home is the quota_partition value set in the /usr/local/directadmin/conf/directadmin.conf file (eg, /home, / or /usr). The command should output a large list of numbers, eg

 

[root@server]# /usr/sbin/repquota /home
*** Report for user quotas on device /dev/hda3
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
———————————————————————-
root — 417796 0 0 7446 0 0
nobody — 4 0 0 1 0 0
bin — 56880 0 0 510 0 0
majordomo — 8 0 0 2 0 0
diradmin — 8 0 0 2 0 0
admin — 200 0 0 44 0 0
user123 — 100 0 0 22 0 0
user456 — 100 0 0 22 0 0

 
If the “used” column is not showing anything, or users are not in the list, then you’ll need to run the quotacheck program:

Redhat:

 

/sbin/quotaoff -a; /sbin/quotacheck -avugm; /sbin/quotaon -a;

FreeBSD:

 

/usr/sbin/quotaoff -a; /sbin/quotacheck -avug; /usr/sbin/quotaon -a;

 
If are getting errors and no output is displayed for the repquota command, you’ll need to check your /etc/fstab file to make sure that it contains the rw,userquota,groupquota line beside the partition that is using the quotas.
*Important: On Linux (Redhat/Debian), it’s usrquota,grpquota, and on FreeBSD it’s userquota,groupquota.

Sample /etc/fstab:

 

# Device Mountpoint FStype Options Dump Pass#
/dev/ad0s1a / ufs rw,userquota,groupquota 1 1
/dev/ad0s1e /tmp ufs rw 2 2
proc /proc procfs rw 0 0

In this case, the quota_partition is /. The quota partition should be the partition that holds your users. Generally, this will be one of /home, / or /usr.

Once the repquota program is returning a normal value, then you can run the tally to get the correct usage to show up in DirectAdmin:

echo “action=tally&value=all” >> /usr/local/directadmin/data/task.queue

 

Updating Apache to the latest version on DirectAdmin

You can check the current version of apache by running
httpd -v

If you wish to update your 1.3 version of apache to the most recent, run the following:
cd /usr/local/directadmin/customapache
./build clean
./build update
./build apache_mod_ssl

If you’re using apache 2.x, use “./build apache_2” isntead of apache_mod_ssl.
This should update both the configure options and the version of apache to the most recent version. Once the update has completed, you’ll need to restart apache:

RedHat:
/sbin/service httpd restart

FreeBSD:
/usr/local/etc/rc.d/httpd restart

Setting up DA with an SSL certificate

You can switch DirectAdmin to use SSL instead of plain text. -> https instead of http.

If you do not have your own certificates, you’ll need to create your own:
/usr/bin/openssl req -x509 -newkey rsa:1024 -keyout /usr/local/directadmin/conf/cakey.pem -out /usr/local/directadmin/conf/cacert.pem -days 9999 -nodes

chown diradmin:diradmin /usr/local/directadmin/conf/cakey.pem
chmod 400 /usr/local/directadmin/conf/cakey.pem


This is the old method, use either the one above, or this one. The end result is the same, but takes more steps.

openssl req -new -x509 -keyout /usr/local/directadmin/conf/cakey.pem.tmp -out /usr/local/directadmin/conf/cacert.pem -days 3653

openssl rsa -in /usr/local/directadmin/conf/cakey.pem.tmp -out /usr/local/directadmin/conf/cakey.pem

rm -f /usr/local/directadmin/conf/cakey.pem.tmp
chown diradmin:diradmin /usr/local/directadmin/conf/cakey.pem
chmod 400 /usr/local/directadmin/conf/cakey.pem

(Paste these one at a time as the first 2 require user input)


If you already have your own certificate and key, then paste them into the following files:

certificate: /usr/local/directadmin/conf/cacert.pem
key: /usr/local/directadmin/conf/cakey.pem

Edit the /usr/local/directadmin/conf/directadmin.conf and set SSL=1 (default is 0). This tells DA to load the certificate and key and to use an SSL connection. DirectAdmin needs to be restarted after this change.

If you also have a CA Root Certificate, this can be specified by adding:

carootcert=/usr/local/directadmin/conf/carootcert.pem

into the /usr/local/directadmin/conf/directadmin.conf file (won’t exist by default) and by pasting the contents of the caroot cert into that file.

Note, as of 1.30.2, you can set the value of the SSL redirect should a User connect to an https connection with plaintext http.
http://www.directadmin.com/features.php?id=801

DirectAdmin Log Files

DirectAdmin:
/var/log/directadmin/error.log
/var/log/directadmin/errortaskq.log
/var/log/directadmin/system.log
/var/log/directadmin/security.log

Apache:
/var/log/httpd/error_log
/var/log/httpd/access_log
/var/log/httpd/suexec_log
/var/log/httpd/fpexec_log
/var/log/httpd/domains/domain.com.error.log
/var/log/httpd/domains/domain.com.log
/var/log/messages (generic errors)

Proftpd:
/var/log/proftpd/access.log
/var/log/proftpd/auth.log
/var/log/messages (generic errors)

vm-pop3d:
/var/log/maillog
/var/log/messages

named (bind):
/var/log/messages

exim:
/var/log/exim/mainlog
/var/log/exim/paniclog
/var/log/exim/processlog
/var/log/exim/rejectlog
(on FreeBSD, they have “exim_” in front of the filenames)

mysqld:
RedHat:
/var/lib/mysql/server.hostname.com.err
FreeBSD:
/usr/local/mysql/data/server.hostname.com.err

crond:
/var/log/cron

To view a log file, run:

less /var/log/filename

Where /var/log/filename is the path of the log you wish to view. If the log is too large you can use the “tail” command:

tail -n 30 /var/log/filename

Where 30 is the number of lines from the end you wish to view.