Virtualmin update Apache, PHP, MySQL and BIND to latest
Apache
Apache will have to be installed in two ways due to the default settings provided with suexec may not work with our system, if you do not use suexec then you can skip the suexec installation section, suexec needs to be compiled from source so we can specify the settings to work with our system. To begin we need to download the httpd package and 2 dependencies which are apt-util and apt-util-ldap.
1 2 3 |
wget http://www.jasonlitka.com/media/EL5/i386/apr-util-1.3.9-1.jason.2.i386.rpm wget http://www.jasonlitka.com/media/EL5/i386/apr-util-ldap-1.3.9-1.jason.2.i386.rpm wget http://www.jasonlitka.com/media/EL5/i386/httpd-2.2.17-jason.1.i386.rpm |
The 3 commands above will download the packages which I am going to be using for my system you may need to get different ones depending on your systems architecture or version you want to install or update to.
1 2 3 |
rpm –Uvh http://www.jasonlitka.com/media/EL5/i386/apr-util-1.3.9-1.jason.2.i386.rpm rpm –Uvh http://www.jasonlitka.com/media/EL5/i386/apr-util-ldap-1.3.9-1.jason.2.i386.rpm rpm -Uvh http://www.jasonlitka.com/media/EL5/i386/httpd-2.2.17-jason.1.i386.rpm |
The following commands will install the packages, if you receive any missing dependency messages you will have to find the required package and install or update if required, if you receive any messages related to a specific version being needed by a package or overwriting files please read the RPM –-nodeps and –-force section at the top of this guide. Now you have updated apache it should all work after a quick restart.
1 |
service httpd restart |
If you require the suexec module for apache then you will need to do the following to check if your suexec module is setup correctly.
1 |
suexec –V |
This will print the settings suexec is currently using mine looks like this.
1 2 3 4 5 6 7 |
-D AP_DOC_ROOT="/var/www" -D AP_GID_MIN=100 -D AP_HTTPD_USER="apache" -D AP_LOG_EXEC="/var/log/httpd/suexec.log" -D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin" -D AP_UID_MIN=500 -D AP_USERDIR_SUFFIX="public_html" |
The main ones you need to look at are D AP_DOC_ROOT which is the location of your users websites which if your storing your websites in the users home directory or using Virtualmin needs to be set to /home, D AP_HTTPD_USER also needs to be set to the same user your http server is running as and D AP_USERDIR_SUFFIX needs to be the directory the site is stored in.
If any of these settings need adjusting then you will have to do the following if the current settings meet the requirements for your systems suexec should work just fine, to begin we need to download the apache httpd source code (make sure it is the same version as the httpd server we just updated to or installed) which is available at http://httpd.apache.org/.
I will be downloading the httpd-2.2.17.tar.gz file to my server by using the following command.
1 |
wget http://mirror.fubra.com/ftp.apache.org//httpd/httpd-2.2.17.tar.gz |
Once the download is complete we need to untar the file using the following command.
1 |
tar zxf httpd-2.2.17.tar.gz |
This will now extract the contents into a folder called httpd-2.2.17 which is now where I want to navigate to.
1 |
cd httpd-2.2.17 |
Before compilation of the source we need to make the small adjustments to are suexec source code so that it uses the settings we need to work correctly, the file is located in a folder called support and the file is called suexec.h.
1 2 |
cd support nano suexec.h |
Nano is a text editor and will open the file allowing me to make the modifications, go through the file and adjust the required lines until the file meets the settings required for your system. I will be making the following changes to my file.
1 2 3 4 5 |
#define AP_DOC_ROOT "/var/www" to #define AP_DOC_ROOT "/home" |
1 2 3 4 5 |
#define AP_LOG_EXEC "/some/long/thing/I've/forgot/suexec.log" to #define AP_LOG_EXEC "/var/log/httpd/suexec.log" |
Once the changes have been performed we can quit and save the changes by pressing Ctr + X and entering yes when prompted, now we can begin compilation.
1 2 3 |
./configure --prefix=/usr/local/apache2 make make suexec |
If you receive any errors related to not having some software or a suitable compiler you may not have the development tools installed on your system, these can be installed by typing.
1 |
yum groupinstall “Development Tools” |
It will now list a load of tools which need to be downloaded and installed on my system it says there is a total of 89MB needing downloading but this may differ on your system depending on what you have or haven’t got already installed. Now all that’s left is to copy the new suexec module and replace the old one which is done using the following commands.
1 2 3 |
cd /usr/sbin mv suexec suexec.bak cp /tmp/httpd-2.2.17/support/suexec suexec |
Now all whats left is to change the group and owner of the new file to the same as the old file using the following commands.
1 2 3 4 |
ls -l suexec.bak chgrp apache suexec chown apache suexec chmod 4510 suexec |
Change suexec to the same owner and group as suexec.bak. A restart of httpd will finish the process and all should now work.
1 |
service httpd restart |