HowTo: Install and Configure a LAMP + CVS Server

Posted by Jarren Long at 2011-06-07 21:01:43

This tutorial is designed to teach you how to install and configure a simple LAMP (Linux, Apache, MySQL, and PHP) server, as well as a CVS (Concurrent Versioning System) server for a small programming company. LAMP servers are the most common servers running today, and can be found on over 90% of all online servers in the world. A LAMP server is designed to do one thing: serve web pages, using the Apache HTTPD web server to deliver content via HTTP. MySQL and PHP are both added to the httpd server to extend functionality, by adding support for Relational SQL databases and the PHP scripting language (which is also be served via HTTP). These three servers comprise the core of a LAMP server. In addition to the LAMP setup, we will also be installing SquirrelMail, a PHP-based webmail client (for testing the HTTPD and PHP configurations), and a CVS server. CVS is a protocol that is used (mainly by software developers) for document revision management. This server allows multiple people to work on a single document, make changes, and "commit" the document back to the CVS repository, where the document changes are logged and the revision number is changed.

Install and Configure Services

  • From a terminal, download and install the httpd, php, mysql, sendmail, dovecot, squirrelmail, and cvs packages. Configuring sendmail and dovecot will not be covered in this tutorial. Image
  • You will need to add three A records to your server's DNS for this tutorial. Create the "www" , "mail", and "cvs" A records, and make sure their IP addresses point to your server.
  • Using a text editor (I use VI), edit the /etc/httpd/conf/httpd.conf file (you will need root privileges to save it). Find the following lines and change the values as shown:
ServerAdmin jarren@jarrenl.class.com
ServerName jarrenl.class.com:80
NameVirtualHost *:80

Image

  • Save and close the file. Congratulations! Your HTTP server configuration is complete! Don't bother restarting any of your services until you reach the end of this tutorial; you'll just have to do it again later, so why waste the time now?
  • Move to the /usr/share/squirrelmail/config directory. In here, there is a script called "conf.pl" that simplifies the configuration of SquirrelMail. Run this script.
  • Select the server option, and change the domain to mail.jarrenl.class.com. Follow the onscreen directions to save and close the configuration script. It is normal to not be able to see what you are typing; use the mouse to highlight the input area to see what you typed. This is the final step in configuring SquirrelMail to communicate with your email server.
  • Create a new directory inside the /var directory called "cvs". This will be where our CVS server stores all of the repository data. Give the directory 775 permissions using the "chmod R 775 /var/cvs" command. After creation, CD into the directory and type "cvs init" in the terminal to configure the directory to be used as the CVS repository. This will create the "CVSROOT" directory which will contain the configuration files (do NOT edit these). Image
  • Create a new user named "cvs" with a password of "cvs" (no quotes). After this, edit the /etc/profile file and append the following line: export CVSROOT=/var/cvs Image
  • Edit the /etc/xinetd.d/cvs file. Change the "user = " to use the "cvs" user instead of root (for security reasons) and the "bind = " line to use your server's IP address. Make sure the "disable = " line is set to "no". Finally, set the "env = " to point to your CVS repository (/var/cvs) and change the path in the "server_args" line to match. Save and close the file. Image
  • At this point, your CVS server is configured, and you can (almost) login and begin using it. At this point, go ahead and restart the following services: httpd, sendmail, dovecot, and xinetd (xinetd manages the CVS service).

Testing Installed Services

  • In the /var/www/html directory, create a file called index.html. Edit this file and add some text that will make it distinct. Create another file in this directory called index.php. In this file, add the following line, save and close:
    <?php phpinfo(); ?>
  • On a client machine, open the web browser to http://www.jarrenl.class.com/index.html. You should see the content from the index.html file displayed. In the web browser, goto http://www.jarrenl.class.com/index.php. If PHP is working correctly, you will see a blue table listing many of the PHP configuration options. Finally, got http://mail.jarrenl.class.com. You should be taken directly to the SquirrelMail login page. Login using one of your email server user accounts to verify that your mail server is functioning properly. Close the web browser.

Image

Image

Image

  • On the client machine, open a terminal prompt. Enter the following lines (use your own server's IP address)
export CVSROOT=:pserver:cvs@192.168.8.151:/var/cvs
cvs login
  • Enter your password. If the server is running properly you should be able to login. Creating and using repositories will not be covered in this tutorial (that's a tutorial on its own). Image
  • To test MySQL installation: on the MySQL server, type "mysql" at the terminal to launch the MySQL prompt. If the install was successful (it always is, there's nothing to configure!) your prompt will change to read "mysql>". Type "quit" to close the prompt. Image