This guide will help you in the process of installing MySQL5, Apache2.2 and PHP5 on an VDS hosted by GoDaddy.com. This guide is based on SSH so if you are under Linux just run
Code:
$ ssh the-ip-address-of-your-vds -l user-name
If you have Windows you can use a tool called Putty. You can find more information about in Godday Help Center here:
http://help.godaddy.com/index.php
First of all you have to make a decision whether to keep the current versions intact and disable the services they provide or remove them altogether. The disadvantage of keeping the current versions is that they start automatically when you restart your VDS. To overcome this problem you have to edit one or two configuration files by commenting the lines that run Apache2.0 and MySQL3. Another disadvantage is that the current binaries that are used to run MySQL3 and Apache2.0 will be in your PATH. This might cause you some confusing especially if you forgot to stop the services before running your own service, MySQL5 and Apache2.2 in this case. The only advantage of keeping the current version that I can think of now is that you can use the Simple Control Panel to configure MySQL3 and Apache2.0.
You can always opt to removing MySQL3 but keeping Apache2.0 and PHP4 or the other way around. There is one important thing that you have to keep in mind, that is you have to use the full path to your new binaries in order to run them unless you add the new directories to your PATH.
Step 1: Removing MySQL 3
There are few packages that you have to remove before removing MySQL3. To get an idea about which packages you need to remove run the following command as root:
Code:
shell> su - root
shell> rpm -e mysql-3.23.58-16.FC2.1
You will notice that there is a package called turbopanel-mysql-1.2.4-20060516.1202 in the output. I am not sure but it looks like that this package is related to the Simple Control Panel. As I said removing MySQL3 will remove MySQL from the list of configurable items under the Simple Control Panel. If you really want to remove MySQL3 then you have to stop it first then you can remove it and its dependencies. Simply run the following commands in sequence:
Code:
shell> mysqladmin -u root shutdown
shell> rpm -e mysql_passwd-0.7-2.swsoft
shell> rpm -e mysql-devel-3.23.58-16.FC2.1
shell> rpm -e turbopanel-1.2.4-20060516.1202
shell> rpm -e turbopanel-mysql-1.2.4-20060516.1202
shell> rpm -e mysql-server-3.23.58-16.FC2.1
shell> rpm -e libdbi-dbd-mysql-0.6.5-8.1
shell> rpm -e perl-DBD-MySQL-2.9003-4 mysql-3.23.58-16.FC2.1
shell> exit
Step 2: Installing MySQL5
First you have to download the latest release of MySQL5. As of May 24, 2006 it is version 5.0.21. So as a normal user create a temporary directory and then use wget to download MySQL5.
Code:
shell> cd
shell> mkdir temp
shell> wget http://mysql.sd2.mirrors.redwire.net/Downloads/MySQL-5.0/mysql-standard-5.0.21-linux-i686-glibc23.tar.gz
Now you have to login as root in order to create a new group and a new user dedicated to MySQL.
Code:
shell> su – root
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < ~/temp/mysql-standard-5.0.21-linux-i686-glibc32.tar.gz | tar xvf -
shell> ln -s /usr/local/mysql-standard-5.0.21-linux-i686-glibc23 mysql
shell> cd mysql
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &
shell> exit
Note that the 'mysqld_safe --user=mysql' command is used to run MySQL as the new user that you have just created. I would strongly suggest you download and read MySQL documentation for further steps involved in securing your database and the initial accounts.
Step 3: Removing Apache2.0 and PHP4
I did not do remove them myself, however if you are interested you can use 'rpm -e' as in Step 1 but with different packages. You have to remove the following ones in particular:
Code:
shell> su - root
shell> rpm -e httpd-2.0.51
error: Failed dependencies:
httpd is needed by (installed) hspc-wwwroot-1.0-14.fc1.swsoft
httpd = 2.0.51 is needed by (installed) httpd-devel-2.0.51-2.9.1.swsoft
httpd >= 2.0.40 is needed by (installed) mod_perl-1.99_12-2.1
httpd = 2.0.51-2.9.1.swsoft is needed by (installed) mod_ssl-2.0.51-2.9.1.swsoft
httpd is needed by (installed) squirrelmail-1.4.4-1.FC2.2.legacy
httpd >= 2.0.40 is needed by (installed) mod_python-3.1.3-1.fc2.2
httpd >= 2.0.40 is needed by (installed) mod_jk-1.2.15-1.fc2.gdg
httpd >= 2.0.51 is needed by (installed) frontpage-5.0.sr1.2-0.fc2.gdg
httpd >= 2.0.46 is needed by (installed) turbopanel-base-1.2.4-20060516.1202
httpd-mmn = 20020903 is needed by (installed) mod_perl-1.99_12-2.1
httpd-mmn = 20020903 is needed by (installed) mod_ssl-2.0.51-2.9.1.swsoft
httpd-mmn = 20020903 is needed by (installed) php-4.3.11-1.fc2.3.legacy.1.swsoft
httpd-mmn = 20020903 is needed by (installed) mod_python-3.1.3-1.fc2.2
webserver is needed by (installed) mailman-2.1.5-10.fc2
webserver is needed by (installed) webalizer-2.01_10-22
Step 4: Installing Apache 2.2
Installing Apache is a bit more involved than Installing MySQL since you have to configure it according to your needs. Apache is based on modular architecture in which services are usually running as modules. These modules can be compiled directly into the httpd binary, which is responsible for running Apache, or compiled as dynamic shared modules known as dynamic shared objects DSO that can be loaded when you first run your server. In the later case you specify the modules that you want to load in the httpd.conf file.
Apache has an excellent documentation that you can browse online or you can download and read it offline as well. The documentation would help you in identifying which modules you might need.
Before proceeding with the installation of Apache2.2 you have to stop Apache2.0 if it is currently running. To stop Apache2.0 to have to be root:
Code:
shell> su - root
shell> apache2ctl stop
shell> exit
Now make sure that you are running as a normal user and NOT as root. The options that I passed to the configure command below might not be applicable to your case.
Code:
shell> cd ~/temp
shell> wget http://apache.ziply.com/httpd/httpd-2.2.2.tar.bz2
shell> tar -xjf httpd-2.2.2.tar.bz2
shell> cd httpd-2.2.2
shell> ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-speling --enable-ssl --enable-unique-id --enable-usertrack --enable-deflat --enable-expires --enable-auth-anon --enable-auth-dbm --enable-auth-digest --enable-logio --enable-mime-magic --enable-modules=most --enable-headers --enable-info --enable-v4-mapped && echo done-conf
shell> make -s && echo done-make
shell> su
shell> make install && echo done-inst
shell> exit
shell> cd ..
Step 5: Installing PHP5
If you followed the instructions in Step 4 then you are currently under ~/temp and is running as a normal user. Similar to Apache, you have to specify the options that you need to pass to the configure command in order to get PHP5 according to you needs.
Code:
shell> wget http://us3.php.net/distributions/php-5.1.4.tar.bz2
shell> tar -xjf php-5.1.4.tar.bz2
shell> cd php-5.1.4
shell> ./configure --with-apxs2=/usr/local/apache2/bin/apxs --enable-magic-quotes --disable-short-tags --with-openssl --with-zlib --with-bz2 --enable-ftp --with-gd --enable-mbstring --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-memory-limit && echo done-conf
shell> make -s && echo done-make
shell> su
shell> make install && echo done-inst
If everything went fine then congratulation you now have MySQL5, Apache2.2 and PHP5 on your VDS
Step 6: Configuring and Testing Apache2.2 and PHP5
You have to run the following commands as root
First, setup you php.ini file.
Code:
shell> cp ~/temp/php-51.4/php.ini-recommended /usr/local/lib/php.ini
Second, edit your http.conf to load the PHP module. Use your favorite text editor to add 'LoadModule php5_module modules/libphp5.so' without the single quotes to /usr/local/apache2/conf/httpd.conf
Third. tell Apache to parse certain extensions as PHP. Using your favorite text editor add 'AddType application/x-httpd-php .php' without the single quotes to /usr/local/apache2/conf/httpd.conf
Fourth, write a simple test page that would show you information about your PHP. configurations.
Code:
shell> cd /usr/local/apache2/htdocs
shell> cat > test.php << EOF
<?php phpinfo(); ?>
EOF
shell> cd ../bin
shell> ./apachectl start
Finally, open Firefox and visit the following link
http://your-site/test.php