Compile Source of Apache/MySQL/PHP on a Linux VPS
Linux IT Engineers often use the Debina APT, or RedHat YUM repositories for an quick and easy install of the services on their servers. But , in some cases we often need to test the latest packages. For example the latest version of MySQL is 5.7 and we cannot get it via the apt, we have to manually download and install in on our Virtual Private Server. Then we can configure it to our production enviroment.
I have configured the VPS server with the 12.04 LTS versions. I prefer the LTS version because of the support for the security and long term update.
First we start with creating the sources folder and downloading the Apache packages that are needed for our web server:
sudo mkdir /usr/src/sources
wget http://httpd.apache.org/dev/dist/httpd-2.4.2.tar.gz
tar xvfz httpd-2.4.2.tar.gz
After downloading the httpd packages and extracting them we can move on further in our process. We now need the APR utilities and the APR package itself. The APR stands for Apache Portable Runtime.
wget http://apache.spinellicreations.com//apr/apr-1.4.8.tar.gz
tar -xzf apr-1.4.8.tar.gz
rm apr-1.4.8.tar.gz
cd apr-1.4.8/
sudo apt-get install make
sudo ./configure
sudo make
sudo make install
Then we need the APR Utils to be configured.
wget http://mirrors.axint.net/apache//apr/apr-util-1.4.1.tar.gz
tar -xvzf apr-util-1.4.1.tar.gz
cd apr-util-1.4.1
./configure --with-apr=/usr/local/apr
make
make install
cd ..
Now we can return to the HTTPD folder to compile and install the Apache:
cd /usr/local/sources/httpd-2.4.2
./configure --enable-file-cache --enable-cache --enable-disk-cache --enable-mem-cache --enable-deflate --enable-expires --enable-headers --enable-usertrack --enable-ssl --enable-cgi --enable-vhost-alias --enable-rewrite --enable-so --with-apr=/usr/local/apr/
make
make install
cd ..
To startup the Web server we will create a soft link to a startup script and copy the startup script to the init.d folder for startup options.
ln -s /usr/local/apache2/bin/apachectl /usr/bin/apachectl
cp /usr/local/apache2/bin/apachectl /etc/init.d
update-rc.d apachectl defaults
Now we can reboot the server and check if it is running. And we can see that the daemon is running.
root@ubsrv1:~# ps aux | grep httpd
root 1063 0.0 0.2 0:00 /usr/local/apache2/bin/httpd -k start
daemon 1065 0.0 0.2 0:00 /usr/local/apache2/bin/httpd -k start
daemon 1066 0.0 0.2 3 0:00 /usr/local/apache2/bin/httpd -k start
Next what we should do is to continue with the PHP support and installation.
cd /usr/src/sources
wget http://us2.php.net/get/php-5.5.5.tar.gz/from/ar2.php.net/mirror
tar xfvz php-5.5.5.tar.gz
cd php-5.5.5
./configure --prefix=/var/www/ --with-apxs2=/var/apache2/bin/apxs --with-config-file- path=/var/www/php --with-mysql
make
make install
The --prefix folder depends on the folder where you installed the apache, you can change this to your needs. And the final step is to install the MySQL server.
groupadd mysql
useradd -r -g mysql mysql
cd /usr/src/sources
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.14.tar.gz/from/http://cdn.mysql.com/
tar zxvf mysql-5.6.14.tar.gz
ln -s /usr/src/sources/mysql-5.6.14 /usr/local/mysql
cd /usr/local/mysql
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
Here we have a simply longer procedure. First we create a user and group. Then download the source files, extract them, create a soft link and run the mysql_install_db script. Add the permissions to the folders and that is all.
Now we can restart the server and everything should work fine. If not check out some cool tutorials on Ubuntu community.
Source http://community.ubuntu.com/
No comments:
Post a Comment