Setting up a web server on Debian
Before we start anything else, we need to set up a web server. The most common setup for TYPO3 is based on a LAMP stack (Linux, Apache, MySQL, and PHP), although other setups are supported as well. Next, we will install all the components required by TYPO3 on a Debian Linux server.
Note
Paths may vary depending on system and setup options.
Getting ready
Setting up a Debian server is very easy, because all the packages you need are available through APT (Advanced Packaging Tool). Make sure that the package lists are up-to-date by running:
Shell> apt-get update
How to do it...
Issue the following command while logged in as root:
Shell> apt-get install apache2-mpm-prefork libapache2-mod-php5 php5-gd php5-mysql mysql-server-5.0
Note
At the time of writing, the latest stable version of Apache on Debian (Lenny) is 2.2.9, while PHP is 5.2.6, and MySQL is 5.0.51a. These versions meet the requirements of our system, and don't have any known bugs that prevent TYPO3 from working correctly.
How it works...
APT makes software maintenance easy, as all packages can be upgraded or removed through simple commands. You could install the packages from source, but it would make subsequent upgrades difficult. With APT, you can run the following to update the package cache information and upgrade your system:
Shell> apt-get update
Shell> apt-get upgrade
Note
One could also use the short notation of this:
apt-get update && apt-get upgrade
It's highly recommended to do this on a regular basis to apply any security patches. But be careful upgrades could break some functionality!
Note
Make sure you have a backup/failover plan in place before performing any upgrades.
There's more...
We can also install some other components to add additional functionality to our system.
ImageMagick
This line will install ImageMagick on your system.
Shell> apt-get install imagemagick
This installs ImageMagick—a powerful graphic processing program. TYPO3 works with GD and ImageMagick, and you can enable the use of ImageMagick in the Install Tool. As ImageMagick is an external program (unlike GD, which is a PHP extension), it is more efficient and feature-rich when it comes to image processing. Therefore, it's highly recommended that you install and enable it.
An alternative to ImageMagick is GraphicsMagick—a fork of ImageMagick with a more stable API. GraphicsMagick is also more efficient, and performs better than ImageMagick, especially on multi-core processors. No changes to TYPO3 are required to work with GraphicsMagick, and it can be utilized as soon as it is installed by using the following command:
Shell> apt-get install graphicsmagick
To verify that everything is functioning correctly, you can go into TYPO3 Install Tool (available when you install TYPO3 as described in recipe Setting up TYPO3), and select Image Processing to check the configuration, then run some tests, as shown on the following screenshot:
Apache commands
Apache provides a few tools that significantly simplify maintenance tasks. Here are some useful commands:
Shell> a2enmod module_name
Shell> a2dismod module_name
The first command line (shown above) enables a module while the second command line disables a module (example: mod_rewrite
).
Shell> a2ensite site_name
Shell> a2dissite site_name
The first command line enables a website configuration file while the second command line disables a website configuration file (example: default
).
Note
Always put different site configurations in separate files. This way you can be sure that disabling a site configuration will only disable that website, and will not have any adverse effects on the other sites hosted on the server.
Shell> apache2ctl start
Shell> apache2ctl stop
Shell> apache2ctl restart
The commands you just saw are used to start, stop, or restart the server respectively. Make sure to restart the server after configuration changes, as they will not take effect (alternatively, you can reload the server).
There are many other resources online to help you set up and optimize the web server. One such resource that also gives some information specific to TYPO3 is http://www.installationwiki.org/Typo3.
See also
Setting up a multithreaded environment
Creating a scalable architecture
Setting up an NFS share